HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GOP_AttribListParse.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  */
7 
8 #ifndef __GOP_AttribListParse_h__
9 #define __GOP_AttribListParse_h__
10 
11 #include "GOP_API.h"
12 #include <UT/UT_ValArray.h>
13 #include <UT/UT_StringHolder.h>
14 #include <GA/GA_Types.h>
15 
16 class UT_String;
17 class GA_Attribute;
18 class GA_AttributeDict;
19 class GA_AttributeFilter;
20 
22 {
29 };
30 
32  const char *, void *);
34  void *);
35 
36 //___________________________________________________________________________
37 
39 {
40 public:
41  // Parses attribute list string to match "P" and "Pw". Returns 0 if
42  // no match, 3 if "P" matches but not "Pw", and 4 if "Pw" matches.
43  // Also removes instances of "P" and "Pw" from the string.
44  // ERRORS:
45  // GOP_AP_ERROR_ATTRIB_DUPLICATED
46  // GOP_AP_ERROR_ATTRIB_REDUNDANT
47  static int parsePAndPw(UT_String &attriblist,
48  GOP_AttribParseErrorCallback errorCB = 0)
49  {
50  return parsePAndPw(attriblist, errorCB, 0);
51  }
52 
53  static int parsePAndPw(UT_String &attriblist,
55  void *errordata);
56 
57  // Parses attribute list string and verifies syntax as well as the
58  // existence of the attributes specified. Can return the nonexistent
59  // attributes in the badlist parameter.
60  // NOTE: Returning false may just be warnings such as the same attribute
61  // showing up explicitly multiple times. You probably want to process
62  // the attributes even if this is false!
63  // ERRORS:
64  // GOP_AP_ERROR_ATTRIB_UNKNOWN
65  // GOP_AP_ERROR_ATTRIB_DUPLICATED
66  static bool isAttribListValid(const GA_AttributeDict &dict,
67  const UT_StringRef &attriblist,
68  GOP_AttribParseErrorCallback errorCB = 0,
69  void *errordata = 0, UT_String *badlist = 0);
70 
71  // Parses the attribute list string and extracts the attribute pointers
72  // into the supplied array.
73  // ERRORS:
74  // GOP_AP_ERROR_PATTERN_MATCH_UNSUPPORTED (warning)
75  static void parseAttribList(const GA_AttributeDict &dict,
76  const UT_StringRef &attriblist,
77  UT_Array<GA_Attribute *> &attribarray,
78  GOP_AttribParseConfirmCallback confirmCB = 0,
79  void *confirmdata = 0,
80  GOP_AttribParseErrorCallback errorCB = 0,
81  void *errordata = 0,
82  const GA_AttributeFilter *filter = 0);
83 
84  // Pattern matches the incoming attribute string with the input attribute
85  // list string and returns the corresponding outgoing attribute string
86  // from the output attribute list string.
87  // ERRORS:
88  // GOP_AP_ERROR_INCOMPATIBLE_ATTRIBUTE_LIST_STRING_PATTERNS
89  static char *renameAttrib(UT_String &attrib,
90  const UT_String &inattriblist,
91  const UT_String &outattriblist,
92  GOP_AttribParseErrorCallback errorCB = 0,
93  void *errordata = 0);
94 
95  // Returns true if the attribute name is valid according to the
96  // atrib list stirng.
97  static bool isAttribAllowedByString(const UT_StringRef &attrib, const UT_StringRef &attriblist_ref);
98 };
99 
100 #endif
Definition of a geometry attribute.
Definition: GA_Attribute.h:197
bool(* GOP_AttribParseConfirmCallback)(const GA_Attribute *, void *)
void
Definition: png.h:1083
#define GOP_API
Definition: GOP_API.h:10
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297
GOP_AttribParseError
void(* GOP_AttribParseErrorCallback)(GOP_AttribParseError, const char *, void *)
static int parsePAndPw(UT_String &attriblist, GOP_AttribParseErrorCallback errorCB=0)