UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
UPnPsdk::CUri Class Reference

Representing a URI that can be modified with a relative reference. More...

#include <uri.hpp>

+ Collaboration diagram for UPnPsdk::CUri:

Public Member Functions

 CUri (std::string a_uriref_str)
 Initialize with the base URI.
 
void operator= (std::string a_relref_str)
 Set a relative resource reference.
 
CComponent::STATE state () const
 Get state of the URI.
 
std::string str () const
 Get the resulting URI string merged with the relative reference.
 

Public Attributes

CUriRef base
 Base URI.
 
CUriRef target
 Resulting URI of merged relative reference to the base URI.
 

Detailed Description

Representing a URI that can be modified with a relative reference.

// Usage e.g.:
try {
CUri uriObj("https://example.com/path/");
uriObj = "/to/res";
std::cout << uriObj.str() << '\n'; // "https://example.com/to/res"
uriObj = "to/res";
std::cout << uriObj.str() << '\n'; // "https://example.com/path/to/res"
} catch (const std::invalid_argument& ex) {
std::cerr << "Error! " << ex.what() << '\n';
handle_error();
}
Representing a URI that can be modified with a relative reference.
Definition uri.hpp:443

On the once given base URI with the constructor, a relative reference can be modified multible times.

Note
This class succeeds the normal examples as given at RFC3986 5.4. If in daubt have look there.

Definition at line 443 of file uri.hpp.

Constructor & Destructor Documentation

◆ CUri()

UPnPsdk::CUri::CUri ( std::string  a_uriref_str)

Initialize with the base URI.

Exceptions
std::invalid_argument
  • if host pattern is invalid. No DNS lookup is performed.
  • if port number is invalid.
  • if invalid percent encoding is detected.
  • if a relative reference without scheme component is given.
Parameters
[in]a_uriref_strSetting an absolute URI, means must have a scheme.

Definition at line 1024 of file uri.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ operator=()

void UPnPsdk::CUri::operator= ( std::string  a_relref_str)

Set a relative resource reference.

Exceptions
std::invalid_argument
  • if host pattern is invalid. No DNS lookup is performed.
  • if port number is invalid.
  • if invalid percent encoding is detected.
  • if an absolute URI with scheme component is given.
Parameters
[in]a_relref_strString with a relative reference for the Base URI set with the constructor.

Definition at line 1037 of file uri.cpp.

+ Here is the call graph for this function:

◆ state()

CComponent::STATE UPnPsdk::CUri::state ( ) const

Get state of the URI.

Definition at line 1094 of file uri.cpp.

+ Here is the call graph for this function:

◆ str()

std::string UPnPsdk::CUri::str ( ) const

Get the resulting URI string merged with the relative reference.

If no relative reference is given then just the base URI is returned.

Definition at line 1101 of file uri.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ base

CUriRef UPnPsdk::CUri::base

Base URI.

Definition at line 446 of file uri.hpp.

◆ target

CUriRef UPnPsdk::CUri::target

Resulting URI of merged relative reference to the base URI.

Definition at line 448 of file uri.hpp.


The documentation for this class was generated from the following files: