2002-10-12 11:37:38 +00:00
|
|
|
/*
|
|
|
|
* ListValue.h: interface for the CListValue class.
|
|
|
|
* Copyright (c) 1996-2000 Erwin Coumans <coockie@acm.org>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Erwin Coumans makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-02-22 10:33:14 +00:00
|
|
|
/** \file ListValue.h
|
|
|
|
* \ingroup expressions
|
|
|
|
*/
|
|
|
|
|
2012-03-09 19:17:19 +00:00
|
|
|
#ifndef __LISTVALUE_H__
|
|
|
|
#define __LISTVALUE_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "Value.h"
|
|
|
|
|
|
|
|
class CListValue : public CPropValue
|
|
|
|
{
|
2011-11-06 01:39:36 +00:00
|
|
|
Py_Header
|
2002-10-12 11:37:38 +00:00
|
|
|
//PLUGIN_DECLARE_SERIAL (CListValue,CValue)
|
|
|
|
|
|
|
|
public:
|
2009-06-28 11:22:26 +00:00
|
|
|
CListValue();
|
2002-10-12 11:37:38 +00:00
|
|
|
virtual ~CListValue();
|
|
|
|
|
|
|
|
void AddConfigurationData(CValue* menuvalue);
|
|
|
|
void Configure(CValue* menuvalue);
|
|
|
|
void Add(CValue* value);
|
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/** \attention not implemented yet :( */
|
2002-10-12 11:37:38 +00:00
|
|
|
virtual CValue* Calc(VALUE_OPERATOR op,CValue *val);
|
|
|
|
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype,
|
|
|
|
VALUE_OPERATOR op,
|
|
|
|
CValue* val);
|
2009-04-20 15:06:46 +00:00
|
|
|
virtual double GetNumber();
|
2014-06-03 20:20:59 +00:00
|
|
|
virtual int GetValueType();
|
2002-10-12 11:37:38 +00:00
|
|
|
virtual CValue* GetReplica();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void MergeList(CListValue* otherlist);
|
|
|
|
bool RemoveValue(CValue* val);
|
|
|
|
void SetReleaseOnDestruct(bool bReleaseContents);
|
|
|
|
bool SearchValue(CValue* val);
|
|
|
|
|
|
|
|
CValue* FindValue(const STR_String & name);
|
2009-06-08 20:08:19 +00:00
|
|
|
CValue* FindValue(const char *name);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
void ReleaseAndRemoveAll();
|
|
|
|
virtual void SetModified(bool bModified);
|
|
|
|
virtual inline bool IsModified();
|
|
|
|
void Remove(int i);
|
|
|
|
void Resize(int num);
|
|
|
|
void SetValue(int i,CValue* val);
|
2012-07-21 22:58:08 +00:00
|
|
|
CValue* GetValue(int i) { assertd(i < m_pValueArray.size()); return m_pValueArray[i]; }
|
2011-11-06 01:39:36 +00:00
|
|
|
int GetCount() { return m_pValueArray.size(); }
|
2002-10-12 11:37:38 +00:00
|
|
|
virtual const STR_String & GetText();
|
|
|
|
|
|
|
|
bool CheckEqual(CValue* first,CValue* second);
|
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2012-09-16 04:58:18 +00:00
|
|
|
virtual PyObject *py_repr(void) {
|
2009-04-20 15:06:46 +00:00
|
|
|
PyObject *py_proxy= this->GetProxy();
|
|
|
|
PyObject *py_list= PySequence_List(py_proxy);
|
|
|
|
PyObject *py_string= PyObject_Repr(py_list);
|
|
|
|
Py_DECREF(py_list);
|
|
|
|
Py_DECREF(py_proxy);
|
|
|
|
return py_string;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-02-23 06:41:10 +00:00
|
|
|
KX_PYMETHOD_O(CListValue,append);
|
|
|
|
KX_PYMETHOD_NOARGS(CListValue,reverse);
|
|
|
|
KX_PYMETHOD_O(CListValue,index);
|
|
|
|
KX_PYMETHOD_O(CListValue,count);
|
2009-06-08 20:08:19 +00:00
|
|
|
KX_PYMETHOD_VARARGS(CListValue,get);
|
2009-04-20 15:06:46 +00:00
|
|
|
KX_PYMETHOD_O(CListValue,from_id);
|
2009-09-29 21:42:40 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
std::vector<CValue*> m_pValueArray;
|
|
|
|
bool m_bReleaseContents;
|
|
|
|
};
|
|
|
|
|
2012-10-09 13:36:42 +00:00
|
|
|
#endif /* __LISTVALUE_H__ */
|
2002-10-30 02:07:20 +00:00
|
|
|
|