##

URI.hh
Go to the documentation of this file.
/*
* Copyright (C) 2016 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_COMMON_URI_HH_
#define GAZEBO_COMMON_URI_HH_
#include <memory>
#include <string>
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace common
{
// Forward declare private data classes.
class URIPathPrivate;
class URIQueryPrivate;
class URIPrivate;
class GZ_COMMON_VISIBLE URIPath
{
public: URIPath();
public: URIPath(const URIPath &_path);
public: explicit URIPath(const std::string &_str);
public: virtual ~URIPath();
public: void Clear();
public: void PushFront(const std::string &_part);
public: void PushBack(const std::string &_part);
public: const URIPath &operator/=(const std::string &_part);
public: const URIPath operator/(const std::string &_part) const;
public: bool operator==(const URIPath &_path) const;
public: std::string Str(const std::string &_delim = "/") const;
public: URIPath &operator=(const URIPath &_path);
public: static bool Valid(const std::string &_str);
public: bool Valid() const;
public: bool Parse(const std::string &_str);
public: bool Contains(const URIPath &_other) const;
private: std::unique_ptr<URIPathPrivate> dataPtr;
};
class GZ_COMMON_VISIBLE URIQuery
{
public: URIQuery();
public: explicit URIQuery(const std::string &_str);
public: URIQuery(const URIQuery &_query);
public: virtual ~URIQuery();
public: void Clear();
public: void Insert(const std::string &_key,
const std::string &_value);
public: URIQuery &operator=(const URIQuery &_query);
public: bool operator==(const URIQuery &_query) const;
public: std::string Str(const std::string &_delim = "&") const;
public: static bool Valid(const std::string &_str);
public: bool Valid() const;
public: bool Parse(const std::string &_string);
private: std::unique_ptr<URIQueryPrivate> dataPtr;
};
class GZ_COMMON_VISIBLE URI
{
public: URI();
// cppcheck-suppress noExplicitConstructor
public: URI(const std::string &_str);
public: URI(const URI &_uri);
public: ~URI();
public: std::string Str() const;
public: void Clear();
public: std::string Scheme() const;
public: void SetScheme(const std::string &_scheme);
public: URIPath &Path();
public: const URIPath &Path() const;
public: URIQuery &Query();
public: const URIQuery &Query() const;
public: URI &operator=(const URI &_uri);
public: bool operator==(const URI &_uri) const;
public: bool Valid() const;
public: static bool Valid(const std::string &_str);
public: bool Parse(const std::string &_str);
private: std::unique_ptr<URIPrivate> dataPtr;
};
}
}
#endif
gazebo::common::URI::Str
std::string Str() const
Get the URI as a string, which has the form:
gazebo::common::URI
A complete URI.
Definition: URI.hh:176
gazebo::common::URI::Scheme
std::string Scheme() const
Get the URI's scheme.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::URIPath::PushBack
void PushBack(const std::string &_part)
Push a new part onto the back of this path.
gazebo::common::URI::~URI
~URI()
Destructor.
gazebo::common::URIQuery
The query component of a URI.
Definition: URI.hh:115
gazebo::common::URIPath::Valid
bool Valid() const
Return true if this is a valid path.
common
common
Definition: FuelModelDatabase.hh:37
gazebo::common::URI::Valid
bool Valid() const
Validate this URI.
gazebo::common::URIQuery::Insert
void Insert(const std::string &_key, const std::string &_value)
Get this query with a new _key=_value pair added.
gazebo::common::URIPath::Str
std::string Str(const std::string &_delim="/") const
Get the path as a string.
gazebo::common::URIQuery::URIQuery
URIQuery()
Constructor.
system.hh
gazebo::common::URIQuery::Str
std::string Str(const std::string &_delim="&") const
Get the query as a string.
gazebo::common::URI::operator==
bool operator==(const URI &_uri) const
Return true if the two URIs match.
gazebo::common::URIQuery::operator==
bool operator==(const URIQuery &_query) const
Return true if the two queries contain the same values.
gazebo::common::URIPath::PushFront
void PushFront(const std::string &_part)
Push a new part onto the front of this path.
gazebo::common::URIQuery::Clear
void Clear()
Remove all values of the query.
gazebo::common::URIPath::operator/=
const URIPath & operator/=(const std::string &_part)
Compound assignment operator.
gazebo::common::URI::Path
URIPath & Path()
Get a mutable version of the path component.
gazebo::common::URIPath::Parse
bool Parse(const std::string &_str)
Parse a string as URIPath.
gazebo::common::URIPath
The path component of a URI.
Definition: URI.hh:35
gazebo::common::URIQuery::operator=
URIQuery & operator=(const URIQuery &_query)
Equal operator.
gazebo::common::URIPath::URIPath
URIPath()
Constructor.
gazebo::common::URIQuery::~URIQuery
virtual ~URIQuery()
Destructor.
gazebo::common::URI::Query
URIQuery & Query()
Get a mutable version of the query component.
gazebo::common::URIPath::Clear
void Clear()
Remove all parts of the path.
gazebo::common::URI::operator=
URI & operator=(const URI &_uri)
Equal operator.
gazebo::common::URI::Clear
void Clear()
Remove all components of the URI.
gazebo::common::URIPath::operator/
const URIPath operator/(const std::string &_part) const
Get the current path with the _part added to the end.
gazebo::common::URIPath::~URIPath
virtual ~URIPath()
Destructor.
gazebo::common::URIQuery::Valid
bool Valid() const
Check if this is a valid URI query.
gazebo::common::URI::URI
URI()
Default constructor.
gazebo::common::URI::SetScheme
void SetScheme(const std::string &_scheme)
Set the URI's scheme.
gazebo::common::URIPath::operator=
URIPath & operator=(const URIPath &_path)
Equal operator.
gazebo::common::URIPath::operator==
bool operator==(const URIPath &_path) const
Return true if the two paths match.
gazebo::common::URIPath::Contains
bool Contains(const URIPath &_other) const
Returns true if _other is a subset of this, counting from the beginning.
gazebo::common::URIQuery::Parse
bool Parse(const std::string &_string)
Parse a string as URIQuery.
gazebo::common::URI::Parse
bool Parse(const std::string &_str)
Parse a string as URI.