HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GOP_VertexGroupParser.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: This class contains a parser for the vertex groups.
7  * The doIt() method returns the number of vertices parsed,
8  * or -1 if an error has occured.
9  *
10  */
11 
12 #ifndef __GOP_VertexGroupParser_h__
13 #define __GOP_VertexGroupParser_h__
14 
15 #include "GOP_API.h"
16 #include "GOP_Parser.h"
17 #include <GA/GA_Types.h>
18 
19 class GEO_Detail;
20 class GOP_Manager;
21 class GA_VertexGroup;
22 
24 {
25 public:
26  GOP_VertexGroupParser(GOP_Manager *manager, const GEO_Detail &gdp,
27  const UT_String &str, bool strict = true,
28  GA_Index prim_offset = GA_Index(0));
29 
30  // Build a string that contains the id's of the breakpoints in a breakpoint
31  // group. The offset is the amount to add to the ids of the primitives for
32  // each breakpoint in the group.
33  static void buildGroupToken(const GA_VertexGroup *vtxgrp,
34  UT_String &token, GA_Index offset = GA_Index(0));
35  // FIXME: Delete this once we split for 15.0.
36  static void buildGroupToken(const GA_VertexGroup *vtxgrp,
37  UT_String &token, int offset);
38 
39 private:
40 
41  virtual void init();
42  virtual void finish();
43  virtual bool dispatch(char c);
44 
45  // State Handlers
46  virtual void handleStart();
47  virtual void handleError();
48 
49  void handleCollectPrim();
50  void handleCollectPrim1();
51  void handleCollectName();
52  void handleCollectVertex0();
53  void handleCollectVertex1();
54 
55  // State Variables
56  GA_Index myPrimIndex;
57  GA_Index myPrim1;
58  int myVertex0;
59  int myVertex1;
60 
61  // Vertex Specific Methods
62  bool addVertex();
63  bool addAllPrimVertices(GA_Offset primoff = GA_INVALID_OFFSET);
64  bool addVertexRange(int u0, int u1);
65  bool addPrimGroup(const char *name);
66  bool addVertexGroup(const char *name);
67 
68  // Primitive Specific Methods
69  bool addPrimRange(int u0, int u1);
70 
71  // Utility methods
72  GA_Offset getPrim();
73 
74 
75  const GEO_Detail &myGdp;
76  GA_VertexGroup *myGroup;
77  GOP_Manager *myManager;
78  bool myStrictFlag;
79  GA_Index myPrimOffset;
80 };
81 
82 
83 #endif
virtual bool dispatch(char c)=0
virtual void finish()
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
#define GOP_API
Definition: GOP_API.h:10
GA_Size GA_Offset
Definition: GA_Types.h:617
virtual void handleError()=0
GLintptr offset
Definition: glcorearb.h:664
GLuint const GLchar * name
Definition: glcorearb.h:785
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
virtual void init()
virtual void handleStart()=0