ADTF  3.18.2
cUrl

Class for general URL representation, handling and verification against the IETF-STD66. More...

Classes

class  cAuthority
 Subclass representing and handling the authority subset as part of cUrl. More...
 
class  cQuery
 Subclass representing and handling the query subset as part of cUrl. More...
 

Public Member Functions

 cUrl (const cString &strUrl)
 Constructor. More...
 
 cUrl ()
 Default constructor. More...
 
 ~cUrl ()
 Destructor.
 
tResult Validate (const cString &strUrl)
 Validation of the URL object. More...
 
tBool IsValid () const
 Checks for the URL's validity. More...
 
tURIComponents GetComponents () const
 Getter method to read the components of the currently abstracted URL. More...
 
A_UTILS_NS::cString GetScheme () const
 Getter method to read the scheme bit of the URL object. More...
 
cAuthority GetAuthority () const
 Getter method to read the authority bit of the URL object. More...
 
A_UTILS_NS::cString GetPath () const
 Getter method to read the path bit of the URL object. More...
 
cQuery GetQuery () const
 Getter method to read the query bit of the URL object. More...
 
A_UTILS_NS::cString GetFragment () const
 Getter method to read the fragment bit of the URL object. More...
 
A_UTILS_NS::cString AsString () const
 Exports the URL back as string. More...
 

Private Attributes

tURIComponents m_sComponents
 < Working data representing the individual parts of any full URL's More...
 
tBool m_bIsValidURL
 The URL as string representation.
 
A_UTILS_NS::cString m_strFullUriString
 

Detailed Description

Class for general URL representation, handling and verification against the IETF-STD66.

The URL class simplifies the access to the values of any URL, passed as cString. It has to fulfill the following scheme pattern:

$uri-scheme$://$user$:$password$@$host_or_address$:$port$/?$option1$&$option2$=$value2$#$fragment$
See also
http://tools.ietf.org/html/std66 for the full IETF specification.

This class aims to handle any URL complying to STD66. However, for reasons of backwards compatibility, the proprietary syntax of the URLs introduced in earlier utils pattern is supported as well.
STD-66 URLs might bear the following structure:

Interpretation of the individual parts, however, depend on upper application layers linking against the A_UTILS library.

In contrast to STD-66 URLs, proprietary URLs with following scheme are supported

  • tcp://127.0.0.1:5001{timeout=1000,max_pkg_size=65000}
  • udp://127.0.0.1:5002{timeout=1000,max_pkg_size=65000}

Usage: After construction you should call function cUrl::IsValid() to determine the URL's validity. If it is found to be valid, cUrl::cQuery and cUrl::cAuthority along with the Getter methods can be used to extract the required URL parts and subsets.

Definition at line 46 of file url.h.

Constructor & Destructor Documentation

◆ cUrl() [1/2]

cUrl ( const cString strUrl)

Constructor.

Parameters
strUrlThe full URL that shall be abstracted and validated.

◆ cUrl() [2/2]

cUrl ( )

Default constructor.

Note
When using the default constructor, cUrl::Validate() has to be called separately.

Member Function Documentation

◆ AsString()

A_UTILS_NS::cString AsString ( ) const

Exports the URL back as string.

Returns
The url string.

◆ GetAuthority()

cAuthority GetAuthority ( ) const

Getter method to read the authority bit of the URL object.

Returns
The authority string (not validated).

◆ GetComponents()

tURIComponents GetComponents ( ) const

Getter method to read the components of the currently abstracted URL.

Returns
The components.
Note
Using this method, the developer has to assure the validity of the URL object separately.

◆ GetFragment()

A_UTILS_NS::cString GetFragment ( ) const

Getter method to read the fragment bit of the URL object.

Returns
The fragment string if any.

◆ GetPath()

A_UTILS_NS::cString GetPath ( ) const

Getter method to read the path bit of the URL object.

Returns
The path string if any.

◆ GetQuery()

cQuery GetQuery ( ) const

Getter method to read the query bit of the URL object.

Returns
The query string if any (not validated).

◆ GetScheme()

A_UTILS_NS::cString GetScheme ( ) const

Getter method to read the scheme bit of the URL object.

Returns
The scheme string.

◆ IsValid()

tBool IsValid ( ) const

Checks for the URL's validity.

Return values
tFalseif the URL or any of it's subsets are invalid or have not yet been validated.
tTrueif the URL is valid and it's values could be extracted successfully.

◆ Validate()

tResult Validate ( const cString strUrl)

Validation of the URL object.

If given url is valid it will be also set for current object.

Postcondition
The values are abstracted and stored by cUrl::cAuthority and cUrl::cQuery
Parameters
strUrlThe URL string to set and validate.
Return values
ERR_NOERRORA valid URL has been given and it's subset have successfully been read
ERR_INVALID_ARGThe URL is syntactically invalid or incomplete

Member Data Documentation

◆ m_sComponents

tURIComponents m_sComponents
private

< Working data representing the individual parts of any full URL's

Boolean flag used to determine if the URL has already been verified

Definition at line 332 of file url.h.