cesium-native 0.43.0
Loading...
Searching...
No Matches
Uri.h
1#pragma once
2
3#include <functional>
4#include <string>
5
6namespace CesiumUtility {
11class Uri final {
12public:
29 static std::string resolve(
30 const std::string& base,
31 const std::string& relative,
32 bool useBaseQuery = false,
33 bool assumeHttpsDefault = true);
44 static std::string addQuery(
45 const std::string& uri,
46 const std::string& key,
47 const std::string& value);
60 static std::string
61 getQueryValue(const std::string& uri, const std::string& key);
62
70 typedef std::string
71 SubstitutionCallbackSignature(const std::string& placeholder);
72
87 static std::string substituteTemplateParameters(
88 const std::string& templateUri,
89 const std::function<SubstitutionCallbackSignature>& substitutionCallback);
90
97 static std::string escape(const std::string& s);
98
106 static std::string unescape(const std::string& s);
107
119 static std::string unixPathToUriPath(const std::string& unixPath);
120
135 static std::string windowsPathToUriPath(const std::string& windowsPath);
136
150 static std::string nativePathToUriPath(const std::string& nativePath);
151
162 static std::string uriPathToUnixPath(const std::string& uriPath);
163
174 static std::string uriPathToWindowsPath(const std::string& uriPath);
175
188 static std::string uriPathToNativePath(const std::string& uriPath);
189
197 static std::string getPath(const std::string& uri);
198
208 static std::string
209 setPath(const std::string& uri, const std::string& newPath);
210};
211} // namespace CesiumUtility
A class for building and manipulating Uniform Resource Identifiers (URIs).
Definition Uri.h:11
static std::string getPath(const std::string &uri)
Gets the path portion of the URI. This will not include path parameters, if present.
static std::string uriPathToWindowsPath(const std::string &uriPath)
Converts the path portion of a URI to a Windows file system path. Percent-encoded characters in the U...
static std::string resolve(const std::string &base, const std::string &relative, bool useBaseQuery=false, bool assumeHttpsDefault=true)
Attempts to resolve a relative URI using a base URI.
static std::string addQuery(const std::string &uri, const std::string &key, const std::string &value)
Adds the given key and value to the query string of a URI. For example, addQuery("https://api....
static std::string setPath(const std::string &uri, const std::string &newPath)
Sets the path portion of a URI to a new value. The other portions of the URI are left unmodified,...
static std::string nativePathToUriPath(const std::string &nativePath)
Converts a file system path on the current system to a string suitable for use as the path portion of...
static std::string getQueryValue(const std::string &uri, const std::string &key)
Obtains the value of the given key from the query string of the URI, if possible.
static std::string windowsPathToUriPath(const std::string &windowsPath)
Converts a Windows file system path to a string suitable for use as the path portion of a URI....
static std::string substituteTemplateParameters(const std::string &templateUri, const std::function< SubstitutionCallbackSignature > &substitutionCallback)
Substitutes the placeholders in a templated URI with their appropriate values obtained using a specif...
static std::string uriPathToUnixPath(const std::string &uriPath)
Converts the path portion of a URI to a Unix file system path. Percent-encoded characters in the URI ...
static std::string escape(const std::string &s)
Escapes a portion of a URI, percent-encoding disallowed characters.
std::string SubstitutionCallbackSignature(const std::string &placeholder)
A callback to fill-in a placeholder value in a URL.
Definition Uri.h:71
static std::string unescape(const std::string &s)
Unescapes a portion of a URI, decoding any percent-encoded characters.
static std::string uriPathToNativePath(const std::string &uriPath)
Converts the path portion of a URI to a file system path on the current system. Percent-encoded chara...
static std::string unixPathToUriPath(const std::string &unixPath)
Converts a Unix file system path to a string suitable for use as the path portion of a URI....
Utility classes for Cesium.