Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
BoolOption.h
1 /*
2  * $Id$
3  * BoolOption class interface
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2004-09, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef ELM_OPTION_BOOL_OPTION_H
23 #define ELM_OPTION_BOOL_OPTION_H
24 
25 #include <elm/option/StandardOption.h>
26 
27 namespace elm { namespace option {
28 
29 // BoolOption class
30 class BoolOption: public StandardOption {
31  bool val;
32 public:
33  BoolOption(Manager& manager, char short_name, CString description,
34  bool value = false);
35  BoolOption(Manager& manager, CString long_name, CString description,
36  bool value = false);
37  BoolOption(Manager& manager, char short_name, CString long_name,
38  CString description, bool value = false);
39  inline bool get(void) const { return val; }
40  inline void set(bool value) { val = value; };
41 
42  // Option overload
43  virtual usage_t usage(void);
44  virtual CString argDescription(void);
45  virtual void process(String arg);
46 
47  // Operators
48  inline operator bool(void) const { return get(); };
49  inline bool operator*(void) const { return get(); }
50  inline BoolOption& operator=(bool value) { val = value; return *this; }
51 
52  // deprecated
53  inline bool value(void) const { return val; };
54 };
55 
56 } } // elm::option
57 
58 #endif // ELM_OPTION_BOOL_OPTION_H
virtual CString argDescription(void)
Definition: option_BoolOption.cpp:111
bool value(void) const
Definition: BoolOption.h:53
Definition: CString.h:17
Definition: Manager.h:59
usage_t
Definition: Option.h:35
Definition: BoolOption.h:30
BoolOption & operator=(bool value)
Definition: BoolOption.h:50
bool operator*(void) const
Definition: BoolOption.h:49
void set(bool value)
Definition: BoolOption.h:40
Definition: StandardOption.h:31
BoolOption(Manager &manager, char short_name, CString description, bool value=false)
Definition: option_BoolOption.cpp:51
Definition: String.h:31
virtual void process(String arg)
Definition: option_BoolOption.cpp:117
virtual usage_t usage(void)
Definition: option_BoolOption.cpp:105
virtual cstring description(void)
Definition: option_StandardOption.cpp:85