HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeOwner.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_OWNER_H__
10 #define __PDG_ATTRIBUTE_OWNER_H__
11 
12 #include "PDG_API.h"
13 #include "PDG_AttributeMap.h"
14 #include "PDG_AttributeTypes.h"
15 
16 #include <UT/UT_RWLock.h>
17 #include <UT/UT_StringHolder.h>
18 
19 #include <iosfwd>
20 
22 class UT_IStream;
23 
24 /*
25  * Interface for other classes that own attribute data
26  */
28 {
29 public:
30  PDG_AttributeOwner(bool has_runtime)
31  : myAttributes(this, has_runtime) {}
32  virtual ~PDG_AttributeOwner() {}
33 
35  { return myAttributes; }
37  { return myAttributes; }
38 
39  bool attribSaveJSON(std::ostream& os, bool binary) const;
40  bool attribSaveJSON(
41  const UT_StringHolder& file_path) const;
42 
43  bool attribLoadJSON(
44  UT_IStream& istream,
45  PDG_AttributeCollision strategy);
46  bool attribLoadJSON(
47  const UT_StringHolder& file_path,
48  PDG_AttributeCollision strategy);
49 
50  bool hasAttributes() const;
51 
52  virtual bool isAttribFlagValid(
53  PDG_AttributeFlag flag) const;
54  virtual bool areAttribFlagsValid(
55  uint16 flags) const;
56 
57  virtual UT_RWLock* attribGlobalLock() const
58  { return nullptr; }
59  virtual bool attribCanWrite(
60  const PDG_EvaluationContext* context) const
61  { return true; }
62 
63  virtual void attribUnlock(bool modified) const {}
64  virtual void attribModify(
65  PDG_AttributeType attrib_type,
66  const UT_StringHolder& attrib_name) const {}
67  virtual void attribWarn(const UT_StringHolder& msg) const {}
68 
70  { return ""; }
71 
72 protected:
74 };
75 
76 #endif
GLbitfield flags
Definition: glcorearb.h:1596
unsigned short uint16
Definition: SYS_Types.h:38
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
virtual UT_RWLock * attribGlobalLock() const
#define PDG_API
Definition: PDG_API.h:23
virtual void attribUnlock(bool modified) const
virtual UT_StringHolder attribOwnerName() const
**But if you need a or simply need to know when the task has note that the like this
Definition: thread.h:617
virtual bool attribCanWrite(const PDG_EvaluationContext *context) const
virtual void attribModify(PDG_AttributeType attrib_type, const UT_StringHolder &attrib_name) const
PDG_AttributeType
Enumeration of possible attribute types.
PDG_AttributeMap & attributes()
PDG_AttributeFlag
Enumeration of extra attribute flags. Flags can be ORed together.
PDG_AttributeOwner(bool has_runtime)
PDG_AttributeMap myAttributes
PDG_AttributeCollision
virtual void attribWarn(const UT_StringHolder &msg) const
Reader/Writer mutex class.
Definition: UT_RWLock.h:48
const PDG_AttributeMap & attributes() const