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{
34public:
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 std::string getMaxIdx() const;
58 unsigned int getLengthValue() const;
59 std::vector<std::string> getFlags() const;
60 std::string getValidFor() const;
61 std::string getDefaultValue() const;
62
63 const std::vector<InterfaceEnumConstant> *getEnumConstants() const;
64 const InterfaceEnumConstant & getEnumConstant(const std::string &name) const;
65
66 bool operator<(const InterfaceField &f) const;
67
68private:
69 void tokenize(const std::string & str,
70 std::vector<std::string> &tokens,
71 const std::string & delimiters = " ");
72
73 std::string name;
74 std::string type;
75 bool is_enum_type;
76 std::string comment;
77 std::string length;
78 std::string max_idx;
79 unsigned int length_value;
80 std::string validfor;
81 std::string default_value;
82 std::vector<std::string> flags;
83 std::vector<InterfaceEnumConstant> *enum_constants;
84};
85
86#endif
Interface generator internal representation of a enum constant as parsed from the XML template file.
Definition: enum_constant.h:31
Interface generator internal representation of a field as parsed from the XML template file.
Definition: field.h:33
const std::vector< InterfaceEnumConstant > * getEnumConstants() const
Get vector of enum constants.
Definition: field.cpp:199
void setAttribute(const std::string &attr_name, const std::string &attr_value)
Set attribute.
Definition: field.cpp:339
std::string getName() const
Get name of field.
Definition: field.cpp:50
std::string getValidFor() const
Get valid for time.
Definition: field.cpp:181
void setLength(const std::string &length)
Set length of field.
Definition: field.cpp:275
std::string getDefaultValue() const
Get default value.
Definition: field.cpp:190
void setDefaultValue(const std::string &default_value)
Set default value.
Definition: field.cpp:295
bool isEnumType() const
Check if type is an enum type.
Definition: field.cpp:142
bool operator<(const InterfaceField &f) const
Check order of two elements.
Definition: field.cpp:417
void setName(const std::string &name)
Set name of field.
Definition: field.cpp:257
std::vector< std::string > getFlags() const
Get flags.
Definition: field.cpp:230
void valid(const std::set< std::string > &reserved_names)
Assert validity.
Definition: field.cpp:367
std::string getPlainAccessType() const
Get non-array accessor type.
Definition: field.cpp:106
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:211
void setComment(const std::string &comment)
Set comment of field.
Definition: field.cpp:266
std::string getComment() const
Get comment of field.
Definition: field.cpp:68
std::string getStructType() const
Get type used to formulate struct.
Definition: field.cpp:123
void setValidFor(const std::string &validfor)
Set valid for time.
Definition: field.cpp:286
std::string getAccessType() const
Get type as used for accessor methods of class.
Definition: field.cpp:77
void setFlags(const std::vector< std::string > &flags)
Set flags.
Definition: field.cpp:304
std::string getMaxIdx() const
Get maximum index (length - 1)
Definition: field.cpp:160
unsigned int getLengthValue() const
Get length value.
Definition: field.cpp:172
std::string getLength() const
Get field length.
Definition: field.cpp:151
void setType(const std::string &type)
Set type of field.
Definition: field.cpp:239
InterfaceField(std::vector< InterfaceEnumConstant > *enum_constants=NULL)
Constructor.
Definition: field.cpp:38