HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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_StringMap.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 NULL pointer 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  /// NULL);
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 NULL 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 clear_self 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 clear_self,
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(NULL)
213  {}
215  : myOptions(i.myOptions)
216  , myIterator(i.myIterator)
217  {}
218  const UT_StringHolder &name() const
219  { return myIterator->first; }
220  const UT_OptionEntry *entry() const
221  { return myIterator->second.get(); }
223  { return entry()->getType(); }
224  const UT_OptionEntry *operator*() const { return entry(); }
225 
227  {
228  myOptions = i.myOptions;
229  myIterator = i.myIterator;
230  return *this;
231  }
232  bool operator==(const iterator &i) const
233  {
234  return myIterator == i.myIterator;
235  }
236  bool operator!=(const iterator &i) const
237  { return !(*this == i); }
238  iterator &operator++() { advance(); return *this; }
239  bool atEnd() const { return myIterator == myEnd; }
240  void advance() { ++myIterator; }
241  private:
242  iterator(const UT_Options &opts, const MapType::const_iterator &it,
244  : myOptions(&opts)
245  , myIterator(it)
246  , myEnd(end)
247  {
248  }
249  const UT_Options *myOptions;
250  MapType::const_iterator myIterator;
251  MapType::const_iterator myEnd;
252  friend class UT_Options;
253  };
255  {
256  public:
258  : myKeys()
259  , myValues()
260  , myOrder()
261  , myPos(0)
262  , myCurr(0)
263  {
264  }
266  : myKeys(src.myKeys)
267  , myValues(src.myValues)
268  , myOrder(src.myOrder)
269  , myPos(src.myPos)
270  , myCurr(src.myCurr)
271  {
272  }
273  const UT_StringHolder &name() const
274  { return myKeys(myCurr); }
275  const UT_OptionEntry *entry() const
276  { return myValues(myCurr); }
278  { return entry()->getType(); }
279  const UT_OptionEntry *operator*() const { return entry(); }
280 
282  {
283  myKeys = i.myKeys;
284  myValues = i.myValues;
285  myOrder = i.myOrder;
286  myPos = i.myPos;
287  myCurr = i.myCurr;
288  return *this;
289  }
290  bool operator==(const ordered_iterator &i) const
291  {
292  if (i.atEnd() && atEnd())
293  return true;
294  // Iterators are only equal if they are both at
295  // the end.
296  return false;
297  }
298  bool operator!=(const ordered_iterator &i) const
299  { return !(*this == i); }
300  ordered_iterator &operator++() { advance(); return *this; }
301  bool atEnd() const { return myPos >= myOrder.entries(); }
302  void advance()
303  {
304  myPos++;
305  if (myPos < myOrder.entries())
306  myCurr = myOrder(myPos);
307  }
308  private:
309  class comparator
310  {
311  public:
312  comparator(const UT_ValArray<UT_StringHolder> &keys)
313  : myKeys(keys)
314  {
315  }
316  bool operator()(int a, int b) const
317  {
318  UT_ASSERT(a >= 0 && a < myKeys.entries());
319  UT_ASSERT(b >= 0 && b < myKeys.entries());
320  return myKeys(a) < myKeys(b);
321  }
322  private:
323  const UT_ValArray<UT_StringHolder> &myKeys;
324  };
325  // If you get an error here, maybe you meant to call obegin()?
326  explicit ordered_iterator(iterator it)
327  : myKeys()
328  , myValues()
329  , myOrder()
330  , myPos(0)
331  , myCurr(0)
332  {
333  int index = 0;
334  for (; !it.atEnd(); ++it, ++index)
335  {
336  myKeys.append(it.name());
337  myValues.append(it.entry());
338  myOrder.append(index);
339  }
340  myOrder.stdsort( comparator(myKeys) );
341  if (myOrder.entries())
342  myCurr = myOrder(0);
343  }
344 
348  int myPos;
349  int myCurr;
350  friend class UT_Options;
351  };
352  iterator begin() const
353  { return iterator(*this, myMap.begin(), myMap.end()); }
354  iterator end() const
355  { return iterator(*this, myMap.end(), myMap.end()); }
357  { return ordered_iterator(begin()); }
359  { return ordered_iterator(end()); }
360 
361  // Functions for accessing specific option values.
362  int64 getOptionI(const UT_StringRef &name) const;
363  bool getOptionB(const UT_StringRef &name) const;
364  fpreal64 getOptionF(const UT_StringRef &name) const;
365  const UT_Vector2D &getOptionV2(const UT_StringRef &name) const;
366  const UT_Vector3D &getOptionV3(const UT_StringRef &name) const;
367  const UT_Vector4D &getOptionV4(const UT_StringRef &name) const;
368  const UT_QuaternionD &getOptionQ(const UT_StringRef &name) const;
369  const UT_Matrix2D &getOptionM2(const UT_StringRef &name) const;
370  const UT_Matrix3D &getOptionM3(const UT_StringRef &name) const;
371  const UT_Matrix4D &getOptionM4(const UT_StringRef &name) const;
372  const UT_Vector2D &getOptionUV(const UT_StringRef &name) const;
373  const UT_Vector3D &getOptionUVW(const UT_StringRef &name) const;
374 
375  // Note that, if the string value contains binary data with null
376  // characters, the UT_String version of getOptionS will not be able to
377  // tell you the length of the data, since UT_String doesn't store the
378  // length.
379  const UT_StringHolder &getOptionS(const UT_StringRef &name) const;
380  void getOptionS(const UT_StringRef &name,
381  std::string &value) const;
382  void getOptionS(const UT_StringRef &name,
383  UT_String &value) const;
384  void getOptionS(const UT_StringRef &name,
385  UT_StringHolder &value) const;
386  void getOptionS(const UT_StringRef &,
387  UT_WorkBuffer &value) const;
388 
389  const UT_Int64Array &getOptionIArray(const UT_StringRef &) const;
390  const UT_Fpreal64Array &getOptionFArray(const UT_StringRef &) const;
391  const UT_StringArray &getOptionSArray(const UT_StringRef &) const;
392 
393  // Returns a valid number if this option is a float or an int.
394  // In the case of an int, it is converted to a float.
395  fpreal64 getOptionNum(const UT_StringRef &) const;
396 
397  // Functions for accessing option values. These methods will perform some
398  // minimal "casting".
399  // importOption(... bool &value) - Tests integers and string options
400  // importOption(... fpreal &value) - Evaluates integer/bool options
401  // importOption(... UT_Vector2 &) - Evaluates Vector2 or UV
402  // importOption(... UT_Vector3 &) - Evaluates Vector3 or UVW
403  //
404  bool importOption(const UT_StringRef &name, int &value) const;
405  bool importOption(const UT_StringRef &name, int64 &value) const;
406  bool importOption(const UT_StringRef &name, bool &value) const;
407  bool importOption(const UT_StringRef &name,
408  fpreal32 &value) const;
409  bool importOption(const UT_StringRef &name,
410  fpreal64 &value) const;
411  bool importOption(const UT_StringRef &name,
412  std::string &value) const;
413  bool importOption(const UT_StringRef &name,
414  UT_String &value) const;
415  bool importOption(const UT_StringRef &name,
416  UT_StringHolder &value) const;
417  bool importOption(const UT_StringRef &name,
418  UT_Vector2F &value) const;
419  bool importOption(const UT_StringRef &name,
420  UT_Vector3F &value) const;
421  bool importOption(const UT_StringRef &name,
422  UT_Vector4F &value) const;
423  bool importOption(const UT_StringRef &name,
424  UT_QuaternionF &value) const;
425  bool importOption(const UT_StringRef &name,
426  UT_Matrix2F &value) const;
427  bool importOption(const UT_StringRef &name,
428  UT_Matrix3F &value) const;
429  bool importOption(const UT_StringRef &name,
430  UT_Matrix4F &value) const;
431  bool importOption(const UT_StringRef &name,
432  UT_Vector2D &value) const;
433  bool importOption(const UT_StringRef &name,
434  UT_Vector3D &value) const;
435  bool importOption(const UT_StringRef &name,
436  UT_Vector4D &value) const;
437  bool importOption(const UT_StringRef &name,
438  UT_QuaternionD &value) const;
439  bool importOption(const UT_StringRef &name,
440  UT_Matrix2D &value) const;
441  bool importOption(const UT_StringRef &name,
442  UT_Matrix3D &value) const;
443  bool importOption(const UT_StringRef &name,
444  UT_Matrix4D &value) const;
445 
446  // Generic import which handles arbitrary length int/float data
447  bool importOption(const UT_StringRef &name,
448  UT_Array<int32> &value) const;
449  bool importOption(const UT_StringRef &name,
450  UT_Array<int64> &value) const;
451  bool importOption(const UT_StringRef &name,
452  UT_Array<fpreal32> &value) const;
453  bool importOption(const UT_StringRef &name,
454  UT_Array<fpreal64> &value) const;
455 
456  // Import a string array
457  bool importOption(const UT_StringRef &name,
458  UT_StringArray &value) const;
459 
460  // Import a single element from a scalar, vector, matrix or array
461  bool importElement(const UT_StringRef &name,
462  fpreal &value,
463  exint index = 0) const;
464  bool importElement(const UT_StringRef &name,
465  int64 &value,
466  exint index = 0) const;
467 
468 
469  // All these functions cause optionChanged to be called.
471  int64 value);
473  bool value);
475  fpreal64 value);
476  // Note that you can store binary data (that can contain null characters
477  // or that isn't null-terminated) in a string option by passing in a
478  // UT_WorkBuffer, or std::string.
480  const UT_StringHolder &value);
481  // setOptionSRaw() is the same as setOptionS() instead of it being
482  // additionally tagged as a "raw" string so that getPyOptionString() and
483  // appendPyDictionary() won't add quotes around the value. To retrieve its
484  // value, use getOptionS().
486  const UT_StringHolder &value);
488  const UT_Vector2F &value);
490  const UT_Vector2D &value);
492  fpreal64 x, fpreal64 y);
494  const UT_Vector3F &value);
496  const UT_Vector3D &value);
500  const UT_Vector4F &value);
502  const UT_Vector4D &value);
504  fpreal64 x, fpreal64 y,
505  fpreal64 z, fpreal64 w);
507  const UT_QuaternionF &value);
509  const UT_QuaternionD &value);
511  const UT_Matrix2F &value);
513  const UT_Matrix2D &value);
515  const UT_Matrix3F &value);
517  const UT_Matrix3D &value);
519  const UT_Matrix4F &value);
521  const UT_Matrix4D &value);
523  const UT_Vector2F &value);
525  const UT_Vector2D &value);
527  const UT_Vector3F &value);
529  const UT_Vector3D &value);
530  /// @{
531  /// Set integer array options
533  const int32 *values, size_t size);
535  const int64 *values, size_t size);
537  const UT_Array<int64> &value);
538  /// @}
539  /// @{
540  /// Set float/double array options
542  const fpreal32 *values, size_t size);
544  const fpreal64 *values, size_t size);
546  const UT_Array<fpreal64> &value);
547  /// @}
548 
549  /// Set string array options
551  const UT_StringHolder *values,
552  size_t size);
554  const char *const*values,
555  size_t size);
557  const UT_StringArray &value);
558 
559  /// Get a hash code for the options
560  unsigned hash() const;
561 
562  /// Comparison operator
563  bool operator==(const UT_Options &src) const;
564  bool operator!=(const UT_Options &src) const
565  { return !(*this == src); }
566 
567  /// Assignment operator
568  const UT_Options &operator=(const UT_Options &src);
569  void merge(const UT_Options &src);
570  void merge(const UT_Options &src,
571  bool (*match)(const UT_StringHolder &name,
572  const UT_OptionEntry *, void *),
573  void *data);
574  virtual int64 getMemoryUsage(bool inclusive) const;
575 
576  /// The map will take ownership of the UT_OptionEntry
577  void setOption(const UT_StringHolder &name,
578  UT_OptionEntry *value);
579 
580 protected:
581  const UT_StringHolder *findOptionS(const UT_StringRef &name) const;
582  void addError(const char *filename, int linecount,
583  const char *error_str) const;
584  bool sendOptionChanges() const
585  { return mySendOptionChanges; }
587  { mySendOptionChanges = f; }
588  virtual void optionChanged(const char *name);
589  UT_OptionEntry *parsePyValue(const char *&value,
590  char sep_delim,
591  char close_delim = '\0');
592 
593 private:
594  template <class ITER>
595  bool save(ITER start, const char *filename, std::ostream &os) const;
596 
597  MapType myMap;
598  bool mySendOptionChanges;
599 };
600 
601 UT_API size_t format(char *buffer, size_t buffer_size, const UT_Options &v);
602 
603 #endif
bool getOptionB(const UT_StringRef &name) const
const UT_Options & operator=(const UT_Options &src)
Assignment operator.
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:273
const UT_OptionEntry * operator*() const
Definition: UT_Options.h:224
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:564
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:72
ordered_iterator oend() const
Definition: UT_Options.h:358
#define UT_API
Definition: UT_API.h:12
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:239
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:586
UT_Options & setOptionIArray(const UT_StringHolder &name, const int32 *values, size_t size)
ordered_iterator & operator=(const ordered_iterator &i)
Definition: UT_Options.h:281
iterator end() const
Definition: UT_Options.h:354
const UT_StringHolder * findOptionS(const UT_StringRef &name) const
ordered_iterator(const ordered_iterator &src)
Definition: UT_Options.h:265
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:106
UT_Options & setOptionSArray(const UT_StringHolder &name, const UT_StringHolder *values, size_t size)
Set string array options.
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)
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:102
int64 exint
Definition: SYS_Types.h:115
double fpreal64
Definition: SYS_Types.h:191
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:279
ordered_iterator obegin() const
Definition: UT_Options.h:356
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:218
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:238
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:34
bool operator!=(const iterator &i) const
Definition: UT_Options.h:236
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:352
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:107
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:269
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:298
ordered_iterator & operator++()
Definition: UT_Options.h:300
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:47
iterator & operator=(const iterator &i)
Definition: UT_Options.h:226
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:584
void merge(const UT_Options &src)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
const UT_OptionEntry * entry() const
Definition: UT_Options.h:275
UT_OptionType type() const
Definition: UT_Options.h:277
UT_OptionFormat
String formatting options for getOptionString.
const UT_OptionEntry * entry() const
Definition: UT_Options.h:220
UT_Options & setOptionSRaw(const UT_StringHolder &name, const UT_StringHolder &value)
UT_OptionType type() const
Definition: UT_Options.h:222
UT_Options & setOptionFArray(const UT_StringHolder &name, const fpreal32 *values, size_t size)
bool operator==(const iterator &i) const
Definition: UT_Options.h:232
bool operator==(const ordered_iterator &i) const
Definition: UT_Options.h:290
UT_Options & setOptionF(const UT_StringHolder &name, fpreal64 value)
bool importOption(const UT_StringRef &name, int &value) const
float fpreal32
Definition: SYS_Types.h:190
fpreal64 getOptionF(const UT_StringRef &name) const
Parent::const_iterator const_iterator
Definition: UT_StringMap.h:50
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