The Free and Open Productivity Suite
Follow us on Twitter: @ApacheOO

Developer's Guide

API

SDK

Tips 'n' Tricks

Miscellaneous


Global Functions in Global Namespace C++
in Sourcefile uri.h


rtl_getUriCharClass
extern "C"
const sal_Bool * rtl_getUriCharClass(
rtl_UriCharClass eCharClass );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Map a predefined rtl_UriCharClass to a form usable by rtl_uriEncode().
Parameters
eCharClass
    Any valid member of rtl_UriCharClass.

    
Return
An array of 128 booleans, to be used in calls to rtl_uriEncode().

rtl_uriConvertRelToAbs
extern "C"
sal_Bool rtl_uriConvertRelToAbs(
rtl_uString * pBaseUriRef,
rtl_uString * pRelUriRef,
rtl_uString * * pResult,
rtl_uString * * pException );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Convert a relative URI reference into an absolute one.
Description
A URI reference is a URI plus an optional <"#" fragment> part. This function uses the algorithm described in RFC 2396, section 5.2, with the following clarifications: (1) Backwards-compatible relative URIs starting with a scheme component (see RFC 2396, section 5.2, step 3) are not supported. (2) Segments "." and ".." within the path of the base URI are not considered special, RFC 2396 seems a bit unlcear about that point. (3) Erroneous excess segments ".." within the path of the relative URI (if it is indeed relative) are left intact, as the examples in RFC 2396, section C.2, suggest. (4) If the relative URI is a reference to the "current document," the "current document" is taken to be the base URI. This function signals exceptions by returning false and letting pException point to a message explaining the exception.
Parameters
pBaseUriRef
    An absolute, hierarchical URI reference that serves as the base URI.  If it
    has to be inspected (i.e., pRelUriRef is not an absolute URI already), and
    if it either is not an absolute URI (i.e., does not begin with a
     part) or has a path that is non-empty but does not start
    with "/", an exception will be signaled.

    
pRelUriRef
    An URI reference that may be either absolute or relative.  If it is
    absolute, it will be returned unmodified (and it need not be hierarchical
    then).

    
pResult
    Returns an absolute URI reference.  Must itself not be null, and must point
    to either null or a valid string.  If an exception is signalled, it is left
    unchanged.

    
pException
    Returns an explanatory message in case an exception is signalled.  Must
    itself not be null, and must point to either null or a valid string.  If no
    exception is signalled, it is left unchanged.

    
Return
True if no exception is signalled, otherwise false.

rtl_uriDecode
extern "C"
void rtl_uriDecode(
rtl_uString * pText,
rtl_UriDecodeMechanism eMechanism,
rtl_TextEncoding eCharset,
rtl_uString * * pResult );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Decode (a part of) a URI.
Parameters
pText
    Any Unicode string.  Must not be null.  (If the input is indeed part of a
    valid URI, this string will only contain a subset of the ASCII characters,
    but this function also handles other Unicode characters properly.)

    
eMechanism
    The mechanism describing how the input text is translated into a Unicode
    string.

    
eCharset
    When the decode mechanism is rtl_UriDecodeWithCharset, all escape
    sequences in the input text are interpreted as characters from this
    charset.  Those characters are translated to Unicode characters in the
    resulting output, if possible.

    When the decode mechanism is rtl_UriDecodeNone or rtl_UriDecodeToIuri,
    this parameter is ignored (and is best specified as
    RTL_TEXTENCODING_UTF8).

    
pResult
    Returns a decoded representation of the input text.  Must itself not be
    null, and must point to either null or a valid string.

    If the decode mechanism is rtl_UriDecodeStrict, and pText cannot be
    converted to eCharset because it contains (encodings of) unmappable
    characters (which implies that pText is not empty), then an empty string is
    returned.
 

rtl_uriEncode
extern "C"
void rtl_uriEncode(
rtl_uString * pText,
const sal_Bool * pCharClass,
rtl_UriEncodeMechanism eMechanism,
rtl_TextEncoding eCharset,
rtl_uString * * pResult );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Encode a text as (part of) a URI.
Parameters
pText
    Any Unicode string.  Must not be null.

    
pCharClass
    A char class, represented as an array of 128 booleans (true means keep the
    corresponding ASCII character unencoded, false means encode it).  Must not
    be null, and the boolean corresponding to the percent sign (0x25) must be
    false.  (See rtl_getUriCharClass() for a function mapping from
    rtl_UriCharClass to such arrays.)

    
eMechanism
    The mechanism describing how escape sequences in the input text are
    handled.

    
eCharset
    When Unicode characters from the input text have to be written using
    escape sequences (because they are either outside the ASCII range or do
    not belong to the given char class), they are first translated into this
    charset before being encoded using escape sequences.

    Also, if the encode mechanism is rtl_UriEncodeCheckEscapes, all escape
    sequences already present in the input text are interpreted as characters
    from this charset.

    
pResult
    Returns an encoded representation of the input text.  Must itself not be
    null, and must point to either null or a valid string.

    If the encode mechanism is rtl_UriEncodeStrict, and pText cannot be
    converted to eCharset because it contains unmappable characters (which
    implies that pText is not empty), then an empty string is returned.
 

Top of Page

Apache Software Foundation

Copyright & License | Privacy | Website Feedback | Contact Us | Donate | Thanks

Apache, the Apache feather logo, and OpenOffice are trademarks of The Apache Software Foundation. OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.