HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_PathSet.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_PathSet_h__
19 #define __HUSD_PathSet_h__
20 
21 #include "HUSD_API.h"
22 #include <UT/UT_StringArray.h>
23 #include <UT/UT_StringHolder.h>
24 #include <stddef.h>
25 #include <pxr/pxr.h>
26 
28 class XUSD_PathSet;
30 
31 class UT_WorkBuffer;
32 class HUSD_Path;
33 
35 {
36 public:
37  HUSD_PathSet();
39  HUSD_PathSet(const PXR_NS::XUSD_PathSet &src);
40  ~HUSD_PathSet();
41 
42  static const HUSD_PathSet &getEmptyPathSet();
43 
44  const HUSD_PathSet &operator=(const HUSD_PathSet &src);
45  bool operator==(const HUSD_PathSet &other) const;
46  bool operator!=(const HUSD_PathSet &other) const;
47  const HUSD_PathSet &operator=(const PXR_NS::XUSD_PathSet &src);
48  bool operator==(const PXR_NS::XUSD_PathSet
49  &other) const;
50  bool operator!=(const PXR_NS::XUSD_PathSet
51  &other) const;
52 
53  bool empty() const;
54  size_t size() const;
55  bool contains(const UT_StringRef &path) const;
56  bool contains(const HUSD_Path &path) const;
57  bool containsPathOrAncestor(
58  const UT_StringRef &path) const;
59  bool containsPathOrAncestor(
60  const HUSD_Path &path) const;
61  bool containsPathOrDescendant(
62  const UT_StringRef &path) const;
63  bool containsPathOrDescendant(
64  const HUSD_Path &path) const;
65  void clear();
66  void insert(const HUSD_PathSet &other);
67  void insert(const HUSD_Path &path);
68  void insert(const UT_StringRef &path);
69  void insert(const UT_StringArray &paths);
70  void erase(const HUSD_PathSet &other);
71  void erase(const HUSD_Path &path);
72  void erase(const UT_StringRef &path);
73  void erase(const UT_StringArray &paths);
74  void swap(HUSD_PathSet &other);
75 
76  PXR_NS::XUSD_PathSet &sdfPathSet()
77  { return *myPathSet; }
78  const PXR_NS::XUSD_PathSet &sdfPathSet() const
79  { return *myPathSet; }
80 
81  // Return a python object holding a set of SdfPath python objects.
82  void *getPythonPathList() const;
83  // Fill this path set from a python tuple of SdfPath python objects.
84  bool setPythonPaths(void *primpaths);
85 
86  // Fill a UT_StringArray with the paths in the SdfPathSet.
87  void getPathsAsStrings(UT_StringArray &paths) const;
88  // Return the string representation of the first path in the set.
89  UT_StringHolder getFirstPathAsString() const;
90 
91  size_t getMemoryUsage() const;
92 
94  public:
95  iterator();
96  iterator(void *internal_iterator);
97  iterator(const iterator &src);
98  iterator(iterator &&src);
99  ~iterator();
100 
101  bool operator==(const iterator &other) const;
102  bool operator!=(const iterator &other) const;
103 
104  HUSD_Path operator*() const;
105  iterator &operator++();
106  iterator &operator=(const iterator &src);
107  iterator &operator=(iterator &&src);
108 
109  private:
110  void *myInternalIterator;
111  friend class HUSD_PathSet;
112  };
113 
114  iterator begin() const;
115  iterator end() const;
116 
117 private:
118  PXR_NS::XUSD_PathSet *myPathSet;
119 };
120 
121 #endif
122 
vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
Definition: simd.h:3340
const PXR_NS::XUSD_PathSet & sdfPathSet() const
Definition: HUSD_PathSet.h:78
Color4< T > operator*(S a, const Color4< T > &v)
Definition: ImathColor.h:728
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
FMT_CONSTEXPR auto begin(const C &c) -> decltype(c.begin())
Definition: format.h:251
#define HUSD_API
Definition: HUSD_API.h:32
void swap(T &lhs, T &rhs)
Definition: pugixml.cpp:7172
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
GLuint GLuint end
Definition: glew.h:1253
bool OIIO_API contains(string_view a, string_view b)
Does 'a' contain the string 'b' within it?
GLsizei const GLchar *const * path
Definition: glew.h:6461
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
PXR_NS::XUSD_PathSet & sdfPathSet()
Definition: HUSD_PathSet.h:76
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
GLenum const void * paths
Definition: glew.h:13589