| Uri.h | | Uri.h | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| #ifndef URI_DOXYGEN | | #ifndef URI_DOXYGEN | |
| # include "UriBase.h" | | # include "UriBase.h" | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Specifies a range of characters within a string. | | * Specifies a range of characters within a string. | |
|
| * The range includes all characters from <code>first</code> | | * The range includes all characters from <c>first</c> | |
| * to one before <code>afterLast</code>. So if both are | | * to one before <c>afterLast</c>. So if both are | |
| * non-NULL the difference is the length of the text range. | | * non-NULL the difference is the length of the text range. | |
|
| | | * | |
| | | * @see UriUriA | |
| | | * @see UriPathSegmentA | |
| | | * @see UriHostDataA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| typedef struct URI_TYPE(TextRangeStruct) { | | typedef struct URI_TYPE(TextRangeStruct) { | |
| const URI_CHAR * first; /**< Pointer to first character */ | | const URI_CHAR * first; /**< Pointer to first character */ | |
| const URI_CHAR * afterLast; /**< Pointer to character after the last
one still in */ | | const URI_CHAR * afterLast; /**< Pointer to character after the last
one still in */ | |
| } URI_TYPE(TextRange); /**< @copydoc UriTextRangeStructA */ | | } URI_TYPE(TextRange); /**< @copydoc UriTextRangeStructA */ | |
| | | | |
| /** | | /** | |
|
| * Represents a segment within a %URI path. | | * Represents a path segment within a %URI path. | |
| * More precisely it is a node in a linked | | * More precisely it is a node in a linked | |
| * list of path segments. | | * list of path segments. | |
|
| | | * | |
| | | * @see UriUriA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| typedef struct URI_TYPE(PathSegmentStruct) { | | typedef struct URI_TYPE(PathSegmentStruct) { | |
| URI_TYPE(TextRange) text; /**< Path segment name */ | | URI_TYPE(TextRange) text; /**< Path segment name */ | |
| struct URI_TYPE(PathSegmentStruct) * next; /**< Pointer to the next
path segment in the list, can be NULL if last already */ | | struct URI_TYPE(PathSegmentStruct) * next; /**< Pointer to the next
path segment in the list, can be NULL if last already */ | |
| | | | |
| void * reserved; /**< Reserved to the parser */ | | void * reserved; /**< Reserved to the parser */ | |
| } URI_TYPE(PathSegment); /**< @copydoc UriPathSegmentStructA */ | | } URI_TYPE(PathSegment); /**< @copydoc UriPathSegmentStructA */ | |
| | | | |
| /** | | /** | |
| * Holds structured host information. | | * Holds structured host information. | |
| * This is either a IPv4, IPv6, plain | | * This is either a IPv4, IPv6, plain | |
| * text for IPvFuture or all zero for | | * text for IPvFuture or all zero for | |
| * a registered name. | | * a registered name. | |
|
| | | * | |
| | | * @see UriUriA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| typedef struct URI_TYPE(HostDataStruct) { | | typedef struct URI_TYPE(HostDataStruct) { | |
| UriIp4 * ip4; /**< IPv4 address */ | | UriIp4 * ip4; /**< IPv4 address */ | |
| UriIp6 * ip6; /**< IPv6 address */ | | UriIp6 * ip6; /**< IPv6 address */ | |
| URI_TYPE(TextRange) ipFuture; /**< IPvFuture address */ | | URI_TYPE(TextRange) ipFuture; /**< IPvFuture address */ | |
| } URI_TYPE(HostData); /**< @copydoc UriHostDataStructA */ | | } URI_TYPE(HostData); /**< @copydoc UriHostDataStructA */ | |
| | | | |
| /** | | /** | |
| * Represents an RFC 3986 %URI. | | * Represents an RFC 3986 %URI. | |
| * Missing components can be {NULL, NULL} ranges. | | * Missing components can be {NULL, NULL} ranges. | |
|
| | | * | |
| | | * @see uriParseUriA | |
| | | * @see uriFreeUriMembersA | |
| | | * @see UriParserStateA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| typedef struct URI_TYPE(UriStruct) { | | typedef struct URI_TYPE(UriStruct) { | |
| URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */ | | URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */ | |
| URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */ | | URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */ | |
| URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, exc
luding square brackets) */ | | URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, exc
luding square brackets) */ | |
| URI_TYPE(HostData) hostData; /**< Structured host type specific data
*/ | | URI_TYPE(HostData) hostData; /**< Structured host type specific data
*/ | |
| URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */ | | URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */ | |
| URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path
segments */ | | URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path
segments */ | |
| URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathH
ead */ | | URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathH
ead */ | |
| URI_TYPE(TextRange) query; /**< Query without leading "?" */ | | URI_TYPE(TextRange) query; /**< Query without leading "?" */ | |
| | | | |
| skipping to change at line 138 | | skipping to change at line 154 | |
| UriBool absolutePath; /**< Absolute path flag, meaningless if %URI i
s absolute */ | | UriBool absolutePath; /**< Absolute path flag, meaningless if %URI i
s absolute */ | |
| UriBool owner; /**< Memory owner flag */ | | UriBool owner; /**< Memory owner flag */ | |
| | | | |
| void * reserved; /**< Reserved to the parser */ | | void * reserved; /**< Reserved to the parser */ | |
| } URI_TYPE(Uri); /**< @copydoc UriUriStructA */ | | } URI_TYPE(Uri); /**< @copydoc UriUriStructA */ | |
| | | | |
| /** | | /** | |
| * Represents a state of the %URI parser. | | * Represents a state of the %URI parser. | |
| * Missing components can be NULL to reflect | | * Missing components can be NULL to reflect | |
| * a components absence. | | * a components absence. | |
|
| | | * | |
| | | * @see uriFreeUriMembersA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| typedef struct URI_TYPE(ParserStateStruct) { | | typedef struct URI_TYPE(ParserStateStruct) { | |
| URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled wh
ile parsing here */ | | URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled wh
ile parsing here */ | |
| int errorCode; /**< Code identifying the occured error */ | | int errorCode; /**< Code identifying the occured error */ | |
| const URI_CHAR * errorPos; /**< Pointer to position in case of a syn
tax error */ | | const URI_CHAR * errorPos; /**< Pointer to position in case of a syn
tax error */ | |
| | | | |
| void * reserved; /**< Reserved to the parser */ | | void * reserved; /**< Reserved to the parser */ | |
| } URI_TYPE(ParserState); /**< @copydoc UriParserStateStructA */ | | } URI_TYPE(ParserState); /**< @copydoc UriParserStateStructA */ | |
| | | | |
| /** | | /** | |
|
| | | * Represents a query element. | |
| | | * More precisely it is a node in a linked | |
| | | * list of query elements. | |
| | | * | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | typedef struct URI_TYPE(QueryListStruct) { | |
| | | const URI_CHAR * key; /**< Key of the query element */ | |
| | | const URI_CHAR * value; /**< Value of the query element, can be NULL | |
| | | */ | |
| | | | |
| | | struct URI_TYPE(QueryListStruct) * next; /**< Pointer to the next ke | |
| | | y/value pair in the list, can be NULL if last already */ | |
| | | } URI_TYPE(QueryList); /**< @copydoc UriQueryListStructA */ | |
| | | | |
| | | /** | |
| * Parses a RFC 3986 URI. | | * Parses a RFC 3986 URI. | |
| * | | * | |
|
| * @param state Parser state with set output %URI, must not be NULL | | * @param state <b>INOUT</b>: Parser state with set output %URI, must | |
| * @param first Pointer to the first character to parse, must not be | | not be NULL | |
| NULL | | * @param first <b>IN</b>: Pointer to the first character to parse, m | |
| * @param afterLast Pointer to the character after the last to parse, mus | | ust not be NULL | |
| t not be NULL | | * @param afterLast <b>IN</b>: Pointer to the character after the last to | |
| | | parse, must not be NULL | |
| * @return 0 on success, error code otherwise | | * @return 0 on success, error code otherwise | |
|
| | | * | |
| | | * @see uriParseUriA | |
| | | * @see uriToStringA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, | | int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, | |
| const URI_CHAR * first, const URI_CHAR * afterLast); | | const URI_CHAR * first, const URI_CHAR * afterLast); | |
| | | | |
| /** | | /** | |
| * Parses a RFC 3986 %URI. | | * Parses a RFC 3986 %URI. | |
| * | | * | |
|
| * @param state Parser state with set output %URI, must not be NULL | | * @param state <b>INOUT</b>: Parser state with set output %URI, must not | |
| * @param text Text to parse, must not be NULL | | be NULL | |
| | | * @param text <b>IN</b>: Text to parse, must not be NULL | |
| * @return 0 on success, error code otherwise | | * @return 0 on success, error code otherwise | |
|
| | | * | |
| | | * @see uriParseUriExA | |
| | | * @see uriToStringA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, | | int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, | |
| const URI_CHAR * text); | | const URI_CHAR * text); | |
| | | | |
| /** | | /** | |
| * Frees all memory associated with the members | | * Frees all memory associated with the members | |
| * of the %URI structure. Note that the structure | | * of the %URI structure. Note that the structure | |
| * itself is not freed, only its members. | | * itself is not freed, only its members. | |
| * | | * | |
|
| * @param uri %URI structure whose members should be freed | | * @param uri <b>INOUT</b>: %URI structure whose members should be freed | |
| | | * | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri); | | void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri); | |
| | | | |
| /** | | /** | |
| * Percent-encodes all unreserved characters from the input string and | | * Percent-encodes all unreserved characters from the input string and | |
| * writes the encoded version to the output string. | | * writes the encoded version to the output string. | |
| * Be sure to allocate <b>3 times</b> the space of the input buffer for | | * Be sure to allocate <b>3 times</b> the space of the input buffer for | |
| * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times
</b> | | * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times
</b> | |
|
| * the space for <c>normalizeBreaks == URI_FALSE</c> | | * the space for <c>normalizeBreaks == URI_TRUE</c> | |
| * (since e.g. "\x0d" becomes "%0D%0A" in that case) | | * (since e.g. "\x0d" becomes "%0D%0A" in that case) | |
| * | | * | |
|
| * @param inFirst Pointer to first character of the input text | | * @param inFirst <b>IN</b>: Pointer to first character of the in | |
| * @param inAfterLast Pointer after the last character of the input t | | put text | |
| ext | | * @param inAfterLast <b>IN</b>: Pointer after the last character of | |
| * @param out Encoded text destination | | the input text | |
| * @param spaceToPlus Wether to convert ' ' to '+' or not | | * @param out <b>OUT</b>: Encoded text destination | |
| * @param normalizeBreaks Wether to convert CR and LF to CR-LF or not. | | * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not | |
| | | * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF | |
| | | or not. | |
| * @return Position of terminator in output string | | * @return Position of terminator in output string | |
|
| | | * | |
| | | * @see uriEscapeA | |
| | | * @see uriUnescapeInPlaceExA | |
| | | * @since 0.5.2 | |
| */ | | */ | |
| URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst, | | URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst, | |
| const URI_CHAR * inAfterLast, URI_CHAR * out, | | const URI_CHAR * inAfterLast, URI_CHAR * out, | |
| UriBool spaceToPlus, UriBool normalizeBreaks); | | UriBool spaceToPlus, UriBool normalizeBreaks); | |
| | | | |
| /** | | /** | |
| * Percent-encodes all unreserved characters from the input string and | | * Percent-encodes all unreserved characters from the input string and | |
| * writes the encoded version to the output string. | | * writes the encoded version to the output string. | |
| * Be sure to allocate <b>3 times</b> the space of the input buffer for | | * Be sure to allocate <b>3 times</b> the space of the input buffer for | |
| * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times
</b> | | * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times
</b> | |
| * the space for <c>normalizeBreaks == URI_FALSE</c> | | * the space for <c>normalizeBreaks == URI_FALSE</c> | |
| * (since e.g. "\x0d" becomes "%0D%0A" in that case) | | * (since e.g. "\x0d" becomes "%0D%0A" in that case) | |
| * | | * | |
|
| * @param in Text source | | * @param in <b>IN</b>: Text source | |
| * @param out Encoded text destination | | * @param out <b>OUT</b>: Encoded text destination | |
| * @param spaceToPlus Wether to convert ' ' to '+' or not | | * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not | |
| * @param normalizeBreaks Wether to convert CR and LF to CR-LF or not. | | * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF | |
| | | or not. | |
| * @return Position of terminator in output string | | * @return Position of terminator in output string | |
|
| | | * | |
| | | * @see uriEscapeExA | |
| | | * @see uriUnescapeInPlaceA | |
| | | * @since 0.5.0 | |
| */ | | */ | |
| URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out, | | URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out, | |
| UriBool spaceToPlus, UriBool normalizeBreaks); | | UriBool spaceToPlus, UriBool normalizeBreaks); | |
| | | | |
| /** | | /** | |
| * Unescapes percent-encoded groups in a given string. | | * Unescapes percent-encoded groups in a given string. | |
| * E.g. "%20" will become " ". Unescaping is done in place. | | * E.g. "%20" will become " ". Unescaping is done in place. | |
| * The return value will be point to the new position | | * The return value will be point to the new position | |
| * of the terminating zero. Use this value to get the new | | * of the terminating zero. Use this value to get the new | |
|
| * length of the string. NULL is only returned if <code>inout</code> | | * length of the string. NULL is only returned if <c>inout</c> | |
| * is NULL. | | * is NULL. | |
| * | | * | |
|
| * @param inout Text to unescape/decode | | * @param inout <b>INOUT</b>: Text to unescape/decode | |
| * @param plusToSpace Whether to convert '+' to ' ' or not | | * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not | |
| * @param breakConversion Line break conversion mode | | * @param breakConversion <b>IN</b>: Line break conversion mode | |
| * @return Pointer to new position of the terminating zero | | * @return Pointer to new position of the terminating zero | |
|
| | | * | |
| | | * @see uriUnescapeInPlaceA | |
| | | * @see uriEscapeExA | |
| | | * @since 0.5.0 | |
| */ | | */ | |
| const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout, | | const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout, | |
| UriBool plusToSpace, UriBreakConversion breakConversion); | | UriBool plusToSpace, UriBreakConversion breakConversion); | |
| | | | |
| /** | | /** | |
| * Unescapes percent-encoded groups in a given string. | | * Unescapes percent-encoded groups in a given string. | |
| * E.g. "%20" will become " ". Unescaping is done in place. | | * E.g. "%20" will become " ". Unescaping is done in place. | |
| * The return value will be point to the new position | | * The return value will be point to the new position | |
| * of the terminating zero. Use this value to get the new | | * of the terminating zero. Use this value to get the new | |
|
| * length of the string. NULL is only returned if <code>inout</code> | | * length of the string. NULL is only returned if <c>inout</c> | |
| * is NULL. | | * is NULL. | |
| * | | * | |
| * NOTE: '+' is not decoded to ' ' and line breaks are not converted. | | * NOTE: '+' is not decoded to ' ' and line breaks are not converted. | |
| * Use the more advanced UnescapeInPlaceEx for that features instead. | | * Use the more advanced UnescapeInPlaceEx for that features instead. | |
| * | | * | |
|
| * @param inout Text to unescape/decode | | * @param inout <b>INOUT</b>: Text to unescape/decode | |
| * @return Pointer to new position of the terminating zero | | * @return Pointer to new position of the terminating zero | |
|
| | | * | |
| | | * @see uriUnescapeInPlaceExA | |
| | | * @see uriEscapeA | |
| | | * @since 0.3.0 | |
| */ | | */ | |
| const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout); | | const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout); | |
| | | | |
| /** | | /** | |
| * Performs reference resolution as described in | | * Performs reference resolution as described in | |
| * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2
of RFC 3986</a>. | | * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2
of RFC 3986</a>. | |
| * | | * | |
|
| * @param absoluteDest Result %URI | | * @param absoluteDest <b>OUT</b>: Result %URI | |
| * @param relativeSource Reference to resolve | | * @param relativeSource <b>IN</b>: Reference to resolve | |
| * @param absoluteBase Base %URI to apply | | * @param absoluteBase <b>IN</b>: Base %URI to apply | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriRemoveBaseUriA | |
| | | * @since 0.4.0 | |
| */ | | */ | |
| int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest, | | int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest, | |
| const URI_TYPE(Uri) * relativeSource, | | const URI_TYPE(Uri) * relativeSource, | |
| const URI_TYPE(Uri) * absoluteBase); | | const URI_TYPE(Uri) * absoluteBase); | |
| | | | |
| /** | | /** | |
| * Tries to make a relative %URI (a reference) from an | | * Tries to make a relative %URI (a reference) from an | |
| * absolute %URI and a given base %URI. This can only work if | | * absolute %URI and a given base %URI. This can only work if | |
| * the absolute %URI shares scheme and authority with | | * the absolute %URI shares scheme and authority with | |
| * the base %URI. If it does not the result will still be | | * the base %URI. If it does not the result will still be | |
| * an absolute URI (with scheme part if necessary). | | * an absolute URI (with scheme part if necessary). | |
| * | | * | |
|
| * @param dest Result %URI | | * @param dest <b>OUT</b>: Result %URI | |
| * @param absoluteSource Absolute %URI to make relative | | * @param absoluteSource <b>IN</b>: Absolute %URI to make relative | |
| * @param absoluteBase Base %URI | | * @param absoluteBase <b>IN</b>: Base %URI | |
| * @param domainRootMode Create %URI with path relative to domain root | | * @param domainRootMode <b>IN</b>: Create %URI with path relative to dom | |
| | | ain root | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriAddBaseUriA | |
| | | * @since 0.5.2 | |
| */ | | */ | |
| int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest, | | int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest, | |
| const URI_TYPE(Uri) * absoluteSource, | | const URI_TYPE(Uri) * absoluteSource, | |
| const URI_TYPE(Uri) * absoluteBase, | | const URI_TYPE(Uri) * absoluteBase, | |
| UriBool domainRootMode); | | UriBool domainRootMode); | |
| | | | |
| /** | | /** | |
| * Checks two URIs for equivalence. Comparison is done | | * Checks two URIs for equivalence. Comparison is done | |
| * the naive way, without prior normalization. | | * the naive way, without prior normalization. | |
|
| * NOTE: Two <code>NULL</code> URIs are equal as well. | | * NOTE: Two <c>NULL</c> URIs are equal as well. | |
| | | * | |
| | | * @param a <b>IN</b>: First %URI | |
| | | * @param b <b>IN</b>: Second %URI | |
| | | * @return <c>URI_TRUE</c> when equal, <c>URI_FAlSE</c> else | |
| * | | * | |
|
| * @param a First %URI | | * @since 0.4.0 | |
| * @param b Second %URI | | | |
| * @return <code>URI_TRUE</code> when equal, <code>URI_FAlSE</code> else | | | |
| */ | | */ | |
| UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) *
b); | | UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) *
b); | |
| | | | |
| /** | | /** | |
| * Calculates the number of characters needed to store the | | * Calculates the number of characters needed to store the | |
| * string representation of the given %URI excluding the | | * string representation of the given %URI excluding the | |
| * terminator. | | * terminator. | |
| * | | * | |
|
| * @param uri %URI to measure | | * @param uri <b>IN</b>: %URI to measure | |
| * @param charsRequired Length of the string representation in characters | | * @param charsRequired <b>OUT</b>: Length of the string representation i | |
| <b>excluding</b> terminator | | n characters <b>excluding</b> terminator | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriToStringA | |
| | | * @since 0.5.0 | |
| */ | | */ | |
| int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri, | | int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri, | |
| int * charsRequired); | | int * charsRequired); | |
| | | | |
| /** | | /** | |
| * Converts a %URI structure back to text as described in | | * Converts a %URI structure back to text as described in | |
| * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of
RFC 3986</a>. | | * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of
RFC 3986</a>. | |
| * | | * | |
|
| * @param dest Output destination | | * @param dest <b>OUT</b>: Output destination | |
| * @param uri %URI to convert | | * @param uri <b>IN</b>: %URI to convert | |
| * @param maxChars Maximum number of characters to copy <b>including< | | * @param maxChars <b>IN</b>: Maximum number of characters to copy <b | |
| /b> terminator | | >including</b> terminator | |
| * @param charsWritten Number of characters written, can be lower than ma | | * @param charsWritten <b>OUT</b>: Number of characters written, can be l | |
| xChars even if the %URI is too long! | | ower than maxChars even if the %URI is too long! | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriToStringCharsRequiredA | |
| | | * @since 0.4.0 | |
| */ | | */ | |
| int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxC
hars, int * charsWritten); | | int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxC
hars, int * charsWritten); | |
| | | | |
| /** | | /** | |
| * Determines the components of a %URI that are not normalized. | | * Determines the components of a %URI that are not normalized. | |
| * | | * | |
|
| * @param uri %URI to check | | * @param uri <b>IN</b>: %URI to check | |
| * @return Normalization job mask | | * @return Normalization job mask | |
|
| | | * | |
| | | * @see uriNormalizeSyntaxA | |
| | | * @since 0.5.0 | |
| */ | | */ | |
| unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * ur
i); | | unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * ur
i); | |
| | | | |
| /** | | /** | |
| * Normalizes a %URI using a normalization mask. | | * Normalizes a %URI using a normalization mask. | |
| * The normalization mask decides what components are normalized. | | * The normalization mask decides what components are normalized. | |
| * | | * | |
| * NOTE: If necessary the %URI becomes owner of all memory | | * NOTE: If necessary the %URI becomes owner of all memory | |
| * behind the text pointed to. Text is duplicated in that case. | | * behind the text pointed to. Text is duplicated in that case. | |
| * | | * | |
|
| * @param uri %URI to normalize | | * @param uri <b>INOUT</b>: %URI to normalize | |
| * @param mask Normalization mask | | * @param mask <b>IN</b>: Normalization mask | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriNormalizeSyntaxA | |
| | | * @see uriNormalizeSyntaxMaskRequiredA | |
| | | * @since 0.5.0 | |
| */ | | */ | |
| int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask); | | int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask); | |
| | | | |
| /** | | /** | |
| * Normalizes all components of a %URI. | | * Normalizes all components of a %URI. | |
| * | | * | |
| * NOTE: If necessary the %URI becomes owner of all memory | | * NOTE: If necessary the %URI becomes owner of all memory | |
| * behind the text pointed to. Text is duplicated in that case. | | * behind the text pointed to. Text is duplicated in that case. | |
| * | | * | |
|
| * @param uri %URI to normalize | | * @param uri <b>INOUT</b>: %URI to normalize | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriNormalizeSyntaxExA | |
| | | * @see uriNormalizeSyntaxMaskRequiredA | |
| | | * @since 0.5.0 | |
| */ | | */ | |
| int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri); | | int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri); | |
| | | | |
| /** | | /** | |
| * Converts a Unix filename to a %URI string. | | * Converts a Unix filename to a %URI string. | |
| * The destination buffer must be large enough to hold 7 + 3 * len(filename
) + 1 | | * 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 c
ase | | * characters in case of an absolute filename or 3 * len(filename) + 1 in c
ase | |
| * of a relative filename. | | * of a relative filename. | |
| * | | * | |
| * EXAMPLE | | * EXAMPLE | |
| * Input: "/bin/bash" | | * Input: "/bin/bash" | |
| * Output: "file:///bin/bash" | | * Output: "file:///bin/bash" | |
| * | | * | |
|
| * @param filename Unix filename to convert | | * @param filename <b>IN</b>: Unix filename to convert | |
| * @param uriString Destination to write %URI string to | | * @param uriString <b>OUT</b>: Destination to write %URI string to | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriUriStringToUnixFilenameA | |
| | | * @see uriWindowsFilenameToUriStringA | |
| | | * @since 0.5.2 | |
| */ | | */ | |
| int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename, | | int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename, | |
| URI_CHAR * uriString); | | URI_CHAR * uriString); | |
| | | | |
| /** | | /** | |
| * Converts a Windows filename to a %URI string. | | * Converts a Windows filename to a %URI string. | |
| * The destination buffer must be large enough to hold 8 + 3 * len(filename
) + 1 | | * 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 c
ase | | * characters in case of an absolute filename or 3 * len(filename) + 1 in c
ase | |
| * of a relative filename. | | * of a relative filename. | |
| * | | * | |
| * EXAMPLE | | * EXAMPLE | |
| * Input: "E:\\Documents and Settings" | | * Input: "E:\\Documents and Settings" | |
| * Output: "file:///E:/Documents%20and%20Settings" | | * Output: "file:///E:/Documents%20and%20Settings" | |
| * | | * | |
|
| * @param filename Windows filename to convert | | * @param filename <b>IN</b>: Windows filename to convert | |
| * @param uriString Destination to write %URI string to | | * @param uriString <b>OUT</b>: Destination to write %URI string to | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriUriStringToWindowsFilenameA | |
| | | * @see uriUnixFilenameToUriStringA | |
| | | * @since 0.5.2 | |
| */ | | */ | |
| int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename, | | int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename, | |
| URI_CHAR * uriString); | | URI_CHAR * uriString); | |
| | | | |
| /** | | /** | |
| * Extracts a Unix filename from a %URI string. | | * Extracts a Unix filename from a %URI string. | |
| * The destination buffer must be large enough to hold len(uriString) + 1 -
7 | | * The destination buffer must be large enough to hold len(uriString) + 1 -
7 | |
| * characters in case of an absolute %URI or len(uriString) + 1 in case | | * characters in case of an absolute %URI or len(uriString) + 1 in case | |
| * of a relative %URI. | | * of a relative %URI. | |
| * | | * | |
|
| * @param uriString %URI string to convert | | * @param uriString <b>IN</b>: %URI string to convert | |
| * @param filename Destination to write filename to | | * @param filename <b>OUT</b>: Destination to write filename to | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriUnixFilenameToUriStringA | |
| | | * @see uriUriStringToWindowsFilenameA | |
| | | * @since 0.5.2 | |
| */ | | */ | |
| int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString, | | int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString, | |
| URI_CHAR * filename); | | URI_CHAR * filename); | |
| | | | |
| /** | | /** | |
| * Extracts a Windows filename from a %URI string. | | * Extracts a Windows filename from a %URI string. | |
| * The destination buffer must be large enough to hold len(uriString) + 1 -
8 | | * The destination buffer must be large enough to hold len(uriString) + 1 -
8 | |
| * characters in case of an absolute %URI or len(uriString) + 1 in case | | * characters in case of an absolute %URI or len(uriString) + 1 in case | |
| * of a relative %URI. | | * of a relative %URI. | |
| * | | * | |
|
| * @param uriString %URI string to convert | | * @param uriString <b>IN</b>: %URI string to convert | |
| * @param filename Destination to write filename to | | * @param filename <b>OUT</b>: Destination to write filename to | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
|
| | | * | |
| | | * @see uriWindowsFilenameToUriStringA | |
| | | * @see uriUriStringToUnixFilenameA | |
| | | * @since 0.5.2 | |
| */ | | */ | |
| int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString, | | int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString, | |
| URI_CHAR * filename); | | URI_CHAR * filename); | |
| | | | |
|
| | | /** | |
| | | * 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". | |
| | | * | |
| | | * @param queryList <b>IN</b>: Query list to measure | |
| | | * @param charsRequired <b>OUT</b>: Length of the string representation | |
| | | in characters <b>excluding</b> terminator | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriComposeQueryCharsRequiredExA | |
| | | * @see uriComposeQueryA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * queryLi | |
| | | st, | |
| | | int * charsRequired); | |
| | | | |
| | | /** | |
| | | * Calculates the number of characters needed to store the | |
| | | * string representation of the given query list excluding the | |
| | | * terminator. | |
| | | * | |
| | | * @param queryList <b>IN</b>: Query list to measure | |
| | | * @param charsRequired <b>OUT</b>: Length of the string representation | |
| | | in characters <b>excluding</b> terminator | |
| | | * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not | |
| | | * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF | |
| | | or not. | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriComposeQueryCharsRequiredA | |
| | | * @see uriComposeQueryExA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * query | |
| | | List, | |
| | | int * charsRequired, UriBool spaceToPlus, UriBool normalizeB | |
| | | reaks); | |
| | | | |
| | | /** | |
| | | * 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". | |
| | | * | |
| | | * @param dest <b>OUT</b>: Output destination | |
| | | * @param queryList <b>IN</b>: Query list to convert | |
| | | * @param maxChars <b>IN</b>: Maximum number of characters to copy | |
| | | <b>including</b> terminator | |
| | | * @param charsWritten <b>OUT</b>: Number of characters written, can b | |
| | | e lower than maxChars even if the query list is too long! | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriComposeQueryExA | |
| | | * @see uriComposeQueryMallocA | |
| | | * @see uriComposeQueryCharsRequiredA | |
| | | * @see uriDissectQueryMallocA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(ComposeQuery)(URI_CHAR * dest, | |
| | | const URI_TYPE(QueryList) * queryList, int maxChars, int * c | |
| | | harsWritten); | |
| | | | |
| | | /** | |
| | | * Converts a query list structure back to a query string. | |
| | | * The composed string does not start with '?'. | |
| | | * | |
| | | * @param dest <b>OUT</b>: Output destination | |
| | | * @param queryList <b>IN</b>: Query list to convert | |
| | | * @param maxChars <b>IN</b>: Maximum number of characters to copy | |
| | | <b>including</b> terminator | |
| | | * @param charsWritten <b>OUT</b>: Number of characters written, can b | |
| | | e lower than maxChars even if the query list is too long! | |
| | | * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not | |
| | | * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF | |
| | | or not. | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriComposeQueryA | |
| | | * @see uriComposeQueryMallocExA | |
| | | * @see uriComposeQueryCharsRequiredExA | |
| | | * @see uriDissectQueryMallocExA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest, | |
| | | const URI_TYPE(QueryList) * queryList, int maxChars, int * c | |
| | | harsWritten, | |
| | | 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 '?', | |
| | | * on the way ' ' is converted to '+' and line breaks are | |
| | | * normalized to "%0D%0A". | |
| | | * | |
| | | * @param dest <b>OUT</b>: Output destination | |
| | | * @param queryList <b>IN</b>: Query list to convert | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriComposeQueryMallocExA | |
| | | * @see uriComposeQueryA | |
| | | * @see uriDissectQueryMallocA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest, | |
| | | const URI_TYPE(QueryList) * 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 '?'. | |
| | | * | |
| | | * @param dest <b>OUT</b>: Output destination | |
| | | * @param queryList <b>IN</b>: Query list to convert | |
| | | * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not | |
| | | * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF | |
| | | or not. | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriComposeQueryMallocA | |
| | | * @see uriComposeQueryExA | |
| | | * @see uriDissectQueryMallocExA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest, | |
| | | const URI_TYPE(QueryList) * queryList, | |
| | | UriBool spaceToPlus, UriBool normalizeBreaks); | |
| | | | |
| | | /** | |
| | | * 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. | |
| | | * | |
| | | * @param dest <b>OUT</b>: Output destination | |
| | | * @param itemCount <b>OUT</b>: Number of items found, can be NULL | |
| | | * @param first <b>IN</b>: Pointer to first character <b>after< | |
| | | /b> '?' | |
| | | * @param afterLast <b>IN</b>: Pointer to character after the last | |
| | | one still in | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriDissectQueryMallocExA | |
| | | * @see uriComposeQueryA | |
| | | * @see uriFreeQueryListA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCou | |
| | | nt, | |
| | | const URI_CHAR * first, const URI_CHAR * afterLast); | |
| | | | |
| | | /** | |
| | | * Constructs a query list from the raw query string of a given URI. | |
| | | * | |
| | | * @param dest <b>OUT</b>: Output destination | |
| | | * @param itemCount <b>OUT</b>: Number of items found, can be NULL | |
| | | * @param first <b>IN</b>: Pointer to first character <b>after< | |
| | | /b> '?' | |
| | | * @param afterLast <b>IN</b>: Pointer to character after the last | |
| | | one still in | |
| | | * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not | |
| | | * @param breakConversion <b>IN</b>: Line break conversion mode | |
| | | * @return Error code or 0 on success | |
| | | * | |
| | | * @see uriDissectQueryMallocA | |
| | | * @see uriComposeQueryExA | |
| | | * @see uriFreeQueryListA | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemC | |
| | | ount, | |
| | | const URI_CHAR * first, const URI_CHAR * afterLast, | |
| | | UriBool plusToSpace, UriBreakConversion breakConversion); | |
| | | | |
| | | /** | |
| | | * Frees all memory associated with the given query list. | |
| | | * The the structure itself is freed as well. | |
| | | * | |
| | | * @param queryList <b>INOUT</b>: Query list to free | |
| | | * | |
| | | * @since 0.7.0 | |
| | | */ | |
| | | void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
End of changes. 49 change blocks. |
| 60 lines changed or deleted | | 353 lines changed or added | |
|