ADTF  3.18.2
url.h
Go to the documentation of this file.
1 
7 #ifndef _A_UTILS_URL_PARSER_
8 #define _A_UTILS_URL_PARSER_
9 
10 
11 namespace A_UTILS_NS
12 {
46 class cUrl
47 {
48 
49 public:
50 
58  class cQuery
59  {
60  friend class cUrl;
61 
62  public:
67  cQuery(const cString& strQuery = cString::Empty);
72 
73  public:
81  tResult Validate(const cString& strQuery);
82 
90  cString GetValue(const cString& strParameter,
91  const cString& strDefault = cString::Empty) const;
92 
97  cString AsString() const;
98 
105  tBool IsValid() const;
106 
107  private:
113  std::map<cString, cString> m_mapQuery;
114  };
115 
127  {
128 
129  friend class cUrl;
130 
131  public:
136  cAuthority(const cString& strAuthority = cString::Empty);
137 
142 
143  public:
152  tResult Validate(const cString& strAuthority);
153  //tBool isValidIPv6(); // ipv6 is enclosed in square brackets [ IPv6 ]
154 
160 
166 
181  tUInt16 GetPort() const;
182 
189  tBool IsValid() const;
190 
196 
197  private:
203  struct sAuthority
204  {
212  tUInt16 nPort;
213  } m_sAuthority;
214  };
215 
216 public:
218  typedef struct sURIComponents
219  {
228  cAuthority oAuthority;
237  cQuery oQuery;
242  } tURIComponents;
243 
244 public:
249  cUrl(const cString& strUrl);
250 
256  cUrl();
257 
261  ~cUrl();
262 
263 public:
275  tResult Validate(const cString& strUrl);
276 
284  tBool IsValid() const;
285 
293 
299 
305 
311 
316  cQuery GetQuery() const;
317 
323 
329 
330 private:
336  A_UTILS_NS::cString m_strFullUriString;
337 };
338 
339 }
340 
341 #endif // _A_UTILS_URL_PARSER_
uint16_t tUInt16
type definition for unsigned integer values (16bit) (platform and compiler independent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
Subclass representing and handling the authority subset as part of cUrl.
Definition: url.h:127
A_UTILS_NS::cString GetPassword() const
Retrieves the password if set.
tBool IsValidIPv4() const
The Host is a valid 1Pv4 adress.
tBool m_bIsValid
Working data representing the individual parts of any URL's authority subset.
Definition: url.h:201
tUInt16 GetPort() const
Retrieves the host port of the given URL is applicable.
A_UTILS_NS::cString AsString() const
Getter method to retrieve the raw query string.
tBool IsValid() const
Checks for the authority's validity.
tResult Validate(const cString &strAuthority)
Validation method for the authority subset.
A_UTILS_NS::cString m_strAuthority
< The raw, unparsed authority string
Definition: url.h:199
A_UTILS_NS::cString GetUser() const
Retrieves the username if set.
A_UTILS_NS::cString GetHost() const
Retrieves the host bit of the given URL.
cAuthority(const cString &strAuthority=cString::Empty)
Constructor of the authority subset of any URL.
Subclass representing and handling the query subset as part of cUrl.
Definition: url.h:59
tBool m_bIsValid
< Boolean flag used to determine if the url subset has already been verified
Definition: url.h:109
cString GetValue(const cString &strParameter, const cString &strDefault=cString::Empty) const
Method to read individual values of the query by their parameters.
tBool IsValid() const
Checks for the query's validity.
cString m_strQueryFull
Map to store the the query's value paris in.
Definition: url.h:111
cQuery(const cString &strQuery=cString::Empty)
Constructor for a Query subset of any URL.
cString AsString() const
Getter method to retrieve the raw query string.
tResult Validate(const cString &strQuery)
Validation procedure for the query subset.
Class for general URL representation, handling and verification against the IETF-STD66.
Definition: url.h:47
tBool m_bIsValidURL
The URL as string representation.
Definition: url.h:334
tResult Validate(const cString &strUrl)
Validation of the URL object.
A_UTILS_NS::cString GetPath() const
Getter method to read the path bit of the URL object.
A_UTILS_NS::cString AsString() const
Exports the URL back as string.
cQuery GetQuery() const
Getter method to read the query bit of the URL object.
~cUrl()
Destructor.
A_UTILS_NS::cString GetScheme() const
Getter method to read the scheme bit of the URL object.
tBool IsValid() const
Checks for the URL's validity.
cUrl()
Default constructor.
cAuthority GetAuthority() const
Getter method to read the authority bit of the URL object.
tURIComponents GetComponents() const
Getter method to read the components of the currently abstracted URL.
tURIComponents m_sComponents
< Working data representing the individual parts of any full URL's
Definition: url.h:332
cUrl(const cString &strUrl)
Constructor.
A_UTILS_NS::cString GetFragment() const
Getter method to read the fragment bit of the URL object.
static const _myType Empty
Internally used empty string.
Definition: string.h:54
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11
A_UTILS_NS::cString strLocation
The port if applicable.
Definition: url.h:210
A_UTILS_NS::cString strUser
< The username if any
Definition: url.h:206
A_UTILS_NS::cString strPassword
The location e.g. 127.0.0.1:80 or 0x1234.
Definition: url.h:208
URL component datatype.
Definition: url.h:219
A_UTILS_NS::cString strScheme
The URL scheme (e.g.
Definition: url.h:223
A_UTILS_NS::cString strFragment
An optional related to the referenced resource.
Definition: url.h:241
A_UTILS_NS::cString strPath
The optional resource path on the referenced host.
Definition: url.h:232
cQuery oQuery
An optional query related to the referenced host or the referenced resource thereon.
Definition: url.h:237
cAuthority oAuthority
The authority bit of the URL including user authentication and the hosts address parameters.
Definition: url.h:228