|
NetBurner 3.5.6
PDF Version |
Lightweight alternative to C++ CString class. More...
#include <nbstring.h>
Inherited by NBInterpolatedString, String, String, String, and String.
Public Member Functions | |
| NBString () | |
| Construct a NBString object. | |
| NBString (const NBString &str) | |
| Construct a new NBString object from an existing NBString object. | |
| NBString (const NBString &str, size_t pos, size_t len=npos) | |
| Construct a new NBString object from a substring of an existing NBString object. | |
| NBString (const char *s) | |
| Construct a NBString object from a character string (null terminated array of characters) | |
| NBString (const char *s, size_t n) | |
| Construct a NBString object from a character string up to the specified amount. | |
| NBString (const JsonRef &jr) | |
| Construct a NBString object using the current string referenced by a JsonRef. This allows for using Large Strings without an intermediate malloc in the JsonParser. | |
| ~NBString () | |
| NBString destructor. | |
| const char * | c_str () const |
| Method to pass a NBString as a constant char *. | |
| NBString | substr (size_t pos=0, size_t len=npos) const |
| Creates a new NBString object from a substring of the existing NBString object. | |
| int | compare (const NBString &str) const |
| Compares two NBString objects. | |
| int | compare (const char *s) const |
| Compares the NBString object to a character string. | |
| size_t | find (const NBString str, size_t pos=0) const |
| Find a substring within a NBString object. | |
| size_t | find (const char *str, size_t pos=0) const |
| Find a substring within a character string. | |
| size_t | find (const char *s, size_t pos, size_t n) const |
| Find a substring within a character string. | |
| size_t | find (char c, size_t pos=0) const |
| Find the first occurence of a character within the NBString object. | |
| size_t | replace (const char *findStr, char rep, size_t startPos=0, size_t end=0) |
| Replace all occurrences of all "<findStr>" characters within the NBString object. | |
| size_t | replace (char c, char rep, size_t startPos=0, size_t end=0) |
| Replace all occurrences of all "<findStr>" characters within the NBString object. | |
| void | shrink (int n) |
| Reduces the length of the string by n. | |
| size_t | size () const |
| Returns the current size of memory allocated for the string. | |
| size_t | length () const |
| Returns the length of the string. | |
| void | clear () |
| Clear a NBString object and free allocated memory. | |
| bool | empty () const |
| Check if a string is empty. | |
| NBString & | Append (const char *str, size_t len) |
| Append a string to an existing NBString object. | |
| NBString & | FdAppend (int fd, size_t len) |
| Append from a file descriptor to an existing NBString object. | |
| NBString & | Reserve (size_t len) |
| Reserve an additional buffer amount. | |
| int | vsiprintf (const char *format, va_list &vl) |
| Print to a string with formatting. | |
| int | sprintf (const char *format,...) |
| sprintf to a string with formatting to a character array | |
| int | sprintf (NBString const format,...) |
| sprintf to a string with formatting as a NBString object | |
| int | siprintf (const char *format,...) |
| isprintf (integer) to a string with formatting to a character array | |
| int | siprintf (NBString const format,...) |
| isprintf (integer) to a string with formatting to a NBString object | |
| int | stoi () const |
| Parse the string and convert to an integer number. | |
| long | stol () const |
| Parse the string value and convert to a long integer number. | |
| unsigned int | stoui () const |
| Parse the string value and convert to a const integer number. | |
| unsigned long | stoul () const |
| Parse the string value and convert to a const unsigned long integer number. | |
| double | stod () const |
| Parse the string value and convert to a const double float number. | |
| IPADDR | to_ipaddr () const |
| Parse the string value and convert to an IPADDR IP address. | |
| size_t | copy (char *s, size_t len, size_t pos=0) const |
| Copy a substring, does not null terminate. | |
| size_t | strcopy (char *s, size_t len, size_t pos=0) const |
| Copy a substring, with null termination. | |
| bool | Interpolate (NBString &dest) |
| Perform a string interpolation and place the finished interpolation in the Destination string. This allows NBStrings to easily access the NetBurner Config System, as in: | |
| bool | Interpolate () |
| Perform an in-place string interpolation. This allows NBStrings to easily access the NetBurner Config System, as in: | |
Friends | |
| void | swap (NBString &x, NBString &y) |
| Swaps the contents of two NBString objects. | |
Lightweight alternative to C++ CString class.
| NBString::NBString | ( | const NBString & | str | ) |
| NBString::NBString | ( | const NBString & | str, |
| size_t | pos, | ||
| size_t | len = npos ) |
| NBString::NBString | ( | const char * | s | ) |
Construct a NBString object from a character string (null terminated array of characters)
| s | String to initialize object |
| NBString::NBString | ( | const char * | s, |
| size_t | n ) |
Construct a NBString object from a character string up to the specified amount.
| s | String to initialize object |
| n | Number of characters to copy |
| NBString::NBString | ( | const JsonRef & | jr | ) |
| NBString & NBString::Append | ( | const char * | str, |
| size_t | len ) |
| const char * NBString::c_str | ( | ) | const |
Method to pass a NBString as a constant char *.
Will cause an allocation if it is pointing to a constant string longer than the currently allocated length.
| void NBString::clear | ( | ) |
| int NBString::compare | ( | const char * | s | ) | const |
| int NBString::compare | ( | const NBString & | str | ) | const |
| size_t NBString::copy | ( | char * | s, |
| size_t | len, | ||
| size_t | pos = 0 ) const |
Copy a substring, does not null terminate.
| s | Destination |
| len | Size of destination |
| pos | Starting position of copy |
| bool NBString::empty | ( | ) | const |
Check if a string is empty.
Check if a NBString object is empty
| true | String is null |
| false | String contains data |
| NBString & NBString::FdAppend | ( | int | fd, |
| size_t | len ) |
| size_t NBString::find | ( | char | c, |
| size_t | pos = 0 ) const |
Find the first occurence of a character within the NBString object.
| c | Character to search for |
| pos | Starting position to start search |
| >=0 | Position in string |
| -1 | If character not found |
| size_t NBString::find | ( | const char * | s, |
| size_t | pos, | ||
| size_t | n ) const |
Find a substring within a character string.
| s | String to search |
| pos | Starting position to start search |
| n | Number of characters that have to match |
| >=0 | Position in searched string |
| -1 | If substring not found |
| size_t NBString::find | ( | const char * | str, |
| size_t | pos = 0 ) const |
Find a substring within a character string.
| str | String to search |
| pos | Starting position to start search |
| >=0 | Position in searched string |
| -1 | If substring not found |
| size_t NBString::find | ( | const NBString | str, |
| size_t | pos = 0 ) const |
Find a substring within a NBString object.
| str | NString object to search |
| pos | Starting position to start search |
| >=0 | Position in searched string |
| -1 | If substring not found |
|
inline |
Perform an in-place string interpolation. This allows NBStrings to easily access the NetBurner Config System, as in:
| bool NBString::Interpolate | ( | NBString & | dest | ) |
Perform a string interpolation and place the finished interpolation in the Destination string. This allows NBStrings to easily access the NetBurner Config System, as in:
| dest | Destination string |
| size_t NBString::length | ( | ) | const |
Returns the length of the string.
| size_t NBString::replace | ( | char | c, |
| char | rep, | ||
| size_t | startPos = 0, | ||
| size_t | end = 0 ) |
Replace all occurrences of all "<findStr>" characters within the NBString object.
| c | Character to be replaced within the NBString |
| rep | Character to replace with |
| startPos | Starting position to start replacing |
| end | Replace all matching characters before this position, 0 = end of NBString |
| >0 | Number of Replaced Characters |
| -1 | If no matching character found |
| size_t NBString::replace | ( | const char * | findStr, |
| char | rep, | ||
| size_t | startPos = 0, | ||
| size_t | end = 0 ) |
Replace all occurrences of all "<findStr>" characters within the NBString object.
| findStr | String of characters to be replaced within the NBString |
| rep | Character to replace with |
| startPos | Starting position to start replacing |
| end | Replace all matching characters before this position, 0 = end of NBString |
| >0 | Number of Replaced Characters |
| -1 | If no matching character found |
| NBString & NBString::Reserve | ( | size_t | len | ) |
Reserve an additional buffer amount.
Reserve an additional buffer amount to prepare for a series of Appends
| len | Number of additional characters to prepare to store |
| int NBString::siprintf | ( | const char * | format, |
| ... ) |
isprintf (integer) to a string with formatting to a character array
| format | printf style formatting |
| int NBString::siprintf | ( | NBString const | format, |
| ... ) |
isprintf (integer) to a string with formatting to a NBString object
| format | printf style formatting |
| size_t NBString::size | ( | ) | const |
Returns the current size of memory allocated for the string.
| int NBString::sprintf | ( | const char * | format, |
| ... ) |
sprintf to a string with formatting to a character array
| format | printf style formatting |
| int NBString::sprintf | ( | NBString const | format, |
| ... ) |
sprintf to a string with formatting as a NBString object
| format | printf style formatting |
| double NBString::stod | ( | ) | const |
Parse the string value and convert to a const double float number.
| int NBString::stoi | ( | ) | const |
Parse the string and convert to an integer number.
| long NBString::stol | ( | ) | const |
Parse the string value and convert to a long integer number.
| unsigned int NBString::stoui | ( | ) | const |
Parse the string value and convert to a const integer number.
| unsigned long NBString::stoul | ( | ) | const |
Parse the string value and convert to a const unsigned long integer number.
| size_t NBString::strcopy | ( | char * | s, |
| size_t | len, | ||
| size_t | pos = 0 ) const |
Copy a substring, with null termination.
| s | Destination |
| len | Size of destination |
| pos | Starting position of copy |
| NBString NBString::substr | ( | size_t | pos = 0, |
| size_t | len = npos ) const |
| IPADDR NBString::to_ipaddr | ( | ) | const |
Parse the string value and convert to an IPADDR IP address.
| int NBString::vsiprintf | ( | const char * | format, |
| va_list & | vl ) |
Print to a string with formatting.
| format | printf style formatting |
| vl | Variable argument list |