Generic string storage. More...
#include <str.h>


Public Member Functions | |
| string (void) | |
| string (const char *) | |
| string (const unsigned char *) | |
| string (const string &) | |
| string (const class statstring &) | |
| string (string *) | |
| string (unsigned int sz) | |
| char * | visitchild (int pos) const |
| operator bool (void) const | |
| operator const char * (void) const | |
| void | printf (const char *,...) |
| void | printf_va (const char *, va_list *) |
| string * | striplf (void) |
| unsigned int | strlen (void) const |
| unsigned int | utf8len (void) const |
| unsigned int | utf8pos (int i) const |
| void | utf8pad (int i, char with= ' ') |
| void | strcat (const char *) |
| void | strcat (const string &) |
| void | strcat (string *) |
| void | strcat (const char *dt, size_t sz) |
| void | strcat (char s) |
| void | strcat (int) |
| void | strcat (double) |
| void | strcat (const class value &) |
| void | strcat (const class statstring &) |
| void | insert (const string &) |
| void | strcpy (const char *) |
| void | strcpy (const string &) |
| void | strclone (const string &) |
| void | strcpy (const char *dt, size_t sz) |
| int | strstr (const char *dat, size_t sz, int offset=0) const |
| int | strstr (const char *, int offset=0) const |
| int | strstr (const string &, int offset=0) const |
| int | countchr (char c, int endpos=0) const |
| int | strcmp (const char *) const |
| int | strcmp (const string &) const |
| int | strncmp (const string &, int sz=0) const |
| int | strcasecmp (const string &) const |
| int | strcasecmp (const char *) const |
| int | strncasecmp (const string &, int sz=0) const |
| bool | globcmp (const string &str) const |
| bool | regcmp (const string &str) const |
| bool | globcmp (const char *str) const |
| bool | eq (const char *s) const |
| bool | eq (const string &s) const |
| size_t | binputopc (size_t offset, const char *opcode) |
| size_t | binputnum64 (size_t offset, const char *opcode, long long value) |
| size_t | binputnum32 (size_t offset, const char *opcode, unsigned int value) |
| size_t | binputnum16 (size_t offset, const char *opcode, unsigned int value) |
| size_t | binputstr (size_t offset, const char *opcode, const string &value) |
| size_t | binputnum8 (size_t offset, const char *opcode, unsigned int value) |
| size_t | binputvint (size_t offset, unsigned int val) |
| size_t | bingetvint (size_t atoffset, unsigned int &into) const |
| size_t | binputvstr (size_t offset, const string &str) |
| size_t | bingetvstr (size_t atoffset, string &into) const |
| size_t | binputieee (size_t offset, double val) |
| size_t | bingetieee (size_t offset, double &into) const |
| void | escape (void) |
| void | unescape (void) |
| void | escapexml (void) |
| void | unescapexml (void) |
| void | flush (void) |
| void | crop (void) |
| void | clear (void) |
| void | crop (int sz) |
| void | pad (int sz, char filler) |
| string * | mid (int pos, int sz=0) const |
| string * | left (int sz) const |
| string * | right (int sz) const |
| string * | encode64 (void) const |
| string * | decode64 (void) const |
| void | docopyonwrite (void) |
| const char * | str (void) const |
| const char * | cval (void) const |
| bool | validate (const string &set) const |
| string * | filter (const string &set) const |
| string * | stripchar (char stripchar) |
| string * | stripchars (const string &stripset) |
| string * | trim (const string &set=" ") const |
| string * | ltrim (const string &set=" ") const |
| string * | rtrim (const string &set=" ") const |
| void | replace (const string &set, char with) |
| void | replace (const class value &set) |
| int | strchr (char c, int left=0) const |
| void | cropat (char c) |
| void | cropat (const char *c) |
| void | cropatlast (char c) |
| void | cropatlast (const char *c) |
| void | cropafter (char c) |
| void | cropafter (const char *c) |
| void | cropafterlast (char c) |
| void | cropafterlast (const char *c) |
| string * | cutat (char c) |
| string * | cutatlast (char c) |
| string * | cutat (const char *c) |
| string * | cutatlast (const char *c) |
| string * | cutafter (const string &str) |
| string * | cutafter (char c) |
| string * | cutafterlast (const string &str) |
| string * | cutafterlast (char c) |
| string * | copyuntil (const string &s) const |
| string * | copyuntil (char c) const |
| string * | copyuntillast (const string &s) const |
| string * | copyuntillast (char c) const |
| string * | copyafter (const string &s) const |
| string * | copyafter (char c) const |
| string * | copyafterlast (const string &s) const |
| string * | copyafterlast (char c) const |
| void | ctolower (void) |
| void | ctoupper (void) |
| string * | lower (void) const |
| string * | upper (void) const |
| void | capitalize (void) |
| int | toint (int base=10) const |
| void | chomp (void) |
| void | chomp (const string &set) |
| virtual void | init (bool first=true) |
| const char | operator[] (int n) const |
| char & | operator[] (int n) |
| bool | operator== (const char *str) const |
| bool | operator== (const class value &) const |
| bool | operator== (const string &str) const |
| bool | operator== (const class statstring &) const |
| bool | operator!= (const class statstring &) const |
| string & | operator= (const string &str) |
| string & | operator= (class value &) |
| string & | operator= (const class value &) |
| string & | operator= (const char *str) |
| string & | operator= (const unsigned char *str) |
| string & | operator= (string *str) |
| string & | operator= (class statstring *str) |
| string & | operator= (const class statstring &str) |
| bool | operator!= (const class value &v) const |
| bool | operator!= (const string &str) const |
| bool | operator!= (const char *str) const |
| string & | operator+= (const string &str) |
| string & | operator+= (string *str) |
| string & | operator+= (class value *) |
| string & | operator+= (class value &) |
| string & | operator+= (const char *str) |
| string * | operator+ (const string &str) const |
| size_t | binput64 (size_t offset, long long val) |
| size_t | binput64u (size_t offset, unsigned long long val) |
| size_t | binput32u (size_t offset, unsigned int val) |
| size_t | binput32 (size_t offset, int) |
| size_t | binput32o (size_t offset, const char *offs) |
| size_t | binput16u (size_t offset, unsigned short val) |
| size_t | binput16 (size_t offset, short) |
| size_t | binput8u (size_t offset, unsigned char val) |
| size_t | binput8 (size_t offset, char) |
| size_t | binget8 (size_t offset, char &) const |
| size_t | binget8u (size_t offset, unsigned char &) const |
| size_t | binget16 (size_t offset, short &) const |
| size_t | binget16u (size_t offset, unsigned short &) const |
| size_t | binget32 (size_t offset, int &) const |
| size_t | binget32u (size_t offset, unsigned int &) const |
| size_t | binget64 (size_t offset, long long &) const |
| size_t | binget64u (size_t offset, unsigned long long &) const |
Protected Attributes | |
| unsigned int | size |
| unsigned int | offs |
| unsigned int | alloc |
| refblock * | data |
Generic string storage.
Uses copy-on-write shared storage for efficiency.
| string::string | ( | const string & | s | ) |
Copy-constructor.
Shares the other object's refblock.
References alloc, data, offs, refblock::refcount, size, strclone(), strlen(), and refblock::threadref.

