2 #include "util/intrusive_ptr.h" 7 #pragma warning( push ) 8 #pragma warning( disable:4275 ) 9 #pragma warning( disable:4251 ) 15 class NPLNumberObject;
18 class NPLStringObject;
20 typedef ParaIntrusivePtr<NPLObjectBase> NPLObjectBase_ptr;
21 typedef ParaIntrusivePtr<NPLTable> NPLTable_ptr;
22 typedef ParaIntrusivePtr<NPLNumberObject> NPLNumberObject_ptr;
23 typedef ParaIntrusivePtr<NPLBoolObject> NPLBoolObject_ptr;
24 typedef ParaIntrusivePtr<NPLStringObject> NPLStringObject_ptr;
30 typedef std::map<std::string, NPLObjectProxy> TableFieldMap_Type;
31 typedef std::map<int, NPLObjectProxy> TableIntFieldMap_Type;
32 typedef TableFieldMap_Type::iterator Iterator_Type;
33 typedef TableIntFieldMap_Type::iterator IndexIterator_Type;
46 inline NPLObjectType GetType(){
return m_type;}
48 bool isTable() {
return GetType() == NPLObjectType_Table; }
49 bool isNumber() {
return GetType() == NPLObjectType_Number; }
50 bool isString() {
return GetType() == NPLObjectType_String; }
51 bool isNil() {
return GetType() == NPLObjectType_Nil; }
52 bool isBool() {
return GetType() == NPLObjectType_Bool; }
81 void operator = (
double value);
85 void operator = (
bool value);
87 operator const string& ();
91 bool operator == (
const string& value);
92 bool operator == (
const char* value);
94 void operator = (
const std::string& value);
95 void operator = (
const char* value);
115 void SetField(
const string& sName,
const NPLObjectProxy& pObject);
122 NPLObjectBase::Iterator_Type begin();
123 NPLObjectBase::Iterator_Type end();
125 NPLObjectBase::IndexIterator_Type index_begin();
126 NPLObjectBase::IndexIterator_Type index_end();
129 NPLObjectBase::NPLObjectType GetType();
143 void SetValue(
double value){m_value = value;}
144 double GetValue() {
return m_value;}
146 NPLNumberObject& operator = (
double value) { SetValue(value);
return *
this;}
157 NPLBoolObject():m_value(
false){m_type = NPLObjectType_Bool;};
163 inline void SetValue(
bool value){m_value = value;}
164 bool GetValue() {
return m_value;}
166 NPLBoolObject& operator = (
bool value) { SetValue(value);
return *
this;}
183 void SetValue(
const std::string&
value){m_value = value;}
184 std::string& GetValue(){
return m_value;}
186 NPLStringObject& operator = (
const std::string& value) { SetValue(value);
return *
this;}
222 void ToString(std::string& str);
231 void SetField(
const string& sName,
const NPLObjectProxy& pObject);
243 Iterator_Type begin() {
return m_fields.begin();};
244 Iterator_Type end() {
return m_fields.end();};
246 IndexIterator_Type index_begin() {
return m_index_fields.begin(); };
247 IndexIterator_Type index_end() {
return m_index_fields.end(); };
250 NPLObjectProxy& operator [](
const string& sName) {
return CreateGetField(sName);};
251 NPLObjectProxy& operator [](
const char* sName) {
return CreateGetField(sName);};
252 NPLObjectProxy& operator [](
int nIndex) {
return CreateGetField(nIndex);};
254 TableFieldMap_Type m_fields;
255 TableIntFieldMap_Type m_index_fields;
267 #pragma warning( pop ) NPLNumberObject(double value)
create the table from a serialized string.
Definition: NPLTable.h:139
define this to enable debugging of NPL code in visual studio
Definition: INPL.h:9
NPL object proxy.
Definition: NPLTable.h:73
base class for all NPL date members.
Definition: NPLTable.h:27
this is a pure c++ implementation of lua table.
Definition: NPLTable.h:213
a floating point number
Definition: NPLTable.h:174
a floating point number
Definition: NPLTable.h:134
NPLBoolObject(bool value)
create the table from a serialized string.
Definition: NPLTable.h:159
Definition: enum_maker.hpp:46
NPLTable()
this is an empty table
Definition: NPLTable.h:217
single-threaded reference counted base class for boost::intrusive_ptr all boost::intrusive_ptr<T>, should derive from this class.
Definition: intrusive_ptr.h:75
NPLStringObject(const std::string &value)
create the table from a serialized string.
Definition: NPLTable.h:179
a boolean
Definition: NPLTable.h:154