9. URI manipulation library based on UriParser

The URIPARSER module exposes uriParser library https://uriparser.github.io to daScript.

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

uriparser::UriTextRangeA

ip4

uriparser::UriIp4Struct ?

ip6

uriparser::UriIp6Struct ?

Host data portion of the URI (IPv4 or IPv6, or some future data).

UriPathSegmentStructA

UriPathSegmentStructA fields are

next

uriparser::UriPathSegmentStructA ?

text

uriparser::UriTextRangeA

Part of the path portion of the URI.

UriUriA

UriUriA fields are

query

uriparser::UriTextRangeA

absolutePath

int

fragment

uriparser::UriTextRangeA

userInfo

uriparser::UriTextRangeA

hostText

uriparser::UriTextRangeA

scheme

uriparser::UriTextRangeA

hostData

uriparser::UriHostDataA

portText

uriparser::UriTextRangeA

pathTail

uriparser::UriPathSegmentStructA ?

owner

int

pathHead

uriparser::UriPathSegmentStructA ?

URI base class, contains all URI data.

Uri

Uri fields are

uri

uriparser::UriUriA

Uri properties are

size

int

status

int

empty

bool

URI implementation.

9.2. Initialization and finalization

Uri()

Uri returns uriparser::Uri

Creates new URI.

using(arg0: block<(uriparser::Uri# explicit):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<(uriparser::Uri# explicit):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<(string#;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

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.

9.6. GUID

make_new_guid()

make_new_guid returns string

Generates new GUID.