| string::string | ( | string * | s | ) |
| string::string | ( | unsigned int | sz | ) |
Constructor (pre-allocated).
Sets up the buffer for the string to at least the required size.
| sz | Requested array size. |
References alloc, data, offs, refblock::refcount, size, and refblock::threadref.
| size_t string::binputvint | ( | size_t | offset, | |
| unsigned int | val | |||
| ) |
Add a SHOX variable int.
The shox output format uses variable length integers to represent internal counters and ids. The general idea is to not use more bytes than strictly necessary. The integer is always encoded in little-endian order, with the highest two bits indicating the length of the integer, yielding a maximum of 30 available bits. If the two upper bits are set to '00' the value is sized 1 byte with 6 bits left. If they are set to '01' the size grows to 2 bytes for 14 bits of storage, &c.
References data, docopyonwrite(), offs, pad(), size, and refblock::v.
Referenced by binputvstr(), and value::printshox().

| size_t string::binputvstr | ( | size_t | offset, | |
| const string & | str | |||
| ) |
Write a SHOX variable string.
A shox string is a shox vint followed by string data. For string sizes up to 63 bytes this is the same as a pascal string.
References binputvint(), data, offs, pad(), size, str(), strlen(), and refblock::v.
Referenced by value::printshox().

| void string::chomp | ( | const string & | set | ) |
Strip leading and trailing characters.
| set | The set of characters to strip. |
References trim().

