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 contains(const HUSD_PathSet &paths) const;
58  bool containsPathOrAncestor(const UT_StringRef &path) const;
59  bool containsPathOrAncestor(const HUSD_Path &path) const;
60  bool containsAncestor(const HUSD_Path &path) const;
61  bool containsPathOrDescendant(const UT_StringRef &path) const;
62  bool containsPathOrDescendant(const HUSD_Path &path) const;
63  bool containsDescendant(const HUSD_Path &path) const;
64  void clear();
65  void insert(const HUSD_PathSet &other);
66  void insert(const HUSD_Path &path);
67  void insert(const UT_StringRef &path);
68  void insert(const UT_StringArray &paths);
69  void erase(const HUSD_PathSet &other);
70  void erase(const HUSD_Path &path);
71  void erase(const UT_StringRef &path);
72  void erase(const UT_StringArray &paths);
73  void swap(HUSD_PathSet &other);
74 
75  // Remove all paths where an ancestor of the path is also in the set.
76  void removeDescendants();
77  // Remove all paths where a descendant of the path is also in the set.
78  void removeAncestors();
79 
80  PXR_NS::XUSD_PathSet &sdfPathSet()
81  { return *myPathSet; }
82  const PXR_NS::XUSD_PathSet &sdfPathSet() const
83  { return *myPathSet; }
84 
85  // Return a python object holding a set of SdfPath python objects.
86  void *getPythonPathList() const;
87  // Fill this path set from a python tuple of SdfPath python objects.
88  bool setPythonPaths(void *primpaths);
89 
90  // Fill a UT_StringArray with the paths in the SdfPathSet.
91  void getPathsAsStrings(UT_StringArray &paths) const;
92  // Return the string representation of the first path in the set.
93  UT_StringHolder getFirstPathAsString() const;
94 
95  size_t getMemoryUsage() const;
96 
98  public:
99  iterator();
100  iterator(void *internal_iterator);
101  iterator(const iterator &src);
102  iterator(iterator &&src);
103  ~iterator();
104 
105  bool operator==(const iterator &other) const;
106  bool operator!=(const iterator &other) const;
107 
108  HUSD_Path operator*() const;
109  iterator &operator++();
110  iterator &operator=(const iterator &src);
111  iterator &operator=(iterator &&src);
112 
113  private:
114  void *myInternalIterator;
115  friend class HUSD_PathSet;
116  };
117 
118  iterator begin() const;
119  iterator end() const;
120 
121 private:
122  PXR_NS::XUSD_PathSet *myPathSet;
123 };
124 
125 #endif
126 
vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
Definition: simd.h:3414
iterator begin() const
const PXR_NS::XUSD_PathSet & sdfPathSet() const
Definition: HUSD_PathSet.h:82
Color4< T > operator*(S a, const Color4< T > &v)
Definition: ImathColor.h:728
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
#define HUSD_API
Definition: HUSD_API.h:32
void swap(T &lhs, T &rhs)
Definition: pugixml.cpp:7172
GLenum src
Definition: glcorearb.h:1792
GLsizeiptr size
Definition: glcorearb.h:663
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
GLuint GLuint end
Definition: glcorearb.h:474
bool OIIO_API contains(string_view a, string_view b)
Does 'a' contain the string 'b' within it?
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1375
PXR_NS::XUSD_PathSet & sdfPathSet()
Definition: HUSD_PathSet.h:80
#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:13872