cesium-native  0.41.0
Uri.h
1 #pragma once
2 
3 #include <functional>
4 #include <string>
5 
6 namespace CesiumUtility {
7 class Uri final {
8 public:
9  static std::string resolve(
10  const std::string& base,
11  const std::string& relative,
12  bool useBaseQuery = false,
13  bool assumeHttpsDefault = true);
14  static std::string addQuery(
15  const std::string& uri,
16  const std::string& key,
17  const std::string& value);
18  static std::string
19  getQueryValue(const std::string& uri, const std::string& key);
20 
21  typedef std::string
22  SubstitutionCallbackSignature(const std::string& placeholder);
23  static std::string substituteTemplateParameters(
24  const std::string& templateUri,
25  const std::function<SubstitutionCallbackSignature>& substitutionCallback);
26 
33  static std::string escape(const std::string& s);
34 
42  static std::string unescape(const std::string& s);
43 
55  static std::string unixPathToUriPath(const std::string& unixPath);
56 
71  static std::string windowsPathToUriPath(const std::string& windowsPath);
72 
86  static std::string nativePathToUriPath(const std::string& nativePath);
87 
98  static std::string uriPathToUnixPath(const std::string& uriPath);
99 
110  static std::string uriPathToWindowsPath(const std::string& uriPath);
111 
124  static std::string uriPathToNativePath(const std::string& uriPath);
125 
133  static std::string getPath(const std::string& uri);
134 
144  static std::string
145  setPath(const std::string& uri, const std::string& newPath);
146 };
147 } // namespace CesiumUtility
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 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 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 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.
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.