Debian Codegraph @

3rdparty/osgXR/src/OpenXR/Path.h

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-only
2 // Copyright (C) 2021 James Hogan <[email protected]>
3
4 #ifndef OSGXR_OPENXR_PATH
5 #define OSGXR_OPENXR_PATH 1
6
7 #include "Instance.h"
8
9 #include <osg/ref_ptr>
10
11 #include <string>
12
13 namespace osgXR {
14
15 namespace OpenXR {
16
17 class Path
18 {
19 public:
20
21 Path(Instance *instance = nullptr, XrPath path = XR_NULL_PATH);
22 Path(Instance *instance, const std::string &path);
23
24 // Error checking
25
26 inline bool valid() const
27 {
28 return _path != XR_NULL_PATH;
29 }
30
31 inline bool check(XrResult result, const char *actionMsg) const
32 {
33 return _instance->check(result, actionMsg);
34 }
35
36 // Conversions
37
38 inline const osg::ref_ptr<Instance> getInstance() const
39 {
40 return _instance;
41 }
42
43 inline XrInstance getXrInstance() const
44 {
45 return _instance->getXrInstance();
46 }
47
48 inline XrPath getXrPath() const
49 {
50 return _path;
51 }
52
53 std::string toString() const;
54
55 // Comparisons
56
57 bool operator == (const Path &other) const
58 {
59 return _path == other._path &&
60 _instance == other._instance;
61 }
62
63 bool operator != (const Path &other) const
64 {
65 return _path != other._path ||
66 _instance != other._instance;
67 }
68
69 protected:
70
71 // Path data
72 osg::ref_ptr<Instance> _instance;
73 XrPath _path;
74 };
75
76 } // osgXR::OpenXR
77
78 } // osgXR
79
80 #endif