Fawkes API  Fawkes Development Version
field.h
1 
2 /***************************************************************************
3  * field.h - Interface generator field representation
4  *
5  * Generated: Wed Oct 11 18:09:57 2006
6  * Copyright 2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _INTERFACES_GENERATOR_FIELD_H_
24 #define _INTERFACES_GENERATOR_FIELD_H_
25 
26 #include <interfaces/generator/enum_constant.h>
27 
28 #include <set>
29 #include <string>
30 #include <vector>
31 
33 {
34 public:
35  InterfaceField(std::vector<InterfaceEnumConstant> *enum_constants = NULL);
36 
37  void setComment(const std::string &comment);
38  void setName(const std::string &name);
39  void setType(const std::string &type);
40  bool isEnumType() const;
41  void setLength(const std::string &length);
42  void setFlags(const std::vector<std::string> &flags);
43  void setValidFor(const std::string &validfor);
44  void setDefaultValue(const std::string &default_value);
45 
46  void setAttribute(const std::string &attr_name, const std::string &attr_value);
47 
48  void valid(const std::set<std::string> &reserved_names);
49 
50  std::string getName() const;
51  std::string getComment() const;
52  std::string getType() const;
53  std::string getAccessType() const;
54  std::string getStructType() const;
55  std::string getPlainAccessType() const;
56  std::string getLength() const;
57  unsigned int getLengthValue() const;
58  std::vector<std::string> getFlags() const;
59  std::string getValidFor() const;
60  std::string getDefaultValue() const;
61 
62  const std::vector<InterfaceEnumConstant> *getEnumConstants() const;
63  const InterfaceEnumConstant & getEnumConstant(const std::string &name) const;
64 
65  bool operator<(const InterfaceField &f) const;
66 
67 private:
68  void tokenize(const std::string & str,
69  std::vector<std::string> &tokens,
70  const std::string & delimiters = " ");
71 
72  std::string name;
73  std::string type;
74  bool is_enum_type;
75  std::string comment;
76  std::string length;
77  unsigned int length_value;
78  std::string validfor;
79  std::string default_value;
80  std::vector<std::string> flags;
81  std::vector<InterfaceEnumConstant> *enum_constants;
82 };
83 
84 #endif
std::string getType() const
Get type of field.
Definition: field.cpp:59
const InterfaceEnumConstant & getEnumConstant(const std::string &name) const
Get specific enum constant.
Definition: field.cpp:202
void setFlags(const std::vector< std::string > &flags)
Set flags.
Definition: field.cpp:294
void setName(const std::string &name)
Set name of field.
Definition: field.cpp:248
unsigned int getLengthValue() const
Get length value.
Definition: field.cpp:163
Interface generator internal representation of a enum constant as parsed from the XML template file.
Definition: enum_constant.h:30
std::vector< std::string > getFlags() const
Get flags.
Definition: field.cpp:221
std::string getDefaultValue() const
Get default value.
Definition: field.cpp:181
const std::vector< InterfaceEnumConstant > * getEnumConstants() const
Get vector of enum constants.
Definition: field.cpp:190
std::string getName() const
Get name of field.
Definition: field.cpp:50
Interface generator internal representation of a field as parsed from the XML template file.
Definition: field.h:32
void setType(const std::string &type)
Set type of field.
Definition: field.cpp:230
std::string getValidFor() const
Get valid for time.
Definition: field.cpp:172
std::string getPlainAccessType() const
Get non-array accessor type.
Definition: field.cpp:106
std::string getAccessType() const
Get type as used for accessor methods of class.
Definition: field.cpp:77
InterfaceField(std::vector< InterfaceEnumConstant > *enum_constants=NULL)
Constructor.
Definition: field.cpp:38
std::string getComment() const
Get comment of field.
Definition: field.cpp:68
void setComment(const std::string &comment)
Set comment of field.
Definition: field.cpp:257
void valid(const std::set< std::string > &reserved_names)
Assert validity.
Definition: field.cpp:357
bool operator<(const InterfaceField &f) const
Check order of two elements.
Definition: field.cpp:407
std::string getLength() const
Get field length.
Definition: field.cpp:151
void setValidFor(const std::string &validfor)
Set valid for time.
Definition: field.cpp:276
bool isEnumType() const
Check if type is an enum type.
Definition: field.cpp:142
void setDefaultValue(const std::string &default_value)
Set default value.
Definition: field.cpp:285
void setAttribute(const std::string &attr_name, const std::string &attr_value)
Set attribute.
Definition: field.cpp:329
void setLength(const std::string &length)
Set length of field.
Definition: field.cpp:266
std::string getStructType() const
Get type used to formulate struct.
Definition: field.cpp:123