HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEP_ContextOptions.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: DEP_ContextOptions.h (DEP Library, C++)
7  */
8 
9 #ifndef __DEP_CONTEXTOPTIONS_H__
10 #define __DEP_CONTEXTOPTIONS_H__
11 
12 #include "DEP_API.h"
13 #include "DEP_ContextOptionsFwd.h"
14 #include <UT/UT_COW.h>
15 #include <UT/UT_ConcurrentSet.h>
16 #include <UT/UT_Options.h>
17 #include <UT/UT_StringHolder.h>
18 #include <UT/UT_StringSet.h>
19 #include <UT/UT_TBBSpinLock.h>
20 #include <UT/UT_UniquePtr.h>
21 #include <SYS/SYS_Types.h>
22 
23 typedef UT_ConcurrentSet<UT_StringHolder> DEP_ContextOptionDeps;
27 
29 {
30 public:
32 
33  int getNumOptions() const;
34  bool hasOption(const UT_StringRef &opt) const;
35  const UT_OptionEntry *getOptionEntry(
36  const UT_StringRef &opt) const;
37  bool isOptionAtDefault(
38  const UT_StringRef &opt) const;
39 
41  UT_Options::iterator end() const;
42 
43  float getOptionF(const UT_StringHolder& opt, float def) const;
44 
45  void setOption(const UT_StringHolder &opt,
47  bool is_default = false);
48  void setOptionS(const UT_StringHolder &opt,
49  const UT_StringHolder &value,
50  bool is_default = false);
51  void setOptionF(const UT_StringHolder &opt,
52  fpreal64 value,
53  bool is_default = false);
54  void removeOption(const UT_StringHolder &opt);
55  void clear();
56 
57  void cloneOptions(const UT_Options &options);
58  void cloneOptionsInto(UT_Options &options) const;
59 
60 private:
61  void setOptionIsAtDefault(
62  const UT_StringHolder &opt,
63  bool is_default);
64 
65  UT_Options myOptions;
66  UT_StringSet myOptionsAtDefaults;
67 };
68 
69 DEP_API extern const DEP_ContextOptionDeps &
75  DEP_ContextOptionDepsLock *lock = nullptr);
76 
77 #endif // __DEP_CONTEXTOPTIONS_H__
78 
UT_UniquePtr< DEP_ContextOptionDeps > DEP_ContextOptionDepsPtr
UT_TBBSpinLock::Scope DEP_ContextOptionDepsLockScope
DEP_API const DEP_ContextOptionDeps & DEPgetContextOptionDepsFromPtr(const DEP_ContextOptionDepsPtr &ptr)
UT_ConcurrentSet< UT_StringHolder > DEP_ContextOptionDeps
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
double fpreal64
Definition: SYS_Types.h:201
GLuint GLuint end
Definition: glcorearb.h:475
UT_TBBSpinLock DEP_ContextOptionDepsLock
A map of string to various well defined value types.
Definition: UT_Options.h:84
auto ptr(T p) -> const void *
Definition: format.h:2448
DEP_API DEP_ContextOptionDeps & DEPcreateContextOptionDepsFromPtr(DEP_ContextOptionDepsPtr &ptr, DEP_ContextOptionDepsLock *lock=nullptr)
Definition: core.h:1131
#define DEP_API
Definition: DEP_API.h:10
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:558