HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Options.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: UT_Options.h (C++, Utility Library)
7  *
8  * COMMENTS: This is a smaller, faster, more type-safe version of
9  * UT_OptionFile. The reason UT_OptionFile was not simply
10  * re-implemented is that when saving and loading UT_OptionFiles,
11  * no information about the type of each option is saved. This
12  * implementation writes out the type of each data item.
13  *
14  */
15 
16 #ifndef _UT_OPTIONS_H_
17 #define _UT_OPTIONS_H_
18 
19 #include "UT_API.h"
20 #include "UT_OptionEntry.h"
21 #include "UT_SmallObject.h"
22 #include "UT_StringArray.h"
23 #include "UT_StringHolder.h"
24 #include "UT_ArrayStringMap.h"
25 #include "UT_UniquePtr.h"
26 #include "UT_VectorTypes.h"
27 #include <SYS/SYS_TypeTraits.h>
28 #include <iosfwd>
29 #include <string>
30 #include <memory>
31 
32 
33 class UT_IStream;
34 class UT_JSONValue;
35 class UT_JSONValueMap;
36 class UT_JSONParser;
37 class UT_JSONWriter;
38 class UT_WorkBuffer;
39 
40 
41 /// A map of string to various well defined value types
43 {
44 private:
45  /// Storage type for the option map
48 
49 public:
50  // Default constructor (empty options)
51  UT_Options();
52  // Copy c-tor
53  UT_Options(const UT_Options &src);
54  virtual ~UT_Options();
55 
56  /// Variadic constructor that allows addition of options during
57  /// construction. Using this option requires very careful coding (as does
58  /// all variadic coding). For example, there is no type checking of
59  /// variadic arguments. If there are floating point arguments, they @b
60  /// must be specified as double (i.e. Not "0", but rather "0.0").
61  /// Type tokens expected are:
62  /// - "int" @n A single @b int value follows
63  /// - "int64" @n A single @b int64 value follows
64  /// - "bool" @n A single @b int follows
65  /// - "float" @n A single @b double follows
66  /// - "string" @n A single string value follows
67  /// - "vector2" @n Two (2) double arguments follow
68  /// - "vector3" @n Three (3) double arguments follow
69  /// - "vector4" @n Four (4) double arguments follow
70  /// - "quaternion" @n Four (4) double arguments follow
71  /// - "matrix2" @n Four (4) double arguments follow
72  /// - "matrix3" @n Nine (9) double arguments follow
73  /// - "matrix4" @n Sixteen (16) double arguments follow
74  /// - "uv" @n Two (2) double arguments follow
75  /// - "uvw" @n Three (3) double arguments follow
76  /// - "stringraw" @n A single string value follows
77  /// - "int[N]" @n
78  /// @c N @b int values follow (creating an integer array).
79  /// Replace @c N with the actual value (of course).
80  /// No spaces may occur in the type name.
81  /// - "int64[N]" @n
82  /// @c N @b int64 values follow (creating an integer array).
83  /// Replace @c N with the actual value (of course).
84  /// No spaces may occur in the type name.
85  /// - "float[N]" @n
86  /// @c N @b double values follow (creating a float array).
87  /// Replace @c N with the actual value (of course).
88  /// No spaces may occur in the type name.
89  /// - "string[N]" @n
90  /// @c N @b string values follow (creating a string array).
91  /// Replace @c N with the actual value (of course).
92  /// No spaces may occur in the type name.
93  ///
94  /// Special type tokens
95  /// - "i_vector2", "i_vector3", "i_vector4", @n
96  /// A single @b double is used to set all components of the vector
97  /// - "i_quaternion" @n
98  /// A single @b double is used to set all components of the vector
99  /// - "i_uv", "i_uvw" @n
100  /// A single @b double is used to set all components of the vector
101  /// - "i_matrix3", "i_matrix4" @n
102  /// A single @b double is used to set the diagonal of the matrix3.
103  /// - "i_int[N]" @n
104  /// A single @b int64 is used to set all components of the array
105  /// - "i_float[N]" @n
106  /// A single @b double is used to set all components of the array
107  ///
108  /// The option name should follow the type specifier (separated by a single
109  /// space).
110  ///
111  /// A nullptr keyword determines the end of the options.
112  ///
113  /// Examples: @code
114  /// UT_Options options("int ival", 0,
115  /// "int64 i64val", (int64)5,
116  /// "bool toggle", (int)1,
117  /// "float fval", (fpreal64)0,
118  /// "vector3 P", 0.0, 1.0, 2.0,
119  /// "string map", "texture.pic",
120  /// "int[2] iarray", int64(0), int64(1),
121  /// nullptr); <======= MUST TERMINATE =======
122  /// @code
123  /// Common errors include: @code
124  /// UT_Options options(
125  /// "int ival", (int64)0, // Error, must be int
126  /// "int64 ival", (int)0, // Error, must be int64
127  /// "vector3 fval", 0, 1.0, 2.0, // First entry is an int!
128  /// "float[3] farray", 0.0, 1.0, // Missing 3rd value
129  /// /* MISSING nullptr TERMINATOR */);
130  /// @endcode
131  UT_Options(const char *type_and_name, ...);
132 
133  // This function does not call optionChanged.
134  void clear();
135 
136  // only returns false if the file encounters an error. true is returned on
137  // success or if the file didn't exist.
138  // The load methods can handle files saved either with this save
139  // or with saveAsJSON. saveAsJSON is preferable as it handles 64bit
140  // floats and ints, but can't be read before H10.5
141  bool load(const char *filename);
142  bool save(const char *filename) const;
143  bool saveOrdered(const char *filename) const;
144  bool load(const char *filename, UT_IStream &is);
145  bool save(const char *filename, std::ostream &os) const;
146  bool saveOrdered(const char *filename, std::ostream &os) const;
147 
148  bool saveAsJSON(const char *filename,
149  bool binary = true) const;
150  bool saveAsJSON(const char *filename, std::ostream &os,
151  bool binary = true) const;
152 
153  // Remove an option.
154  void removeOption(const UT_StringHolder &name);
155 
156  // Get the string representation of any of our options. Note that, if
157  // the value contains binary data with null characters, you can't determine
158  // the length of the data with UT_String version of these methods.
159  bool getOptionString(const UT_StringHolder &name,
161  UT_WorkBuffer &result) const;
162  bool getOptionString(const UT_StringHolder &name,
163  UT_OptionFormat format,
164  UT_String &result) const;
165 
166  // Append the python dictionary representation of ALL our options to the
167  // buffer
168  bool appendPyDictionary(UT_WorkBuffer &result,
169  bool sorted=false) const;
170 
171  // Parse a python dictionary string and merge the results into our
172  // options.
173  bool setFromPyDictionary(const char *dict);
174 
175  // Parse a python formatted value and set it as the named option.
176  bool setPyOptionString(const UT_StringHolder &name,
177  const char *value);
178 
179  /// Save a UT_Options to JSON format using UT_JSONWriter
180  bool save(UT_JSONWriter &w) const;
181  /// Save a UT_Options to a UT_JSONValue
182  void save(UT_JSONValueMap &map) const;
183 
184  /// Load a UT_Options from a JSON parser.
185  /// @param parser Parser
186  /// @param do_clear Clear existing map before loading
187  /// If true and the first object in the JSON stream is not a map object,
188  /// then the parser will fail (with an error). Otherwise a warning will
189  /// be added and the object will be skipped.
190  /// @param is If this is specified, then data will be read from that
191  /// stream rather than the stream associated with the parser.
192  bool load(UT_JSONParser &parser,
193  bool do_clear,
194  UT_IStream *is = 0);
195 
196  /// Writes a JSON dump to ostream of the current options.
197  void dump(std::ostream &os) const;
198  /// Dump to stdout/cout
199  void dump() const;
200 
201  // Functions for accessing the options by name.
202  bool hasOption(const UT_StringRef &name) const;
203  UT_OptionType getOptionType(const UT_StringRef &name) const;
204  const UT_OptionEntry*getOptionEntry(const UT_StringRef &name) const;
205 
206  // Functions for accessing all options sequentially.
207  int getNumOptions() const;
209  {
210  public:
212  : myOptions(nullptr)
213  {}
215  : myOptions(i.myOptions)
216  , myIterator(i.myIterator)
217  , myEnd(i.myEnd)
218  {}
219  const UT_StringHolder &name() const
220  { return myIterator->first; }
221  const UT_OptionEntry *entry() const
222  { return myIterator->second.get(); }
224  { return entry()->getType(); }
225  const UT_OptionEntry *operator*() const { return entry(); }
226 
228  {
229  myOptions = i.myOptions;
230  myIterator = i.myIterator;
231  myEnd = i.myEnd;
232  return *this;
233  }
234  bool operator==(const iterator &i) const
235  {
236  return myIterator == i.myIterator;
237  }
238  bool operator!=(const iterator &i) const
239  { return !(*this == i); }
240  iterator &operator++() { advance(); return *this; }
241  bool atEnd() const { return myIterator == myEnd; }
242  void advance() { ++myIterator; }
243  private:
244  iterator(const UT_Options &opts, const MapType::const_iterator &it,
246  : myOptions(&opts)
247  , myIterator(it)
248  , myEnd(end)
249  {
250  }
251  const UT_Options *myOptions;
252  MapType::const_iterator myIterator;
253  MapType::const_iterator myEnd;
254  friend class UT_Options;
255  };
257  {
258  public:
260  : myKeys()
261  , myValues()
262  , myOrder()
263  , myPos(0)
264  , myCurr(0)
265  {
266  }
268  : myKeys(src.myKeys)
269  , myValues(src.myValues)
270  , myOrder(src.myOrder)
271  , myPos(src.myPos)
272  , myCurr(src.myCurr)
273  {
274  }
275  const UT_StringHolder &name() const
276  { return myKeys(myCurr); }
277  const UT_OptionEntry *entry() const
278  { return myValues(myCurr); }
280  { return entry()->getType(); }
281  const UT_OptionEntry *operator*() const { return entry(); }
282 
284  {
285  myKeys = i.myKeys;
286  myValues = i.myValues;
287  myOrder = i.myOrder;
288  myPos = i.myPos;
289  myCurr = i.myCurr;
290  return *this;
291  }
292  bool operator==(const ordered_iterator &i) const
293  {
294  if (i.atEnd() && atEnd())
295  return true;
296  // Iterators are only equal if they are both at
297  // the end.
298  return false;
299  }
300  bool operator!=(const ordered_iterator &i) const
301  { return !(*this == i); }
302  ordered_iterator &operator++() { advance(); return *this; }
303  bool atEnd() const { return myPos >= myOrder.entries(); }
304  void advance()
305  {
306  myPos++;
307  if (myPos < myOrder.entries())
308  myCurr = myOrder(myPos);
309  }
310  private:
311  class comparator
312  {
313  public:
314  comparator(const UT_ValArray<UT_StringHolder> &keys)
315  : myKeys(keys)
316  {
317  }
318  bool operator()(int a, int b) const
319  {
320  UT_ASSERT(a >= 0 && a < myKeys.entries());
321  UT_ASSERT(b >= 0 && b < myKeys.entries());
322  return myKeys(a) < myKeys(b);
323  }
324  private:
325  const UT_ValArray<UT_StringHolder> &myKeys;
326  };
327  // If you get an error here, maybe you meant to call obegin()?
328  explicit ordered_iterator(iterator it)
329  : myKeys()
330  , myValues()
331  , myOrder()
332  , myPos(0)
333  , myCurr(0)
334  {
335  int index = 0;
336  for (; !it.atEnd(); ++it, ++index)
337  {
338  myKeys.append(it.name());
339  myValues.append(it.entry());
340  myOrder.append(index);
341  }
342  myOrder.stdsort( comparator(myKeys) );
343  if (myOrder.entries())
344  myCurr = myOrder(0);
345  }
346 
350  int myPos;
351  int myCurr;
352  friend class UT_Options;
353  };
354  iterator begin() const
355  { return iterator(*this, myMap.begin(), myMap.end()); }
356  iterator end() const
357  { return iterator(*this, myMap.end(), myMap.end()); }
359  { return ordered_iterator(begin()); }
361  { return ordered_iterator(end()); }
362 
363  // Functions for accessing specific option values.
364  int64 getOptionI(const UT_StringRef &name) const;
365  bool getOptionB(const UT_StringRef &name) const;
366  fpreal64 getOptionF(const UT_StringRef &name) const;
367  const UT_Vector2D &getOptionV2(const UT_StringRef &name) const;
368  const UT_Vector3D &getOptionV3(const UT_StringRef &name) const;
369  const UT_Vector4D &getOptionV4(const UT_StringRef &name) const;
370  const UT_QuaternionD &getOptionQ(const UT_StringRef &name) const;
371  const UT_Matrix2D &getOptionM2(const UT_StringRef &name) const;
372  const UT_Matrix3D &getOptionM3(const UT_StringRef &name) const;
373  const UT_Matrix4D &getOptionM4(const UT_StringRef &name) const;
374  const UT_Vector2D &getOptionUV(const UT_StringRef &name) const;
375  const UT_Vector3D &getOptionUVW(const UT_StringRef &name) const;
376 
377  // Note that, if the string value contains binary data with null
378  // characters, the UT_String version of getOptionS will not be able to
379  // tell you the length of the data, since UT_String doesn't store the
380  // length.
381  const UT_StringHolder &getOptionS(const UT_StringRef &name) const;
382  void getOptionS(const UT_StringRef &name,
383  std::string &value) const;
384  void getOptionS(const UT_StringRef &name,
385  UT_String &value) const;
386  void getOptionS(const UT_StringRef &name,
387  UT_StringHolder &value) const;
388  void getOptionS(const UT_StringRef &,
389  UT_WorkBuffer &value) const;
390 
391  const UT_Int64Array &getOptionIArray(const UT_StringRef &) const;
392  const UT_Fpreal64Array &getOptionFArray(const UT_StringRef &) const;
393  const UT_StringArray &getOptionSArray(const UT_StringRef &) const;
394 
395  // Returns a valid number if this option is a float or an int.
396  // In the case of an int, it is converted to a float.
397  fpreal64 getOptionNum(const UT_StringRef &) const;
398 
399  // Functions for accessing option values. These methods will perform some
400  // minimal "casting".
401  // importOption(... bool &value) - Tests integers and string options
402  // importOption(... fpreal &value) - Evaluates integer/bool options
403  // importOption(... UT_Vector2 &) - Evaluates Vector2 or UV
404  // importOption(... UT_Vector3 &) - Evaluates Vector3 or UVW
405  //
406  bool importOption(const UT_StringRef &name, int &value) const;
407  bool importOption(const UT_StringRef &name, int64 &value) const;
408  bool importOption(const UT_StringRef &name, bool &value) const;
409  bool importOption(const UT_StringRef &name,
410  fpreal32 &value) const;
411  bool importOption(const UT_StringRef &name,
412  fpreal64 &value) const;
413  bool importOption(const UT_StringRef &name,
414  std::string &value) const;
415  bool importOption(const UT_StringRef &name,
416  UT_String &value) const;
417  bool importOption(const UT_StringRef &name,
418  UT_StringHolder &value) const;
419  bool importOption(const UT_StringRef &name,
420  UT_Vector2F &value) const;
421  bool importOption(const UT_StringRef &name,
422  UT_Vector3F &value) const;
423  bool importOption(const UT_StringRef &name,
424  UT_Vector4F &value) const;
425  bool importOption(const UT_StringRef &name,
426  UT_QuaternionF &value) const;
427  bool importOption(const UT_StringRef &name,
428  UT_Matrix2F &value) const;
429  bool importOption(const UT_StringRef &name,
430  UT_Matrix3F &value) const;
431  bool importOption(const UT_StringRef &name,
432  UT_Matrix4F &value) const;
433  bool importOption(const UT_StringRef &name,
434  UT_Vector2D &value) const;
435  bool importOption(const UT_StringRef &name,
436  UT_Vector3D &value) const;
437  bool importOption(const UT_StringRef &name,
438  UT_Vector4D &value) const;
439  bool importOption(const UT_StringRef &name,
440  UT_QuaternionD &value) const;
441  bool importOption(const UT_StringRef &name,
442  UT_Matrix2D &value) const;
443  bool importOption(const UT_StringRef &name,
444  UT_Matrix3D &value) const;
445  bool importOption(const UT_StringRef &name,
446  UT_Matrix4D &value) const;
447 
448  // Generic import which handles arbitrary length int/float data
449  bool importOption(const UT_StringRef &name,
450  UT_Array<int32> &value) const;
451  bool importOption(const UT_StringRef &name,
452  UT_Array<int64> &value) const;
453  bool importOption(const UT_StringRef &name,
454  UT_Array<fpreal32> &value) const;
455  bool importOption(const UT_StringRef &name,
456  UT_Array<fpreal64> &value) const;
457 
458  // Import a string array
459  bool importOption(const UT_StringRef &name,
460  UT_StringArray &value) const;
461 
462  // Import a single element from a scalar, vector, matrix or array
463  bool importElement(const UT_StringRef &name,
464  fpreal &value,
465  exint index = 0) const;
466  bool importElement(const UT_StringRef &name,
467  int64 &value,
468  exint index = 0) const;
469 
470 
471  // All these functions cause optionChanged to be called.
473  int64 value);
475  bool value);
477  fpreal64 value);
478  // Note that you can store binary data (that can contain null characters
479  // or that isn't null-terminated) in a string option by passing in a
480  // UT_WorkBuffer, or std::string.
482  const UT_StringHolder &value);
483  // setOptionSRaw() is the same as setOptionS() instead of it being
484  // additionally tagged as a "raw" string so that getPyOptionString() and
485  // appendPyDictionary() won't add quotes around the value. To retrieve its
486  // value, use getOptionS().
488  const UT_StringHolder &value);
490  const UT_Vector2F &value);
492  const UT_Vector2D &value);
494  fpreal64 x, fpreal64 y);
496  const UT_Vector3F &value);
498  const UT_Vector3D &value);
502  const UT_Vector4F &value);
504  const UT_Vector4D &value);
506  fpreal64 x, fpreal64 y,
507  fpreal64 z, fpreal64 w);
509  const UT_QuaternionF &value);
511  const UT_QuaternionD &value);
513  const UT_Matrix2F &value);
515  const UT_Matrix2D &value);
517  const UT_Matrix3F &value);
519  const UT_Matrix3D &value);
521  const UT_Matrix4F &value);
523  const UT_Matrix4D &value);
525  const UT_Vector2F &value);
527  const UT_Vector2D &value);
529  const UT_Vector3F &value);
531  const UT_Vector3D &value);
532  /// @{
533  /// Set integer array options
535  const int32 *values, size_t size);
537  const int64 *values, size_t size);
539  const UT_Array<int64> &value);
540  /// @}
541  /// @{
542  /// Set float/double array options
544  const fpreal32 *values, size_t size);
546  const fpreal64 *values, size_t size);
548  const UT_Array<fpreal64> &value);
549  /// @}
550 
551  /// Set string array options
553  const UT_StringHolder *values,
554  size_t size);
556  const char *const*values,
557  size_t size);
559  const UT_StringArray &value);
560 
561  /// Get a hash code for the options
562  unsigned hash() const;
563 
564  /// Comparison operator
565  bool operator==(const UT_Options &src) const;
566  bool operator!=(const UT_Options &src) const
567  { return !(*this == src); }
568 
569  /// Assignment operator
570  const UT_Options &operator=(const UT_Options &src);
571  void merge(const UT_Options &src);
572  void merge(const UT_Options &src,
573  bool (*match)(const UT_StringHolder &name,
574  const UT_OptionEntry *, void *),
575  void *data);
576  virtual int64 getMemoryUsage(bool inclusive) const;
577 
578  /// The map will take ownership of the UT_OptionEntry
579  void setOption(const UT_StringHolder &name,
580  UT_OptionEntry *value);
581 
582 protected:
583  const UT_StringHolder *findOptionS(const UT_StringRef &name) const;
584  void addError(const char *filename, int linecount,
585  const char *error_str) const;
586  bool sendOptionChanges() const
587  { return mySendOptionChanges; }
589  { mySendOptionChanges = f; }
590  virtual void optionChanged(const char *name);
591  UT_OptionEntry *parsePyValue(const char *&value,
592  char sep_delim,
593  char close_delim = '\0');
594 
595 private:
596  template <class ITER>
597  bool save(ITER start, const char *filename, std::ostream &os) const;
598 
599  MapType myMap;
600  bool mySendOptionChanges;
601 };
602 
603 UT_API size_t format(char *buffer, size_t buffer_size, const UT_Options &v);
604 
605 #endif
bool getOptionB(const UT_StringRef &name) const
const UT_Options & operator=(const UT_Options &src)
Assignment operator.
GT_API const UT_StringHolder filename
const UT_Vector2D & getOptionV2(const UT_StringRef &name) const
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
const UT_StringHolder & name() const
Definition: UT_Options.h:275
const UT_OptionEntry * operator*() const
Definition: UT_Options.h:225
const UT_StringArray & getOptionSArray(const UT_StringRef &) const
int myOrder
Definition: GT_CurveEval.h:263
const GLdouble * v
Definition: glcorearb.h:836
GLuint start
Definition: glcorearb.h:474
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:847
void addError(const char *filename, int linecount, const char *error_str) const
UT_Options & setOptionUVW(const UT_StringHolder &name, const UT_Vector3F &value)
bool operator!=(const UT_Options &src) const
Definition: UT_Options.h:566
UT_Options & setOptionV3(const UT_StringHolder &name, const UT_Vector3F &value)
int64 getOptionI(const UT_StringRef &name) const
UT_OptionType
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
const UT_Vector3D & getOptionV3(const UT_StringRef &name) const
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:75
ordered_iterator oend() const
Definition: UT_Options.h:360
#define UT_API
Definition: UT_API.h:13
GLint y
Definition: glcorearb.h:102
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
const UT_Matrix3D & getOptionM3(const UT_StringRef &name) const
const UT_Fpreal64Array & getOptionFArray(const UT_StringRef &) const
bool atEnd() const
Definition: UT_Options.h:241
GLuint buffer
Definition: glcorearb.h:659
png_uint_32 i
Definition: png.h:2877
UT_Options & setOptionM4(const UT_StringHolder &name, const UT_Matrix4F &value)
GLsizeiptr size
Definition: glcorearb.h:663
void setSendOptionChanges(bool f)
Definition: UT_Options.h:588
UT_Options & setOptionIArray(const UT_StringHolder &name, const int32 *values, size_t size)
ordered_iterator & operator=(const ordered_iterator &i)
Definition: UT_Options.h:283
iterator end() const
Definition: UT_Options.h:356
const UT_StringHolder * findOptionS(const UT_StringRef &name) const
ordered_iterator(const ordered_iterator &src)
Definition: UT_Options.h:267
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:107
UT_Options & setOptionSArray(const UT_StringHolder &name, const UT_StringHolder *values, size_t size)
Set string array options.
Parent::const_iterator const_iterator
GLfloat f
Definition: glcorearb.h:1925
UT_Options & setOptionI(const UT_StringHolder &name, int64 value)
fpreal64 getOptionNum(const UT_StringRef &) const
UT_Options & setOptionUV(const UT_StringHolder &name, const UT_Vector2F &value)
int64 exint
Definition: SYS_Types.h:116
double fpreal64
Definition: SYS_Types.h:192
unsigned hash() const
Get a hash code for the options.
UT_Options & setOptionQ(const UT_StringHolder &name, const UT_QuaternionF &value)
GLuint GLuint end
Definition: glcorearb.h:474
const UT_OptionEntry * operator*() const
Definition: UT_Options.h:281
ordered_iterator obegin() const
Definition: UT_Options.h:358
const UT_Vector3D & getOptionUVW(const UT_StringRef &name) const
UT_Options & setOptionV4(const UT_StringHolder &name, const UT_Vector4F &value)
UT_Options & setOptionB(const UT_StringHolder &name, bool value)
const UT_StringHolder & name() const
Definition: UT_Options.h:219
UT_Options & setOptionM3(const UT_StringHolder &name, const UT_Matrix3F &value)
virtual void optionChanged(const char *name)
const UT_Matrix2D & getOptionM2(const UT_StringRef &name) const
iterator & operator++()
Definition: UT_Options.h:240
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
UT_Options & setOptionM2(const UT_StringHolder &name, const UT_Matrix2F &value)
iterator(const iterator &i)
Definition: UT_Options.h:214
const UT_QuaternionD & getOptionQ(const UT_StringRef &name) const
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
int int32
Definition: SYS_Types.h:35
bool operator!=(const iterator &i) const
Definition: UT_Options.h:238
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
const UT_Int64Array & getOptionIArray(const UT_StringRef &) const
void setOption(const UT_StringHolder &name, UT_OptionEntry *value)
The map will take ownership of the UT_OptionEntry.
virtual int64 getMemoryUsage(bool inclusive) const
bool save(const char *filename) const
iterator begin() const
Definition: UT_Options.h:354
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:107
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
A map of string to various well defined value types.
Definition: UT_Options.h:42
const UT_Vector4D & getOptionV4(const UT_StringRef &name) const
bool operator!=(const ordered_iterator &i) const
Definition: UT_Options.h:300
ordered_iterator & operator++()
Definition: UT_Options.h:302
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:47
iterator & operator=(const iterator &i)
Definition: UT_Options.h:227
GLuint index
Definition: glcorearb.h:785
png_infop png_bytep png_size_t buffer_size
Definition: png.h:2124
GLint GLenum GLint x
Definition: glcorearb.h:408
UT_Options & setOptionS(const UT_StringHolder &name, const UT_StringHolder &value)
const UT_Vector2D & getOptionUV(const UT_StringRef &name) const
bool importElement(const UT_StringRef &name, fpreal &value, exint index=0) const
const UT_Matrix4D & getOptionM4(const UT_StringRef &name) const
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Options &v)
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:75
bool sendOptionChanges() const
Definition: UT_Options.h:586
void merge(const UT_Options &src)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:126
const UT_OptionEntry * entry() const
Definition: UT_Options.h:277
UT_OptionType type() const
Definition: UT_Options.h:279
UT_OptionFormat
String formatting options for getOptionString.
const UT_OptionEntry * entry() const
Definition: UT_Options.h:221
UT_Options & setOptionSRaw(const UT_StringHolder &name, const UT_StringHolder &value)
UT_OptionType type() const
Definition: UT_Options.h:223
UT_Options & setOptionFArray(const UT_StringHolder &name, const fpreal32 *values, size_t size)
bool operator==(const iterator &i) const
Definition: UT_Options.h:234
bool operator==(const ordered_iterator &i) const
Definition: UT_Options.h:292
UT_Options & setOptionF(const UT_StringHolder &name, fpreal64 value)
bool importOption(const UT_StringRef &name, int &value) const
float fpreal32
Definition: SYS_Types.h:191
fpreal64 getOptionF(const UT_StringRef &name) const
UT_Options & setOptionV2(const UT_StringHolder &name, const UT_Vector2F &value)
GLenum src
Definition: glcorearb.h:1792
UT_OptionEntry * parsePyValue(const char *&value, char sep_delim, char close_delim= '\0')
const UT_StringHolder & getOptionS(const UT_StringRef &name) const