18#if defined(OS_MINGW) || defined(OS_WIN)
53 return (
t->op ==
URL_TUPLE) && (
N (
t) == (n + 1)) && (
t[0] == s);
57 return (
t->op ==
URL_TUPLE) && (
N (
t) == (n + 1)) && (
t[0] == s);
69 if (url_label ==
"root") {
70 return rep->t[1]->label;
79 if (
p1 ==
"")
return "";
117 (s[i] ==
':' || (s[i] >=
'0' && s[i] <=
'9') ||
118 (s[i] >=
'a' && s[i] <=
'f') || (s[i] >=
'A' && s[i] <=
'F')))
120 if (i <
N (s) && s[i] ==
']') i++;
126 int i= 0, n=
N (
name);
129 else if (
name[i] ==
sep)
return true;
138 if (
N (
name) < 2)
return false;
139 if ((
name[0] ==
'\\') && (
name[1] ==
'\\'))
return true;
183 if (
N (s) == 2 &&
ends (s,
":"))
196 while ((i < n) && (s[i] !=
sep) && (s[i] !=
'/')) {
204 else if (i ==
start) {
236 while ((i < n) && (s[i] !=
sep)) {
241 if (i == n)
return u;
267 if (
u->t ==
"")
return url_root (
"default");
276 string protocol=
tokens[0];
279 if (protocol ==
"file")
return file_url (path);
280 if (protocol ==
"http")
return http_url (path);
281 if (protocol ==
"https")
return https_url (path);
282 if (protocol ==
"ftp")
return ftp_url (path);
386 for (i= n - 1; i >= 0; i--)
387 if (s[i] ==
'.')
break;
388 if ((i > 0) && (i < n - 1)) {
389 string r= s (i + 1, n);
390 while ((
N (
r) > 0) && (
r[
N (
r) - 1] ==
'~' ||
r[
N (
r) - 1] ==
'#'))
459 base[2][1] !=
u[2][1])
478 return u.protocol ();
524 if (
u1[1] ==
u2[1])
return u1[2] <=
u2[2];
525 else return u1[1] <=
u2[1];
539 else return to |
add;
553 if (
is_concat (
v) && (
u[1][1] ==
v[1]))
return u[1][1] * (
u[1][2] |
v[2]);
555 return (
u[1][1] * (
u[1][2] |
v[1][2])) |
v[2];
574 if (
u ==
base)
return true;
605 return u1[1] *
v *
u2[2];
669 return is_root (
u) && (
u[1]->t->label == s);
794 if (
is_root (
u,
"default"))
return "/";
796 if (
is_root (
u,
"blank"))
return "/";
797 if (
is_root (
u,
"file"))
return u[1]->t->label *
"://";
798 if (
is_root (
u))
return u[1]->t->label *
":/";
bool starts(string s, const char *what)
bool is_alphanum(string s)
string locase_all(string s)
Converts all uppercase characters in a string to lowercase.
array< string > tokenize(string s, string sep)
bool ends(string s, const char *what)
bool is_alpha(string s)
Checks if a string contains only alphabetic characters.
int index_of(string s, char c)
string remove_suffix(string s, string suffix)
Remove the suffix from s if matches.
int N(array< T > a)
Get the length of the array.
bool contains(T a, array< T > b)
Check if an array contains a specified element.
#define TM_FAILED(msg)
Macro used to throw an exception with a specified error message.
The list class represents a linked list.
friend url as_url(url_tree t)
SI max(SI i, SI j)
Returns the maximum of two signed integers.
string get_env(string var)
static url_tree url_tuple(string label)
url url_or(url u1, url u2)
static url url_get_atom(string s, int type)
string suffix(url u, bool use_locase)
static bool is_tuple(url_tree t, string s)
static bool is_special_root(url u)
bool is_rooted_name(url u)
url url_system(string name)
url url_concat(url u1, url u2)
url url_standard(string name)
static bool heuristic_is_ftp(string name)
static bool heuristic_is_path(string name, int type)
static url sort_sub(url add, url to)
url operator*(url u1, url u2)
string basename(url u, string suf)
static bool heuristic_is_default(string name, int type)
tm_ostream & operator<<(tm_ostream &out, url u)
url operator|(url u1, url u2)
static url factor_sorted(url u)
static url url_mingw_default(string name, int type)
url url_root(string protocol)
bool is_name_in_path(url u)
static url url_get_path(string s, int type=URL_STANDARD, int i=0)
url relative(url base, url u)
bool is_pseudo_atomic(url u)
static url url_default(string name, int type=URL_SYSTEM)
url reroot(url u, string protocol)
bool descends(url u, url base)
url url_get_name(string s, int type, int i)
url delta_sub(url base, url u)
static bool heuristic_is_http(string name)
url url_path(string s, int type)
url url_ramdisc(string contents)
static url factor_sub(url u)
url delta(url base, url u)
static bool operator<=(url u1, url u2)
static url expand(url u1, url u2)
static bool heuristic_is_mingw_default(string name, int type)
bool is_rooted_web(url u)
url unglue(url u, int nr)
url glue(url u, string s)
url url_general(string name, int type=URL_SYSTEM)
string as_string(url u, int type)
bool is_wildcard(url u, int n)
void skip_ipv6(string s, int &i)
bool is_root(url u, string s)
static bool is_semi_root(url u)
lolly_tree< int > url_tree