| void string::clear | ( | void | ) | [inline] |
| string * string::copyafter | ( | char | c | ) | const |
Get a copy of the string after the first occurence of a separator.
| s | The separator. |
References mid(), strlen(), and strstr().
Referenced by filesystem::ls().

| string * string::copyafterlast | ( | char | c | ) | const |
| string * string::copyuntil | ( | char | c | ) | const |
Get a copy of the string until the first occurence of a separator.
| s | The separator. |
References left(), and strstr().
Referenced by filesystem::ls().

| string * string::copyuntillast | ( | char | c | ) | const |
| int string::countchr | ( | char | c, | |
| int | endpos = 0 | |||
| ) | const |
Count the number of occurences of a character in the string (optionally up to a given position).
References data, offs, and refblock::v.
Referenced by strutil::xmlreadtag().
| void string::crop | ( | int | sz | ) |
Crop the buffer to a set size.
| sz | Desired maximum size. If negative, keep the rightmost part of the original. |
References alloc, tune::str::cropcopylimit, data, offs, refblock::refcount, size, refblock::threadref, and refblock::v.
| void string::crop | ( | void | ) |
Empty the buffer.
Reallocates the buffer storage to minimum size.
Referenced by scriptparser::build(), cgi::cgi(), validator::check(), daemon::checkpid(), chomp(), value::clear(), clear(), tcpsocket::connect(), httpsocket::connectToHost(), cropafter(), cropafterlast(), cropat(), cropatlast(), cutat(), cutatlast(), dbfile::encode(), httpsocket::get(), file::gets(), timestamp::init(), init(), configdb< appclass >::load(), strutil::makepath(), xmlschema::nstransattr(), pad(), value::parsecompressed(), value::phpdeserialize(), httpsocket::post(), value::print(), file::printf(), printf_va(), file::read(), file::readbuffer(), httpdworker::run(), strutil::splitescaped(), strcpy(), tcpsocket::uconnect(), utf8pad(), file::waitforline(), and strutil::xmlreadtag().
| void string::cropafter | ( | const char * | c | ) |
| void string::cropafter | ( | char | c | ) |
| void string::cropafterlast | ( | const char * | c | ) |
| void string::cropafterlast | ( | char | c | ) |
| void string::cropat | ( | const char * | c | ) |
| void string::cropat | ( | char | c | ) |
Crop the string until the first occurence of a character.
If none are found the string is left intact.
| c | The character to look for |
References crop(), and strchr().
Referenced by httpd::handle(), httpdfileshare::run(), and smtpsocket::setsender().

| void string::cropatlast | ( | const char * | c | ) |
| void string::cropatlast | ( | char | c | ) |
| string * string::cutafter | ( | char | c | ) |
Split the string in two parts.
Returns a new object containing the right half.
| str | The separation sequence. |
References mid(), strlen(), and strstr().
Referenced by httpdlogger::handle().

| string * string::cutafterlast | ( | char | c | ) |
| string * string::cutat | ( | const char * | c | ) |
Split the string in two parts.
Returns a new object containing the left half. The first occurence of a separator sequence is used as a splitting point.
| c | The string to be used as a separator. It will be included in neither of the two. If the sequence is not found, an empty string object is returned and the local string data is left untouched. |
References crop(), left(), offs, strlen(), and strstr().

