Functions | |
XML_Char * | newAndCopy (XML_Char const *source) |
void | deleteNewAndCopy (XML_Char **dest, XML_Char const *src) |
void | deleteNewAndCopy (XML_Char const *&dest, bool &destOwnership, XML_Char const *source, bool sourceCopy) |
template<class T > | |
T const * | getSetNull (T const *&dest) |
void | copyIfOwned (XML_Char const *&dest, bool &ownDest, XML_Char const *source, bool ownSource) |
void | freeIfOwned (XML_Char const *&dest, bool ownDest) |
XML_Char * | makeAbsoluteUri (XML_Char const *sourceUri, XML_Char const *baseUri) |
XML_Char * | makeRelativeUri (XML_Char const *sourceUri, XML_Char const *baseUri) |
bool | isUri (XML_Char const *text) |
bool | isAbsoluteUri (XML_Char const *text) |
bool | extractInteger (XML_Char const *text, int inclusiveMinimum, int *output) |
bool | isWhiteSpace (XML_Char const *text, int numChars) |
void | cutOffWhiteSpace (XML_Char const *input, int inputNumChars, XML_Char const *&blackSpaceStart, int &blackSpaceNumChars) |
void | trimString (std::basic_string< XML_Char > &target) |
void Xspf::Toolbox::copyIfOwned | ( | XML_Char const *& | dest, | |
bool & | ownDest, | |||
XML_Char const * | source, | |||
bool | ownSource | |||
) |
Copies a string's content if owned or just it's address if not.
dest | Reference of destination string | |
ownDest | Reference of destination owner flag | |
source | Source string | |
ownSource | Source owner flag |
void Xspf::Toolbox::cutOffWhiteSpace | ( | XML_Char const * | input, | |
int | inputNumChars, | |||
XML_Char const *& | blackSpaceStart, | |||
int & | blackSpaceNumChars | |||
) |
Cuts off whitespace at head and tail. The source string is not modified so this more is a detection function.
input | Source text | |
inputNumChars | Length of source in characters | |
blackSpaceStart | Pointer to first non-white character | |
blackSpaceNumChars | Length of characters until whitespace tail |
void Xspf::Toolbox::deleteNewAndCopy | ( | XML_Char const *& | dest, | |
bool & | destOwnership, | |||
XML_Char const * | source, | |||
bool | sourceCopy | |||
) |
Replaces the string in dest
by a duplicate of the string in src
(using new() not malloc()). The old string is deleted. If destOwnership
is false the old string is not deleted. If sourceCopy
is false only source
's pointer is copied, not the string.
dest | Destination text | |
destOwnership | Destination ownership flag | |
source | Source text | |
sourceCopy | Source copy flag |
void Xspf::Toolbox::deleteNewAndCopy | ( | XML_Char ** | dest, | |
XML_Char const * | src | |||
) |
Replaces the string in *dest
by a duplicate of the string in src
(using new() not malloc()). The old string is deleted.
dest | Destination text | |
src | Source text |
bool Xspf::Toolbox::extractInteger | ( | XML_Char const * | text, | |
int | inclusiveMinimum, | |||
int * | output | |||
) |
Extracts an integer from text
.
text | Text | |
inclusiveMinimum | Inclusive minimum | |
output | Integer storage destination |
inclusiveMinimum
flag void Xspf::Toolbox::freeIfOwned | ( | XML_Char const *& | dest, | |
bool | ownDest | |||
) |
Deletes the text behind dest
if owned and non-NULL. NOTE: dest
is not set to NULL after
dest | Reference of string to delete | |
ownDest | Owner flag, false will prevent deletion |
T const* Xspf::Toolbox::getSetNull | ( | T const *& | dest | ) | [inline] |
Sets a pointer to NULL
and returns the original value. This helper is used for stealing memory.
dest | Destination |
Definition at line 129 of file XspfToolbox.h.
bool Xspf::Toolbox::isAbsoluteUri | ( | XML_Char const * | text | ) |
Checks wether text
is a valid absolute URI.
text | Text |
bool Xspf::Toolbox::isUri | ( | XML_Char const * | text | ) |
Checks wether text
is a valid URI.
text | Text |
bool Xspf::Toolbox::isWhiteSpace | ( | XML_Char const * | text, | |
int | numChars | |||
) |
Checks a string for being all whitespace. Whitespace is: ' ', '\r', '\n', '\t' as defined here: http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace
text | Text to check | |
numChars | Length of text in characters |
XML_Char* Xspf::Toolbox::makeAbsoluteUri | ( | XML_Char const * | sourceUri, | |
XML_Char const * | baseUri | |||
) |
Resolves a URI reference against a given base URI. If the given URI already is absolute the result will be that URI again. You can think of this function as "make my URI absolute if it isn't already". Please note you are responbsible to run delete [] on the return value.
sourceUri | Relative URI to resolve | |
baseUri | Absolute base URI to resolve against |
XML_Char* Xspf::Toolbox::makeRelativeUri | ( | XML_Char const * | sourceUri, | |
XML_Char const * | baseUri | |||
) |
Reduces a given absolute URI to a relative URI reference if possible. If there is no commonality between sourceUri
and baseUri
the resulting URI will still be absolute. You can think of this function as "make my URI relative if possible". Please note you are responbsible to run delete [] on the return value.
sourceUri | Absolute URI to reduce | |
baseUri | Absolute base URI to reduce against |
XML_Char* Xspf::Toolbox::newAndCopy | ( | XML_Char const * | source | ) |
Duplicates the string (using new() not malloc()) and returns the duplicate. If source
is NULL the return value also is NULL.
source | Source text |
void Xspf::Toolbox::trimString | ( | std::basic_string< XML_Char > & | target | ) |
Cuts off whitespace at head and tail.
target | String object to modify |