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;
215 if (z == 0)
return 0;
261 if (
n <= 0)
n = strlen(z);
262 zResult =
new char[
n + 1];
264 memcpy(zResult, z,
n);
275 if (*pzDest != 0)
delete[] *pzDest;
284static char *Trim(
char *z)
291 while (isspace(*z)) z++;
293 zNew =
new char[i + 1];
294 if (zNew == 0)
return 0;
296 while (i > 0 && isspace(zNew[i-1])) zNew[--i] = 0;
312 if (zUri == 0 || *zUri == 0)
return 0;
345 zBuf =
new char[strlen(base->
fZPath) + strlen(term->
fZPath) + 2];
348 sprintf(zBuf,
"%s", base->
fZPath);
349 for (i = strlen(zBuf) - 1; i >= 0 && zBuf[i] !=
'/'; --i) {
353 strcat(zBuf, term->
fZPath);
354 for (i = 0; zBuf[i]; i++) {
355 if (zBuf[i] ==
'/' && zBuf[i+1] ==
'.' && zBuf[i+2] ==
'/') {
357 strcpy(&zBuf[i+1], &zBuf[i+3]);
361 if (zBuf[i] ==
'/' && zBuf[i+1] ==
'.' && zBuf[i+2] == 0) {
365 if (i > 0 && zBuf[i] ==
'/' && zBuf[i+1] ==
'.' &&
366 zBuf[i+2] ==
'.' && (zBuf[i+3] ==
'/' || zBuf[i+3] == 0)) {
367 for (j = i - 1; j >= 0 && zBuf[j] !=
'/'; --j) {}
370 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.