| string * string::cutat | ( | char | c | ) |
Split the string in two parts.
Returns a new object containing the left half. The first occurence of a separator character is used as a splitting point.
| c | The character to be used as a separator. It will be included in neither of the two. If the sequence is not found, an empty string object is returned and the local string data is left untouchd. |
References crop(), left(), offs, and strchr().
Referenced by application::application(), scriptparser::build(), value::decode(), dbfile::decode(), filesystem::exists(), timestamp::format(), httpsocket::get(), filesystem::getresource(), strutil::httpurldecode(), timestamp::iso(), filesystem::mkdir(), filesystem::mv(), xmlschema::nstransattr(), xmlschema::nstranstype(), strutil::parsemime(), strutil::parsenv(), httpsocket::post(), filesystem::rm(), httpdbasicauth::run(), httpdworker::run(), and cmdtoken_data::run().

| string * string::cutatlast | ( | const char * | c | ) |
Split the string in two parts.
Returns a new object containing the left half. The last occurence of a separator sequence is used as a splitting point.
| c | The string to be used as a separator. It will be included in neither of the two. If the sequence is not found, an empty string object is returned and the local string data is left untouched. |
References crop(), left(), offs, strlen(), and strstr().

| string * string::cutatlast | ( | char | c | ) |
Split the string in two parts.
Returns a new object containing the left half. The last occurence of a separator character is used as a splitting point.
| c | The character to be used as a separator. It will be included in neither of the two. If the sequence is not found, an empty string object is returned and the local string data is left untouched. |
Usage example:
void myclass::printFileNames (value &listOfFileNames)
{
for (int i=0; i < listOfFileNames.count(); ++i)
{
string fName = listOfFileNames[i];
string fBase;
fBase = fName.cutatlast ('.');
if (fBase)
{
// Print out filename sans extension.
fout.printf ("%s\n", fBase.str());
}
else // Filename had no extension.
{
fout.printf ("%s\n", fName.str());
}
}
}
References crop(), left(), offs, and strchr().
Referenced by strutil::makepath().

| string * string::decode64 | ( | void | ) | const |
Create base64-decoded version of self.
References data, offs, strlen(), and refblock::v.
Referenced by value::fromxml(), and httpdbasicauth::run().

| void string::docopyonwrite | ( | void | ) | [inline] |
Create private reference.
If the string data is shared with other references, a new unique copy is allocated so that we can mess with our data without interfering with that of other string objects.
References alloc, data, offs, refblock::refcount, size, refblock::threadref, and refblock::v.
Referenced by binput64(), binputieee(), binputopc(), binputvint(), ctolower(), ctoupper(), pad(), replace(), and str().
| string * string::encode64 | ( | void | ) | const |
Create base64-encoded version of self.
References data, offs, strlen(), and refblock::v.
Referenced by httpsocket::authentication(), md5checksum::base64(), and value::printxml().

| void string::escape | ( | void | ) |
Escape data in the buffer.
Useful for SQL or other areas where quotes, backslashes, the percent-sign and control characters are unwanted.
References alloc, data, offs, refblock::refcount, size, strcat(), and refblock::v.

| void string::escapexml | ( | void | ) |
Escape data in the buffer for XML.
Encodes any characters that would mess up with CDATA-like situations:
References alloc, data, offs, printf(), refblock::refcount, size, strcat(), and refblock::v.

Create a new string with only a subset of characters.
| set | The character set. |
References data, offs, size, strchr(), and refblock::v.
Referenced by smtpd::normalizeaddr().

| void string::flush | ( | void | ) |
Remove buffer data without resizing the buffer.
The strlen() will be reset to 0 but there will be no reallocation of the buffer.
References alloc, data, refblock::refcount, size, and refblock::v.
| bool string::globcmp | ( | const char * | str | ) | const |
Perform a glob match against a wildcard.
| str | The glob-style wildcard statement. |
References str().

| bool string::globcmp | ( | const string & | str | ) | const |
Perform a glob match against a wildcard.
| str | The glob-style wildcard statement. |
References str().
Referenced by httpsocket::get(), httpd::handle(), httpsocket::post(), and cmdtoken_if::run().

