Blender V2.61 - r43446

StringValue.h

Go to the documentation of this file.
00001 /*
00002  * StringValue.h: interface for the CStringValue 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 #ifndef __STRINGVALUE_H__
00020 #define __STRINGVALUE_H__
00021 
00022 #include "Value.h"
00023 
00024 class CStringValue : public CPropValue  
00025 {
00026 
00027     
00028     //PLUGIN_DECLARE_SERIAL(CStringValue,CValue)        
00029 public:
00031     CStringValue();
00032     CStringValue (const char *txt, const char *name , AllocationTYPE alloctype = CValue::HEAPVALUE);
00033 
00034     virtual ~CStringValue() {}
00036     virtual bool        IsEqual(const STR_String & other);
00037     virtual const STR_String &  GetText();
00038     virtual double      GetNumber();
00039     
00040     virtual CValue*     Calc(VALUE_OPERATOR op, CValue *val);
00041     virtual CValue*     CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
00042     virtual void        SetValue(CValue* newval) {  m_strString = newval->GetText(); SetModified(true); }
00043     virtual CValue*     GetReplica();
00044 #ifdef WITH_PYTHON
00045     virtual PyObject*   ConvertValueToPython() {
00046         return PyUnicode_From_STR_String(m_strString);
00047     }
00048 #endif // WITH_PYTHON
00049 
00050 private:
00051     // data member
00052     STR_String              m_strString;
00053 
00054 
00055 #ifdef WITH_CXX_GUARDEDALLOC
00056 public:
00057     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:CStringValue"); }
00058     void operator delete( void *mem ) { MEM_freeN(mem); }
00059 #endif
00060 };
00061 
00062 #endif
00063