9. URI manipulation library based on UriParser¶
The URIPARSER module exposes uriParser library https://uriparser.github.io to Daslang.
All functions and symbols are in “uriparser” module, use require to get access to it.
require uriparser
9.1. Handled structures¶
-
UriTextRangeA
¶
Range of text in the URI.
-
UriIp4Struct
¶
UriIp4Struct fields are
data |
uint8[4] |
IPv4 address portion of the URI.
-
UriIp6Struct
¶
UriIp6Struct fields are
data |
uint8[16] |
IPv6 address porition of the URI.
-
UriHostDataA
¶
UriHostDataA fields are
ipFuture |
|
ip4 |
|
ip6 |
|
Host data portion of the URI (IPv4 or IPv6, or some future data).
-
UriPathSegmentStructA
¶
UriPathSegmentStructA fields are
next |
|
text |
|
Part of the path portion of the URI.
-
UriUriA
¶
UriUriA fields are
query |
|
absolutePath |
int |
fragment |
|
userInfo |
|
hostText |
|
scheme |
|
hostData |
|
portText |
|
pathTail |
|
owner |
int |
pathHead |
|
URI base class, contains all URI data.
-
Uri
¶
Uri fields are
uri |
|
Uri property operators are
empty |
bool |
size |
int |
status |
int |
URI implementation.
9.2. Initialization and finalization¶
-
Uri
()
Uri returns uriparser::Uri
Creates new URI.
-
using
(arg0: block<(var arg0:Uri#):void> const implicit)¶
argument |
argument type |
---|---|
arg0 |
block<( uriparser::Uri #):void> const implicit |
Creates scoped URI variable.
-
Uri
(arg0: string const implicit)
Uri returns uriparser::Uri
argument |
argument type |
---|---|
arg0 |
string const implicit |
Creates new URI.
-
using
(arg0: string const implicit; arg1: block<(var arg0:Uri#):void> const implicit)
argument |
argument type |
---|---|
arg0 |
string const implicit |
arg1 |
block<( uriparser::Uri #):void> const implicit |
Creates scoped URI variable.
-
finalize
(uri: Uri implicit)¶
argument |
argument type |
---|---|
uri |
uriparser::Uri implicit |
Finalizer for the URI.
-
clone
(dest: Uri implicit; src: Uri const implicit)¶
argument |
argument type |
---|---|
dest |
uriparser::Uri implicit |
src |
uriparser::Uri const implicit |
Clones the URI.
9.3. Escape and unescape¶
-
escape_uri
(uriStr: string const implicit; spaceToPlus: bool const; normalizeBreaks: bool const)¶
escape_uri returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
spaceToPlus |
bool const |
normalizeBreaks |
bool const |
Adds escape characters to the URI.
-
unescape_uri
(uriStr: string const implicit)¶
unescape_uri returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Remove escape characters from the URI.
9.4. Uri manipulations¶
-
strip_uri
(uri: Uri const implicit; query: bool const; fragment: bool const)¶
strip_uri returns uriparser::Uri
argument |
argument type |
---|---|
uri |
uriparser::Uri const implicit |
query |
bool const |
fragment |
bool const |
Removes query and fragment from the URI.
-
add_base_uri
(base: Uri const implicit; relative: Uri const implicit)¶
add_base_uri returns uriparser::Uri
argument |
argument type |
---|---|
base |
uriparser::Uri const implicit |
relative |
uriparser::Uri const implicit |
Adds base URI to the relative URI.
-
remove_base_uri
(base: Uri const implicit; relative: Uri const implicit)¶
remove_base_uri returns uriparser::Uri
argument |
argument type |
---|---|
base |
uriparser::Uri const implicit |
relative |
uriparser::Uri const implicit |
Removes base URI from the relative URI.
-
normalize
(uri: Uri implicit)¶
normalize returns bool
argument |
argument type |
---|---|
uri |
uriparser::Uri implicit |
Normalizes URI, i.e. removes redundant / and . characters.
-
string
(uri: Uri const implicit)¶
string returns string
argument |
argument type |
---|---|
uri |
uriparser::Uri const implicit |
Converts URI to string.
-
string
(range: UriTextRangeA const implicit)
string returns string
argument |
argument type |
---|---|
range |
uriparser::UriTextRangeA const implicit |
Converts URI to string.
-
uri_for_each_query_kv
(uri: Uri const implicit; block: block<(var arg0:string#;var arg1:string#):void> const implicit)¶
argument |
argument type |
---|---|
uri |
uriparser::Uri const implicit |
block |
block<(string#;string#):void> const implicit |
Iterates over the URI query parameters.
-
normalize_uri
(uriStr: string const implicit)¶
normalize_uri returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Normalizes URI. i.e. removes redundant / and . characters.
9.5. File name conversions¶
uri_from_file_name (filename:string const implicit) : uriparser::Uri
uri_from_windows_file_name (filename:string const implicit) : uriparser::Uri
uri_from_unix_file_name (filename:string const implicit) : uriparser::Uri
uri_to_file_name (uriStr:string const implicit;context:__context const;at:__lineInfo const) : string
file_name_to_uri (uriStr:string const implicit;context:__context const;at:__lineInfo const) : string
-
to_unix_file_name
(uri: Uri const implicit)¶
to_unix_file_name returns string
argument |
argument type |
---|---|
uri |
uriparser::Uri const implicit |
Converts URI to Unix file name.
-
to_windows_file_name
(uri: Uri const implicit)¶
to_windows_file_name returns string
argument |
argument type |
---|---|
uri |
uriparser::Uri const implicit |
Converts URI to Windows file name.
-
to_file_name
(uri: Uri const implicit)¶
to_file_name returns string
argument |
argument type |
---|---|
uri |
uriparser::Uri const implicit |
Converts URI to the current platform file name.
-
uri_from_file_name
(filename: string const implicit)¶
uri_from_file_name returns uriparser::Uri
argument |
argument type |
---|---|
filename |
string const implicit |
Converts current platform file name to URI.
-
uri_from_windows_file_name
(filename: string const implicit)¶
uri_from_windows_file_name returns uriparser::Uri
argument |
argument type |
---|---|
filename |
string const implicit |
Converts Windows file name to URI.
-
uri_from_unix_file_name
(filename: string const implicit)¶
uri_from_unix_file_name returns uriparser::Uri
argument |
argument type |
---|---|
filename |
string const implicit |
Converts Unix file name to URI.
-
uri_to_unix_file_name
(uriStr: string const implicit)¶
uri_to_unix_file_name returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Converts URI to Unix file name.
-
uri_to_windows_file_name
(uriStr: string const implicit)¶
uri_to_windows_file_name returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Converts URI to Windows file name.
-
unix_file_name_to_uri
(uriStr: string const implicit)¶
unix_file_name_to_uri returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Converts Unix file name to URI.
-
windows_file_name_to_uri
(uriStr: string const implicit)¶
windows_file_name_to_uri returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Converts Windows file name to URI.
-
uri_to_file_name
(uriStr: string const implicit)¶
uri_to_file_name returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Converts URI to the current platform file name.
-
file_name_to_uri
(uriStr: string const implicit)¶
file_name_to_uri returns string
argument |
argument type |
---|---|
uriStr |
string const implicit |
Converts current file name to URI.