| void string::insert | ( | const string & | s | ) |
Add string data at the start.
Inserts the data from the other string at the left side of the buffer.
References alloc, data, offs, refblock::refcount, size, str(), strcpy(), strlen(), refblock::threadref, and refblock::v.

| string* string::left | ( | int | sz | ) | const [inline] |
Derive new string from left range.
| sz | Number of bytes from the left to copy. |
References mid().
Referenced by cgi::cgi(), chomp(), copyuntil(), copyuntillast(), cutat(), cutatlast(), value::left(), ltrim(), strutil::makepath(), strutil::parsehdr(), rtrim(), httpdvhost::run(), filesystem::transr(), filesystem::transw(), trim(), and strutil::wrap().

Trims charcters from the left of the current string until it finds a character not in the set.
| set | Set of special characters |
References data, left(), mid(), offs, size, strchr(), and refblock::v.
Referenced by cli< ctlclass >::tabhandler().

| string * string::mid | ( | int | pos, | |
| int | sz = 0 | |||
| ) | const |
Derive new string from range.
| pos | Index of the start of the range. | |
| sz | Number of bytes to copy, 0 for all. |
References alloc, data, offs, refblock::refcount, size, strcpy(), refblock::threadref, and refblock::v.
Referenced by scriptparser::build(), cgi::cgi(), copyafter(), copyafterlast(), cutafter(), cutafterlast(), value::decode(), file::file(), value::fromxml(), httpsocket::get(), value::iniparse(), timestamp::iso(), left(), value::load(), value::loadini(), value::loadinitree(), ltrim(), strutil::parsehdr(), httpsocket::post(), right(), smtpworker::run(), httpdfileshare::run(), serverpage::run(), strutil::split(), strutil::splitquoted(), strutil::splitspace(), filesystem::transr(), filesystem::transw(), trim(), strutil::wrap(), and strutil::xmlreadtag().

| const char string::operator[] | ( | int | n | ) | const [inline] |
Array access.
Out-of-range indices return a ''.
| n | Position. Use negative for position from the right. |
References data, offs, size, and refblock::v.
| void string::pad | ( | int | sz, | |
| char | filler | |||
| ) |
Pad/crop the buffer.
Useful for creating aligned layouts with fixed space fonts.
| sz | Desired size (only positive). | |
| filler | Filler character to use for padding. |
References alloc, crop(), data, docopyonwrite(), offs, size, strcat(), and refblock::v.
Referenced by binput64(), binputieee(), binputopc(), binputstr(), binputvint(), binputvstr(), logthread::run(), and utf8pad().

| void string::printf | ( | const char * | fmtx, | |
| ... | ||||
| ) |
Add data with libc-style format string.
There are some extra format characters to keep in mind:
Keep in mind that the formatted text is added to the string buffer. Use string::crop() to empty the buffer first if you want to start with a clear string.
References printf_va().
Referenced by cgi::addschema(), cgi::cgi(), tcpsocket::connect(), thread::dorun(), escapexml(), value::fromxml(), filesystem::getinfo(), systemclass::userdbFunctions::getpwuid(), file::gets(), strutil::httpurlencode(), fswatch::list(), configdb< appclass >::load(), value::loadini(), value::loadinitree(), filesystem::ls(), value::parsecompressed(), value::phpdeserialize(), value::print(), value::printphp(), value::printstr(), value::printxml(), filesystem::pwdize(), file::read(), file::readbuffer(), smtpworker::run(), httpdbasicauth::run(), logthread::run(), value::savecsv(), value::tocsv(), tcpsocket::uconnect(), file::waitforline(), strutil::wrap(), and strutil::xmlreadtag().

| bool string::regcmp | ( | const string & | str | ) | const |
Perform a regular expression match.
| str | The expression. |
References str().

| void string::replace | ( | const class value & | set | ) |
| void string::replace | ( | const string & | set, | |
| char | with | |||
| ) |
Filter the string with a subset of characters replaced by a single replacement.
| set | The character set. | |
| with | The character to replace characters in the set with. |
References data, docopyonwrite(), offs, size, strchr(), and refblock::v.

