HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_ExpansionState.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_ExpansionState_h__
19 #define __HUSD_ExpansionState_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_Path.h"
23 #include "HUSD_PathSet.h"
24 #include <UT/UT_IntrusivePtr.h>
25 #include <UT/UT_NonCopyable.h>
26 #include <iosfwd>
27 
28 class UT_IStream;
29 class UT_JSONValue;
30 class UT_JSONWriter;
32 
34 
36  public UT_IntrusiveRefCounter<HUSD_ExpansionState>,
37  public UT_NonCopyable
38 {
39 public:
42 
44  { return myExpandedPinnedPaths; }
46  { myExpandedPinnedPaths = paths; }
48  { return myExpandedScenePaths; }
50  { myExpandedScenePaths = paths; }
51  bool setExpanded(const HUSD_Path &path,
52  bool pinned,
53  bool expanded);
54 
56  { return myLockedExpandedScenePaths; }
58  { return myLockedScenePaths; }
59  bool setExpansionLocked(const HUSD_Path &path,
60  bool locked,
61  const HUSD_PathSet *
62  expanded_subpaths = nullptr,
63  bool use_pinned_subpaths = false,
64  bool preserve_descendant_expansion = false,
66  undo_locked_paths = nullptr,
68  undo_locked_expanded_paths = nullptr);
69  void undoExpansionLockState(
70  UT_Array<HUSD_Path> &swap_locked_paths,
71  UT_Array<HUSD_Path> &swap_locked_expanded_paths);
72 
73  exint getMemoryUsage() const;
74 
75  void clear();
76  void copy(const HUSD_ExpansionState &src);
77  bool save(std::ostream &os, bool binary) const;
78  bool load(UT_IStream &is);
79 
80 private:
81  bool save(UT_JSONWriter &writer,
82  const HUSD_PathSet &paths,
83  bool allow_saving_indirect_descendants,
84  HUSD_PathSet::iterator &iter) const;
85  bool load(const UT_JSONValue &value,
86  const HUSD_Path &path,
87  HUSD_PathSet &paths);
88  bool loadDeprecated(const UT_JSONValue &value,
89  const HUSD_Path &path,
90  HUSD_PathSet &paths);
91  bool loadDeprecated(UT_JSONValue &rootvalue);
92 
93  HUSD_PathSet myExpandedPinnedPaths;
94  HUSD_PathSet myExpandedScenePaths;
95  HUSD_PathSet myLockedScenePaths;
96  HUSD_PathSet myLockedExpandedScenePaths;
97 };
98 
99 #endif
const HUSD_PathSet & lockedExpandedScenePaths() const
const HUSD_PathSet & expandedPinnedPaths() const
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
GLsizei const GLfloat * value
Definition: glcorearb.h:824
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void setExpandedPinnedPaths(const HUSD_PathSet &paths)
int64 exint
Definition: SYS_Types.h:125
#define HUSD_API
Definition: HUSD_API.h:31
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
A reference counter base class for use with UT_IntrusivePtr.
UT_IntrusivePtr< HUSD_ExpansionState > HUSD_ExpansionStateHandle
void setExpandedScenePaths(const HUSD_PathSet &paths)
Wrapper around hboost::intrusive_ptr.
const HUSD_PathSet & expandedScenePaths() const
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
const HUSD_PathSet & lockedScenePaths() const
GLenum src
Definition: glcorearb.h:1793