C# 클래스 NPLMono.NPLWriter

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);
파일 보기 프로젝트 열기: LiXizhi/NPLRuntime

공개 메소드들

메소드 설명
Append ( string sText ) : void

append any text

BeginTable ( ) : void
EndTable ( ) : void
GetEmptyMessage ( ) : string

GetNilMessage ( ) : string

NPLWriter ( )
NPLWriter ( StringBuilder buff_ )
NPLWriter ( int nReservedSize )
Reset ( ) : void
Reset ( int nReservedSize ) : void
ToString ( ) : string
WriteName ( string name ) : void
WriteName ( string name, bool bUseBrackets ) : void

write a parameter name

WriteNil ( ) : void
WriteParamDelimiter ( ) : void
WriteValue ( double value ) : void
WriteValue ( string value ) : void
WriteValue ( string value, bool bInQuotation ) : void

rite a parameter value

메소드 상세

Append() 공개 메소드

append any text
public Append ( string sText ) : void
sText string
리턴 void

BeginTable() 공개 메소드

public BeginTable ( ) : void
리턴 void

EndTable() 공개 메소드

public EndTable ( ) : void
리턴 void

GetEmptyMessage() 공개 정적인 메소드

public static GetEmptyMessage ( ) : string
리턴 string

GetNilMessage() 공개 정적인 메소드

public static GetNilMessage ( ) : string
리턴 string

NPLWriter() 공개 메소드

public NPLWriter ( )

NPLWriter() 공개 메소드

public NPLWriter ( StringBuilder buff_ )
buff_ StringBuilder

NPLWriter() 공개 메소드

public NPLWriter ( int nReservedSize )
nReservedSize int

Reset() 공개 메소드

public Reset ( ) : void
리턴 void

Reset() 공개 메소드

public Reset ( int nReservedSize ) : void
nReservedSize int
리턴 void

ToString() 공개 메소드

public ToString ( ) : string
리턴 string

WriteName() 공개 메소드

public WriteName ( string name ) : void
name string
리턴 void

WriteName() 공개 메소드

write a parameter name
public WriteName ( string name, bool bUseBrackets ) : void
name string
bUseBrackets bool if false, one has to make sure that the name is a valid NPL name string, without special characters.
리턴 void

WriteNil() 공개 메소드

public WriteNil ( ) : void
리턴 void

WriteParamDelimiter() 공개 메소드

public WriteParamDelimiter ( ) : void
리턴 void

WriteValue() 공개 메소드

public WriteValue ( double value ) : void
value double
리턴 void

WriteValue() 공개 메소드

public WriteValue ( string value ) : void
value string
리턴 void

WriteValue() 공개 메소드

rite a parameter value
public WriteValue ( string value, bool bInQuotation ) : void
value string
bInQuotation bool if bInQuotation is true, it writes a parameter text value. Otherwise it will just append the value without encoding it with quotation marks.
리턴 void