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 <string>
27 #include <vector>
28 
29 #include <interfaces/generator/enum_constant.h>
30 
32 {
33  public:
34  InterfaceField(std::vector<InterfaceEnumConstant> *enum_constants = NULL);
35 
36  void setComment(const std::string &comment);
37  void setName(const std::string &name);
38  void setType(const std::string &type);
39  bool isEnumType() const;
40  void setLength(const std::string &length);
41  void setFlags(const std::vector<std::string> &flags);
42  void setValidFor(const std::string &validfor);
43  void setDefaultValue(const std::string &default_value);
44 
45  void setAttribute(const std::string &attr_name, const std::string &attr_value);
46 
47  void valid();
48 
49  std::string getName() const;
50  std::string getComment() const;
51  std::string getType() const;
52  std::string getAccessType() const;
53  std::string getStructType() const;
54  std::string getPlainAccessType() const;
55  std::string getLength() const;
56  unsigned int getLengthValue() const;
57  std::vector<std::string> getFlags() const;
58  std::string getValidFor() const;
59  std::string getDefaultValue() const;
60 
61  const std::vector<InterfaceEnumConstant> * getEnumConstants() const;
62  const InterfaceEnumConstant & getEnumConstant(const std::string &name) const;
63 
64  bool operator< (const InterfaceField &f) const;
65 
66  private:
67  void tokenize(const std::string& str,
68  std::vector<std::string>& tokens,
69  const std::string& delimiters = " ");
70 
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 
85 #endif
std::string getType() const
Get type of field.
Definition: field.cpp:63
const InterfaceEnumConstant & getEnumConstant(const std::string &name) const
Get specific enum constant.
Definition: field.cpp:215
void setFlags(const std::vector< std::string > &flags)
Set flags.
Definition: field.cpp:314
void setName(const std::string &name)
Set name of field.
Definition: field.cpp:263
unsigned int getLengthValue() const
Get length value.
Definition: field.cpp:173
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:234
std::string getDefaultValue() const
Get default value.
Definition: field.cpp:193
const std::vector< InterfaceEnumConstant > * getEnumConstants() const
Get vector of enum constants.
Definition: field.cpp:203
std::string getName() const
Get name of field.
Definition: field.cpp:53
Interface generator internal representation of a field as parsed from the XML template file...
Definition: field.h:31
void setType(const std::string &type)
Set type of field.
Definition: field.cpp:244
std::string getValidFor() const
Get valid for time.
Definition: field.cpp:183
std::string getPlainAccessType() const
Get non-array accessor type.
Definition: field.cpp:113
void valid()
Assert validity.
Definition: field.cpp:379
std::string getAccessType() const
Get type as used for accessor methods of class.
Definition: field.cpp:83
InterfaceField(std::vector< InterfaceEnumConstant > *enum_constants=NULL)
Constructor.
Definition: field.cpp:40
std::string getComment() const
Get comment of field.
Definition: field.cpp:73
void setComment(const std::string &comment)
Set comment of field.
Definition: field.cpp:273
bool operator<(const InterfaceField &f) const
Check order of two elements.
Definition: field.cpp:425
std::string getLength() const
Get field length.
Definition: field.cpp:160
void setValidFor(const std::string &validfor)
Set valid for time.
Definition: field.cpp:294
bool isEnumType() const
Check if type is an enum type.
Definition: field.cpp:151
void setDefaultValue(const std::string &default_value)
Set default value.
Definition: field.cpp:304
void setAttribute(const std::string &attr_name, const std::string &attr_value)
Set attribute.
Definition: field.cpp:351
void setLength(const std::string &length)
Set length of field.
Definition: field.cpp:283
std::string getStructType() const
Get type used to formulate struct.
Definition: field.cpp:131