All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AbstractEnum.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file AbstractEnum.h
22 
23  \brief Abstract class to represent an enumeration.
24 
25  \ingroup layout
26 */
27 
28 #ifndef __TERRALIB_LAYOUT_INTERNAL_ABSTRACT_ENUM_H
29 #define __TERRALIB_LAYOUT_INTERNAL_ABSTRACT_ENUM_H
30 
31 // TerraLib
32 #include "EnumType.h"
33 #include "../Config.h"
34 
35 // STL
36 #include <string>
37 #include <vector>
38 
39 namespace te
40 {
41  namespace layout
42  {
43  /*!
44  \brief Abstract class to represent an enumeration.
45 
46  \ingroup layout
47  */
49  {
50  public:
51 
52  /*!
53  \brief Constructor
54  */
55  AbstractEnum();
56 
57  /*!
58  \brief Destructor
59  */
60  virtual ~AbstractEnum();
61 
62  /*!
63  \brief Searching for a value of the enumeration by id
64 
65  \param enumId id
66  \return value found in the enumeration or null
67  */
68  virtual EnumType* getEnum(int enumId) const;
69 
70  /*!
71  \brief Searching for an enumeration value by name
72 
73  \param name
74  \return value found in the enumeration or null
75  */
76  virtual EnumType* getEnum(std::string name) const;
77 
78  /*!
79  \brief Searching for an enumeration value by name
80 
81  \param name
82  \return value found in the enumeration or null
83  */
84  virtual EnumType* searchLabel(std::string label) const;
85 
86  /*!
87  \brief Searching for a max value of the id
88 
89  \return -1 if no found, otherwise the id
90  */
91  virtual int maxId();
92 
93  /*!
94  \brief Searching for a min value of the id
95 
96  \return -1 if no found, otherwise the id
97  */
98  virtual int minId();
99 
100  virtual int size();
101 
102  protected:
103 
104  /*!
105  \brief Creates the enumeration values and adds the list
106  Reimplement this function in a AbstractEnum subclass to provide the enum's init implementation.
107  */
108  virtual void init() = 0;
109 
110  protected:
111 
112  std::vector<EnumType*> m_enums; //!< list of enumeration values
113  };
114  }
115 }
116 
117 #endif
Abstract class to represent an enumeration.
Definition: AbstractEnum.h:48
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
std::vector< EnumType * > m_enums
list of enumeration values
Definition: AbstractEnum.h:112
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
Definition: EnumType.h:48