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