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