knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
URI.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_URI_H
7 #define KNOWROB_URI_H
8 
9 #include <string>
10 #include <optional>
11 #include <boost/property_tree/ptree.hpp>
12 
13 namespace knowrob {
17  class URI {
18  public:
22  explicit URI(std::string_view path);
23 
27  explicit URI(const boost::property_tree::ptree &property_tree);
28 
35  URI(std::string path, std::string protocol, std::string host, int port);
36 
42  static std::string resolve(const std::string_view &uriString);
43 
47  static std::optional<std::string> getHomePath(void);
48 
52  const auto &operator()() const { return uri_; }
53 
57  const std::string &path() const { return path_; }
58 
59  protected:
62  boost::optional<std::string> protocol_;
63  boost::optional<std::string> host_;
64  boost::optional<int> port_;
65 
66  void updateURI();
67  };
68 }
69 
70 #endif //KNOWROB_URI_H
boost::optional< int > port_
Definition: URI.h:64
URI(const boost::property_tree::ptree &property_tree)
boost::optional< std::string > host_
Definition: URI.h:63
const std::string & path() const
Definition: URI.h:57
static std::string resolve(const std::string_view &uriString)
void updateURI()
URI(std::string_view path)
boost::optional< std::string > protocol_
Definition: URI.h:62
const auto & operator()() const
Definition: URI.h:52
std::string uri_
Definition: URI.h:60
std::string path_
Definition: URI.h:61
URI(std::string path, std::string protocol, std::string host, int port)
static std::optional< std::string > getHomePath(void)
TermRule & string()
Definition: terms.cpp:63