OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
WItemSelectionItem.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut 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 Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WITEMSELECTIONITEM_H
26 #define WITEMSELECTIONITEM_H
27 
28 #include <string>
29 
30 #include "WExportCommon.h"
31 
32 /**
33  * Class for keeping a single named item in a WItemSelection.
34  */
35 class OWCOMMON_EXPORT WItemSelectionItem // NOLINT
36 {
37 public:
38 
39  /**
40  * Constructs a new item with the specified values.
41  *
42  * \param name Name of item.
43  * \param description Description, can be empty.
44  * \param icon Icon, can be NULL.
45  */
46  WItemSelectionItem( std::string name, std::string description = "", const char** icon = NULL );
47 
48  /**
49  * Destruction. Does NOT delete the icon!
50  */
51  virtual ~WItemSelectionItem();
52 
53  /**
54  * Returns the name of the item.
55  *
56  * \return the name
57  */
58  std::string getName() const;
59 
60  /**
61  * The description of the item.
62  *
63  * \return the description
64  */
65  std::string getDescription() const;
66 
67  /**
68  * The icon associated with this item. Can be NULL.
69  *
70  * \return the icon, might be NULL.
71  */
72  const char** getIcon() const;
73 
74  /**
75  * Compares this and another item using their names only.
76  *
77  * \param other the second to compare the this one with
78  *
79  * \return true if the names are equal.
80  */
81  bool operator==( const WItemSelectionItem& other ) const;
82 
83 protected:
84 
85  /**
86  * Item name.
87  */
88  std::string m_name;
89 
90  /**
91  * Item description.
92  */
93  std::string m_description;
94 
95  /**
96  * Item icon.
97  */
98  const char** m_icon;
99 
100 private:
101 };
102 
103 #endif // WITEMSELECTIONITEM_H
104