CLI  2.9
config_menu.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2006-2018, Alexis Royer, http://alexis.royer.free.fr/CLI
3 
4  All rights reserved.
5 
6  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
10  and/or other materials provided with the distribution.
11  * Neither the name of the CLI library project nor the names of its contributors may be used to endorse or promote products derived from this software
12  without specific prior written permission.
13 
14  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 
31 
32 #ifndef _CLI_CONFIG_MENU_H_
33 #define _CLI_CONFIG_MENU_H_
34 
35 #include "cli/namespace.h"
36 #include "cli/menu.h"
37 
38 
40 
41  // Forward declarations.
42  class Keyword;
43  class OutputDevice;
44 
45 
47  class ConfigMenu : public Menu
48  {
49  public:
51  explicit ConfigMenu(void);
52 
54  virtual ~ConfigMenu(void);
55 
56  private:
58  ConfigMenu(const ConfigMenu&);
60  ConfigMenu& operator=(const ConfigMenu&);
61 
62  public:
63  // Inherit doxygen comments from cli::Element documentation.
64  virtual void SetCli(Cli& CLI_Cli);
65  // Inherit doxygen comments from cli::Menu documentation.
66  virtual const bool ExecuteReserved(const CommandLine& CLI_CmdLine) const;
67  // Inherit doxygen comments from cli::Menu documentation.
68  virtual const bool Execute(const CommandLine& CLI_CmdLine) const;
69 
70  private:
72  void ShowVersion(void) const;
74  void ShowAuthor(void) const;
76  void ShowLicense(void) const;
77 
79  void EchoOn(void) const;
80 
82  void EchoOff(void) const;
83 
85  void BeepOn(void) const;
86 
88  void BeepOff(void) const;
89 
91  void SetLang(const ResourceString::LANG E_Lang) const;
92 
93  #ifdef _DEBUG
94  void CheckIODevice(void) const;
97  void CheckOutChar(void) const;
98  #endif
99 
100  private:
102  const Keyword& GetShowNode(void) const;
104  const Keyword& GetShowVersionNode(void) const;
106  const Keyword& GetShowAuthorNode(void) const;
108  const Keyword& GetShowLicenseNode(void) const;
109 
111  const Keyword& GetEchoNode(void) const;
113  const Keyword& GetEchoOnNode(void) const;
115  const Keyword& GetEchoOffNode(void) const;
116 
118  const Keyword& GetBeepNode(void) const;
120  const Keyword& GetBeepOnNode(void) const;
122  const Keyword& GetBeepOffNode(void) const;
123 
125  const Keyword& GetLangNode(void) const;
127  const Keyword& GetEnglishLangNode(void) const;
129  const Keyword& GetFrenchLangNode(void) const;
130 
131  #ifdef _DEBUG
132  const Keyword& GetCheckNode(void) const;
135  const Keyword& GetCheckIONode(void) const;
137  const Keyword& GetOutCharNode(void) const;
138  #endif
139 
140  private:
142  Keyword* m_pcliShow;
144  Keyword* m_pcliShowVersion;
146  Keyword* m_pcliShowAuthor;
148  Keyword* m_pcliShowLicense;
149 
151  Keyword* m_pcliEcho;
153  Keyword* m_pcliEchoOn;
155  Keyword* m_pcliEchoOff;
156 
158  Keyword* m_pcliBeep;
160  Keyword* m_pcliBeepOn;
162  Keyword* m_pcliBeepOff;
163 
165  Keyword* m_pcliLang;
167  Keyword* m_pcliEnglishLang;
169  Keyword* m_pcliFrenchLang;
170 
171  #ifdef _DEBUG
172  Keyword* m_pcliCheck;
175  Keyword* m_pcliCheckIO;
177  Keyword* m_pcliOutChar;
178  #endif
179  };
180 
182 
183 #endif // _CLI_CONFIG_MENU_H_
Main namespace of the CLI library.
CLI configuration menu definition.
Definition: config_menu.h:47
virtual const bool ExecuteReserved(const CommandLine &CLI_CmdLine) const
Reserved commands execution.
#define CLI_NS_END(__ns)
End a namespace definition.
Definition: namespace.h:45
LANG
Languages identifiers.
virtual void SetCli(Cli &CLI_Cli)
Cli reference setting.
Command line parsing.
Definition: command_line.h:52
ConfigMenu(void)
Default constructor.
Namespace management.
Keyword element class.
Definition: keyword.h:47
Generic output device.
Definition: io_device.h:256
virtual ~ConfigMenu(void)
Destructor.
#define CLI_NS_BEGIN(__ns)
Begin a namespace definition.
Definition: namespace.h:38
Menu definition.
Definition: menu.h:51
virtual const bool Execute(const CommandLine &CLI_CmdLine) const
User-defined commands execution.
CLI definition class.
Definition: cli.h:97