HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OP_ParmIterator.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: OP_ParmIterator.h ( Operator Library, C++)
7  *
8  * COMMENTS:
9  * This class implements an object that can be used to iterate
10  * through parms (and their subindices) for a given node.
11  */
12 #ifndef __OP_ParmIterator_h__
13 #define __OP_ParmIterator_h__
14 
15 #include "OP_API.h"
16 #include <UT/UT_String.h>
17 
18 class PRM_Parm;
19 class OP_Parameters;
20 
22 {
23  OP_PIM_NONE = 0x00, // No parms will pass this
24  OP_PIM_ORDINAL = 0x01, // ordinal parms
25  OP_PIM_STRING = 0x02, // string parms
26  OP_PIM_ANIMATED = 0x04, // Animatable parms
27  OP_PIM_CHANNELS = 0x08, // Parms with CH_Channels present
28  OP_PIM_AUTOSCOPED = 0x10, // Parm with the auto-scope flag
29  OP_PIM_ALL = 0xff
30 };
31 
33 {
34  OP_PIEM_NONE = 0x00, // No exclusions
35  OP_PIEM_LOCKED = 0x01, // Exclude locked parms
36  OP_PIEM_ALL = 0x0f
37 };
38 
39 inline OP_ParmIteratorMask
41 {
42  return (OP_ParmIteratorMask)((unsigned int)a | (unsigned int)b);
43 }
44 
47 {
48  return (OP_ParmIteratorExcludeMask)((unsigned int)a | (unsigned int)b);
49 }
50 
52 {
53 public:
56  OP_ParmIteratorExcludeMask exclude_mask =
57  OP_PIEM_NONE);
58  ~OP_ParmIterator();
59 
60  // Returns true when the iterator has finished iterating through all
61  // the parameters.
62  bool atEnd() const { return myAtEnd; }
63 
64  // This methods gets the name of the next channel in the list. The reason
65  // this is called getNextChannel because this method returns names of
66  // channels not parm names. This does not imply that the name returned will
67  // actually have a CH_Channel associated with it.
68  // It will return true if successful and false otherwise. (It shouldn't
69  // fail if you check for atEnd before you call it).
70  bool getNextChannel(UT_String &channame, UT_String *chanalias=NULL);
71 
72  // This methods gets the parm pointer and subindex of the next one in the
73  // list.
74  bool getNextParm(PRM_Parm * &parm, int &vi);
75 
76 protected:
77 
78  void scrollToNext(bool first_time);
79 
80  // This method will return true if the parm passes the mask in this
81  // iterator.
82  bool passesMasks(PRM_Parm *parm, int subindex);
83 
84 private:
85  OP_Parameters &myNode;
86  OP_ParmIteratorMask myMask;
87  OP_ParmIteratorExcludeMask myExcludeMask;
88  bool myAtEnd;
89  int myCurrentParmIndex;
90  int myCurrentParmSubIndex;
91  UT_String myCurrentToken;
92  UT_String myCurrentAlias;
93 };
94 
95 #endif
OP_ParmIteratorMask
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
GLint GLuint mask
Definition: glcorearb.h:123
OP_ParmIteratorExcludeMask
OP_ParmIteratorMask operator|(OP_ParmIteratorMask a, OP_ParmIteratorMask b)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
typedef int
Definition: png.h:1175
#define OP_API
Definition: OP_API.h:10
bool atEnd() const