HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeRef.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  * COMMENTS:
7  */
8 
9 #ifndef __PDG_ATTRIBUTE_REF_H__
10 #define __PDG_ATTRIBUTE_REF_H__
11 
12 #include "PDG_API.h"
13 
14 #include "PDG_AttributeArray.h"
15 #include "PDG_AttributeGeometry.h"
16 #include "PDG_AttributeHolder.h"
17 #include "PDG_AttributePyObject.h"
18 #include "PDG_Types.h"
19 
20 #include <UT/UT_StringHolder.h>
21 #include <UT/UT_WorkBuffer.h>
22 
23 class PDG_AttributeOwner;
24 class PDG_Node;
25 
26 /**
27  * Base class for attribute references
28  */
30 {
31 public:
32  /// Enumeration of possible errors that could occur when attempting to
33  /// to construct an attribute reference
34  enum Error
35  {
36  /// No error was specified, i.e. the ref is valid
38 
39  /// An unspecified error occured - the ref is invalid
41 
42  /// The requested attribute was not found - the ref is invalid
44 
45  /// The requested attribute was a readonly when attempting to create
46  /// a RW ref - the ref is invalid
48 
49  /// The requested attribute is internal, and therefore cannot be
50  /// removed by user code
52 
53  /// The entire attribute map is read only
55 
56  /// The requested attribute type did not match the attribute - the
57  /// ref is invalid
59 
60  /// The requested attribute is static and was not upgraded to dynamic
62 
63  /// The requested attribute already exists, but the API call was
64  /// instruct to not overwrite existing values
66 
67  /// The ref is uninitialized and needs to be created at a later point
69 
70  /// The attribute doesn't support a flag that was passed to a SetFlag
71  /// call
73  };
74 
75 public:
77  const PDG_AttributeOwner* owner,
78  Error error=eErrorNone)
79  : myName(name)
80  , myOwner(owner)
81  , myError(error)
82  {
83  }
84 
85  /// Returns true if the handle is valid
86  inline operator bool() const
87  {
88  return isValid();
89  }
90 
91  /// Returns true if the handle is valid
92  inline bool isValid() const
93  {
94  return (myError == eErrorNone);
95  }
96 
97  /// Returns the error state of the handle
98  inline Error error() const
99  {
100  return myError;
101  }
102 
103  /// Returns the name of the attribute referenced by this attrib ref
104  inline const UT_StringHolder&
105  name() const
106  {
107  return myName;
108  }
109 
110  /// Returns the PDG_AttributeOwner that owns the underlying attribute
111  const PDG_AttributeOwner*
112  owner() const
113  {
114  return myOwner;
115  }
116 
117  /// Returns false and Writes an attribute error message into the buffer if
118  /// an error exists, or returns trues and does not modify the buffer if no
119  /// error has been recorded.
120  bool validate(UT_WorkBuffer& buffer) const;
121 
122  /// Same as above, except the attribute error is reported on the specified
123  /// node instead of returned as a buffer, if an error has occured. The
124  /// method still returns true if no error has occured, and false if one
125  /// has.
126  ///
127  /// The report_errors argument is provided as a convenience, to make it
128  /// possible to parametrically skip error reporting
129  bool validate(const PDG_Node* node,
130  bool report_errors=true,
131  bool as_warning=false) const;
132 
133  /// Writes an attribute error format message to the buffer, based on the
134  /// supply error, attrib name and optional work item. Returns True if no
135  /// error is detected, or false if an error occured.
136  static bool attributeError(UT_WorkBuffer& buffer,
137  Error error,
138  const UT_StringHolder& attrib_name,
139  const PDG_AttributeOwner* owner=nullptr);
140 
141  /// Emits events when the attribute is modified
142  static void attributeModified(
143  const PDG_AttributeOwner* owner,
144  PDG_AttributeType attrib_type,
145  const UT_StringHolder& attrib_name);
146 
147 protected:
151 };
152 
153 /**
154  * Base class for templated attribute references
155  */
156 template <typename Attribute, typename Holder>
158 {
159 public:
161 
162 public:
163  explicit PDG_AttributeRefT(Holder* holder,
164  const UT_StringHolder& name,
165  const PDG_AttributeOwner* owner,
166  PDG_AttributeRef::Error error=eErrorNone)
167  : PDG_AttributeRef(name, owner, error)
168  , myHolder(holder)
169  {
170  }
171 
172  /// Returns the underlying attribute holder
173  inline Holder* holder() const
174  {
175  return myHolder;
176  }
177 
178  /// Returns a const pointer to the underlying attribute instance
179  inline const Attribute* attribute() const
180  {
181  return myHolder->template attribute<const Attribute>();
182  }
183 
184  /// Returns a const pointer to the underlying attribute instance,
185  /// casted to the specified type
186  template <typename T> const T* attributeT() const
187  {
188  return myHolder->template attribute<const T>();
189  }
190 
191  /// Returns a const pointer to the underlying attribute instance
192  inline const Attribute* operator->() const
193  {
194  return attribute();
195  }
196 
197  /// Returns true if the contained attribute has any data
198  inline bool hasData() const
199  {
200  return myHolder->template hasData<Attribute>();
201  }
202 
203  /// Returns true if the contained attribute holder owns its data
204  inline bool isOwner() const
205  {
206  return myHolder->isOwner();
207  }
208 
209  /// Returns the type of the contained attribute
210  inline PDG_AttributeType type() const
211  {
212  return myHolder->type();
213  }
214 
215  /// Returns the flags on the contained holder
216  inline uint16 flags() const
217  {
218  return myHolder->flags();
219  }
220 
221  /// Returns true if the contained holder has any flags set
222  inline bool hasAnyFlags() const
223  {
224  return myHolder->hasAnyFlags();
225  }
226 
227  /// Returns true if the contained holder has the specified flag set
228  inline bool hasFlag(PDG_AttributeFlag flag) const
229  {
230  return myHolder->hasFlag(flag);
231  }
232 
233  /// Returns true if the contained holder has all of the specified flags set
234  inline bool hasFlags(uint16 flags) const
235  {
236  return myHolder->hasFlags(flags);
237  }
238 
239  /// Returns true if the contained holder has any of the specified flags set
240  inline bool hasAnyFlags(uint16 flags) const
241  {
242  return myHolder->hasAnyFlags(flags);
243  }
244 
245  /// Returns true if the attribute is numeric
246  inline bool isNumeric() const
247  {
248  return (myHolder->type() == PDG_AttributeType::eIntegerArray) ||
249  (myHolder->type() == PDG_AttributeType::eFloatArray);
250  }
251 
252  /// Returns true if the attribute is an array
253  inline bool isArray() const
254  {
255  return (myHolder->type() <= PDG_AttributeType::eFileArray);
256  }
257 
258  /// Casts the value contained in the attribute at the particular index to a
259  /// numeric value, by looking up the value with the query string. Falls
260  /// a regular cast if query strings aren't supported
262  const UT_StringHolder& query,
263  int index,
264  bool has_component) const
265  {
266  if (myHolder->type() == PDG_AttributeType::ePythonObject)
267  {
268  if (!has_component)
269  index = -1;
270  return myHolder->template attribute<PDG_AttributePyObject>()->query(
271  number, query, index);
272  }
273  return asNumber(number, index);
274  }
275 
276  /// Casts the value contained in the attribute at the particular index to a
277  /// numeric value, if possible.
278  inline PDG_AttributeCast asNumber(fpreal& number, int index) const
279  {
280  if (myHolder->type() == PDG_AttributeType::eIntegerArray)
281  {
283  if (myHolder->template attribute<PDG_AttributeInteger>()->value(
284  temp, index))
285  {
286  number = temp;
288  }
289 
291  }
292  else if (myHolder->type() == PDG_AttributeType::eFloatArray)
293  {
294  if (myHolder->template attribute<PDG_AttributeFloat>()->value(
295  number, index))
296  {
298  }
299 
301  }
302 
304  }
305 
306  /// Casts the value contained in the attribute to a PDG_File object. Only
307  /// valid for string, file and PyObject attribute types
309  PDG_File& file,
310  int index,
311  const UT_StringHolder& tag =
313  PDG_File::Hash hash = 0,
314  bool own = false) const
315  {
316  UT_StringHolder file_path;
317  UT_StringHolder file_tag = tag;
318  PDG_File::Hash file_hash = hash;
319 
320  switch (myHolder->type())
321  {
323  {
324  if (!myHolder->template attribute<PDG_AttributePyObject>()->str(
325  file_path))
326  {
328  }
329 
330  break;
331  }
332 
334  {
335  if (!myHolder->template attribute<PDG_AttributeString>()->value(
336  file_path, index))
337  {
339  }
340 
341  break;
342  }
343 
345  {
347  if (myHolder->template attribute<PDG_AttributeFile>()->value(
348  temp, index))
349  {
350  file_path = temp.data();
351 
352  if (file_tag.isEmpty())
353  file_tag = temp.tag();
354 
355  if (!file_hash)
356  file_hash = temp.hash();
357 
358  break;
359  }
360 
362  }
363 
364  default:
366  }
367 
368  file = PDG_File(file_path, file_tag, file_hash, own);
370  }
371 
372  /// Casts the value contained in the attribute at the particular index to a
373  /// string value, by looking up the value with the query string. Falls
374  /// a regular cast if query strings aren't supported
376  const UT_StringHolder& query,
377  int index,
378  int pad,
379  bool has_component) const
380  {
381  if (myHolder->type() == PDG_AttributeType::ePythonObject)
382  {
383  if (!has_component)
384  index = -1;
385  return myHolder->template attribute<PDG_AttributePyObject>()->query(
386  buffer, query, index);
387  }
388  return asString(buffer, index, pad);
389  }
390 
391  /// Casts the value contained in the attribute at the particular index to a
392  /// string value, if possible.
394  int index,
395  int pad=0) const
396  {
397  switch (myHolder->type())
398  {
400  {
402  if (myHolder->template attribute<PDG_AttributeInteger>()->value(
403  temp, index))
404  {
405  buffer.sprintf("%0*" SYS_PRId64, pad, temp);
407  }
409  }
410 
412  {
414  if (myHolder->template attribute<PDG_AttributeFloat>()->value(
415  temp, index))
416  {
417  // If a padding was specified, round to the nearest int and
418  // pad the integer value. This is the same behavior as the
419  // padzero() HScript function. Otherwise, format the value
420  // as-is.
421  if (pad > 0)
422  buffer.sprintf("%0*d", pad, (int)SYSrint(temp));
423  else
424  buffer.sprintf("%g", temp);
426  }
428  }
429 
431  {
433  if (myHolder->template attribute<PDG_AttributeString>()->value(
434  temp, index))
435  {
436  buffer.sprintf("%s", temp.c_str());
438  }
440  }
441 
443  {
445  if (myHolder->template attribute<PDG_AttributeFile>()->value(
446  temp, index))
447  {
448  buffer.sprintf("%s", temp.data().c_str());
450  }
452  }
453 
455  {
456  UT_StringHolder temp;
457  if (myHolder->template attribute<PDG_AttributePyObject>()->str(
458  temp))
459  {
460  buffer.sprintf("%s", temp.c_str());
462  }
464  }
465 
466  default:
468  }
469  }
470 
471  /// Prints the values contained in the attribute to space-separated string
473  int pad=0) const
474  {
475  switch (myHolder->type())
476  {
478  {
479  auto&& values = myHolder->template
480  attribute<PDG_AttributeInteger>()->values();
481  for (auto&& value : values)
482  buffer.appendSprintf("%0*" SYS_PRId64 " ", pad, value);
483  buffer.removeTrailingSpace();
485  }
486 
488  {
489  auto&& values = myHolder->template
490  attribute<PDG_AttributeFloat>()->values();
491  for (auto&& value : values)
492  {
493  // If a padding was specified, round to the nearest int and
494  // pad the integer value. This is the same behavior as the
495  // padzero() HScript function. Otherwise, format the value
496  // as-is.
497  if (pad > 0)
498  buffer.appendSprintf("%0*d ", pad, (int)SYSrint(value));
499  else
500  buffer.appendSprintf("%g ", value);
501  }
502 
503  buffer.removeTrailingSpace();
505  }
506 
508  {
509  auto&& values = myHolder->template
510  attribute<PDG_AttributeString>()->values();
511  for (auto&& value : values)
512  {
513  UT_String wrap(value);
514  wrap.protectString();
515  buffer.appendSprintf("%s ", wrap.buffer());
516  }
517 
518  buffer.removeTrailingSpace();
520  }
521 
523  {
524  auto&& values = myHolder->template
525  attribute<PDG_AttributeFile>()->values();
526  for (auto&& value : values)
527  {
528  UT_String wrap(value.data());
529  wrap.protectString();
530  buffer.appendSprintf("%s ", wrap.buffer());
531  }
532 
533  buffer.removeTrailingSpace();
535  }
536 
538  {
540  if (myHolder->template attribute<PDG_AttributePyObject>()->str(
541  value))
542  {
543  UT_String wrap(value);
544  wrap.protectString();
545  buffer.appendSprintf("%s", wrap.buffer());
547  }
549  }
550 
551  default:
553  }
554  }
555 
556  /// Returns the size of the data stored in the attribute
557  inline int size() const
558  {
559  switch (myHolder->type())
560  {
562  {
563  return myHolder->template attribute<
565  }
566 
568  {
569  return myHolder->template attribute<
570  PDG_AttributeFloat>()->size();
571  }
572 
574  {
575  return myHolder->template attribute<
577  }
578 
580  {
581  return myHolder->template attribute<
582  PDG_AttributeFile>()->size();
583  }
584 
586  {
587  return myHolder->template attribute<
589  }
590 
592  {
593  return myHolder->template attribute<
595  }
596 
597  default:
598  return 0;
599  }
600  }
601 
602 protected:
603  Holder* myHolder;
604 };
605 
606 /**
607  * Read-only, const attribute ref
608  */
609 template <typename Attribute>
611  public PDG_AttributeRefT<Attribute, const PDG_AttributeHolder>
612 {
613 public:
615  using Base::Base;
616 };
617 
618 /**
619  * Read/write attribute ref that permits modifications of holder flags as
620  * well as non-const access to the underlying data. Accessing the attribute
621  * using either the named accessor or the -> overload will result in a deep
622  * copy + ownership being taken, if the data is not already owned by the
623  * holder.
624  */
625 template <typename Attribute>
627  public PDG_AttributeRefT<Attribute, PDG_AttributeHolder>
628 {
629 public:
632 
633  /// Constructs an uninitialized RW ref
635  const PDG_AttributeOwner* owner)
636  : Base(nullptr, name, owner, PDG_AttributeRef::eErrorUninitialized)
637  , myModified(false)
638  {
639  }
640 
641  /// Constructs a ref that can modify attribute data. We store the work
642  /// item so we can emit events.
644  const UT_StringHolder& name,
645  const PDG_AttributeOwner* owner,
647  : Base(holder, name, owner, error)
648  , myModified(false)
649  {
650  }
651 
652  /// Explicitly defined copy constructor, since we don't want to copy the
653  /// myModified flag from the source reference. Doing so would mean that
654  /// we'd potentially by emitting an extra data change event on destruction.
655  PDG_RWAttributeRef(const Self& other)
656  : Base(other)
657  , myModified(false)
658  {
659  }
660 
661  /// Explicitly defined move constructor, since a copy constructor has been
662  /// defined. When moving a ref we do want to preserve the myModified flag,
663  /// unlike in the copy constructor.
665  : Base(std::move(other))
666  , myModified(other.myModified)
667  {
668  other.myModified = false;
669  }
670 
671  /// Emits data changed events if this attribute ref recorded a modification
673  {
674  emitEvents();
675  }
676 
677  /// Explicitly defined copy assignment operator, since the copy constructor
678  /// is defined.
679  Self& operator=(const Self& other)
680  {
681  if (this != &other)
682  {
683  emitEvents();
684 
685  myModified = false;
686  Base::operator=(other);
687  }
688 
689  return *this;
690  }
691 
692  /// Explicitly defined move assignment operator, since the move constructor
693  /// is defined.
694  Self& operator=(Self&& other)
695  {
696  if (this != &other)
697  {
698  emitEvents();
699 
700  myModified = other.myModified;
701  other.myModified = false;
702 
703  Base::operator=(std::move(other));
704  }
705 
706  return *this;
707  }
708 
709  /// Emits pending events from the ref
710  inline void emitEvents()
711  {
712  if (Base::myOwner && myModified)
713  Base::attributeModified(Base::myOwner, Base::type(), Base::myName);
714 
715  myModified = false;
716  }
717 
718  /// Clears any pending events
719  inline void clearEvents()
720  {
721  myModified = false;
722  }
723 
724  /// Returns a non-const pointer to the underlying attribute instance. This
725  /// induces a copy if the attribute is not already owned, and counts as a
726  /// modification for the purpose of event handling.
728  {
729  Base::myHolder->own();
730  Base::myHolder->setIsChanged(true);
731 
732  myModified = true;
733  return Base::myHolder->template attribute<Attribute>();
734  }
735 
736  /// Returns a non-const pointer to the underlying attribute instance
738  {
739  return attribute();
740  }
741 
742  /// Sets the specific flag on or off, based on the set arugment, an
743  /// returns whether or not the flag was changed.
744  inline typename Base::Error
746  bool set,
747  bool& changed)
748  {
749  if (!Base::isValid())
750  return Base::error();
751 
752  if (Base::myOwner && !Base::myOwner->isAttribFlagValid(flag))
753  return Base::eErrorInvalidFlag;
754 
755  changed = Base::myHolder->setFlag(flag, set);
756  return Base::eErrorNone;
757  }
758 
759  /// Sets the specific flag on or off
760  inline typename Base::Error
761  setFlag(PDG_AttributeFlag flag, bool set)
762  {
763  bool discard;
764  return setFlag(flag, set, discard);
765  }
766 
767  /// Directly sets the flag bits to the specified flags
768  inline typename Base::Error
769  setFlags(uint16 flags, bool& changed)
770  {
771  if (!Base::isValid())
772  return Base::error();
773 
774  if (Base::myOwner && !Base::myOwner->areAttribFlagsValid(flags))
775  return Base::eErrorInvalidFlag;
776 
777  changed = Base::myHolder->setFlags(flags);
778  return Base::eErrorNone;
779  }
780 
781  /// Sets all flags
782  inline typename Base::Error
784  {
785  bool discard;
786  return setFlags(flags, discard);
787  }
788 
789  /// Truncates the array stored in the attribute
790  inline void truncate(int length)
791  {
792  switch (Base::myHolder->type())
793  {
795  {
796  return Base::myHolder->template attribute<
797  PDG_AttributeInteger>()->truncate(length);
798  }
799 
801  {
802  return Base::myHolder->template attribute<
803  PDG_AttributeFloat>()->truncate(length);
804  }
805 
807  {
808  return Base::myHolder->template attribute<
809  PDG_AttributeString>()->truncate(length);
810  }
811 
813  {
814  return Base::myHolder->template attribute<
815  PDG_AttributeFile>()->truncate(length);
816  }
817 
818  default:
819  return;
820  }
821  }
822 
823 private:
824  bool myModified;
825 };
826 
827 #endif
GLenum query
Definition: glad.h:2772
A single, opaque PyObject.
GLbitfield flags
Definition: glcorearb.h:1596
unsigned short uint16
Definition: SYS_Types.h:38
const T * attributeT() const
PDG_RWAttributeRef(PDG_AttributeHolder *holder, const UT_StringHolder &name, const PDG_AttributeOwner *owner, PDG_AttributeRef::Error error=PDG_AttributeRef::eErrorNone)
bool isOwner() const
Returns true if the contained attribute holder owns its data.
GLsizei const GLfloat * value
Definition: glcorearb.h:824
const UT_StringHolder & name() const
Returns the name of the attribute referenced by this attrib ref.
#define PDG_API
Definition: PDG_API.h:23
bool isEmpty() const
Same as !isstring()
bool isArray() const
Returns true if the attribute is an array.
Error error() const
Returns the error state of the handle.
Attribute * attribute()
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
An array of UT_StringHolder values.
The entire attribute map is read only.
The requested attribute was not found - the ref is invalid.
No error was specified, i.e. the ref is valid.
void pad(T &out, int n)
Definition: ImfXdr.h:490
Base::Error setFlag(PDG_AttributeFlag flag, bool set)
Sets the specific flag on or off.
Base::Error setFlag(PDG_AttributeFlag flag, bool set, bool &changed)
Base::Error setFlags(uint16 flags)
Sets all flags.
< returns > If no error
Definition: snippets.dox:2
~PDG_RWAttributeRef()
Emits data changed events if this attribute ref recorded a modification.
bool hasAnyFlags(uint16 flags) const
Returns true if the contained holder has any of the specified flags set.
Cast failed due to a type mismatch (string vs. int)
bool hasFlag(PDG_AttributeFlag flag) const
Returns true if the contained holder has the specified flag set.
const char * buffer() const
Definition: UT_String.h:509
Hash hash() const
Definition: PDG_File.h:101
void truncate(int length)
Truncates the array stored in the attribute.
int64 Hash
The file hash/modtime type.
Definition: PDG_File.h:38
An array of PDG_File values, e.g. File info structs.
An unspecified error occured - the ref is invalid.
Definition: core.h:760
bool removeTrailingSpace()
Remove trailing whitespace, return true if whitespace was removed.
UT_StringHolder myName
const UT_StringHolder & tag() const
Definition: PDG_File.h:98
bool hasAnyFlags() const
Returns true if the contained holder has any flags set.
void clearEvents()
Clears any pending events.
The requested attribute is static and was not upgraded to dynamic.
static const UT_StringHolder theEmptyString
PDG_AttributeCast
Enumeration of attribute cast results.
Attribute * operator->()
Returns a non-const pointer to the underlying attribute instance.
PDG_AttributeCast asNumber(fpreal &number, int index) const
PDG_AttributeCast asFile(PDG_File &file, int index, const UT_StringHolder &tag=UT_StringHolder::theEmptyString, PDG_File::Hash hash=0, bool own=false) const
bool hasData() const
Returns true if the contained attribute has any data.
#define PDG_API_TMPL
Definition: PDG_API.h:24
Holder * holder() const
Returns the underlying attribute holder.
SYS_FORCE_INLINE const char * c_str() const
PDG_RWAttributeRef(const UT_StringHolder &name, const PDG_AttributeOwner *owner)
Constructs an uninitialized RW ref.
const UT_StringHolder & data() const
Definition: PDG_File.h:95
GLuint const GLchar * name
Definition: glcorearb.h:786
const Attribute * attribute() const
Returns a const pointer to the underlying attribute instance.
const PDG_AttributeOwner * myOwner
PDG_AttributeFlag
Enumeration of extra attribute flags. Flags can be ORed together.
const PDG_AttributeOwner * owner() const
Returns the PDG_AttributeOwner that owns the underlying attribute.
A single PDG_ApplicationShim::Geometry instance.
fpreal32 SYSrint(fpreal32 val)
Definition: SYS_Floor.h:163
PDG_AttributeRef(const UT_StringHolder &name, const PDG_AttributeOwner *owner, Error error=eErrorNone)
int sprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
#define SYS_PRId64
Definition: SYS_Types.h:76
GLsizeiptr size
Definition: glcorearb.h:664
PDG_RWAttributeRef(const Self &other)
An array of fpreal values.
PDG_AttributeCast asNumber(fpreal &number, const UT_StringHolder &query, int index, bool has_component) const
PDG_AttributeRefT(Holder *holder, const UT_StringHolder &name, const PDG_AttributeOwner *owner, PDG_AttributeRef::Error error=eErrorNone)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
int size() const
Returns the size of the data stored in the attribute.
Error
Definition: oidn.hpp:319
PDG_AttributeType
Enumeration of possible attribute types.
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
PDG_AttributeCast asStringValues(UT_WorkBuffer &buffer, int pad=0) const
Prints the values contained in the attribute to space-separated string.
PDG_AttributeType type() const
Returns the type of the contained attribute.
uint16 flags() const
Returns the flags on the contained holder.
fpreal64 fpreal
Definition: SYS_Types.h:277
bool isNumeric() const
Returns true if the attribute is numeric.
PDG_AttributeCast asString(UT_WorkBuffer &buffer, const UT_StringHolder &query, int index, int pad, bool has_component) const
GLuint index
Definition: glcorearb.h:786
PDG_AttributeCast asString(UT_WorkBuffer &buffer, int index, int pad=0) const
No cast error occured (success)
PDG_RWAttributeRef(Self &&other)
OIIO_API bool attribute(string_view name, TypeDesc type, const void *val)
void protectString(bool protect_empty=false)
Definition: core.h:1131
An array of int values.
const Attribute * operator->() const
Returns a const pointer to the underlying attribute instance.
void emitEvents()
Emits pending events from the ref.
Base::Error setFlags(uint16 flags, bool &changed)
Directly sets the flag bits to the specified flags.
Cast failed due to an index being out of bounds.
type
Definition: core.h:1059
Self & operator=(Self &&other)
Self & operator=(const Self &other)
The ref is uninitialized and needs to be created at a later point.
bool isValid() const
Returns true if the handle is valid.
bool hasFlags(uint16 flags) const
Returns true if the contained holder has all of the specified flags set.