00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __PRM_Label__
00022 #define __PRM_Label__
00023
00024 #include "PRM_API.h"
00025 #include <UT/UT_IntArray.h>
00026 #include <UT/UT_String.h>
00027
00028 class PRM_API PRM_Name
00029 {
00030 public:
00031
00032
00033
00034
00035
00036 PRM_Name(const char *thetoken = 0,
00037 const char *thelabel = 0,
00038 int theflags = 0);
00039 virtual ~PRM_Name();
00040
00041 const char *getToken() const { return myToken; }
00042 const char *getLabel() const
00043 {
00044 return ((const char *)myLabel) ? myLabel : myToken;
00045 }
00046 int getExpressionFlag() const { return myFlags; }
00047 unsigned getHash() const { return myTokenHash; }
00048
00049 void setToken(const char *s);
00050 void setLabel(const char *s);
00051 void harden();
00052
00053 void instance(const int *instance, int num);
00054 void instance(const UT_IntArray &instance_num);
00055
00056 bool isValidChoice() const
00057 {
00058
00059 if (!(const char *)myToken)
00060 return false;
00061 return myToken.isstring() || myLabel.isstring();
00062 }
00063
00064 static const char *mySeparator;
00065
00066 static unsigned theSentinelHash;
00067
00068 private:
00069 void calculateTokenHash();
00070
00071 UT_String myToken;
00072 UT_String myLabel;
00073 unsigned myTokenHash;
00074 short myFlags;
00075 };
00076 #endif