00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00046 #ifndef XSPF_TOOLBOX_H
00047 #define XSPF_TOOLBOX_H
00048
00049
00050 #include "XspfDefines.h"
00051 #include <string>
00052 #include <cstring>
00053
00054 namespace Xspf {
00055
00056
00057 class XspfDateTime;
00058
00059
00063 namespace Toolbox {
00064
00065
00067
00072 struct XspfStringCompare {
00073
00080 bool operator()(XML_Char const * s1, XML_Char const * s2) const;
00081
00082 };
00083
00085
00086
00095 XML_Char * newAndCopy(XML_Char const * source);
00096
00104 void deleteNewAndCopy(XML_Char ** dest, XML_Char const * src);
00105
00117 void deleteNewAndCopy(XML_Char const * & dest, bool & destOwnership,
00118 XML_Char const * source, bool sourceCopy);
00119
00128 template <class T>
00129 T const * getSetNull(T const * & dest) {
00130 T const * backup = dest;
00131 dest = NULL;
00132 return backup;
00133 }
00134
00135
00144 void copyIfOwned(XML_Char const * & dest, bool & ownDest, XML_Char const * source, bool ownSource);
00145
00146
00155 void freeIfOwned(XML_Char const * & dest, bool ownDest);
00156
00157
00169 XML_Char * makeAbsoluteUri(XML_Char const * sourceUri, XML_Char const * baseUri);
00170
00171
00184 XML_Char * makeRelativeUri(XML_Char const * sourceUri, XML_Char const * baseUri);
00185
00186
00194 bool isUri(XML_Char const * text);
00195
00196
00204 bool isAbsoluteUri(XML_Char const * text);
00205
00206
00216 bool extractInteger(XML_Char const * text, int inclusiveMinimum, int * output);
00217
00218
00229 bool isWhiteSpace(XML_Char const * text, int numChars);
00230
00231
00242 void cutOffWhiteSpace(XML_Char const * input, int inputNumChars,
00243 XML_Char const * & blackSpaceStart, int & blackSpaceNumChars);
00244
00245
00252 void trimString(std::basic_string<XML_Char> & target);
00253
00254
00255 }
00256 }
00257
00258 #endif // XSPF_TOOLBOX_H