Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ListValue.h

Go to the documentation of this file.
00001 // ListValue.h: interface for the CListValue class.
00002 /*
00003  * Copyright (c) 1996-2000 Erwin Coumans <[email protected]>

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 
00015 #if !defined _LISTVALUE_H
00016 #define _LISTVALUE_H
00017 
00018 
00019 #include "Value.h"
00020 
00021 class CListValue : public CPropValue  
00022 {
00023         Py_Header;
00024         //PLUGIN_DECLARE_SERIAL (CListValue,CValue)
00025 
00026 public:
00027         CListValue(PyTypeObject *T = &Type);
00028         virtual ~CListValue();
00029 
00030         void AddConfigurationData(CValue* menuvalue);
00031         void Configure(CValue* menuvalue);
00032         void Add(CValue* value){        m_pValueArray.push_back(value);}
00033         virtual CValue* Calc(VALUE_OPERATOR op,CValue *val) {
00034                 assert(false); // todo: implement me!
00035                 return NULL;
00036         }
00037         virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype,VALUE_OPERATOR op, CValue* val) {
00038                 assert(false); // todo: implement me!
00039                 return NULL;
00040         }
00041         virtual float GetNumber() {
00042                 return -1;
00043         }
00044         
00045         
00046         virtual CValue* GetReplica();
00047         //member variables
00048 public:
00049         void MergeList(CListValue* otherlist);
00050         bool RemoveValue(CValue* val);
00051         void SetReleaseOnDestruct(bool bReleaseContents);
00052         bool SearchValue(CValue* val);
00053         
00054         CValue* FindValue(const CCString & name);
00055 
00056         void ReleaseAndRemoveAll();
00057         virtual void SetModified(bool bModified)        {       
00058                 CValue::SetModified(bModified);
00059                 int numels = GetCount();
00060                 for (int i=0;i<numels;i++)
00061                         GetValue(i)->SetModified(bModified);
00062                                 
00063         }
00064         virtual inline bool IsModified() {
00065                 bool bmod = CValue::IsModified(); //normal own flag
00066                 int numels = GetCount();
00067                 for (int i=0;i<numels;i++)
00068                         bmod = bmod || GetValue(i)->IsModified();
00069                 return bmod;
00070 
00071         }
00072         void Remove(int i);
00073         void Resize(int num);
00074         void SetValue(int i,CValue* val);
00075         CValue* GetValue(int i){        assertd(i < m_pValueArray.size());      return m_pValueArray[i];}
00076         const int GetCount() { return m_pValueArray.size();};
00077         virtual const CCString & GetText();
00078 
00079         virtual PyObject*  _getattr(char *attr);
00080 
00081 private:
00082 
00083         std::vector<CValue*> m_pValueArray;
00084         bool    m_bReleaseContents;
00085 };
00086 
00087 #endif // !defined _LISTVALUE_H

Generated at Thu Feb 1 13:03:07 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000