| string* string::right | ( | int | sz | ) | const [inline] |
Trims charcters from the right of the current string until it finds a character not in the set.
| set | Set of special characters |
References data, left(), offs, right(), size, strchr(), and refblock::v.
Referenced by striplf(), and cli< ctlclass >::tabhandler().

| void string::strcat | ( | double | ) |
Add a printed floating point number.
Converts the double to an ASCII representation of the floating point data.
| void string::strcat | ( | int | ) |
Add a printed integer.
Converts the integer to a base 10 ASCII string and adds this representation to the buffer.
| void string::strcat | ( | const char * | dt, | |
| size_t | sz | |||
| ) |
Add binary data.
| dt | The data block. | |
| sz | Number of bytes to copy. |
References alloc, data, offs, refblock::refcount, size, refblock::threadref, and refblock::v.
| void string::strcat | ( | string * | s | ) |
| int string::strchr | ( | char | c, | |
| int | left = 0 | |||
| ) | const |
Find string sequence.
References data, offs, and refblock::v.
Referenced by filesystem::cd(), cgi::cgi(), copyafter(), copyafterlast(), copyuntil(), copyuntillast(), strutil::crlfornot(), cropafter(), cropafterlast(), cropat(), cropatlast(), cutafter(), cutafterlast(), cutat(), cutatlast(), value::decode(), filter(), httpsocket::get(), filesystem::getresource(), httpdlogger::handle(), httpdfileshare::httpdfileshare(), timestamp::iso(), value::load(), filesystem::ls(), ltrim(), strutil::makepath(), filesystem::mkdir(), filesystem::mv(), xmlschema::nstransattr(), xmlschema::nstranstype(), strutil::parsehdr(), httpsocket::post(), filesystem::pwdize(), replace(), filesystem::rm(), rtrim(), httpdfileshare::run(), serverpage::run(), httpdvhost::run(), httpdbasicauth::run(), httpdworker::run(), httpd::setdefaultdocument(), smtpsocket::setsender(), strutil::split(), strutil::splitcsv(), strutil::splitescaped(), cliutil::splitwords(), stripchars(), cli< ctlclass >::tabhandler(), filesystem::transr(), filesystem::transw(), trim(), validate(), and strutil::xmlreadtag().
| void string::strclone | ( | const string & | s | ) |
Clone from other string.
Ensures that no reference is shared with the original.
References alloc, data, offs, refblock::refcount, size, strlen(), refblock::threadref, and refblock::v.
Referenced by strcpy(), and string().

