Blender V2.61 - r43446
|
00001 /* 00002 * ListValue.h: interface for the CListValue class. 00003 * Copyright (c) 1996-2000 Erwin Coumans <coockie@acm.org> 00004 * 00005 * Permission to use, copy, modify, distribute and sell this software 00006 * and its documentation for any purpose is hereby granted without fee, 00007 * provided that the above copyright notice appear in all copies and 00008 * that both that copyright notice and this permission notice appear 00009 * in supporting documentation. Erwin Coumans makes no 00010 * representations about the suitability of this software for any 00011 * purpose. It is provided "as is" without express or implied warranty. 00012 * 00013 */ 00014 00019 #if !defined _LISTVALUE_H 00020 #define _LISTVALUE_H 00021 00022 #include "Value.h" 00023 00024 class CListValue : public CPropValue 00025 { 00026 Py_Header 00027 //PLUGIN_DECLARE_SERIAL (CListValue,CValue) 00028 00029 public: 00030 CListValue(); 00031 virtual ~CListValue(); 00032 00033 void AddConfigurationData(CValue* menuvalue); 00034 void Configure(CValue* menuvalue); 00035 void Add(CValue* value); 00036 00038 virtual CValue* Calc(VALUE_OPERATOR op,CValue *val); 00039 virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, 00040 VALUE_OPERATOR op, 00041 CValue* val); 00042 virtual double GetNumber(); 00043 virtual CValue* GetReplica(); 00044 00045 public: 00046 void MergeList(CListValue* otherlist); 00047 bool RemoveValue(CValue* val); 00048 void SetReleaseOnDestruct(bool bReleaseContents); 00049 bool SearchValue(CValue* val); 00050 00051 CValue* FindValue(const STR_String & name); 00052 CValue* FindValue(const char *name); 00053 00054 void ReleaseAndRemoveAll(); 00055 virtual void SetModified(bool bModified); 00056 virtual inline bool IsModified(); 00057 void Remove(int i); 00058 void Resize(int num); 00059 void SetValue(int i,CValue* val); 00060 CValue* GetValue(int i){ assertd(i < m_pValueArray.size()); return m_pValueArray[i];} 00061 int GetCount() { return m_pValueArray.size(); } 00062 virtual const STR_String & GetText(); 00063 00064 bool CheckEqual(CValue* first,CValue* second); 00065 00066 #ifdef WITH_PYTHON 00067 virtual PyObject* py_repr(void) { 00068 PyObject *py_proxy= this->GetProxy(); 00069 PyObject *py_list= PySequence_List(py_proxy); 00070 PyObject *py_string= PyObject_Repr(py_list); 00071 Py_DECREF(py_list); 00072 Py_DECREF(py_proxy); 00073 return py_string; 00074 } 00075 00076 KX_PYMETHOD_O(CListValue,append); 00077 KX_PYMETHOD_NOARGS(CListValue,reverse); 00078 KX_PYMETHOD_O(CListValue,index); 00079 KX_PYMETHOD_O(CListValue,count); 00080 KX_PYMETHOD_VARARGS(CListValue,get); 00081 KX_PYMETHOD_O(CListValue,from_id); 00082 #endif 00083 00084 private: 00085 00086 std::vector<CValue*> m_pValueArray; 00087 bool m_bReleaseContents; 00088 }; 00089 00090 #endif // !defined _LISTVALUE_H 00091