Go to the documentation of this file.
17 #ifndef IGNITION_COMMON_URI_HH_
18 #define IGNITION_COMMON_URI_HH_
24 #include <ignition/common/Export.hh>
32 class URIAuthorityPrivate;
34 class URIQueryPrivate;
35 class URIFragmentPrivate;
88 public:
void SetUserInfo(
const std::string &_userInfo)
const;
96 public:
void SetHost(
const std::string &_host)
const;
100 public:
bool EmptyHostValid()
const;
106 public:
void SetEmptyHostValid(
bool _valid)
const;
110 public: std::optional<int> Port()
const;
113 public:
void SetPort(
int _port)
const;
118 public:
bool operator==(
const URIAuthority &_auth)
const;
136 bool _emptyHostValid =
false);
140 public:
bool Valid()
const;
149 bool _emptyHostValid =
false);
184 public:
void Clear();
188 public:
bool IsAbsolute()
const;
195 public:
void SetAbsolute(
bool _absolute =
true);
200 public:
void SetRelative();
245 public:
bool operator==(
const URIPath &_path)
const;
260 public:
static bool Valid(
const std::string &_str);
264 public:
bool Valid()
const;
296 public:
void Clear();
312 public:
bool operator==(
const URIQuery &_query)
const;
323 public:
static bool Valid(
const std::string &_str);
327 public:
bool Valid()
const;
359 public:
void Clear();
374 public:
bool operator==(
const URIFragment &_fragment)
const;
383 public:
static bool Valid(
const std::string &_str);
387 public:
bool Valid()
const;
406 class IGNITION_COMMON_VISIBLE
URI
416 bool _hasAuthority =
false);
420 public:
URI(
const URI &_uri);
433 public:
void Clear();
441 public:
void SetScheme(
const std::string &_scheme);
445 public:
void SetAuthority(
const URIAuthority &_authority);
452 public: std::optional<URIAuthority> Authority()
const;
460 public:
const URIPath &Path()
const;
468 public:
const URIQuery &Query()
const;
481 public:
URI &operator=(
const URI &_uri);
486 public:
bool operator==(
const URI &_uri)
const;
490 public:
bool Valid()
const;
495 public:
static bool Valid(
const std::string &_str);
bool IsAbsolute() const
Returns whether the path is absolute or not.
void SetEmptyHostValid(bool _valid) const
Set whether an empty host is considered valid. This should only be set to true if the corresponding U...
void Clear()
Remove all parts of the authority.
const URIPath operator/(const std::string &_part) const
Get the current path with the _part added to the end.
bool operator==(const URIPath &_path) const
Return true if the two paths match.
Forward declarations for the common classes.
std::string Str(const std::string &_delim="&") const
Get the query as a string.
void SetRelative()
Set the path to be relative.
void SetPort(int _port) const
Set the port number.
URIAuthority & operator=(const URIAuthority &_auth)
Assignment operator.
void SetAuthority(const URIAuthority &_authority)
Set the URI's authority.
URIFragment()
Constructor.
URIQuery & operator=(const URIQuery &_query)
Assignment operator.
std::string Scheme() const
Get the URI's scheme.
void Clear()
Remove all components of the URI.
void Clear()
Remove all values of the query.
bool Parse(const std::string &_string)
Parse a string as URIQuery.
std::string Str() const
Get the complete authoriy as a string.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Microsoft Visual Studio does not automatically export the interface information for member variables ...
Definition: SuppressWarning.hh:64
std::string PopFront()
Remove the part that's in the front of this path and return it.
bool Valid() const
Validate this URI.
virtual ~URIFragment()
Destructor.
bool Valid() const
Check if this is a valid URI query.
std::string PopBack()
Remove the part that's in the back of this path and return it.
void SetAbsolute(bool _absolute=true)
Set whether the path is to be treated absolute or not.
bool operator==(const URI &_uri) const
Return true if the two URIs match.
A URI path contains a sequence of segments separated by /. The path may be empty in a valid URI....
Definition: URI.hh:167
std::string Host() const
Get the host.
void PushBack(const std::string &_part)
Push a new part onto the back of this path.
A complete URI which has the following components:
Definition: URI.hh:406
The fragment component of a URI.
Definition: URI.hh:342
bool operator==(const URIQuery &_query) const
Return true if the two queries contain the same values.
URIAuthority()
Constructor.
std::optional< int > Port() const
Get the port.
bool Parse(const std::string &_str)
Parse a string as URIPath.
void SetScheme(const std::string &_scheme)
Set the URI's scheme.
std::string UserInfo() const
Get the user information.
bool Valid() const
Check if this is a valid URI fragment.
const URIPath & operator/=(const std::string &_part)
Compound assignment operator.
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
Definition: SuppressWarning.hh:67
URIFragment & operator=(const URIFragment &_fragment)
Assignment operator.
void Insert(const std::string &_key, const std::string &_value)
Get this query with a new _key=_value pair added.
The query component of a URI.
Definition: URI.hh:279
std::optional< URIAuthority > Authority() const
Get a copy of the URI's authority. If the authority has no value (as opposed to being empty),...
bool Parse(const std::string &_string)
Parse a string as URIFragment.
virtual ~URIAuthority()
Destructor.
URI & operator=(const URI &_uri)
Assignment operator.
void Clear()
Remove all parts of the path.
std::string Str() const
Get the fragment as a string.
void SetHost(const std::string &_host) const
Set the host.
URIFragment & Fragment()
Get a mutable version of the fragment component.
URIPath & Path()
Get a mutable version of the path component.
URIQuery & Query()
Get a mutable version of the query component.
bool operator==(const URIAuthority &_auth) const
Return true if the two authorities match.
std::string Str() const
Get the URI as a string, which has the form:
virtual ~URIQuery()
Destructor.
virtual ~URIPath()
Destructor.
URIPath & operator=(const URIPath &_path)
Assignment operator.
void PushFront(const std::string &_part)
Push a new part onto the front of this path.
bool Valid() const
Return true if this is a valid path.
bool Parse(const std::string &_str, bool _emptyHostValid=false)
Parse a string as URIAuthority.
bool Valid() const
Return true if this is a valid authority.
void Clear()
Remove all values of the fragment.
void SetUserInfo(const std::string &_userInfo) const
Set the user information.
URI()
Default constructor.
bool Parse(const std::string &_str)
Parse a string as URI. If there's no authority (i.e. Authority().has_value() == false),...
std::string Str(const std::string &_delim="/") const
Get the path as a string.
bool operator==(const URIFragment &_fragment) const
Return true if the two fragments contain the same values.
bool EmptyHostValid() const
True if an empty host is considered valid.