![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
String class. More...
#include <RakString.h>
Classes | |
| struct | SharedString |
Public Member Functions | |
| void | AppendBytes (const char *bytes, unsigned int count) |
| RakString | Assign (const char *str, size_t pos, size_t n) |
| const char * | C_String (void) const |
| Same as std::string::c_str. | |
| char * | C_StringUnsafe (void) |
| void | Clear (void) |
| Clear the string. | |
| bool | ContainsNonprintableExceptSpaces (void) const |
| Does the string contain non-printable characters other than spaces? | |
| bool | Deserialize (BitStream *bs) |
| bool | DeserializeCompressed (BitStream *bs, bool readLanguageId=false) |
| void | Erase (unsigned int index, unsigned int count) |
| Erase characters out of the string at index for count. | |
| size_t | Find (const char *stringToFind, size_t pos=0) |
| void | FPrintf (FILE *fp) |
| Print the string to a file. | |
| size_t | GetLength (void) const |
| Returns the length of the string. | |
| bool | IPAddressMatch (const char *IP) |
| Does the given IP address match the IP address encoded into this string, accounting for wildcards? | |
| bool | IsEmailAddress (void) const |
| Is this a valid email address? | |
| bool | IsEmpty (void) const |
| Returns if the string is empty. Also, C_String() would return "". | |
| RakNet::RakString & | MakeFilePath (void) |
| Fix to be a file path, ending with /. | |
| operator const char * () const | |
| Implicit return of const char*. | |
| bool | operator!= (const char *str) const |
| bool | operator!= (char *str) const |
| bool | operator!= (const RakString &rhs) const |
| Inequality. | |
| RakString & | operator+= (const RakString &rhs) |
| Concatenation. | |
| RakString & | operator+= (char *str) |
| RakString & | operator+= (const char *str) |
| RakString & | operator+= (const unsigned char *str) |
| RakString & | operator+= (char unsigned *str) |
| RakString & | operator+= (const char c) |
| bool | operator< (const RakString &right) const |
| bool | operator<= (const RakString &right) const |
| RakString & | operator= (const char c) |
| RakString & | operator= (const RakString &rhs) |
| Assigment operators. | |
| RakString & | operator= (const char *str) |
| RakString & | operator= (char *str) |
| RakString & | operator= (const unsigned char *str) |
| RakString & | operator= (char unsigned *str) |
| bool | operator== (const RakString &rhs) const |
| Equality. | |
| bool | operator== (const char *str) const |
| bool | operator== (char *str) const |
| bool | operator> (const RakString &right) const |
| bool | operator>= (const RakString &right) const |
| unsigned char | operator[] (const unsigned int position) const |
| Character index. Do not use to change the string however. | |
| void | Printf (void) |
| Print the string to the screen. | |
| RakString (const unsigned char *format,...) | |
| RakString () | |
| RakString (char input) | |
| RakString (const char *format,...) | |
| RakString (SharedString *_sharedString) | |
| RakString (unsigned char input) | |
| RakString (const RakString &rhs) | |
| void | RemoveCharacter (char c) |
| Remove all instances of c. | |
| void | Replace (unsigned index, unsigned count, unsigned char c) |
| Replace character(s) in starting at index, for count, with c. | |
| void | Serialize (BitStream *bs) const |
| void | SerializeCompressed (BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false) const |
| void | Set (const char *format,...) |
| Set the value of the string. | |
| void | SetChar (unsigned index, unsigned char c) |
| Replace character at index with c. | |
| void | SetChar (unsigned index, RakNet::RakString s) |
| Replace character at index with string s. | |
| void | SplitURI (RakNet::RakString &header, RakNet::RakString &domain, RakNet::RakString &path) |
| https://servers.api.rackspacecloud.com/v1.0 to https://, servers.api.rackspacecloud.com, /v1.0 | |
| RakNet::RakString & | SQLEscape (void) |
| Scan for quote, double quote, and backslash and prepend with backslash. | |
| int | StrCmp (const RakString &rhs) const |
| Compare strings (case sensitive) | |
| int | StrICmp (const RakString &rhs) const |
| Compare strings (not case sensitive) | |
| RakString | SubStr (unsigned int index, unsigned int count) const |
| void | TerminateAtFirstCharacter (char c) |
| Set the first instance of c with a NULL terminator. | |
| void | TerminateAtLastCharacter (char c) |
| Set the last instance of c with a NULL terminator. | |
| const char * | ToLower (void) |
| Change all characters to lowercase. | |
| const char * | ToUpper (void) |
| Change all characters to uppercase. | |
| void | Truncate (unsigned length) |
| Make sure string is no longer than length. | |
| RakNet::RakString & | URLDecode (void) |
| URL decode the string. | |
| RakNet::RakString & | URLEncode (void) |
| URL Encode the string. See http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4029/. | |
| ~RakString () | |
Static Public Member Functions | |
| static bool | Deserialize (char *str, BitStream *bs) |
| Static version of the Deserialize() function. | |
| static bool | DeserializeCompressed (char *str, BitStream *bs, bool readLanguageId=false) |
| Static version of the DeserializeCompressed() function. | |
| static void | FreeMemory (void) |
| static void | FreeMemoryNoMutex (void) |
| static size_t | GetSizeToAllocate (size_t bytes) |
| static void | LockMutex (void) |
| static RakNet::RakString | NonVariadic (const char *str) |
| static int | RakStringComp (RakString const &key, RakString const &data) |
| static void | Serialize (const char *str, BitStream *bs) |
| Static version of the Serialize function. | |
| static void | SerializeCompressed (const char *str, BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false) |
| Static version of the SerializeCompressed function. | |
| static unsigned long | ToInteger (const char *str) |
| Has the string into an unsigned int. | |
| static unsigned long | ToInteger (const RakString &rs) |
| static const char * | ToString (uint64_t i) |
| static const char * | ToString (int64_t i) |
| static void | UnlockMutex (void) |
Public Attributes | |
| SharedString * | sharedString |
Static Public Attributes | |
| static SharedString | emptyString |
| static DataStructures::List < SharedString * > | freeList |
Protected Member Functions | |
| void | Allocate (size_t len) |
| void | Assign (const char *str) |
| void | Assign (const char *str, va_list ap) |
| void | Clone (void) |
| void | Free (void) |
| void | Realloc (SharedString *sharedString, size_t bytes) |
| unsigned char | ToLower (unsigned char c) |
| unsigned char | ToUpper (unsigned char c) |
Has the following improvements over std::string -Reference counting: Suitable to store in lists -Variadic assignment operator -Doesn't cause linker errors
Definition at line 29 of file RakString.h.
| RakNet::RakString::RakString | ( | ) |
| RakNet::RakString::RakString | ( | char | input | ) |
| RakNet::RakString::RakString | ( | unsigned char | input | ) |
| RakNet::RakString::RakString | ( | const unsigned char * | format, |
| ... | |||
| ) |
| RakNet::RakString::RakString | ( | const char * | format, |
| ... | |||
| ) |
| RakNet::RakString::~RakString | ( | ) |
| RakNet::RakString::RakString | ( | const RakString & | rhs | ) |
| RakNet::RakString::RakString | ( | SharedString * | _sharedString | ) |
| void RakNet::RakString::Allocate | ( | size_t | len | ) | [protected] |
| void RakNet::RakString::AppendBytes | ( | const char * | bytes, |
| unsigned int | count | ||
| ) |
| RakString RakNet::RakString::Assign | ( | const char * | str, |
| size_t | pos, | ||
| size_t | n | ||
| ) |
Sets a copy of a substring of str as the new content. The substring is the portion of str that begins at the character position pos and takes up to n characters (it takes less than n if the end of str is reached before).
| [in] | str | The string to copy in |
| [in] | pos | The position on str to start the copy |
| [in] | n | How many chars to copy |
| void RakNet::RakString::Assign | ( | const char * | str | ) | [protected] |
| void RakNet::RakString::Assign | ( | const char * | str, |
| va_list | ap | ||
| ) | [protected] |
| const char* RakNet::RakString::C_String | ( | void | ) | const [inline] |
Definition at line 45 of file RakString.h.
Referenced by SraNetwork::CreateCharacterMessage::process(), and SraNetwork::ClientLoginMessage::process().
{return sharedString->c_str;}
| char* RakNet::RakString::C_StringUnsafe | ( | void | ) | [inline] |
Definition at line 49 of file RakString.h.
{Clone(); return sharedString->c_str;}
| void RakNet::RakString::Clear | ( | void | ) |
| void RakNet::RakString::Clone | ( | void | ) | [protected] |
| bool RakNet::RakString::ContainsNonprintableExceptSpaces | ( | void | ) | const |
Deserialize what was written by Serialize
| [in] | bs | Bitstream to serialize from |
Referenced by RakNet::BitStream::Read().
Deserialize compressed string, written by SerializeCompressed
| [in] | bs | Bitstream to serialize from |
| [in] | readLanguageId | If true, looks for the variable langaugeId in the data stream. Must match what was passed to SerializeCompressed |
Referenced by RakNet::BitStream::ReadCompressed().
| static bool RakNet::RakString::DeserializeCompressed | ( | char * | str, |
| BitStream * | bs, | ||
| bool | readLanguageId = false |
||
| ) | [static] |
| void RakNet::RakString::Erase | ( | unsigned int | index, |
| unsigned int | count | ||
| ) |
| size_t RakNet::RakString::Find | ( | const char * | stringToFind, |
| size_t | pos = 0 |
||
| ) |
String class find replacement Searches the string for the content specified in stringToFind and returns the position of the first occurrence in the string. Search only includes characters on or after position pos, ignoring any possible occurrences in previous locations.
| [in] | stringToFind | The string to find inside of this object's string |
| [in] | pos | The position in the string to start the search |
| void RakNet::RakString::FPrintf | ( | FILE * | fp | ) |
| void RakNet::RakString::Free | ( | void | ) | [protected] |
| static void RakNet::RakString::FreeMemory | ( | void | ) | [static] |
RakString uses a freeList of old no-longer used strings Call this function to clear this memory on shutdown
| static void RakNet::RakString::FreeMemoryNoMutex | ( | void | ) | [static] |
| size_t RakNet::RakString::GetLength | ( | void | ) | const |
| static size_t RakNet::RakString::GetSizeToAllocate | ( | size_t | bytes | ) | [inline, static] |
Definition at line 246 of file RakString.h.
{
const size_t smallStringSize = 128-sizeof(unsigned int)-sizeof(size_t)-sizeof(char*)*2;
if (bytes<=smallStringSize)
return smallStringSize;
else
return bytes*2;
}
| bool RakNet::RakString::IPAddressMatch | ( | const char * | IP | ) |
| bool RakNet::RakString::IsEmailAddress | ( | void | ) | const |
| bool RakNet::RakString::IsEmpty | ( | void | ) | const |
Referenced by SraNetwork::ClientRegister::checkForValidCharacterInfo().
| static void RakNet::RakString::LockMutex | ( | void | ) | [static] |
| RakNet::RakString& RakNet::RakString::MakeFilePath | ( | void | ) |
| static RakNet::RakString RakNet::RakString::NonVariadic | ( | const char * | str | ) | [static] |
Create a RakString with a value, without doing printf style parsing Equivalent to assignment operator
| RakNet::RakString::operator const char * | ( | ) | const [inline] |
Definition at line 42 of file RakString.h.
{return sharedString->c_str;}
| bool RakNet::RakString::operator!= | ( | const char * | str | ) | const |
| bool RakNet::RakString::operator!= | ( | char * | str | ) | const |
| RakString& RakNet::RakString::operator+= | ( | const char * | str | ) |
| RakString& RakNet::RakString::operator+= | ( | char * | str | ) |
| RakString& RakNet::RakString::operator+= | ( | const unsigned char * | str | ) |
| RakString& RakNet::RakString::operator+= | ( | char unsigned * | str | ) |
| RakString& RakNet::RakString::operator+= | ( | const char | c | ) |
| RakString& RakNet::RakString::operator= | ( | char unsigned * | str | ) |
| RakString& RakNet::RakString::operator= | ( | const char | c | ) |
| RakString& RakNet::RakString::operator= | ( | const char * | str | ) |
| RakString& RakNet::RakString::operator= | ( | char * | str | ) |
| RakString& RakNet::RakString::operator= | ( | const unsigned char * | str | ) |
| bool RakNet::RakString::operator== | ( | const char * | str | ) | const |
| bool RakNet::RakString::operator== | ( | char * | str | ) | const |
| unsigned char RakNet::RakString::operator[] | ( | const unsigned int | position | ) | const |
| void RakNet::RakString::Printf | ( | void | ) |
| static int RakNet::RakString::RakStringComp | ( | RakString const & | key, |
| RakString const & | data | ||
| ) | [static] |
| void RakNet::RakString::Realloc | ( | SharedString * | sharedString, |
| size_t | bytes | ||
| ) | [protected] |
| void RakNet::RakString::RemoveCharacter | ( | char | c | ) |
| void RakNet::RakString::Replace | ( | unsigned | index, |
| unsigned | count, | ||
| unsigned char | c | ||
| ) |
| static void RakNet::RakString::Serialize | ( | const char * | str, |
| BitStream * | bs | ||
| ) | [static] |
| void RakNet::RakString::Serialize | ( | BitStream * | bs | ) | const |
Serialize to a bitstream, uncompressed (slightly faster)
| [out] | bs | Bitstream to serialize to |
Referenced by SraNetwork::CreateCharacterMessage::process(), and RakNet::BitStream::Write().
| void RakNet::RakString::SerializeCompressed | ( | BitStream * | bs, |
| uint8_t | languageId = 0, |
||
| bool | writeLanguageId = false |
||
| ) | const |
Serialize to a bitstream, compressed (better bandwidth usage)
| [out] | bs | Bitstream to serialize to |
| [in] | languageId | languageId to pass to the StringCompressor class |
| [in] | writeLanguageId | encode the languageId variable in the stream. If false, 0 is assumed, and DeserializeCompressed will not look for this variable in the stream (saves bandwidth) |
Referenced by RakNet::BitStream::WriteCompressed().
| static void RakNet::RakString::SerializeCompressed | ( | const char * | str, |
| BitStream * | bs, | ||
| uint8_t | languageId = 0, |
||
| bool | writeLanguageId = false |
||
| ) | [static] |
| void RakNet::RakString::Set | ( | const char * | format, |
| ... | |||
| ) |
| void RakNet::RakString::SetChar | ( | unsigned | index, |
| unsigned char | c | ||
| ) |
| void RakNet::RakString::SetChar | ( | unsigned | index, |
| RakNet::RakString | s | ||
| ) |
| void RakNet::RakString::SplitURI | ( | RakNet::RakString & | header, |
| RakNet::RakString & | domain, | ||
| RakNet::RakString & | path | ||
| ) |
| RakNet::RakString& RakNet::RakString::SQLEscape | ( | void | ) |
| int RakNet::RakString::StrCmp | ( | const RakString & | rhs | ) | const |
| int RakNet::RakString::StrICmp | ( | const RakString & | rhs | ) | const |
| RakString RakNet::RakString::SubStr | ( | unsigned int | index, |
| unsigned int | count | ||
| ) | const |
| void RakNet::RakString::TerminateAtFirstCharacter | ( | char | c | ) |
| void RakNet::RakString::TerminateAtLastCharacter | ( | char | c | ) |
| static unsigned long RakNet::RakString::ToInteger | ( | const RakString & | rs | ) | [static] |
| static unsigned long RakNet::RakString::ToInteger | ( | const char * | str | ) | [static] |
| unsigned char RakNet::RakString::ToLower | ( | unsigned char | c | ) | [protected] |
| const char* RakNet::RakString::ToLower | ( | void | ) |
| static const char* RakNet::RakString::ToString | ( | int64_t | i | ) | [static] |
| static const char* RakNet::RakString::ToString | ( | uint64_t | i | ) | [static] |
| const char* RakNet::RakString::ToUpper | ( | void | ) |
| unsigned char RakNet::RakString::ToUpper | ( | unsigned char | c | ) | [protected] |
| void RakNet::RakString::Truncate | ( | unsigned | length | ) |
| static void RakNet::RakString::UnlockMutex | ( | void | ) | [static] |
| RakNet::RakString& RakNet::RakString::URLDecode | ( | void | ) |
| RakNet::RakString& RakNet::RakString::URLEncode | ( | void | ) |
Definition at line 275 of file RakString.h.
Definition at line 281 of file RakString.h.
Definition at line 270 of file RakString.h.
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.