uriparser 0.9.8
|
Data Structures | |
struct | UriTextRangeStructA |
struct | UriPathSegmentStructA |
struct | UriHostDataStructA |
struct | UriUriStructA |
struct | UriParserStateStructA |
struct | UriQueryListStructA |
Typedefs | |
typedef struct UriTextRangeStructA | UriTextRangeA |
typedef struct UriPathSegmentStructA | UriPathSegmentA |
typedef struct UriHostDataStructA | UriHostDataA |
typedef struct UriUriStructA | UriUriA |
typedef struct UriParserStateStructA | UriParserStateA |
typedef struct UriQueryListStructA | UriQueryListA |
Functions | |
URI_PUBLIC int | uriParseUriExA (UriParserStateA *state, const char *first, const char *afterLast) |
URI_PUBLIC int | uriParseUriA (UriParserStateA *state, const char *text) |
URI_PUBLIC int | uriParseSingleUriA (UriUriA *uri, const char *text, const char **errorPos) |
URI_PUBLIC int | uriParseSingleUriExA (UriUriA *uri, const char *first, const char *afterLast, const char **errorPos) |
URI_PUBLIC int | uriParseSingleUriExMmA (UriUriA *uri, const char *first, const char *afterLast, const char **errorPos, UriMemoryManager *memory) |
URI_PUBLIC void | uriFreeUriMembersA (UriUriA *uri) |
URI_PUBLIC int | uriFreeUriMembersMmA (UriUriA *uri, UriMemoryManager *memory) |
URI_PUBLIC char * | uriEscapeExA (const char *inFirst, const char *inAfterLast, char *out, UriBool spaceToPlus, UriBool normalizeBreaks) |
URI_PUBLIC char * | uriEscapeA (const char *in, char *out, UriBool spaceToPlus, UriBool normalizeBreaks) |
URI_PUBLIC const char * | uriUnescapeInPlaceExA (char *inout, UriBool plusToSpace, UriBreakConversion breakConversion) |
URI_PUBLIC const char * | uriUnescapeInPlaceA (char *inout) |
URI_PUBLIC int | uriAddBaseUriA (UriUriA *absoluteDest, const UriUriA *relativeSource, const UriUriA *absoluteBase) |
URI_PUBLIC int | uriAddBaseUriExA (UriUriA *absoluteDest, const UriUriA *relativeSource, const UriUriA *absoluteBase, UriResolutionOptions options) |
URI_PUBLIC int | uriAddBaseUriExMmA (UriUriA *absoluteDest, const UriUriA *relativeSource, const UriUriA *absoluteBase, UriResolutionOptions options, UriMemoryManager *memory) |
URI_PUBLIC int | uriRemoveBaseUriA (UriUriA *dest, const UriUriA *absoluteSource, const UriUriA *absoluteBase, UriBool domainRootMode) |
URI_PUBLIC int | uriRemoveBaseUriMmA (UriUriA *dest, const UriUriA *absoluteSource, const UriUriA *absoluteBase, UriBool domainRootMode, UriMemoryManager *memory) |
URI_PUBLIC UriBool | uriEqualsUriA (const UriUriA *a, const UriUriA *b) |
URI_PUBLIC int | uriToStringCharsRequiredA (const UriUriA *uri, int *charsRequired) |
URI_PUBLIC int | uriToStringA (char *dest, const UriUriA *uri, int maxChars, int *charsWritten) |
URI_PUBLIC unsigned int | uriNormalizeSyntaxMaskRequiredA (const UriUriA *uri) |
URI_PUBLIC int | uriNormalizeSyntaxMaskRequiredExA (const UriUriA *uri, unsigned int *outMask) |
URI_PUBLIC int | uriNormalizeSyntaxExA (UriUriA *uri, unsigned int mask) |
URI_PUBLIC int | uriNormalizeSyntaxExMmA (UriUriA *uri, unsigned int mask, UriMemoryManager *memory) |
URI_PUBLIC int | uriNormalizeSyntaxA (UriUriA *uri) |
URI_PUBLIC int | uriUnixFilenameToUriStringA (const char *filename, char *uriString) |
URI_PUBLIC int | uriWindowsFilenameToUriStringA (const char *filename, char *uriString) |
URI_PUBLIC int | uriUriStringToUnixFilenameA (const char *uriString, char *filename) |
URI_PUBLIC int | uriUriStringToWindowsFilenameA (const char *uriString, char *filename) |
URI_PUBLIC int | uriComposeQueryCharsRequiredA (const UriQueryListA *queryList, int *charsRequired) |
URI_PUBLIC int | uriComposeQueryCharsRequiredExA (const UriQueryListA *queryList, int *charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks) |
URI_PUBLIC int | uriComposeQueryA (char *dest, const UriQueryListA *queryList, int maxChars, int *charsWritten) |
URI_PUBLIC int | uriComposeQueryExA (char *dest, const UriQueryListA *queryList, int maxChars, int *charsWritten, UriBool spaceToPlus, UriBool normalizeBreaks) |
URI_PUBLIC int | uriComposeQueryMallocA (char **dest, const UriQueryListA *queryList) |
URI_PUBLIC int | uriComposeQueryMallocExA (char **dest, const UriQueryListA *queryList, UriBool spaceToPlus, UriBool normalizeBreaks) |
URI_PUBLIC int | uriComposeQueryMallocExMmA (char **dest, const UriQueryListA *queryList, UriBool spaceToPlus, UriBool normalizeBreaks, UriMemoryManager *memory) |
URI_PUBLIC int | uriDissectQueryMallocA (UriQueryListA **dest, int *itemCount, const char *first, const char *afterLast) |
URI_PUBLIC int | uriDissectQueryMallocExA (UriQueryListA **dest, int *itemCount, const char *first, const char *afterLast, UriBool plusToSpace, UriBreakConversion breakConversion) |
URI_PUBLIC int | uriDissectQueryMallocExMmA (UriQueryListA **dest, int *itemCount, const char *first, const char *afterLast, UriBool plusToSpace, UriBreakConversion breakConversion, UriMemoryManager *memory) |
URI_PUBLIC void | uriFreeQueryListA (UriQueryListA *queryList) |
URI_PUBLIC int | uriFreeQueryListMmA (UriQueryListA *queryList, UriMemoryManager *memory) |
URI_PUBLIC int | uriMakeOwnerA (UriUriA *uri) |
URI_PUBLIC int | uriMakeOwnerMmA (UriUriA *uri, UriMemoryManager *memory) |
Holds the RFC 3986 URI parser interface. NOTE: This header includes itself twice.
typedef struct UriHostDataStructA UriHostDataA |
Holds structured host information. This is either a IPv4, IPv6, plain text for IPvFuture or all zero for a registered name.
"
Holds structured host information. This is either a IPv4, IPv6, plain text for IPvFuture or all zero for a registered name.
typedef struct UriParserStateStructA UriParserStateA |
Represents a state of the URI parser. Missing components can be NULL to reflect a components absence.
"
Represents a state of the URI parser. Missing components can be NULL to reflect a components absence.
typedef struct UriPathSegmentStructA UriPathSegmentA |
typedef struct UriQueryListStructA UriQueryListA |
Represents a query element. More precisely it is a node in a linked list of query elements.
"
Represents a query element. More precisely it is a node in a linked list of query elements.
typedef struct UriTextRangeStructA UriTextRangeA |
Specifies a range of characters within a string. The range includes all characters from first
to one before afterLast
. So if both are non-NULL the difference is the length of the text range.
"
Specifies a range of characters within a string. The range includes all characters from first
to one before afterLast
. So if both are non-NULL the difference is the length of the text range.
typedef struct UriUriStructA UriUriA |
Represents an RFC 3986 URI. Missing components can be {NULL, NULL} ranges.
"
Represents an RFC 3986 URI. Missing components can be {NULL, NULL} ranges.
URI_PUBLIC int uriAddBaseUriA | ( | UriUriA * | absoluteDest, |
const UriUriA * | relativeSource, | ||
const UriUriA * | absoluteBase ) |
Performs reference resolution as described in section 5.2.2 of RFC 3986. Uses default libc-based memory manager. NOTE: On success you have to call uriFreeUriMembersA on absoluteDest
manually later.
absoluteDest | OUT: Result URI |
relativeSource | IN: Reference to resolve |
absoluteBase | IN: Base URI to apply |
URI_PUBLIC int uriAddBaseUriExA | ( | UriUriA * | absoluteDest, |
const UriUriA * | relativeSource, | ||
const UriUriA * | absoluteBase, | ||
UriResolutionOptions | options ) |
Performs reference resolution as described in section 5.2.2 of RFC 3986. Uses default libc-based memory manager. NOTE: On success you have to call uriFreeUriMembersA on absoluteDest
manually later.
absoluteDest | OUT: Result URI |
relativeSource | IN: Reference to resolve |
absoluteBase | IN: Base URI to apply |
options | IN: Configuration to apply |
URI_PUBLIC int uriAddBaseUriExMmA | ( | UriUriA * | absoluteDest, |
const UriUriA * | relativeSource, | ||
const UriUriA * | absoluteBase, | ||
UriResolutionOptions | options, | ||
UriMemoryManager * | memory ) |
Performs reference resolution as described in section 5.2.2 of RFC 3986. NOTE: On success you have to call uriFreeUriMembersMmA on absoluteDest
manually later.
absoluteDest | OUT: Result URI |
relativeSource | IN: Reference to resolve |
absoluteBase | IN: Base URI to apply |
options | IN: Configuration to apply |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC int uriComposeQueryA | ( | char * | dest, |
const UriQueryListA * | queryList, | ||
int | maxChars, | ||
int * | charsWritten ) |
Converts a query list structure back to a query string. The composed string does not start with '?', on the way ' ' is converted to '+' and line breaks are normalized to "%0D%0A".
dest | OUT: Output destination |
queryList | IN: Query list to convert |
maxChars | IN: Maximum number of characters to copy including terminator |
charsWritten | OUT: Number of characters written, can be lower than maxChars even if the query list is too long! |
URI_PUBLIC int uriComposeQueryCharsRequiredA | ( | const UriQueryListA * | queryList, |
int * | charsRequired ) |
Calculates the number of characters needed to store the string representation of the given query list excluding the terminator. It is assumed that line breaks are will be normalized to "%0D%0A".
queryList | IN: Query list to measure |
charsRequired | OUT: Length of the string representation in characters excluding terminator |
URI_PUBLIC int uriComposeQueryCharsRequiredExA | ( | const UriQueryListA * | queryList, |
int * | charsRequired, | ||
UriBool | spaceToPlus, | ||
UriBool | normalizeBreaks ) |
Calculates the number of characters needed to store the string representation of the given query list excluding the terminator.
queryList | IN: Query list to measure |
charsRequired | OUT: Length of the string representation in characters excluding terminator |
spaceToPlus | IN: Whether to convert ' ' to '+' or not |
normalizeBreaks | IN: Whether to convert CR and LF to CR-LF or not. |
URI_PUBLIC int uriComposeQueryExA | ( | char * | dest, |
const UriQueryListA * | queryList, | ||
int | maxChars, | ||
int * | charsWritten, | ||
UriBool | spaceToPlus, | ||
UriBool | normalizeBreaks ) |
Converts a query list structure back to a query string. The composed string does not start with '?'.
dest | OUT: Output destination |
queryList | IN: Query list to convert |
maxChars | IN: Maximum number of characters to copy including terminator |
charsWritten | OUT: Number of characters written, can be lower than maxChars even if the query list is too long! |
spaceToPlus | IN: Whether to convert ' ' to '+' or not |
normalizeBreaks | IN: Whether to convert CR and LF to CR-LF or not. |
URI_PUBLIC int uriComposeQueryMallocA | ( | char ** | dest, |
const UriQueryListA * | queryList ) |
Converts a query list structure back to a query string. Memory for this string is allocated internally. The composed string does not start with '?', on the way ' ' is converted to '+' and line breaks are normalized to "%0D%0A". Uses default libc-based memory manager.
dest | OUT: Output destination |
queryList | IN: Query list to convert |
URI_PUBLIC int uriComposeQueryMallocExA | ( | char ** | dest, |
const UriQueryListA * | queryList, | ||
UriBool | spaceToPlus, | ||
UriBool | normalizeBreaks ) |
Converts a query list structure back to a query string. Memory for this string is allocated internally. The composed string does not start with '?'. Uses default libc-based memory manager.
dest | OUT: Output destination |
queryList | IN: Query list to convert |
spaceToPlus | IN: Whether to convert ' ' to '+' or not |
normalizeBreaks | IN: Whether to convert CR and LF to CR-LF or not. |
URI_PUBLIC int uriComposeQueryMallocExMmA | ( | char ** | dest, |
const UriQueryListA * | queryList, | ||
UriBool | spaceToPlus, | ||
UriBool | normalizeBreaks, | ||
UriMemoryManager * | memory ) |
Converts a query list structure back to a query string. Memory for this string is allocated internally. The composed string does not start with '?'.
dest | OUT: Output destination |
queryList | IN: Query list to convert |
spaceToPlus | IN: Whether to convert ' ' to '+' or not |
normalizeBreaks | IN: Whether to convert CR and LF to CR-LF or not. |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC int uriDissectQueryMallocA | ( | UriQueryListA ** | dest, |
int * | itemCount, | ||
const char * | first, | ||
const char * | afterLast ) |
Constructs a query list from the raw query string of a given URI. On the way '+' is converted back to ' ', line breaks are not modified. Uses default libc-based memory manager.
dest | OUT: Output destination |
itemCount | OUT: Number of items found, can be NULL |
first | IN: Pointer to first character after '?' |
afterLast | IN: Pointer to character after the last one still in |
URI_PUBLIC int uriDissectQueryMallocExA | ( | UriQueryListA ** | dest, |
int * | itemCount, | ||
const char * | first, | ||
const char * | afterLast, | ||
UriBool | plusToSpace, | ||
UriBreakConversion | breakConversion ) |
Constructs a query list from the raw query string of a given URI. Uses default libc-based memory manager.
dest | OUT: Output destination |
itemCount | OUT: Number of items found, can be NULL |
first | IN: Pointer to first character after '?' |
afterLast | IN: Pointer to character after the last one still in |
plusToSpace | IN: Whether to convert '+' to ' ' or not |
breakConversion | IN: Line break conversion mode |
URI_PUBLIC int uriDissectQueryMallocExMmA | ( | UriQueryListA ** | dest, |
int * | itemCount, | ||
const char * | first, | ||
const char * | afterLast, | ||
UriBool | plusToSpace, | ||
UriBreakConversion | breakConversion, | ||
UriMemoryManager * | memory ) |
Constructs a query list from the raw query string of a given URI.
dest | OUT: Output destination |
itemCount | OUT: Number of items found, can be NULL |
first | IN: Pointer to first character after '?' |
afterLast | IN: Pointer to character after the last one still in |
plusToSpace | IN: Whether to convert '+' to ' ' or not |
breakConversion | IN: Line break conversion mode |
memory | IN: Memory manager to use, NULL for default libc |
Checks two URIs for equivalence. Comparison is done the naive way, without prior normalization. NOTE: Two NULL
URIs are equal as well.
a | IN: First URI |
b | IN: Second URI |
URI_TRUE
when equal, URI_FAlSE
elseURI_PUBLIC char * uriEscapeA | ( | const char * | in, |
char * | out, | ||
UriBool | spaceToPlus, | ||
UriBool | normalizeBreaks ) |
Percent-encodes all unreserved characters from the input string and writes the encoded version to the output string.
NOTE: Be sure to allocate 3 times the space of the input buffer for the output buffer for normalizeBreaks == URI_FALSE
and 6 times the space for normalizeBreaks == URI_TRUE
(since e.g. "\x0d" becomes "%0D%0A" in that case).
NOTE: The implementation treats (both char
and) wchar_t
units as code point integers, which works well for code points U+0001
to U+00ff
in host-native endianness but nothing more; in particular, using uriEscapeW
with arbitrary Unicode input will not produce healthy results. Passing UTF-8 input to uriEscapeA
may be useful in some scenarios. Keep in mind that uriparser is about URI (RFC 3986) not IRI (RFC 3987).
in | IN: Text source |
out | OUT: Encoded text destination |
spaceToPlus | IN: Whether to convert ' ' to '+' or not |
normalizeBreaks | IN: Whether to convert CR and LF to CR-LF or not. |
URI_PUBLIC char * uriEscapeExA | ( | const char * | inFirst, |
const char * | inAfterLast, | ||
char * | out, | ||
UriBool | spaceToPlus, | ||
UriBool | normalizeBreaks ) |
Percent-encodes all unreserved characters from the input string and writes the encoded version to the output string.
NOTE: Be sure to allocate 3 times the space of the input buffer for the output buffer for normalizeBreaks == URI_FALSE
and 6 times the space for normalizeBreaks == URI_TRUE
(since e.g. "\x0d" becomes "%0D%0A" in that case).
NOTE: The implementation treats (both char
and) wchar_t
units as code point integers, which works well for code points U+0001
to U+00ff
in host-native endianness but nothing more; in particular, using uriEscapeExW
with arbitrary Unicode input will not produce healthy results. Passing UTF-8 input to uriEscapeExA
may be useful in some scenarios. Keep in mind that uriparser is about URI (RFC 3986) not IRI (RFC 3987).
inFirst | IN: Pointer to first character of the input text |
inAfterLast | IN: Pointer after the last character of the input text |
out | OUT: Encoded text destination |
spaceToPlus | IN: Whether to convert ' ' to '+' or not |
normalizeBreaks | IN: Whether to convert CR and LF to CR-LF or not. |
URI_PUBLIC void uriFreeQueryListA | ( | UriQueryListA * | queryList | ) |
Frees all memory associated with the given query list. The structure itself is freed as well.
queryList | INOUT: Query list to free |
URI_PUBLIC int uriFreeQueryListMmA | ( | UriQueryListA * | queryList, |
UriMemoryManager * | memory ) |
Frees all memory associated with the given query list. The structure itself is freed as well.
queryList | INOUT: Query list to free |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC void uriFreeUriMembersA | ( | UriUriA * | uri | ) |
Frees all memory associated with the members of the URI structure. Note that the structure itself is not freed, only its members. Uses default libc-based memory manager.
uri | INOUT: URI structure whose members should be freed |
URI_PUBLIC int uriFreeUriMembersMmA | ( | UriUriA * | uri, |
UriMemoryManager * | memory ) |
Frees all memory associated with the members of the URI structure. Note that the structure itself is not freed, only its members.
uri | INOUT: URI structure whose members should be freed |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC int uriMakeOwnerA | ( | UriUriA * | uri | ) |
Makes the URI hold copies of strings so that it no longer depends on the original URI string. If the URI is already owner of copies, this function returns URI_TRUE
and does not modify the URI further.
Uses default libc-based memory manager.
uri | INOUT: URI to make independent |
URI_PUBLIC int uriMakeOwnerMmA | ( | UriUriA * | uri, |
UriMemoryManager * | memory ) |
Makes the URI hold copies of strings so that it no longer depends on the original URI string. If the URI is already owner of copies, this function returns URI_TRUE
and does not modify the URI further.
uri | INOUT: URI to make independent |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC int uriNormalizeSyntaxA | ( | UriUriA * | uri | ) |
Normalizes all components of a URI.
NOTE: If necessary the URI becomes owner of all memory behind the text pointed to. Text is duplicated in that case. Uses default libc-based memory manager.
uri | INOUT: URI to normalize |
URI_PUBLIC int uriNormalizeSyntaxExA | ( | UriUriA * | uri, |
unsigned int | mask ) |
Normalizes a URI using a normalization mask. The normalization mask decides what components are normalized.
NOTE: If necessary the URI becomes owner of all memory behind the text pointed to. Text is duplicated in that case. Uses default libc-based memory manager.
uri | INOUT: URI to normalize |
mask | IN: Normalization mask |
URI_PUBLIC int uriNormalizeSyntaxExMmA | ( | UriUriA * | uri, |
unsigned int | mask, | ||
UriMemoryManager * | memory ) |
Normalizes a URI using a normalization mask. The normalization mask decides what components are normalized.
NOTE: If necessary the URI becomes owner of all memory behind the text pointed to. Text is duplicated in that case.
uri | INOUT: URI to normalize |
mask | IN: Normalization mask |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC unsigned int uriNormalizeSyntaxMaskRequiredA | ( | const UriUriA * | uri | ) |
Determines the components of a URI that are not normalized.
uri | IN: URI to check |
URI_PUBLIC int uriNormalizeSyntaxMaskRequiredExA | ( | const UriUriA * | uri, |
unsigned int * | outMask ) |
Determines the components of a URI that are not normalized.
uri | IN: URI to check |
outMask | OUT: Normalization job mask |
URI_PUBLIC int uriParseSingleUriA | ( | UriUriA * | uri, |
const char * | text, | ||
const char ** | errorPos ) |
Parses a single RFC 3986 URI. Uses default libc-based memory manager.
uri | OUT: Output URI, must not be NULL |
text | IN: Pointer to the first character to parse, must not be NULL |
errorPos | OUT: Pointer to a pointer to the first character causing a syntax error, can be NULL; only set when URI_ERROR_SYNTAX was returned |
URI_PUBLIC int uriParseSingleUriExA | ( | UriUriA * | uri, |
const char * | first, | ||
const char * | afterLast, | ||
const char ** | errorPos ) |
Parses a single RFC 3986 URI. Uses default libc-based memory manager.
uri | OUT: Output URI, must not be NULL |
first | IN: Pointer to the first character to parse, must not be NULL |
afterLast | IN: Pointer to the character after the last to parse, can be NULL (to use first + strlen(first)) |
errorPos | OUT: Pointer to a pointer to the first character causing a syntax error, can be NULL; only set when URI_ERROR_SYNTAX was returned |
URI_PUBLIC int uriParseSingleUriExMmA | ( | UriUriA * | uri, |
const char * | first, | ||
const char * | afterLast, | ||
const char ** | errorPos, | ||
UriMemoryManager * | memory ) |
Parses a single RFC 3986 URI.
uri | OUT: Output URI, must not be NULL |
first | IN: Pointer to the first character to parse, must not be NULL |
afterLast | IN: Pointer to the character after the last to parse, can be NULL (to use first + strlen(first)) |
errorPos | OUT: Pointer to a pointer to the first character causing a syntax error, can be NULL; only set when URI_ERROR_SYNTAX was returned |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC int uriParseUriA | ( | UriParserStateA * | state, |
const char * | text ) |
Parses a RFC 3986 URI. Uses default libc-based memory manager.
state | INOUT: Parser state with set output URI, must not be NULL |
text | IN: Text to parse, must not be NULL |
URI_PUBLIC int uriParseUriExA | ( | UriParserStateA * | state, |
const char * | first, | ||
const char * | afterLast ) |
Parses a RFC 3986 URI. Uses default libc-based memory manager.
state | INOUT: Parser state with set output URI, must not be NULL |
first | IN: Pointer to the first character to parse, must not be NULL |
afterLast | IN: Pointer to the character after the last to parse, must not be NULL |
URI_PUBLIC int uriRemoveBaseUriA | ( | UriUriA * | dest, |
const UriUriA * | absoluteSource, | ||
const UriUriA * | absoluteBase, | ||
UriBool | domainRootMode ) |
Tries to make a relative URI (a reference) from an absolute URI and a given base URI. The resulting URI is going to be relative if the absolute URI and base UI share both scheme and authority. If that is not the case, the result will still be an absolute URI (with scheme part if necessary). Uses default libc-based memory manager. NOTE: On success you have to call uriFreeUriMembersA on dest
manually later.
dest | OUT: Result URI |
absoluteSource | IN: Absolute URI to make relative |
absoluteBase | IN: Base URI |
domainRootMode | IN: Create URI with path relative to domain root |
URI_PUBLIC int uriRemoveBaseUriMmA | ( | UriUriA * | dest, |
const UriUriA * | absoluteSource, | ||
const UriUriA * | absoluteBase, | ||
UriBool | domainRootMode, | ||
UriMemoryManager * | memory ) |
Tries to make a relative URI (a reference) from an absolute URI and a given base URI. The resulting URI is going to be relative if the absolute URI and base UI share both scheme and authority. If that is not the case, the result will still be an absolute URI (with scheme part if necessary). NOTE: On success you have to call uriFreeUriMembersMmA on dest
manually later.
dest | OUT: Result URI |
absoluteSource | IN: Absolute URI to make relative |
absoluteBase | IN: Base URI |
domainRootMode | IN: Create URI with path relative to domain root |
memory | IN: Memory manager to use, NULL for default libc |
URI_PUBLIC int uriToStringA | ( | char * | dest, |
const UriUriA * | uri, | ||
int | maxChars, | ||
int * | charsWritten ) |
Converts a URI structure back to text as described in section 5.3 of RFC 3986.
NOTE: Scheme-based normalization (section 6.2.3 of RFC 3986) is not applied and is considered a responsibility of the application using uriparser.
dest | OUT: Output destination |
uri | IN: URI to convert |
maxChars | IN: Maximum number of characters to copy including terminator |
charsWritten | OUT: Number of characters written, can be lower than maxChars even if the URI is too long! |
URI_PUBLIC int uriToStringCharsRequiredA | ( | const UriUriA * | uri, |
int * | charsRequired ) |
Calculates the number of characters needed to store the string representation of the given URI excluding the terminator.
uri | IN: URI to measure |
charsRequired | OUT: Length of the string representation in characters excluding terminator |
URI_PUBLIC const char * uriUnescapeInPlaceA | ( | char * | inout | ) |
Unescapes percent-encoded groups in a given string. E.g. "%20" will become " ". Unescaping is done in place. The return value will be point to the new position of the terminating zero. Use this value to get the new length of the string. NULL is only returned if inout
is NULL.
NOTE: '+' is not decoded to ' ' and line breaks are not converted. Use the more advanced UnescapeInPlaceEx for that features instead.
inout | INOUT: Text to unescape/decode |
URI_PUBLIC const char * uriUnescapeInPlaceExA | ( | char * | inout, |
UriBool | plusToSpace, | ||
UriBreakConversion | breakConversion ) |
Unescapes percent-encoded groups in a given string. E.g. "%20" will become " ". Unescaping is done in place. The return value will be point to the new position of the terminating zero. Use this value to get the new length of the string. NULL is only returned if inout
is NULL.
inout | INOUT: Text to unescape/decode |
plusToSpace | IN: Whether to convert '+' to ' ' or not |
breakConversion | IN: Line break conversion mode |
URI_PUBLIC int uriUnixFilenameToUriStringA | ( | const char * | filename, |
char * | uriString ) |
Converts a Unix filename to a URI string. The destination buffer must be large enough to hold 7 + 3 * len(filename) + 1 characters in case of an absolute filename or 3 * len(filename) + 1 in case of a relative filename.
EXAMPLE Input: "/bin/bash" Output: "file:///bin/bash"
filename | IN: Unix filename to convert |
uriString | OUT: Destination to write URI string to |
URI_PUBLIC int uriUriStringToUnixFilenameA | ( | const char * | uriString, |
char * | filename ) |
Extracts a Unix filename from a URI string. The destination buffer must be large enough to hold len(uriString) + 1 - 5 characters in case of an absolute URI or len(uriString) + 1 in case of a relative URI.
uriString | IN: URI string to convert |
filename | OUT: Destination to write filename to |
URI_PUBLIC int uriUriStringToWindowsFilenameA | ( | const char * | uriString, |
char * | filename ) |
Extracts a Windows filename from a URI string. The destination buffer must be large enough to hold len(uriString) + 1 - 5 characters in case of an absolute URI or len(uriString) + 1 in case of a relative URI.
uriString | IN: URI string to convert |
filename | OUT: Destination to write filename to |
URI_PUBLIC int uriWindowsFilenameToUriStringA | ( | const char * | filename, |
char * | uriString ) |
Converts a Windows filename to a URI string. The destination buffer must be large enough to hold 8 + 3 * len(filename) + 1 characters in case of an absolute filename or 3 * len(filename) + 1 in case of a relative filename.
EXAMPLE Input: "E:\\Documents and Settings" Output: "file:///E:/Documents%20and%20Settings"
filename | IN: Windows filename to convert |
uriString | OUT: Destination to write URI string to |