Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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  bool operator< (const InterfaceField &f) const;
62 
63  private:
64  void tokenize(const std::string& str,
65  std::vector<std::string>& tokens,
66  const std::string& delimiters = " ");
67 
68 
69  std::string name;
70  std::string type;
71  bool is_enum_type;
72  std::string comment;
73  std::string length;
74  unsigned int length_value;
75  std::string validfor;
76  std::string default_value;
77  std::vector<std::string> flags;
78  std::vector<InterfaceEnumConstant> *enum_constants;
79 
80 };
81 
82 #endif