00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __INTERFACES_GENERATOR_FIELD_H_
00024 #define __INTERFACES_GENERATOR_FIELD_H_
00025
00026 #include <string>
00027 #include <vector>
00028
00029 #include <interfaces/generator/enum_constant.h>
00030
00031 class InterfaceField
00032 {
00033 public:
00034 InterfaceField(std::vector<InterfaceEnumConstant> *enum_constants = NULL);
00035
00036 void setComment(const std::string &comment);
00037 void setName(const std::string &name);
00038 void setType(const std::string &type);
00039 bool isEnumType() const;
00040 void setLength(const std::string &length);
00041 void setFlags(const std::vector<std::string> &flags);
00042 void setValidFor(const std::string &validfor);
00043 void setDefaultValue(const std::string &default_value);
00044
00045 void setAttribute(const std::string &attr_name, const std::string &attr_value);
00046
00047 void valid();
00048
00049 std::string getName() const;
00050 std::string getComment() const;
00051 std::string getType() const;
00052 std::string getAccessType() const;
00053 std::string getStructType() const;
00054 std::string getPlainAccessType() const;
00055 std::string getLength() const;
00056 unsigned int getLengthValue() const;
00057 std::vector<std::string> getFlags() const;
00058 std::string getValidFor() const;
00059 std::string getDefaultValue() const;
00060
00061 bool operator< (const InterfaceField &f) const;
00062
00063 private:
00064 void tokenize(const std::string& str,
00065 std::vector<std::string>& tokens,
00066 const std::string& delimiters = " ");
00067
00068
00069 std::string name;
00070 std::string type;
00071 bool is_enum_type;
00072 std::string comment;
00073 std::string length;
00074 unsigned int length_value;
00075 std::string validfor;
00076 std::string default_value;
00077 std::vector<std::string> flags;
00078 std::vector<InterfaceEnumConstant> *enum_constants;
00079
00080 };
00081
00082 #endif