My Project
Public Member Functions | Static Public Member Functions | List of all members
NPLMono.NPLWriter Class Reference

a simple class for creating NPL script code, especially data table code. More...

Public Member Functions

 NPLWriter (int nReservedSize)
 the internal buffer reserved size. More...
 
 NPLWriter (StringBuilder buff_)
 
void Reset ()
 
void Reset (int nReservedSize)
 
void WriteName (string name)
 
void WriteName (string name, bool bUseBrackets)
 write a parameter name More...
 
void WriteValue (string value)
 
void WriteValue (string value, bool bInQuotation)
 rite a parameter value More...
 
void WriteValue (double value)
 
void WriteNil ()
 
void WriteParamDelimiter ()
 
void Append (string sText)
 append any text More...
 
void BeginTable ()
 
void EndTable ()
 
override string ToString ()
 get the current NPL code. More...
 
 NPLWriter (int nReservedSize)
 the internal buffer reserved size. More...
 
 NPLWriter (StringBuilder buff_)
 
void Reset ()
 
void Reset (int nReservedSize)
 
void WriteName (string name)
 
void WriteName (string name, bool bUseBrackets)
 write a parameter name More...
 
void WriteValue (string value)
 
void WriteValue (string value, bool bInQuotation)
 rite a parameter value More...
 
void WriteValue (double value)
 
void WriteNil ()
 
void WriteParamDelimiter ()
 
void Append (string sText)
 append any text More...
 
void BeginTable ()
 
void EndTable ()
 
override string ToString ()
 get the current NPL code. More...
 

Static Public Member Functions

static string GetNilMessage ()
 
static string GetEmptyMessage ()
 
static string GetNilMessage ()
 
static string GetEmptyMessage ()
 

Detailed Description

a simple class for creating NPL script code, especially data table code.

this class is reentrant (thread-safe). Please note that this class does not ensure that the code is a pure table. See Example: // to generate the string : msg={name=1,2,{"3"="4",},}; NPLWriter writer = new NPLWriter(); writer.WriteName("msg"); writer.BeginTable(); writer.WriteName("name"); writer.WriteValue(1); writer.WriteValue(2); writer.BeginTable(); writer.WriteName("3", true); writer.WriteValue("4"); writer.EndTable(); writer.EndTable(); writer.WriteParamDelimiter(); ParaGlobal.log(writer.ToString());

One can also provide their own string buffer to write to, like below. StringBuilder buff = new StringBuilder(); buff.EnsureCapacity(100); NPLWriter writer = new NPLWriter(buff);

Constructor & Destructor Documentation

§ NPLWriter() [1/2]

NPLMono.NPLWriter.NPLWriter ( int  nReservedSize)
inline

the internal buffer reserved size.

§ NPLWriter() [2/2]

NPLMono.NPLWriter.NPLWriter ( int  nReservedSize)
inline

the internal buffer reserved size.

Member Function Documentation

§ Append() [1/2]

void NPLMono.NPLWriter.Append ( string  sText)
inline

append any text

Parameters
sText

§ Append() [2/2]

void NPLMono.NPLWriter.Append ( string  sText)
inline

append any text

Parameters
sText

§ GetEmptyMessage() [1/2]

static string NPLMono.NPLWriter.GetEmptyMessage ( )
inlinestatic

Returns
"msg={};"

§ GetEmptyMessage() [2/2]

static string NPLMono.NPLWriter.GetEmptyMessage ( )
inlinestatic

Returns
"msg={};"

§ GetNilMessage() [1/2]

static string NPLMono.NPLWriter.GetNilMessage ( )
inlinestatic

Returns
"msg=nil;"

§ GetNilMessage() [2/2]

static string NPLMono.NPLWriter.GetNilMessage ( )
inlinestatic

Returns
"msg=nil;"

§ ToString() [1/2]

override string NPLMono.NPLWriter.ToString ( )
inline

get the current NPL code.

§ ToString() [2/2]

override string NPLMono.NPLWriter.ToString ( )
inline

get the current NPL code.

§ WriteName() [1/2]

void NPLMono.NPLWriter.WriteName ( string  name,
bool  bUseBrackets 
)
inline

write a parameter name

Parameters
name
bUseBracketsif false, one has to make sure that the name is a valid NPL name string, without special characters.

§ WriteName() [2/2]

void NPLMono.NPLWriter.WriteName ( string  name,
bool  bUseBrackets 
)
inline

write a parameter name

Parameters
name
bUseBracketsif false, one has to make sure that the name is a valid NPL name string, without special characters.

§ WriteValue() [1/2]

void NPLMono.NPLWriter.WriteValue ( string  value,
bool  bInQuotation 
)
inline

rite a parameter value

Parameters
value
bInQuotationif bInQuotation is true, it writes a parameter text value. Otherwise it will just append the value without encoding it with quotation marks.

§ WriteValue() [2/2]

void NPLMono.NPLWriter.WriteValue ( string  value,
bool  bInQuotation 
)
inline

rite a parameter value

Parameters
value
bInQuotationif bInQuotation is true, it writes a parameter text value. Otherwise it will just append the value without encoding it with quotation marks.

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