OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ParseAlias.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_ParseAlias_h_GUID_F34B71BE_C378_4999_CE65_16AC5D1A80F1
26 #define INCLUDED_ParseAlias_h_GUID_F34B71BE_C378_4999_CE65_16AC5D1A80F1
27 
28 // Internal Includes
29 #include <osvr/Common/Export.h>
30 
31 // Library/third-party includes
32 #include <json/value.h>
33 
34 // Standard includes
35 #include <string>
36 
37 namespace osvr {
38 namespace common {
39  class ParsedAlias {
40  public:
42  OSVR_COMMON_EXPORT ParsedAlias(std::string const &src);
43 
45  ParsedAlias(Json::Value src);
46 
48  OSVR_COMMON_EXPORT bool isValid() const;
49 
51  OSVR_COMMON_EXPORT bool isSimple() const;
52 
54  OSVR_COMMON_EXPORT std::string getLeaf() const;
55 
57  void setLeaf(std::string const &leaf);
58 
60  OSVR_COMMON_EXPORT std::string getAlias() const;
61 
64  OSVR_COMMON_EXPORT Json::Value getAliasValue() const;
65 
66  private:
67  void m_parse(std::string const &src);
68  void m_parse(Json::Value &val);
69  Json::Value &m_leaf();
70  Json::Value const &m_leaf() const;
71  bool m_simple;
72  Json::Value m_value;
73  };
74 } // namespace common
75 } // namespace osvr
76 #endif // INCLUDED_ParseAlias_h_GUID_F34B71BE_C378_4999_CE65_16AC5D1A80F1
bool isValid() const
Did the alias parse in a valid way?
Definition: ParseAlias.cpp:66
ParsedAlias(std::string const &src)
Constructor - performs parse and normalization of format.
Definition: ParseAlias.cpp:60
Json::Value getAliasValue() const
Gets a copy of the normalized version of the alias as a Json::Value.
Definition: ParseAlias.cpp:85
std::string getLeaf() const
Get the ultimate source/leaf of the alias.
Definition: ParseAlias.cpp:69
std::string getAlias() const
Get the normalized, cleaned, compacted version of the alias.
Definition: ParseAlias.cpp:72
Automatically-generated export header - do not edit!
void setLeaf(std::string const &leaf)
Set the leaf of the alias: should be an absolute path.
Definition: ParseAlias.cpp:70
bool isSimple() const
Is this a simple (string-only, no transform) alias?
Definition: ParseAlias.cpp:68