| void string::strcpy | ( | const char * | dt, | |
| size_t | sz | |||
| ) |
Copy from binary data.
Buffer will be cleared.
| dt | The data location. | |
| sz | The number of ytes to copy. |
References alloc, data, offs, refblock::refcount, size, refblock::threadref, and refblock::v.
| string * string::stripchar | ( | char | stripchar | ) |
Create a new string without the given character.
| stripchar | The character to strip |
References data, offs, size, and refblock::v.
| string * string::striplf | ( | void | ) |
| unsigned int string::strlen | ( | void | ) | const [inline] |
Get string length.
References size.
Referenced by cgi::addschema(), md5checksum::append(), termbuffer::backspace(), binputstr(), binputvstr(), scriptparser::build(), cgi::cgi(), daemon::checkpid(), filesystem::chgrp(), filesystem::chown(), termbuffer::clearleft(), file::close(), tcpsocket::connect(), httpsocket::connectToHost(), copyafter(), filesystem::cp(), termbuffer::crhome(), termbuffer::crleft(), cropafter(), cropafterlast(), termbuffer::crsrpos(), termbuffer::crup(), timestamp::ctime(), cutafter(), cutafterlast(), cutat(), cutatlast(), value::decode(), decode64(), termbuffer::del(), encode64(), strutil::encodecsv(), termbuffer::eraseword(), value::fromcsv(), value::fromcxml(), value::fromshox(), value::fromxml(), cli< ctlclass >::fullexpand(), httpsocket::get(), filesystem::getinfo(), termbuffer::getkey(), termbuffer::getline(), stringrefdb::getref(), filesystem::getresource(), file::gets(), httpdlogger::handle(), httpd::handle(), systemclass::netFunctions::hostname(), strutil::htmlize(), strutil::httpurldecode(), value::iniparse(), termbuffer::insert(), insert(), filesystem::isdir(), timestamp::iso(), termbuffer::length(), value::loadcsv(), value::loadini(), value::loadinitree(), value::loadxml(), filesystem::mkdir(), filesystem::mv(), xmlschema::nstransattr(), file::openappend(), file::openread(), file::openwrite(), statstring::operator bool(), value::parsecompressed(), strutil::parsenv(), httpsocket::post(), value::print(), file::printf(), printf_va(), value::printshox(), value::printstr(), value::printxml(), file::puts(), file::read(), filesystem::rm(), cli< ctlclass >::run(), smtpworker::run(), httpdfileshare::run(), httpdvhost::run(), httpdbasicauth::run(), httpdworker::run(), cmdtoken_if::run(), filesystem::save(), tcpsocket::sendfile(), cgi::sendpage(), udpsocket::sendto(), termbuffer::set(), termbuffer::setcrsr(), termbuffer::setprompt(), strutil::split(), strutil::splitcsv(), strutil::splitescaped(), strutil::splitquoted(), strutil::splitspace(), cliutil::splitwords(), smtpd::start(), strcasecmp(), strcat(), strclone(), strcmp(), strcpy(), string(), value::strlen(), statstring::strlen(), strncasecmp(), strncmp(), strstr(), cli< ctlclass >::tabhandler(), termbuffer::tohistory(), termbuffer::tprintf(), termbuffer::tputs(), file::tryputs(), strutil::unescape(), stringrefdb::unref(), strutil::urldecode(), strutil::urlencode(), utf8pad(), termbuffer::wordleft(), strutil::wrap(), file::writeln(), daemon::writepid(), and strutil::xmlreadtag().
| int string::strstr | ( | const string & | substr, | |
| int | offset = 0 | |||
| ) | const |
| int string::strstr | ( | const char * | substr, | |
| int | offset = 0 | |||
| ) | const |
| int string::strstr | ( | const char * | dat, | |
| size_t | sz, | |||
| int | offset = 0 | |||
| ) | const |
Find a sequence.
| dat | The search data. | |
| sz | Size of the sequence. | |
| offset | Index to start the search at. |
References data, offs, size, and refblock::v.
Referenced by application::application(), cgi::cgi(), copyafter(), copyafterlast(), copyuntil(), copyuntillast(), strutil::crlfornot(), cropafter(), cropafterlast(), cropat(), cropatlast(), cutafter(), cutafterlast(), cutat(), cutatlast(), timestamp::format(), filesystem::ls(), httpdfileshare::run(), cmdtoken_data::run(), strutil::split(), strstr(), and strutil::xmlreadtag().
| int string::toint | ( | int | base = 10 |
) | const |
Cast to integer.
| base | Optional math base to use. |
Referenced by smtpsocket::dosmtp(), timestamp::iso(), terminal< cli< ctlclass > >::readline(), cmdtoken_set::run(), and strutil::splitcsv().

Trims charcters from the left and right of the current string until it finds a character not in the set.
| set | Set of special characters |
References data, left(), mid(), offs, right(), size, strchr(), and refblock::v.
Referenced by chomp().

| void string::unescape | ( | void | ) |
Unescape data in the buffer.
Uses the reverse rules of escape().
References alloc, data, offs, refblock::refcount, size, strcat(), and refblock::v.

| unsigned int string::utf8len | ( | void | ) | const |
| void string::utf8pad | ( | int | i, | |
| char | with = ' ' | |||
| ) |
| unsigned int string::utf8pos | ( | int | i | ) | const |
| bool string::validate | ( | const string & | set | ) | const |
| char * string::visitchild | ( | int | pos | ) | const |
Implementation of the iterator protocol, makes string foreachable.
References data, offs, and refblock::v.
1.6.1