OSVR-Core
ResourcePath.h
Go to the documentation of this file.
1 
12 // Copyright 2014 Sensics, Inc.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 
26 #ifndef INCLUDED_ResourcePath_h_GUID_00432A94_11D2_47B4_7493_4F66E635FBE2
27 #define INCLUDED_ResourcePath_h_GUID_00432A94_11D2_47B4_7493_4F66E635FBE2
28 
29 // Internal Includes
30 // - none
31 
32 // Library/third-party includes
33 // - none
34 
35 // Standard includes
36 #include <string>
37 #include <vector>
38 #include <cstddef>
39 
40 namespace osvr {
41 namespace util {
42  class ResourcePath;
43 
61  class ResourcePath {
62  public:
64  ResourcePath();
65 
67  explicit ResourcePath(std::string const &url);
68 
70  explicit ResourcePath(const char *url);
71 
75  ResourcePath GetParent() const;
76 
80  ResourcePath GetChild(std::string const &childName) const;
81 
84  ResourcePath GetChild(const char *childName) const;
85 
91  std::string GetString() const;
92 
94  std::string GetHostString() const;
95 
98  std::string GetPathString() const;
100 
105  std::size_t GetDepth() const;
106 
112  std::string GetComponent(std::size_t i) const;
114 
115  private:
116  std::string m_host;
117  std::string m_path;
118  typedef std::vector<std::size_t> IndexArray;
119  IndexArray m_components;
120  };
121 } // namespace util
122 } // namespace osvr
123 
124 #endif // INCLUDED_ResourcePath_h_GUID_00432A94_11D2_47B4_7493_4F66E635FBE2
Definition: RunLoopManager.h:42
std::string GetComponent(std::size_t i) const
Gets the identified component, where 0 is the name of the component immediately under the root...
std::string GetPathString() const
Gets the path following the hostname as a string, starting with a leading slash.
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
ResourcePath GetChild(std::string const &childName) const
Go to the named child.
Class representing a host and resource path in the OSVR logical system.
Definition: ResourcePath.h:61
std::string GetHostString() const
Gets the host portion of the path as a string.
ResourcePath()
Default constructor - initializes to osvr://localhost/ (root)
ResourcePath GetParent() const
Go to parent path.