C# Class Henchmen.Lua.LString

Show file Open project: henchmeninteractive/HenchLua Class Usage Examples

Public Properties

Property Type Description
Empty LString

Public Methods

Method Description
AllocBuffer ( int length, int &offset ) : byte[]

Allocates a data buffer for a string of a given length.

CopyTo ( byte buffer, int index ) : void
Equals ( LString other ) : bool

Compares this string to another for equality.

Equals ( object obj ) : bool
FinishBuffer ( byte buffer ) : LString

Finishes construction of a string from a preallocated buffer.

The buffer must be fully initialized before this function is called. The buffer must be treated as read-only after this call. Modifying it will have unpredictable results.

GetHashCode ( ) : int
IndexOf ( LString str ) : int
IndexOf ( LString str, int index ) : int
IndexOf ( LString str, int index, int count ) : int
LString ( byte rawBytes ) : System

Initializes a String from an array of raw bytes.

LString ( byte rawBytes, int index, int count ) : System

Initializes a String from an array of raw bytes.

LString ( string str ) : System

Initializes a String from a .NET String using UTF8.

LString ( string str, Encoding encoding ) : System

Initializes a String from a .NET String and the desired byte encoding.

Substring ( int index ) : LString
Substring ( int index, int count ) : LString
ToString ( ) : string
ToString ( Encoding encoding ) : string

Gets the string's contents as a .NET string using the specified encoding.

UnsafeGetDataBuffer ( byte &buffer, int &index, int &count ) : void

Gets the string's raw data buffer.

Things will break (and break badly) if you modify the contents of this buffer. That's why this method is tagged Unsafe.

operator ( ) : LString
operator ( ) : bool
this ( int index ) : byte

Private Methods

Method Description
InternalAllocBuffer ( int length ) : byte[]
InternalCompareOrdinal ( byte a, byte b ) : int
InternalEquals ( byte a, byte b ) : bool
InternalFinishBuffer ( byte buffer ) : LString
InternalFromData ( byte internalData ) : LString
InternalGetHashCode ( byte internalData ) : int
UpdateHashCode ( ) : void

Method Details

AllocBuffer() public static method

Allocates a data buffer for a string of a given length.
public static AllocBuffer ( int length, int &offset ) : byte[]
length int /// The length of the buffer to allocate. ///
offset int /// The offset in the returned buffer to write your data at. /// Do not write data before this position or after offset + length. ///
return byte[]

CopyTo() public method

public CopyTo ( byte buffer, int index ) : void
buffer byte
index int
return void

Equals() public method

Compares this string to another for equality.
public Equals ( LString other ) : bool
other LString
return bool

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool

FinishBuffer() public static method

Finishes construction of a string from a preallocated buffer.
The buffer must be fully initialized before this function is called. The buffer must be treated as read-only after this call. Modifying it will have unpredictable results.
public static FinishBuffer ( byte buffer ) : LString
buffer byte /// The buffer value returned by . ///
return LString

GetHashCode() public method

public GetHashCode ( ) : int
return int

IndexOf() public method

public IndexOf ( LString str ) : int
str LString
return int

IndexOf() public method

public IndexOf ( LString str, int index ) : int
str LString
index int
return int

IndexOf() public method

public IndexOf ( LString str, int index, int count ) : int
str LString
index int
count int
return int

LString() public method

Initializes a String from an array of raw bytes.
public LString ( byte rawBytes ) : System
rawBytes byte The byte array.
return System

LString() public method

Initializes a String from an array of raw bytes.
public LString ( byte rawBytes, int index, int count ) : System
rawBytes byte The byte array.
index int The start of the subrange to use.
count int The length of the subrange to use.
return System

LString() public method

Initializes a String from a .NET String using UTF8.
public LString ( string str ) : System
str string The string.
return System

LString() public method

Initializes a String from a .NET String and the desired byte encoding.
public LString ( string str, Encoding encoding ) : System
str string The string.
encoding System.Text.Encoding The desired encoding.
return System

Substring() public method

public Substring ( int index ) : LString
index int
return LString

Substring() public method

public Substring ( int index, int count ) : LString
index int
count int
return LString

ToString() public method

public ToString ( ) : string
return string

ToString() public method

Gets the string's contents as a .NET string using the specified encoding.
public ToString ( Encoding encoding ) : string
encoding System.Text.Encoding The encoding to use.
return string

UnsafeGetDataBuffer() public method

Gets the string's raw data buffer.
Things will break (and break badly) if you modify the contents of this buffer. That's why this method is tagged Unsafe.
public UnsafeGetDataBuffer ( byte &buffer, int &index, int &count ) : void
buffer byte /// On exit, the buffer containing the string data. This will be null for nil strings. ///
index int /// On exit, the index in the buffer where the string data begins. This will be -1 for nil strings. ///
count int /// On exit, the length of the string data. This will be zero for nil strings. ///
return void

operator() public static method

public static operator ( ) : LString
return LString

operator() public static method

public static operator ( ) : bool
return bool

this() public method

public this ( int index ) : byte
index int
return byte

Property Details

Empty public static property

public static LString,Henchmen.Lua Empty
return LString