Photon Fusion 1.1.2

Public Member Functions | Static Public Member Functions | Properties | List of all members
NetworkString< Size > Class Template Reference

Fixed-size UTF32 string. All operations are alloc-free, except for converting to System.String. More...

Inherits INetworkString, INetworkStruct, IEquatable< NetworkString< Size >>, and IEnumerable< char >.

Public Member Functions

bool Get (ref string cache)
 Checks if cache is equivalent and if not converts to UTF16 and stores the result in cache . More...
 
bool Set (string value)
 Converts value to UTF32 string and stores it internally. More...
 
int IndexOf (char c, int startIndex=0)
 
int IndexOf (char c, int startIndex, int count)
 
int IndexOf (uint codePoint, int startIndex=0)
 
int IndexOf (uint codePoint, int startIndex, int count)
 
int IndexOf (string str, int startIndex=0)
 
int IndexOf (string str, int startIndex, int count)
 
int IndexOf< OtherSize > (NetworkString< OtherSize > str, int startIndex=0)
 
int IndexOf< OtherSize > (NetworkString< OtherSize > str, int startIndex, int count)
 
int IndexOf< OtherSize > (ref NetworkString< OtherSize > str, int startIndex=0)
 
int IndexOf< OtherSize > (ref NetworkString< OtherSize > str, int startIndex, int count)
 
bool Contains (char c)
 
bool Contains (uint codePoint)
 
bool Contains (string str)
 
bool Contains< OtherSize > (NetworkString< OtherSize > str)
 
bool Contains< OtherSize > (ref NetworkString< OtherSize > str)
 
NetworkString< Size > Substring (int startIndex)
 
NetworkString< Size > Substring (int startIndex, int length)
 
NetworkString< Size > ToLower ()
 
NetworkString< Size > ToUpper ()
 
int GetCharCount ()
 Calculates the length of the equivalent UTF16 string. More...
 
int Compare (string s)
 
int Compare (NetworkString< Size > s)
 
int Compare (ref NetworkString< Size > s)
 
int Compare< OtherSize > (NetworkString< OtherSize > other)
 
int Compare< OtherSize > (ref NetworkString< OtherSize > other)
 
bool Equals (string s)
 
override bool Equals (object obj)
 
bool Equals (NetworkString< Size > other)
 
bool Equals (ref NetworkString< Size > other)
 
bool Equals< OtherSize > (NetworkString< OtherSize > other)
 
bool Equals< OtherSize > (ref NetworkString< OtherSize > other)
 
bool StartsWith (string s)
 
bool StartsWith< OtherSize > (ref NetworkString< OtherSize > other)
 
bool EndsWith< OtherSize > (ref NetworkString< OtherSize > other)
 
bool EndsWith (string s)
 
override int GetHashCode ()
 
override string ToString ()
 
UTF32Tools.CharEnumerator GetEnumerator ()
 
IEnumerator< char > IEnumerable< char >. GetEnumerator ()
 
IEnumerator IEnumerable. GetEnumerator ()
 

Static Public Member Functions

static implicit operator NetworkString< Size > (string str)
 
static bool operator!= (NetworkString< Size > a, NetworkString< Size > b)
 
static bool operator!= (string a, NetworkString< Size > b)
 
static bool operator!= (NetworkString< Size > a, string b)
 
static bool operator== (NetworkString< Size > a, NetworkString< Size > b)
 
static bool operator== (string a, NetworkString< Size > b)
 
static bool operator== (NetworkString< Size > a, string b)
 
static int GetCapacity< Size > ()
 

Properties

int Capacity [get]
 Maximum UTF32 string length. More...
 
string Value [get, set]
 Converts to/from regular UTF16 string. Setter is alloc-free. Use Get(ref string, bool) to get possibly alloc-free conversion. More...
 
int Length [get]
 Number of UTF32 scalars. It is equal or less than GetCharCount or the length of Value, because those use UTF16 encoding, which needs two characters to encode some values. More...
 
ref uint this[int index] [get]
 Returns UTF32 scalar at index position. To iterate over characters, use GetEnumerator. More...
 

Detailed Description

Fixed-size UTF32 string. All operations are alloc-free, except for converting to System.String.

Template Parameters
Size
Type Constraints
Size :unmanaged 
Size :IFixedStorage 

Member Function Documentation

◆ Get()

bool Get ( ref string  cache)

Checks if cache is equivalent and if not converts to UTF16 and stores the result in cache .

Parameters
cache
ignoreCase
Returns
False if no conversion was performed, true otherwise.

◆ GetCharCount()

int GetCharCount ( )

Calculates the length of the equivalent UTF16 string.

Returns

◆ Set()

bool Set ( string  value)

Converts value to UTF32 string and stores it internally.

Parameters
value
Returns
False if value was too long to fit and had to be trimmed.

Property Documentation

◆ Capacity

int Capacity
get

Maximum UTF32 string length.

◆ Length

int Length
get

Number of UTF32 scalars. It is equal or less than GetCharCount or the length of Value, because those use UTF16 encoding, which needs two characters to encode some values.

◆ this[int index]

ref uint this[int index]
get

Returns UTF32 scalar at index position. To iterate over characters, use GetEnumerator.

Parameters
index
Returns

◆ Value

string Value
getset

Converts to/from regular UTF16 string. Setter is alloc-free. Use Get(ref string, bool) to get possibly alloc-free conversion.