44static char *
StrNDup(
const char *z,
int n);
45static void ReplaceStr(
char **pzDest,
const char *zSrc);
47static char *Trim(
char *z);
61 while (isspace(*zUri)) ++zUri;
63 if (
n > 0 && zUri[
n] ==
':') {
187 for (
n = 0; zInit[
n]; ++
n) {
188 if (zInit[
n] != z[
n])
return 0;
191 for (i = 0; zTerm[i]; ++i) {
192 if (z[
n] == zTerm[i])
return n;
238 if (
n <= 0)
n = strlen(z);
239 zResult =
new char[
n + 1];
241 memcpy(zResult, z,
n);
252 if (*pzDest != 0)
delete[] *pzDest;
261static char *Trim(
char *z)
268 while (isspace(*z)) z++;
270 zNew =
new char[i + 1];
271 if (zNew == 0)
return 0;
273 while (i > 0 && isspace(zNew[i-1])) zNew[--i] = 0;
289 if (zUri == 0 || *zUri == 0)
return 0;
320 int i, j, zBufSz = strlen(base->
fZPath) + strlen(term->
fZPath) + 2;
321 char *zBuf =
new char[zBufSz];
323 strlcpy(zBuf, base->
fZPath, zBufSz);
324 for (i = strlen(zBuf) - 1; i >= 0 && zBuf[i] !=
'/'; --i) {
327 strlcat(zBuf, term->
fZPath, zBufSz);
328 for (i = 0; zBuf[i]; i++) {
329 if (zBuf[i] ==
'/' && zBuf[i+1] ==
'.' && zBuf[i+2] ==
'/') {
331 strcpy(&zBuf[i+1], &zBuf[i+3]);
335 if (zBuf[i] ==
'/' && zBuf[i+1] ==
'.' && zBuf[i+2] == 0) {
339 if (i > 0 && zBuf[i] ==
'/' && zBuf[i+1] ==
'.' &&
340 zBuf[i+2] ==
'.' && (zBuf[i+3] ==
'/' || zBuf[i+3] == 0)) {
341 for (j = i - 1; j >= 0 && zBuf[j] !=
'/'; --j) {}
344 strcpy(&zBuf[j+1], &zBuf[i+4]);
static char * StrNDup(const char *z, int n)
Duplicate a string of length n.
static void ReplaceStr(char **pzDest, const char *zSrc)
Replace the string in *pzDest with the string in zSrc.
#define URI_FRAGMENT_MASK
char * StrDup(const char *str)
Duplicate the string str.
int EqualsUri(const TGHtmlUri *uri, int field_mask=URI_FULL_MASK)
Compare another uri with given field mask.
int ComponentLength(const char *z, const char *zInit, const char *zTerm)
Return the length of the next component of the URL in z[] given that the component starts at z[0].
virtual ~TGHtmlUri()
Html uri destructor.
char * BuildUri()
Create a string to hold the given URI.
TGHtmlUri(const TGHtmlUri &)=delete
virtual char * ResolveUri(const char *uri)
This function resolves the specified URI and returns the result in a newly allocated string.
const char * Data() const
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.