HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Variant.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_Variant.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __UT_Variant__
12 #define __UT_Variant__
13 
14 #include "UT_API.h"
15 
16 #include "UT_VectorTypes.h"
17 #include "UT_StringMap.h"
18 #include "UT_Array.h"
19 
20 #include <array>
21 #include <type_traits>
22 #include <memory>
23 
24 class UT_Variant;
25 
26 // ============================================================================
27 /// Wrapper around a shared variant array container.
28 /// Modifications are shared among all wrappers referring to the same container.
30 {
31 public:
35 
36  /// Construct a variant array of a given size. The constructed variants
37  /// will all be of the unknown type.
39 
40  /// Construct a variant array from an initializer list.
41  UT_VariantArray(std::initializer_list<UT_Variant> init);
42 
43  /// Construct a variant array by referencing the variant array container
44  /// from another. Only the pointer to the underlying array is copied.
45  /// The two wrappers will share the same array.
46  UT_VariantArray(const UT_VariantArray &) = default;
47 
48  /// Move the variant array container from another variant array.
49  UT_VariantArray(UT_VariantArray &&) = default;
50 
51  /// Copy a variant array by referencing the variant array container from
52  /// another. The two variant arrays will share the same list container.
53  UT_VariantArray &operator=(const UT_VariantArray &) = default;
54 
55  /// Move the variant array container from another variant array.
56  UT_VariantArray &operator=(UT_VariantArray &&) = default;
57 
58  /// Item-wise equality comparison of the variants of the two arrays.
59  bool operator==(const UT_VariantArray &o) const { return m_array->operator==(*o.m_array); }
60 
61  /// Item-wise non-equality comparison of the variants of the two arrays.
62  bool operator!=(const UT_VariantArray &o) const { return !operator==(o); }
63 
64  /// Make a deep copy of another array container. This array wrapper will not
65  /// share the array container with the other.
66  void deepCopy(const UT_VariantArray &);
67 
68  /// Returns the number of items in the array container.
69  exint size() const { return m_array->size(); }
70 
71  /// Returns a read-only variant at index @c index. No bound-checking is
72  /// performed.
73  const UT_Variant &operator[](exint index) const { return m_array->operator [](index); }
74 
75  /// Returns a writable variant at index @c index. No bound-checking is
76  /// performed.
77  UT_Variant &operator[](exint index) { return m_array->operator [](index); }
78 
79  /// Add a new variant to the array container. All instances of a array
80  /// wrapper that use the same array container will see the new item.
81  exint append(const UT_Variant &t) { return m_array->append(t); }
82 
83  /// Add a new variant to the array container. All instances of a array
84  /// wrapper that use the same array container will see the new item.
85  exint append(UT_Variant &&t) { return m_array->append(t); }
86 
87  /// Return a writable iterator to the beginning of the array container.
88  iterator begin() { return m_array->begin(); }
89 
90  /// Return a read-only iterator to the beginning of the array container.
91  const_iterator begin() const { return m_array->begin(); }
92 
93  /// Return a writable iterator to the end of the array container.
94  iterator end() { return m_array->end(); }
95 
96  /// Return a read-only iterator to the end of the array container.
97  const_iterator end() const { return m_array->end(); }
98 
99  /// Returns a read-only reference to the underlying array container.
100  const container_type &container() const { return *m_array.get(); }
101 
102  /// Returns a writable reference to the underlying array container.
103  container_type &container() { return *m_array.get(); }
104 private:
105  std::shared_ptr<container_type> m_array;
106 };
107 
108 // ============================================================================
109 /// Wrapper around a shared variant map container.
110 /// Modifications are shared among all wrappers referring to the same container.
112 {
113 public:
117 
118  /// Construct a default, empty container.
119  UT_VariantMap();
120 
121  /// Construct a new container from a list of key/value pairs.
122  UT_VariantMap(std::initializer_list<container_type::value_type> init);
123 
124  /// Construct a variant map by referencing the variant map container
125  /// from another. The two map wrappers will share the same map.
126  UT_VariantMap(const UT_VariantMap &) = default;
127 
128  /// Move the variant map container from another variant map wrapper.
129  UT_VariantMap(UT_VariantMap &&) = default;
130 
131  /// Copy a variant map by referencing the variant map container from
132  /// another. The two map wrappers will share the same map container.
133  UT_VariantMap &operator=(const UT_VariantMap &) = default;
134 
135  /// Move the variant map container from another variant map wrapper.
136  UT_VariantMap &operator=(UT_VariantMap &&) = default;
137 
138  /// Item-wise equality comparison of the keys and variants of the two maps.
139  bool operator==(const UT_VariantMap &o) const;
140 
141  /// Item-wise non-equality comparison of the keys and variants of the two
142  /// maps.
143  bool operator!=(const UT_VariantMap &o) const { return !operator==(o); }
144 
145  /// Make a deep copy of another array container. This array wrapper will not
146  /// share the array container with the other.
147  void deepCopy(const UT_VariantMap &);
148 
149  /// Returns a read-only variant associated with @c key. No error checking
150  /// is performed. If the key doesn't exist, the behavior is undefined.
151  const UT_Variant &operator[](const UT_StringRef &key) const;
152 
153  /// Returns a writable variant associated with @c key. No error checking
154  /// is performed. If the key doesn't exist, the behavior is undefined.
155  UT_Variant &operator[](const UT_StringHolder &key);
156 
157  /// Returns a read-only iterator pointing to the item associated with @c key.
158  /// If the item doesn't exist, this will be the value of @end.
159  const_iterator find(const UT_StringRef &key) const;
160 
161  /// Returns a writable iterator pointing to the item associated with @c key.
162  /// If the item doesn't exist, this will be the value of @end.
163  iterator find(const UT_StringRef &key);
164 
165  /// Returns @c true if the item associated with @c key exists in the map
166  /// container.
167  bool contains(const UT_StringRef &key) const { return m_map->contains(key); }
168 
169  /// Erase the item associated with the key @key. If the item existed and
170  /// was successfully erased, this function returns @true.
171  bool erase(const UT_StringRef &key);
172 
173  /// Erase the item pointed to by the iterator @c it. The returned
174  /// @c iterator will point to the next item after the one deleted.
175  iterator erase(const_iterator it);
176 
177  /// Return a writable iterator to the beginning of the map container.
178  iterator begin();
179 
180  /// Return a read-only iterator to the beginning of the map container.
181  const_iterator begin() const;
182 
183  /// Return a writable iterator to the end of the map container.
184  iterator end();
185 
186  /// Return a read-only iterator to the end of the map container.
187  const_iterator end() const;
188 
189  /// Returns a read-only reference to the underlying map container.
190  const container_type &container() const { return *m_map.get(); }
191 
192  /// Returns a writable reference to the underlying map container.
193  container_type &container() { return *m_map.get(); }
194 
195 private:
196  std::shared_ptr<container_type> m_map;
197 };
198 
199 // ============================================================================
200 
201 /// UT_Variant is a container that can hold a single value of many different
202 /// types.
204 {
205 public:
206  ///
207  enum class Type
208  {
209  Unknown, ///< Uninitialized variant. This is distinct from a null variant.
210  Null, ///< A null variant. A null variant holds no value.
211  Bool, ///< A boolean.
212  Int, ///< A 64-bit signed integer.
213  UInt, ///< A 64-bit unsigned integer.
214  Float, ///< A 64-bit float value.
215  String, ///< A shared string.
216  Vector2, ///< @c UT_Vector2D
217  Vector3, ///< @c UT_Vector3D
218  Vector4, ///< @c UT_Vector4D
219  Matrix2, ///< @c UT_Matrix2D
220  Matrix3, ///< @c UT_Matrix3D
221  Matrix4, ///< @c UT_Matrix4D
222  Pointer, ///< An arbitrary @c void pointer value.
223  Array, ///< A @c UT_VariantArray value
224  Map ///< A @c UT_VariantMap value
225  };
226 
227  /// A keystone type used to indicate that a variant should be initialized
228  /// as a null variant.
229  enum NullType { Null };
230 
231  template<typename T>
232  struct TypeInfo { static constexpr Type typeId = Type::Unknown;
233  static constexpr bool is_trivial = false;
234  static constexpr bool is_complex = false; };
235 
236  template<typename T>
238  {
239  static constexpr bool value = TypeInfo<T>::is_trivial;
240  };
241 
242  template<typename T>
244  {
245  static constexpr bool value = TypeInfo<T>::is_complex;
246  };
247 
248  template<typename U> struct TypeConversion { using To = U; using From = void; };
249  template<typename T> struct IsConvertibleType
250  {
251  static constexpr bool value =
252  !std::is_same<typename TypeConversion<T>::From, void>::value;
253  };
254 
255  /// Construct an unknown variant.
256  UT_Variant() : m_type(Type::Unknown) {}
257 
258  /// Construct a null variant. Call like so:
259  /// @code
260  /// UT_Variant null(UT_Variant::Null);
261  /// @endcode
262  UT_Variant(NullType) : m_type(Type::Null) {}
263 
264  /// Construct a boolean variant with the given value.
265  UT_Variant(bool v) : m_type(Type::Bool) { m_value.m_bool = v; }
266 
267  /// Construct an integer variant with the given value.
268  UT_Variant(int32 v) : m_type(Type::Int) { m_value.m_int = v; }
269 
270  /// Construct an integer variant with the given value.
271  UT_Variant(int64 v) : m_type(Type::Int) { m_value.m_int = v; }
272 
273  /// Construct an unsigned integer variant with the given value.
274  UT_Variant(uint32 v) : m_type(Type::UInt) { m_value.m_int = int64(v); }
275 
276  /// Construct an unsigned integer variant with the given value.
277  UT_Variant(uint64 v) : m_type(Type::UInt) { m_value.m_int = int64(v); }
278 
279  /// Construct a float variant with the given value.
280  UT_Variant(fpreal32 v) : m_type(Type::Float) { m_value.m_float = v; }
281 
282  /// Construct a float variant with the given value.
283  UT_Variant(fpreal64 v) : m_type(Type::Float) { m_value.m_float = v; }
284 
285  /// Construct a string variant with the given value.
286  UT_Variant(const char *v);
287 
288  /// Construct a @c Type::String variant with the given value.
289  UT_Variant(const UT_StringHolder &v);
290 
291  /// Construct a @c Type::String variant with the given value.
292  UT_Variant(const UT_StringRef &v);
293 
294  /// Construct a @c Type::Vector2 variant with the given value.
295  UT_Variant(const UT_Vector2F &v);
296 
297  /// Construct a @c Type::Vector2 variant with the given value.
298  UT_Variant(const UT_Vector2D &v);
299 
300  /// Construct a @c Type::Vector3 variant with the given value.
301  UT_Variant(const UT_Vector3F &v);
302 
303  /// Construct a @c Type::Vector3 variant with the given value.
304  UT_Variant(const UT_Vector3D &v);
305 
306  /// Construct a @c Type::Vector4 variant with the given value.
307  UT_Variant(const UT_Vector4F &v);
308 
309  /// Construct a @c Type::Vector4 variant with the given value.
310  UT_Variant(const UT_Vector4D &v);
311 
312  /// Construct a @c Type::Matrix2 variant with the given value.
313  UT_Variant(const UT_Matrix2F &v);
314 
315  /// Construct a @c Type::Matrix2 variant with the given value.
316  UT_Variant(const UT_Matrix2D &v);
317 
318  /// Construct a @c Type::Matrix3 variant with the given value.
319  UT_Variant(const UT_Matrix3F &v);
320 
321  /// Construct a @c Type::Matrix3 variant with the given value.
322  UT_Variant(const UT_Matrix3D &v);
323 
324  /// Construct a @c Type::Matrix4 variant with the given value.
325  UT_Variant(const UT_Matrix4F &v);
326 
327  /// Construct a @c Type::Matrix4 variant with the given value.
328  UT_Variant(const UT_Matrix4D &v);
329 
330  /// Construct a @c Type::Pointer variant with the given value.
331  UT_Variant(void *v) : m_type(Type::Pointer) { m_value.m_ptr = v; }
332 
333  /// Construct a @c Type::Array variant with the given value.
334  UT_Variant(const UT_VariantArray &v);
335 
336  /// Construct a @c Type::Array variant with the given value.
338 
339  /// Construct a @c Type::Map variant with the given value.
340  UT_Variant(const UT_VariantMap &v);
341 
342  /// Construct a @c Type::Map variant with the given value.
344 
345  /// Copy construct a variant with the given value.
346  UT_Variant(const UT_Variant &v);
347 
348  /// Move construct a variant with the given value.
350 
351  /// Variant destructor. For shared items, it only decreases reference
352  /// counts.
353  ~UT_Variant();
354 
355  /// Copy assignment operator. For shared data, it only adds a reference to
356  /// them.
357  UT_Variant &operator=(const UT_Variant &v);
358 
359  /// Move assignment operator. The passed-in variant is cleared out and left
360  /// as an unknown type.
361  UT_Variant &operator=(UT_Variant &&v);
362 
363  ///
364  bool operator==(const UT_Variant &v) const;
365 
366  Type type() const { return m_type; }
367  const char *typeName() const { return typeName(m_type); }
368  static const char *typeName(Type type);
369 
370  /// Convert this variant to a different type, in-place. Returns @c true
371  /// if the conversion succeeded. If the conversion failed, the variant
372  /// is left as-is.
373  bool convert(Type type);
374 
375  /// An explicit method of setting the variant type to null.
376  void setNull() { convert(Type::Null); }
377 
378  /// @{
379  /// Return the type requested by the template argument. If the contained
380  /// type is not of the requested type, a conversion is attempted.
381  /// If the conversion fails, the default instance of the return type is
382  /// returned and the value of @c ok is set to @c false.
383  /// Compound values, such as the vector and matrix types are returned by
384  /// reference, whereas all the others are returned by value.
385  template<typename T>
388  get(bool &ok) const;
389 
390  template<typename T>
393  get(bool &ok) const;
394 
395  template<typename T>
399  get(bool &ok) const;
400  /// @}
401 
402  /// @{
403  /// Return the type requested by the template argument. If the contained
404  /// type is not of the requested type, a conversion is attempted.
405  /// If the conversion fails, a default value is returned for the type
406  /// requested.
407  template<typename T>
410  get() const { bool ok; return get<T>(ok); }
411 
412  template<typename T>
415  get() const { bool ok; return get<T>(ok); }
416 
417  template<typename T>
421  get() const { bool ok; return get<T>(ok); }
422  /// @}
423 
424  /// Set the value and type of this variant to match the type and value of
425  /// the argument passed in.
426  template<typename T> void set(const T &v)
427  {
428  move(UT_Variant(v));
429  }
430 
431 private:
432  void copy(const UT_Variant &v);
433  void move(UT_Variant &&v);
434  void destroy();
435 
436  template<typename T>
437  const T *valueGet() const;
438 
439  template<typename T>
440  T &valueAlloc();
441 
442  template<typename T>
443  void valueDelete();
444 
445  template<typename T>
446  T valueConvert(bool &ok) const;
447 
448  bool parseBool(bool &ok) const;
449  int64 parseInt(bool &ok) const;
450  uint64 parseUInt(bool &ok) const;
451  fpreal64 parseFloat(bool &ok) const;
452  UT_StringHolder formatString(bool &ok) const;
453  UT_StringHolder formatInt() const;
454  UT_StringHolder formatUInt() const;
455  UT_StringHolder formatFloat() const;
456 
457  union
458  {
459  bool m_bool;
462  void *m_ptr;
463 
464  // Any type, same size or smaller than this, will be aliased into this
465  // storage. Otherwise it will be allocated on the heap.
466  // std::array is a trivial type and so is allowed in a union with no
467  // special considerations.
468  std::array<unsigned char, 24> m_storage;
469  } m_value;
470  Type m_type;
471 };
472 
473 // ============================================================================
474 // UT_VariantArray implementation
475 
476 inline
477 UT_VariantArray::UT_VariantArray(std::initializer_list<UT_Variant> init) :
478  UT_VariantArray(init.size())
479 {
480  for (auto &&v: init)
481  m_array->append(v);
482 }
483 
484 
485 // ============================================================================
486 // UT_VariantMap implementation
487 
488 inline
490  std::initializer_list<container_type::value_type> init) :
491  UT_VariantMap()
492 {
493  for (auto &&v: init)
494  m_map->insert(v);
495 }
496 
497 inline bool
499 {
500  return *m_map == *o.m_map;
501 }
502 
503 inline const UT_Variant &
505 {
506  return m_map->operator [](key);
507 }
508 
509 inline UT_Variant &
511 {
512  return m_map->operator [](key);
513 }
514 
517 {
518  return m_map->find(key);
519 }
520 
523 {
524  return m_map->find(key);
525 }
526 
527 inline bool
529 {
530  return m_map->erase(key);
531 }
532 
535 {
536  return m_map->erase(it);
537 }
538 
541 {
542  return m_map->begin();
543 }
544 
547 {
548  return m_map->begin();
549 }
550 
553 {
554  return m_map->end();
555 }
556 
559 {
560  return m_map->end();
561 }
562 
563 // ============================================================================
564 // UT_Variant implementation
565 
566 #define UT_VARIANT_TYPE_ID(_T_, _ID_, _TRV_, _CPL_) \
567  template<> struct UT_Variant::TypeInfo<_T_> { \
568  static constexpr UT_Variant::Type typeId = UT_Variant::Type::_ID_; \
569  static constexpr bool is_trivial = _TRV_; \
570  static constexpr bool is_complex = _CPL_; \
571  }
572 
573 UT_VARIANT_TYPE_ID(void, Null, false, false);
574 UT_VARIANT_TYPE_ID(bool, Bool, true, false);
575 UT_VARIANT_TYPE_ID(int64, Int, true, false);
576 UT_VARIANT_TYPE_ID(uint64, UInt, true, false);
577 UT_VARIANT_TYPE_ID(fpreal64, Float, true, false);
578 UT_VARIANT_TYPE_ID(UT_StringHolder, String, true, false);
579 UT_VARIANT_TYPE_ID(UT_Vector2D, Vector2, false, true);
580 UT_VARIANT_TYPE_ID(UT_Vector3D, Vector3, false, true);
581 UT_VARIANT_TYPE_ID(UT_Vector4D, Vector4, false, true);
582 UT_VARIANT_TYPE_ID(UT_Matrix2D, Matrix2, false, true);
583 UT_VARIANT_TYPE_ID(UT_Matrix3D, Matrix3, false, true);
584 UT_VARIANT_TYPE_ID(UT_Matrix4D, Matrix4, false, true);
585 UT_VARIANT_TYPE_ID(void *, Pointer, true, false);
587 UT_VARIANT_TYPE_ID(UT_VariantMap, Map, true, false);
588 
589 #undef UT_VARIANT_TYPE_ID
590 
591 template<>
592 inline bool
593 UT_Variant::valueConvert<bool>(bool &ok) const
594 {
595  ok = true;
596  if (m_type == Type::Bool)
597  return m_value.m_bool;
598  else if (m_type == Type::Int || m_type == Type::UInt)
599  return m_value.m_int != 0;
600  else if (m_type == Type::Float)
601  return m_value.m_float != 0;
602  else if (m_type == Type::String)
603  return parseBool(ok);
604  else
605  {
606  ok = false;
607  return false;
608  }
609 }
610 
611 template<>
612 inline int64
613 UT_Variant::valueConvert<int64>(bool &ok) const
614 {
615  ok = true;
616  if (m_type == Type::Bool)
617  return m_value.m_bool ? 1 : 0;
618  else if (m_type == Type::Int || m_type == Type::UInt)
619  return m_value.m_int;
620  else if (m_type == Type::Float)
621  return static_cast<int64>(m_value.m_float);
622  else if (m_type == Type::String)
623  return parseInt(ok);
624  else
625  {
626  ok = false;
627  return false;
628  }
629 }
630 
631 template<>
632 inline uint64
633 UT_Variant::valueConvert<uint64>(bool &ok) const
634 {
635  ok = true;
636  if (m_type == Type::Bool)
637  return m_value.m_bool ? 1 : 0;
638  else if (m_type == Type::Int || m_type == Type::UInt)
639  return uint64(m_value.m_int);
640  else if (m_type == Type::Float)
641  return static_cast<uint64>(m_value.m_float);
642  else if (m_type == Type::String)
643  return uint64(parseInt(ok));
644  else
645  {
646  ok = false;
647  return false;
648  }
649 }
650 
651 template<>
652 inline fpreal64
653 UT_Variant::valueConvert<fpreal64>(bool &ok) const
654 {
655  ok = true;
656  if (m_type == Type::Bool)
657  return m_value.m_bool ? 1 : 0;
658  else if (m_type == Type::Int)
659  return fpreal64(m_value.m_int);
660  else if (m_type == Type::UInt)
661  return fpreal64(uint64(m_value.m_int));
662  else if (m_type == Type::Float)
663  return m_value.m_float;
664  else if (m_type == Type::String)
665  return parseFloat(ok);
666  else
667  {
668  ok = false;
669  return false;
670  }
671 }
672 
673 template<>
674 inline UT_StringHolder
675 UT_Variant::valueConvert<UT_StringHolder>(bool &ok) const
676 {
677  ok = true;
678  if (m_type == Type::Bool)
679  return UT_StringHolder(m_value.m_bool ? "true" : "false");
680  else if (m_type == Type::Int)
681  return formatInt();
682  else if (m_type == Type::UInt)
683  return formatUInt();
684  else if (m_type == Type::Float)
685  return formatFloat();
686  else if (m_type == Type::String)
687  return *valueGet<UT_StringHolder>();
688  else
689  {
690  ok = false;
691  return UT_StringHolder();
692  }
693 }
694 
695 
696 template<>
697 inline void *
698 UT_Variant::valueConvert<void *>(bool &ok) const
699 {
700  if (m_type == Type::Pointer)
701  {
702  ok = true;
703  return m_value.m_ptr;
704  }
705  else
706  {
707  ok = false;
708  return nullptr;
709  }
710 }
711 
712 
713 template<>
714 inline UT_VariantArray
715 UT_Variant::valueConvert<UT_VariantArray>(bool &ok) const
716 {
717  if (m_type == Type::Array)
718  {
719  ok = true;
720  return *valueGet<UT_VariantArray>();
721  }
722  else
723  {
724  ok = false;
725  return UT_VariantArray();
726  }
727 }
728 
729 template<>
730 inline UT_VariantMap
731 UT_Variant::valueConvert<UT_VariantMap>(bool &ok) const
732 {
733  if (m_type == Type::Map)
734  {
735  ok = true;
736  return *valueGet<UT_VariantMap>();
737  }
738  else
739  {
740  ok = false;
741  return UT_VariantMap();
742  }
743 }
744 
745 
746 template<typename T>
749 UT_Variant::get(bool &ok) const
750 {
751  return valueConvert<T>(ok);
752 }
753 
754 template<typename T>
757 UT_Variant::get(bool &ok) const
758 {
759  const T *v = this->valueGet<T>();
760  if (v)
761  {
762  ok = true;
763  return *v;
764  }
765  else
766  {
767  static T s_default;
768  ok = false;
769  return s_default;
770  }
771 }
772 
773 // Conversion templates
774 template<> struct UT_Variant::TypeConversion<int32> { using From = int64; };
775 template<> struct UT_Variant::TypeConversion<uint32> { using From = uint64; };
776 template<> struct UT_Variant::TypeConversion<fpreal32> { using From = fpreal64; };
777 template<> struct UT_Variant::TypeConversion<UT_Vector2F> { using From = UT_Vector2D; };
778 template<> struct UT_Variant::TypeConversion<UT_Vector3F> { using From = UT_Vector3D; };
779 template<> struct UT_Variant::TypeConversion<UT_Vector4F> { using From = UT_Vector4D; };
780 template<> struct UT_Variant::TypeConversion<UT_Matrix2F> { using From = UT_Matrix2D; };
781 template<> struct UT_Variant::TypeConversion<UT_Matrix3F> { using From = UT_Matrix3D; };
782 template<> struct UT_Variant::TypeConversion<UT_Matrix4F> { using From = UT_Matrix4D; };
783 template<> struct UT_Variant::TypeConversion<const char *> { using From = UT_StringHolder; };
784 
785 
786 template<typename T>
790 UT_Variant::get(bool &ok) const
791 {
792  return static_cast<T>(this->get<typename TypeConversion<T>::From>(ok));
793 }
794 
795 UT_API size_t format(char *buffer, size_t buffer_size, const UT_Variant &v);
796 
797 
798 #endif // __UT_Variant__
UT_Matrix4T< fpreal64 > UT_Matrix4D
Definition: ImfArray.h:77
UT_Variant(NullType)
Definition: UT_Variant.h:262
UT_Variant()
Construct an unknown variant.
Definition: UT_Variant.h:256
iterator begin()
Return a writable iterator to the beginning of the map container.
Definition: UT_Variant.h:540
UT_Variant(void *v)
Construct a Type::Pointer variant with the given value.
Definition: UT_Variant.h:331
const UT_Variant & operator[](exint index) const
Definition: UT_Variant.h:73
UT_Variant(fpreal32 v)
Construct a float variant with the given value.
Definition: UT_Variant.h:280
const GLdouble * v
Definition: glcorearb.h:836
UT_Vector2T< fpreal64 > UT_Vector2D
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
UT_Variant(int32 v)
Construct an integer variant with the given value.
Definition: UT_Variant.h:268
const_iterator begin() const
Return a read-only iterator to the beginning of the array container.
Definition: UT_Variant.h:91
iterator begin()
Return a writable iterator to the beginning of the array container.
Definition: UT_Variant.h:88
void setNull()
An explicit method of setting the variant type to null.
Definition: UT_Variant.h:376
iterator end()
Return a writable iterator to the end of the map container.
Definition: UT_Variant.h:552
bool erase(const UT_StringRef &key)
Definition: UT_Variant.h:528
exint append(const UT_Variant &t)
Definition: UT_Variant.h:81
container_type::iterator iterator
Definition: UT_Variant.h:115
bool m_bool
Definition: UT_Variant.h:459
#define UT_API
Definition: UT_API.h:12
UT_VariantMap()
Construct a default, empty container.
GLuint buffer
Definition: glcorearb.h:659
const container_type & container() const
Returns a read-only reference to the underlying map container.
Definition: UT_Variant.h:190
UT_Variant(uint32 v)
Construct an unsigned integer variant with the given value.
Definition: UT_Variant.h:274
GLsizeiptr size
Definition: glcorearb.h:663
std::array< unsigned char, 24 > m_storage
Definition: UT_Variant.h:468
bool operator!=(const UT_VariantArray &o) const
Item-wise non-equality comparison of the variants of the two arrays.
Definition: UT_Variant.h:62
int64 m_int
Definition: UT_Variant.h:460
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:106
UT_Variant(uint64 v)
Construct an unsigned integer variant with the given value.
Definition: UT_Variant.h:277
std::enable_if< IsTrivialType< T >::value &&!IsConvertibleType< T >::value, T >::type get() const
Definition: UT_Variant.h:410
exint append(UT_Variant &&t)
Definition: UT_Variant.h:85
unsigned long long uint64
Definition: SYS_Types.h:107
const char * typeName() const
Definition: UT_Variant.h:367
bool operator==(const UT_VariantArray &o) const
Item-wise equality comparison of the variants of the two arrays.
Definition: UT_Variant.h:59
UT_VariantArray(exint size=0)
int64 exint
Definition: SYS_Types.h:115
container_type & container()
Returns a writable reference to the underlying map container.
Definition: UT_Variant.h:193
iterator end()
Return a writable iterator to the end of the array container.
Definition: UT_Variant.h:94
bool operator==(const UT_VariantMap &o) const
Item-wise equality comparison of the keys and variants of the two maps.
Definition: UT_Variant.h:498
double fpreal64
Definition: SYS_Types.h:191
GLuint GLuint end
Definition: glcorearb.h:474
exint size() const
Returns the number of items in the array container.
Definition: UT_Variant.h:69
void * m_ptr
Definition: UT_Variant.h:462
UT_Vector3T< fpreal64 > UT_Vector3D
UT_Variant & operator[](exint index)
Definition: UT_Variant.h:77
container_type::const_iterator const_iterator
Definition: UT_Variant.h:116
container_type & container()
Returns a writable reference to the underlying array container.
Definition: UT_Variant.h:103
int int32
Definition: SYS_Types.h:34
UT_Matrix2T< fpreal64 > UT_Matrix2D
GLsizei const GLfloat * value
Definition: glcorearb.h:823
bool operator!=(const UT_VariantMap &o) const
Definition: UT_Variant.h:143
const container_type & container() const
Returns a read-only reference to the underlying array container.
Definition: UT_Variant.h:100
bool contains(const UT_StringRef &key) const
Definition: UT_Variant.h:167
GLuint index
Definition: glcorearb.h:785
void set(const T &v)
Definition: UT_Variant.h:426
Type type() const
Definition: UT_Variant.h:366
png_infop png_bytep png_size_t buffer_size
Definition: png.h:2124
UT_Variant(bool v)
Construct a boolean variant with the given value.
Definition: UT_Variant.h:265
const UT_Variant & operator[](const UT_StringRef &key) const
Definition: UT_Variant.h:504
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
UT_Variant(fpreal64 v)
Construct a float variant with the given value.
Definition: UT_Variant.h:283
#define UT_VARIANT_TYPE_ID(_T_, _ID_, _TRV_, _CPL_)
Definition: UT_Variant.h:566
#define const
Definition: zconf.h:214
const_iterator find(const UT_StringRef &key) const
Definition: UT_Variant.h:522
UT_Variant(int64 v)
Construct an integer variant with the given value.
Definition: UT_Variant.h:271
UT_Vector4T< fpreal64 > UT_Vector4D
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Variant &v)
const_iterator end() const
Return a read-only iterator to the end of the array container.
Definition: UT_Variant.h:97
Parent::iterator iterator
Definition: UT_StringMap.h:51
float fpreal32
Definition: SYS_Types.h:190
Parent::const_iterator const_iterator
Definition: UT_StringMap.h:50
fpreal64 m_float
Definition: UT_Variant.h:461
UT_Matrix3T< fpreal64 > UT_Matrix3D
unsigned int uint32
Definition: SYS_Types.h:35