Cafu Engine
ConsoleByWindow.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_GUISYS_CONSOLE_BY_WINDOW_HPP_INCLUDED
8 #define CAFU_GUISYS_CONSOLE_BY_WINDOW_HPP_INCLUDED
9 
10 #include "ConsoleCommands/Console.hpp"
11 #include "Templates/Pointer.hpp"
12 
13 
14 namespace cf
15 {
16  namespace GuiSys
17  {
18  class ComponentTextT;
19  class WindowT;
20 
21 
22  /// This class implements the cf::ConsoleI interface by means of a cf::GuiSys::WindowT, thus providing us with a GuiSys-based console.
23  /// It quasi acts as a kind of "mediator" between the cf::ConsoleI interface and the WindowT instance.
24  /// Note that the target window must live longer than instances of this class!
26  {
27  public:
28 
29  /// Constructor for a console that is implemented by means of the given WindowT object.
31 
32  // Implementation of the cf::ConsoleI interface.
33  void Print(const std::string& s);
34  void DevPrint(const std::string& s);
35  void Warning(const std::string& s);
36  void DevWarning(const std::string& s);
37 
38 
39  private:
40 
41  IntrusivePtrT<WindowT> m_Win; ///< The "target" window that is supposed to receive the console output.
42  IntrusivePtrT<ComponentTextT> m_TextComp; ///< The "Text" component of m_Win.
43  };
44  }
45 }
46 
47 #endif
This class implements smart (reference-counted) pointers.
Definition: Pointer.hpp:43
ConsoleByWindowT(IntrusivePtrT< WindowT > Win)
Constructor for a console that is implemented by means of the given WindowT object.
Definition: ConsoleByWindow.cpp:15
void Warning(const std::string &s)
Print warning to console.
Definition: ConsoleByWindow.cpp:40
This class implements the cf::ConsoleI interface by means of a cf::GuiSys::WindowT, thus providing us with a GuiSys-based console.
Definition: ConsoleByWindow.hpp:25
This class is an interface to the application console.
Definition: Console.hpp:18
void DevPrint(const std::string &s)
Print dev message to console.
Definition: ConsoleByWindow.cpp:32
void DevWarning(const std::string &s)
Print dev warning to console.
Definition: ConsoleByWindow.cpp:48
void Print(const std::string &s)
Print message to console.
Definition: ConsoleByWindow.cpp:24