|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS ��NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CUri { public: CUri(); ~CUri(); public: void Create(const WCHAR *pszSource); const WCHAR *GetSource(); bool IsAbsolute(); bool GetScheme(CString &strScheme); bool GetAuthority(CString &strAuthority); bool IsRelativePath(); int GetSegmentCount(); CString GetSegment(int nIndex); bool GetQuery(CString &strQuery); bool GetOpaquePart(CString &strOpaquePart); bool GetFragment(CString &strFragment); CString ResolveUri(const WCHAR *pszUri); public: static bool FileNameToUri( const WCHAR *pszFileName, CString &strUri); static bool UriToFileName( const WCHAR *pszUri, CString &strFileName); };
The representation for the Universal Resource Identifier (URI).
Member functions of this class can be used for fetching URI components and for resolution of relative URI. Furthermore, few static functions provide conversions between URI and file path names of the local file system.
Constructor/Destructor Summary | |
CUri
();
����������Constructs the URI. |
|
~CUri
();
����������Destroys the URI. |
Function Summary | |
void
|
Create
(const WCHAR *pszSource);
����������Creates the URI from the specified source string containing the URI text. |
const�WCHAR�*
|
GetSource
();
����������Returns a source string containing the text of this URI. |
bool
|
IsAbsolute
();
����������Tests whether this URI is absolute (that is, conforms to the absoluteURI
syntax
defined by RFC 2396). |
bool
|
GetScheme
(CString &strScheme);
����������Returns a string representing the scheme
component of this URI. |
bool
|
GetAuthority
(CString &strAuthority);
����������Returns a string representing the authority
component of this URI. |
bool
|
IsRelativePath
();
����������Tests whether this URI is relative and contains a relative path component (that is, a component which conforms to the rel_path
syntax rule defined by RFC 2396). |
int
|
GetSegmentCount
();
����������Returns a number of segments in the path of this URI. |
CString
|
GetSegment
(int nIndex);
����������Returns a string representing a segment in the path of this URI at the specified index. |
bool
|
GetQuery
(CString &strQuery);
����������Returns a string representing the query
component of this URI. |
bool
|
GetOpaquePart
(CString &strOpaquePart);
����������Returns a string representing the opaque_part
component of this URI. |
bool
|
GetFragment
(CString &strFragment);
����������Returns a string representing the fragment
component of this URI. |
CString
|
ResolveUri
(const WCHAR *pszUri);
����������Resolves a specified relative URI using this URI object as the base. |
bool
|
FileNameToUri
(const WCHAR *pszFileName, CString &strUri);
����������Converts a file path to an URI. |
bool
|
UriToFileName
(const WCHAR *pszUri, CString &strFileName);
����������Converts an absolute URI to a file path. |
Constructor/Destructor Detail |
CUri();
Constructs the URI.
The contents of URI remains unspecified until
the member function
Create
is called.
~CUri();
Destroys the URI.
Function Detail |
void Create(const WCHAR *pszSource);
Creates the URI from the specified source string containing the URI text.
pszSource
- the source string containing
the URI textconst WCHAR *GetSource();
Returns a source string containing the text of this URI.
bool IsAbsolute();
Tests whether this URI is absolute (that is,
conforms to the
absoluteURI
syntax
defined by RFC 2396).
true
if this URI is absolute;
false
otherwisebool GetScheme(CString &strScheme);
Returns a string representing the
scheme
component of this URI.
strScheme
- on return, the string
representing the
scheme
component of this URI;
unspecified if this component is not presenttrue
if the
scheme
component is present in this URI;
false
otherwisebool GetAuthority(CString &strAuthority);
Returns a string representing the
authority
component of this URI.
strAuthority
- on return, the string
representing the
authority
component of this URI;
unspecified if this component is not presenttrue
if the
authority
component is present in this URI;
false
otherwisebool IsRelativePath();
Tests whether this URI is relative and
contains a relative path component
(that is, a component which conforms to the
rel_path
syntax rule defined by RFC 2396).
true
if this URI is relative and
contains a relative path component;
false
otherwiseint GetSegmentCount();
Returns a number of segments in the path of this URI.
Each
segment
and
rel_segment
component is counted as a segment. If this URI is absolute
and contains
opaque_part
, the number of
segments is
0
.
CString GetSegment(int nIndex);
Returns a string representing a segment in the path of this URI at the specified index.
nIndex
- the index (zero-based)bool GetQuery(CString &strQuery);
Returns a string representing the
query
component of this URI.
strQuery
- on return, the string
representing the
query
component of this URI;
unspecified if this component is not presenttrue
if the
query
component is present in this URI;
false
otherwisebool GetOpaquePart(CString &strOpaquePart);
Returns a string representing the
opaque_part
component of this URI.
strOpaquePart
- on return, the string
representing the
opaque_part
component of this URI;
unspecified if this component is not presenttrue
if the
opaque_part
component is present in this URI;
false
otherwisebool GetFragment(CString &strFragment);
Returns a string representing the
fragment
component of this URI.
strFragment
- on return, the string
representing the
fragment
component of this URI;
unspecified if this component is not presenttrue
if the
fragment
component is present in this URI;
false
otherwiseCString ResolveUri(const WCHAR *pszUri);
Resolves a specified relative URI using this URI object as the base.
If the specified URI is absolute, it is returned unchanged as the result of this function. If the specified URI is relative, it is resolved as specified in RFC 2396, section "5.2. Resolving Relative References to Absolute Form"; the URI represented by this URI object is used as the base URI.
It is an error if the URI represented by this object is not absolute.
pszUri
- the URI to resolvestatic bool FileNameToUri( const WCHAR *pszFileName, CString &strUri);
Converts a file path to an URI.
The file path syntax is platform-dependent. The conversion algorithm is platform-dependent.
Relative file path strings are resolved to the absolute form in the platform-dependent way.
The conversion may fail due to the invalid syntax of the input file path.
pszFileName
- the input file path stringstrUri
- on return, the URI string obtained
as the result of conversion; unspecified if conversion failedtrue
if conversion was successful;
false
if conversion failedstatic bool UriToFileName( const WCHAR *pszUri, CString &strFileName);
Converts an absolute URI to a file path.
The file path syntax is platform-dependent. The conversion algorithm is platform-dependent.
The input URI must represent an absolute file URI,
that is, it must start with
"file:///"
or
"file://localhost/"
.
The conversion may fail due to the invalid or unsupported syntax of the input URI.
pszUri
- the input URI stringstrFileName
- on return, the file path string obtained
as the result of conversion; unspecified if conversion failedtrue
if conversion was successful;
false
if conversion failed
|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS ��NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |