CLI  2.9
string_device.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_STRING_DEVICE_H_
33 #define _CLI_STRING_DEVICE_H_
34 
35 
36 #include "cli/tk.h"
37 #include "cli/io_device.h"
38 
40 
41 
42  class StringDevice : public OutputDevice
47  {
48  public:
50  explicit StringDevice(
51  const unsigned int UI_OutputMaxLen,
52  const bool B_AutoDelete
53  );
54 
56  virtual ~StringDevice(void);
57 
58  private:
60  explicit StringDevice(void);
62  StringDevice(const StringDevice&);
64  StringDevice& operator=(const StringDevice&);
65 
66  public:
67  // Inherit doxygen comments from cli::OutputDevice interface documentation.
68  virtual const bool OpenDevice(void);
69  // Inherit doxygen comments from cli::OutputDevice interface documentation.
70  virtual const bool CloseDevice(void);
71  // Inherit doxygen comments from cli::OutputDevice interface documentation.
72  virtual void PutString(const char* const STR_Out) const;
73  // Inherit doxygen comments from cli::OutputDevice interface documentation.
74  virtual void Beep(void) const;
75  // Inherit doxygen comments from cli::OutputDevice interface documentation.
76  virtual void CleanScreen(void) const;
77 
78  public:
81  const tk::String& GetString(void) const;
82 
85  StringDevice& Reset(void);
86 
87  private:
89  mutable tk::String m_tkString;
90  };
91 
93 
94 #endif // _CLI_STRING_DEVICE_H_
Main namespace of the CLI library.
virtual const bool CloseDevice(void)
Device closure handler.
#define CLI_NS_END(__ns)
End a namespace definition.
Definition: namespace.h:45
virtual ~StringDevice(void)
Destructor.
virtual void Beep(void) const
Beep handler.
virtual void PutString(const char *const STR_Out) const
Output handler.
String device.
Definition: string_device.h:46
Generic output device.
Definition: io_device.h:256
virtual void CleanScreen(void) const
Clean screen.
#define CLI_NS_BEGIN(__ns)
Begin a namespace definition.
Definition: namespace.h:38
OutputDevice, IODevice and IOEndl classes defintion.
CLI toolkit definition.
StringDevice & Reset(void)
Reset.
virtual const bool OpenDevice(void)
Device opening handler.
const tk::String & GetString(void) const
String accessor.