My Project
Static Public Member Functions | List of all members
NPLInterface::NPLHelper Class Reference

NPL helper class. More...

#include <NPLInterface.hpp>

Static Public Member Functions

static bool DeserializePureNPLDataBlock (LexState *ls, NPLObjectProxy &objProxy)
 
static bool IsSCodePureData (const char *sCode, int nCodeSize=-1)
 verify the script code. More...
 
static bool IsPureData (const char *sCode, int nCodeSize=-1)
 it will return true if input string is "false", "true", NUMBER, STRING, and {table} More...
 
static bool IsPureTable (const char *sCode, int nCodeSize=-1)
 it will return true if input string is a {table} containing only "false", "true", NUMBER, STRING, and other such {table} More...
 
static NPLObjectProxy StringToNPLTable (const char *input, int nLen=-1)
 converting string to NPL table object More...
 
static NPLObjectProxy MsgStringToNPLTable (const char *input, int nLen=-1)
 same as StringToNPLTable(), except that it begins with "msg={...}" More...
 
template<typename StringType >
static bool SerializeNPLTableToString (const char *sStorageVar, NPLObjectProxy &input, StringType &sCode, int nCodeOffset)
 
template<typename StringType >
static void EncodeStringInQuotation (StringType &buff, int nOutputOffset, const char *str, int nSize)
 
static bool NPLTableToString (const char *sStorageVar, NPLObjectProxy &input, std::string &sCode, int nCodeOffset=0)
 same as SerializeNPLTableToString. More...
 
template<typename StringType >
static void EncodeStringInQuotation (StringType &output, int nOutputOffset, const std::string &input)
 
template<typename StringType >
static void EncodeStringInQuotation (StringType &output, int nOutputOffset, const char *input)
 

Detailed Description

NPL helper class.

Member Function Documentation

§ DeserializePureNPLDataBlock()

static bool NPLInterface::NPLHelper::DeserializePureNPLDataBlock ( LexState ls,
NPLObjectProxy objProxy 
)
inlinestatic

Fixed: 2008.6.3 LiXizhi the following is for auto indexed table items {"string1", "string2\r\n", 213, nil,["A"]="B", true, false, {"another table", "field1"}}

§ IsPureData()

static bool NPLInterface::NPLHelper::IsPureData ( const char *  sCode,
int  nCodeSize = -1 
)
inlinestatic

it will return true if input string is "false", "true", NUMBER, STRING, and {table}

Parameters
sCodethe input string
nCodeSizenumber of bytes in string. if -1, strlen() is used to determine the size.

§ IsPureTable()

static bool NPLInterface::NPLHelper::IsPureTable ( const char *  sCode,
int  nCodeSize = -1 
)
inlinestatic

it will return true if input string is a {table} containing only "false", "true", NUMBER, STRING, and other such {table}

Parameters
sCodethe input string
nCodeSizenumber of bytes in string. if -1, strlen() is used to determine the size.

§ IsSCodePureData()

static bool NPLInterface::NPLHelper::IsSCodePureData ( const char *  sCode,
int  nCodeSize = -1 
)
inlinestatic

verify the script code.

it returns true if the script code contains pure msg data or table. this function is used to verify scode received from the network. So that the execution of a pure data in the local runtime is harmless.

Parameters
sCodethe input string
nCodeSizenumber of bytes in string. if -1, strlen() is used to determine the size.

§ MsgStringToNPLTable()

static NPLObjectProxy NPLInterface::NPLHelper::MsgStringToNPLTable ( const char *  input,
int  nLen = -1 
)
inlinestatic

same as StringToNPLTable(), except that it begins with "msg={...}"

Parameters
inputsuch as "msg={nid=10, name=\"value", tab={name1="value1"}}"

§ NPLTableToString()

static bool NPLInterface::NPLHelper::NPLTableToString ( const char *  sStorageVar,
NPLObjectProxy input,
std::string &  sCode,
int  nCodeOffset = 0 
)
inlinestatic

same as SerializeNPLTableToString.

Except that it is used via DLL interface.

§ StringToNPLTable()

static NPLObjectProxy NPLInterface::NPLHelper::StringToNPLTable ( const char *  input,
int  nLen = -1 
)
inlinestatic

converting string to NPL table object

Parameters
inputsuch as "{nid=10, name=\"value", tab={name1="value1"}}"

The documentation for this class was generated from the following file: