#include <URI.h>
|
| URI (std::string_view path) |
|
| URI (const boost::property_tree::ptree &property_tree) |
|
| URI (std::string path, std::string protocol, std::string host, int port) |
|
const auto & | operator() () const |
|
const std::string & | path () const |
|
| URI (std::string_view path) |
|
| URI (const boost::property_tree::ptree &property_tree) |
|
| URI (std::string path, std::string protocol, std::string host, int port) |
|
const auto & | operator() () const |
|
const std::string & | path () const |
|
|
static std::string | resolve (const std::string_view &uriString) |
|
static std::optional< std::string > | getHomePath (void) |
|
static std::string | resolve (const std::string_view &uriString) |
|
static std::optional< std::string > | getHomePath (void) |
|
|
std::string | uri_ |
|
std::string | path_ |
|
boost::optional< std::string > | protocol_ |
|
boost::optional< std::string > | host_ |
|
boost::optional< int > | port_ |
|
A URI is a uniform resource identifier.
Definition at line 17 of file URI.h.
◆ URI() [1/6]
URI::URI |
( |
std::string_view |
path | ) |
|
|
explicit |
- Parameters
-
Definition at line 19 of file URI.cpp.
const std::string & path() const
◆ URI() [2/6]
URI::URI |
( |
const boost::property_tree::ptree & |
property_tree | ) |
|
|
explicit |
- Parameters
-
property_tree | the property tree to construct the URI from. |
Definition at line 32 of file URI.cpp.
34 path_ = property_tree.get(
"path",
"/");
36 port_ = property_tree.get_optional<
int>(
"port");
boost::optional< int > port_
boost::optional< std::string > host_
boost::optional< std::string > protocol_
◆ URI() [3/6]
URI::URI |
( |
std::string |
path, |
|
|
std::string |
protocol, |
|
|
std::string |
host, |
|
|
int |
port |
|
) |
| |
- Parameters
-
path | the path of the URI. |
protocol | the protocol of the URI. |
host | the host of the URI. |
port | the port of the URI. |
Definition at line 24 of file URI.cpp.
27 host_(std::move(host)),
◆ URI() [4/6]
knowrob::URI::URI |
( |
std::string_view |
path | ) |
|
|
explicit |
◆ URI() [5/6]
knowrob::URI::URI |
( |
const boost::property_tree::ptree & |
property_tree | ) |
|
|
explicit |
- Parameters
-
property_tree | the property tree to construct the URI from. |
◆ URI() [6/6]
knowrob::URI::URI |
( |
std::string |
path, |
|
|
std::string |
protocol, |
|
|
std::string |
host, |
|
|
int |
port |
|
) |
| |
- Parameters
-
path | the path of the URI. |
protocol | the protocol of the URI. |
host | the host of the URI. |
port | the port of the URI. |
◆ getHomePath() [1/2]
std::optional< std::string > URI::getHomePath |
( |
void |
| ) |
|
|
static |
- Returns
- the home path of the current user.
Definition at line 53 of file URI.cpp.
55 auto env_drive = getenv(
"HOMEDRIVE");
56 auto env_path = getenv(
"HOMEPATH");
57 if (env_drive && env_path) {
60 KB_WARN(
"Could not determine home directory");
64 auto env_home = getenv(
"HOME");
68 struct passwd *pw = getpwuid(getuid());
72 KB_WARN(
"Could not determine home directory");
◆ getHomePath() [2/2]
static std::optional<std::string> knowrob::URI::getHomePath |
( |
void |
| ) |
|
|
static |
- Returns
- the home path of the current user.
◆ operator()() [1/2]
const auto& knowrob::URI::operator() |
( |
| ) |
const |
|
inline |
- Returns
- URI string of this data source.
Definition at line 52 of file URI.h.
◆ operator()() [2/2]
const auto& knowrob::URI::operator() |
( |
| ) |
const |
|
inline |
- Returns
- URI string of this data source.
Definition at line 52 of file URI.h.
◆ path() [1/2]
const std::string& knowrob::URI::path |
( |
| ) |
const |
|
inline |
- Returns
- string identifier of the data format.
Definition at line 57 of file URI.h.
◆ path() [2/2]
const std::string& knowrob::URI::path |
( |
| ) |
const |
|
inline |
- Returns
- string identifier of the data format.
Definition at line 57 of file URI.h.
◆ resolve() [1/2]
std::string URI::resolve |
( |
const std::string_view & |
uriString | ) |
|
|
static |
Resolves a URI string.
- Parameters
-
uriString | the URI string to resolve. |
- Returns
- the resolved URI string.
Definition at line 79 of file URI.cpp.
80 static std::filesystem::path projectPath(KNOWROB_SOURCE_DIR);
81 static std::filesystem::path installPath(KNOWROB_INSTALL_PREFIX);
82 static std::optional<std::string> homePath(
getHomePath());
84 std::filesystem::path filePath(uriString);
85 if (!exists(filePath)) {
86 std::vector<std::filesystem::path> possiblePaths;
88 possiblePaths.push_back(projectPath / filePath);
89 possiblePaths.push_back(projectPath /
"src" / filePath);
92 possiblePaths.push_back(std::filesystem::path(homePath.value()) /
".knowrob" / filePath);
95 possiblePaths.push_back(installPath /
"share" /
"knowrob" / filePath);
96 possiblePaths.push_back(installPath /
"lib" /
"knowrob" / filePath);
98 for (
const auto &p: possiblePaths) {
99 if (exists(p))
return p.u8string();
static std::optional< std::string > getHomePath(void)
◆ resolve() [2/2]
static std::string knowrob::URI::resolve |
( |
const std::string_view & |
uriString | ) |
|
|
static |
Resolves a URI string.
- Parameters
-
uriString | the URI string to resolve. |
- Returns
- the resolved URI string.
◆ updateURI() [1/2]
◆ updateURI() [2/2]
void knowrob::URI::updateURI |
( |
| ) |
|
|
protected |
◆ host_
boost::optional< std::string > knowrob::URI::host_ |
|
protected |
Definition at line 63 of file URI.h.
◆ path_
std::string knowrob::URI::path_ |
|
protected |
Definition at line 61 of file URI.h.
◆ port_
boost::optional< int > knowrob::URI::port_ |
|
protected |
Definition at line 64 of file URI.h.
◆ protocol_
boost::optional< std::string > knowrob::URI::protocol_ |
|
protected |
Definition at line 62 of file URI.h.
◆ uri_
std::string knowrob::URI::uri_ |
|
protected |
Definition at line 60 of file URI.h.
The documentation for this class was generated from the following files:
- build/_CPack_Packages/Linux/DEB/knowrob-2.1.0-Linux/usr/include/knowrob/URI.h
- src/URI.cpp