HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PRM_ScriptImports.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: PRM_ScriptImports.h ( PRM Library, C++)
7  *
8  * COMMENTS: This class identifies a block of parameters in an associated
9  * template list and their import source.
10  */
11 
12 #ifndef __PRM_ScriptImports_h__
13 #define __PRM_ScriptImports_h__
14 
15 #include "PRM_API.h"
16 #include <UT/UT_String.h>
17 #include <UT/UT_Array.h>
18 
20 {
21 public:
23  : myLabel(UT_String::ALWAYS_DEEP),
24  mySource(UT_String::ALWAYS_DEEP),
25  myToken(UT_String::ALWAYS_DEEP),
26  myMask(UT_String::ALWAYS_DEEP)
27  {
28  init(-1, 0, 0, 0, 0, 0, false);
29  }
30 
32  const char *src)
33  : myLabel(UT_String::ALWAYS_DEEP),
34  mySource(UT_String::ALWAYS_DEEP),
35  myToken(UT_String::ALWAYS_DEEP),
36  myMask(UT_String::ALWAYS_DEEP)
37  {
38  init(offset, size, src, 0, 0, 0, false);
39  }
40 
41  void init(int offset, int size,
42  const char *src,
43  const char *token,
44  const char *mask,
45  const char *label,
46  bool enable)
47  {
48  myOffset = offset;
49  mySize = size;
50  mySource = src;
51  myToken = token;
52  myMask = mask;
53  myLabel = label;
54  myEnable = enable;
55 
56  myNestLevel = -1;
57  mySwitcherIndex = -1;
58  myFolder = -1;
59  }
60 
61  int getOffset() const { return myOffset; }
62 
63  int getNestLevel() const { return myNestLevel; }
64  void setNestLevel(int level) { myNestLevel = level; }
65 
66  int getSwitcherIndex() const { return mySwitcherIndex; }
67  void setSwitcherIndex(int i) { mySwitcherIndex = i; }
68  int getFolder() const { return myFolder; }
69  void setFolder(int i) { myFolder = i; }
70 
71  int getSize() const { return mySize; }
72 
73  const UT_String &getLabel() const { return myLabel; }
74  const UT_String &getSource() const { return mySource; }
75  const UT_String &getToken() const { return myToken; }
76  const UT_String &getMask() const { return myMask; }
77  bool getEnable() const { return myEnable; }
78 
79 protected:
80  // The offset in the template list of the first parameter that belongs to
81  // this block.
82  int myOffset;
83 
84  // The nest level indicates how deep this block is embedded in switchers
85  // and other nested blocks. This is necessary to support import blocks
86  // within import blocks.
88 
89  // The offset and nest level are not enough to uniquely determine which
90  // folder (or even which switcher) an import block correctly belongs to
91  // once empty folders enter the picture. Thus we need to keep track of
92  // the switcher index and folder number to which the block belongs.
94  int myFolder;
95 
96  // The number of parameters embedded in this block. Any embedded switchers
97  // are treated as a single entity.
98  int mySize;
99 
100  // The remaining members represent actual data associated with the import
101  // block not used to locate it in a template list.
106  bool myEnable;
107 };
108 
110 
112 public:
115 
116  void appendBlock(int offset, int size,
117  const char *source,
118  const char *token,
119  const char *mask,
120  const char *label,
121  bool enable);
122 
123  // All nest levels of the import blocks take the nest level of the
124  // given index in the template list as the 0 level.
125  int getNestBaseIndex() const
126  { return myNestBaseIndex; }
128  { myNestBaseIndex = index; }
129 
130  // Go through the import blocks in our list and find the one with a
131  // matching label. Returns null if no matching block is found.
132  const PRM_ScriptImportBlock *findBlockWithLabel(const char *label) const;
133 
136 };
137 
138 #endif
const UT_String & getToken() const
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
GLint level
Definition: glcorearb.h:108
int getNestBaseIndex() const
const UT_String & getMask() const
PRM_ScriptImportBlock(int offset, int size, const char *src)
UT_Array< PRM_ScriptImportBlock > PRM_ScriptImportList
GLintptr offset
Definition: glcorearb.h:665
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLint GLuint mask
Definition: glcorearb.h:124
void setNestLevel(int level)
const UT_String & getLabel() const
int getSwitcherIndex() const
PRM_ScriptImportList myBlocks
GLsizeiptr size
Definition: glcorearb.h:664
void setNestBaseIndex(int index)
GLuint index
Definition: glcorearb.h:786
const UT_String & getSource() const
#define PRM_API
Definition: PRM_API.h:10
void init(int offset, int size, const char *src, const char *token, const char *mask, const char *label, bool enable)
GLenum src
Definition: glcorearb.h:1793