2 * VoidValue.h: interface for the CVoidValue class.
5 * ***** BEGIN GPL LICENSE BLOCK *****
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
22 * All rights reserved.
24 * The Original Code is: all of this file.
26 * Contributor(s): none yet.
28 * ***** END GPL LICENSE BLOCK *****
30 #ifndef __VOIDVALUE_H__
31 #define __VOIDVALUE_H__
36 // Void value, used to transport *any* type of data
38 class CVoidValue : public CPropValue
40 //PLUGIN_DECLARE_SERIAL (CVoidValue,CValue)
43 /// Construction/destruction
44 CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { }
45 CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr) { if (alloctype == STACKVALUE) CValue::DisableRefCount(); }
46 virtual ~CVoidValue(); // Destruct void value, delete memory if we're owning it
48 /// Value -> String or number
49 virtual const STR_String & GetText(); // Get string description of void value (unimplemented)
50 virtual double GetNumber() { return -1; }
53 virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
54 virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue* val);
57 virtual CValue* GetReplica();
60 bool m_bDeleteOnDestruct;
64 #ifdef WITH_CXX_GUARDEDALLOC
66 void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CVoidValue"); }
67 void operator delete( void *mem ) { MEM_freeN(mem); }
71 #endif // !defined _VOIDVALUE_H