Cafu Engine
ConsoleComposite.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_COMPOSITE_CONSOLE_HPP_INCLUDED
8 #define CAFU_COMPOSITE_CONSOLE_HPP_INCLUDED
9 
10 #include "Console.hpp"
11 #include "Templates/Array.hpp"
12 
13 
14 namespace cf
15 {
16  /// This class implements the ConsoleI interface as a composite console
17  /// by sending all output to its attached sub-consoles.
18  class CompositeConsoleT : public ConsoleI
19  {
20  public:
21 
22  /// Constructor for creating a composite console.
24 
25  /// Attaches the given console c to the set of sub-consoles.
26  bool Attach(ConsoleI* c);
27 
28  /// Removes the given console c from the set of sub-consoles.
29  bool Detach(ConsoleI* c);
30 
31  // Methods of the ConsoleI interface.
32  void Print(const std::string& s);
33  void DevPrint(const std::string& s);
34  void Warning(const std::string& s);
35  void DevWarning(const std::string& s);
36 
37 
38  private:
39 
40  ArrayT<ConsoleI*> m_Consoles; ///< The filestream output is logged to.
41  };
42 }
43 
44 #endif
void Warning(const std::string &s)
Print warning to console.
Definition: ConsoleComposite.cpp:54
bool Attach(ConsoleI *c)
Attaches the given console c to the set of sub-consoles.
Definition: ConsoleComposite.cpp:18
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: ConsoleComposite.cpp:47
This class implements the ConsoleI interface as a composite console by sending all output to its atta...
Definition: ConsoleComposite.hpp:18
CompositeConsoleT()
Constructor for creating a composite console.
Definition: ConsoleComposite.cpp:13
void Print(const std::string &s)
Print message to console.
Definition: ConsoleComposite.cpp:40
void DevWarning(const std::string &s)
Print dev warning to console.
Definition: ConsoleComposite.cpp:61
bool Detach(ConsoleI *c)
Removes the given console c from the set of sub-consoles.
Definition: ConsoleComposite.cpp:27
Definition: Renderer.hpp:16