Fawkes API  Fawkes Development Version
enum_constant.h
1 
2 /***************************************************************************
3  * enum_constant.h - Interface generator enum constant representation
4  *
5  * Generated: Wed Oct 11 19:40:37 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_ENUM_CONSTANT_H_
24 #define _INTERFACES_GENERATOR_ENUM_CONSTANT_H_
25 
26 #include <string>
27 #include <utility>
28 #include <vector>
29 
31 {
32 public:
33  /** Enumeration item. */
34  typedef struct
35  {
36  std::string name; ///< Name of item.
37  std::string comment; ///< Comment for item.
38  bool has_custom_value; ///< True if custom value set.
39  int custom_value; ///< Custom value.
40  } EnumItem;
41 
42  InterfaceEnumConstant(const std::string &name, const std::string &comment);
43 
44  const std::string & get_name() const;
45  const std::string & get_comment() const;
46  const std::vector<EnumItem> &get_items() const;
47  void add_item(std::string name, std::string comment);
48  void add_item(std::string name, std::string comment, int value);
49 
50 private:
51  std::string name_;
52  std::string comment_;
53  std::vector<EnumItem> items_;
54 };
55 
56 #endif
InterfaceEnumConstant::get_comment
const std::string & get_comment() const
Get comment of enum constant.
Definition: enum_constant.cpp:57
InterfaceEnumConstant
Definition: enum_constant.h:29
InterfaceEnumConstant::get_items
const std::vector< EnumItem > & get_items() const
Get enumeration items.
Definition: enum_constant.cpp:67
InterfaceEnumConstant::EnumItem
Enumeration item.
Definition: enum_constant.h:38
InterfaceEnumConstant::InterfaceEnumConstant
InterfaceEnumConstant(const std::string &name, const std::string &comment)
Constructor.
Definition: enum_constant.cpp:35
InterfaceEnumConstant::add_item
void add_item(std::string name, std::string comment)
Add an item without custom value.
Definition: enum_constant.cpp:77
InterfaceEnumConstant::get_name
const std::string & get_name() const
Get name of enum constant.
Definition: enum_constant.cpp:48