My Project
|
this is a pure c++ implementation of lua table. More...
#include <NPLInterface.hpp>
Public Types | |
typedef std::map< std::string, NPLObjectProxy > | TableFieldMap_Type |
typedef std::map< int, NPLObjectProxy > | TableIntFieldMap_Type |
typedef TableFieldMap_Type::iterator | Iterator_Type |
typedef TableIntFieldMap_Type::iterator | IndexIterator_Type |
![]() | |
enum | NPLObjectType { NPLObjectType_Nil, NPLObjectType_Table, NPLObjectType_Number, NPLObjectType_String, NPLObjectType_Bool } |
Public Member Functions | |
NPLTable () | |
this is an empty table | |
void | ToString (std::string &str) |
void | Clear () |
void | SetField (const string &sName, const NPLObjectProxy &pObject) |
void | SetField (int nIndex, const NPLObjectProxy &pObject) |
NPLObjectProxy | GetField (int nIndex) |
NPLObjectProxy | GetField (const string &sName) |
NPLObjectProxy & | CreateGetField (int nIndex) |
NPLObjectProxy & | CreateGetField (const string &sName) |
Iterator_Type | begin () |
Iterator_Type | end () |
IndexIterator_Type | index_begin () |
IndexIterator_Type | index_end () |
NPLObjectProxy & | operator[] (const string &sName) |
this will create get field. More... | |
NPLObjectProxy & | operator[] (const char *sName) |
NPLObjectProxy & | operator[] (int nIndex) |
![]() | |
NPLObjectType | GetType () |
Additional Inherited Members | |
![]() | |
long | m_ref_count |
![]() | |
NPLObjectType | m_type |
this is a pure c++ implementation of lua table.
it can convert back and force from string. only data members are supported. This class is mostly used by C++ plugin modules.
Example 2: deserialize NPLTable from string.
NPLObjectProxy tabMsg = NPLHelper::StringToNPLTable("{nid=10, name=\"value\", tab={name1=\"value1\"}}"); assert((double)tabMsg["nid"] == 10); assert((tabMsg["name"]) == "value"); assert((tabMsg["tab"]["name1"]) == "value1"); @note: no cyclic link is allowed.
|
inline |
this will create get field.