Fix issue in Rocket.lua script.
[Cafu-Engine.git] / Libs / ConsoleCommands / ConsoleFile.hpp
blobf339269ed5e7aa5775bb60e26be28a05d82fd75d
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 */
7 #ifndef CAFU_CONSOLE_FILE_HPP_INCLUDED
8 #define CAFU_CONSOLE_FILE_HPP_INCLUDED
10 #include "Console.hpp"
12 #include <fstream>
15 namespace cf
17 /// This class implements the ConsoleI interface by writing the console output into a text file.
18 class ConsoleFileT : public ConsoleI
20 public:
22 /// Constructor for creating an instance of a ConsoleFileT.
23 /// @param FileName Path and name of the file that the console output is to be written to.
24 ConsoleFileT(const std::string& FileName);
26 /// Sets if the console buffer should be auto-flushed after each call to one of the Print() or Warning() methods.
27 void SetAutoFlush(bool AutoFlush) { m_AutoFlush=AutoFlush; }
29 /// Flushes the buffers so that all contents is immediately written into the file.
30 void Flush();
32 // Methods of the 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);
39 private:
41 std::ofstream m_File; ///< The filestream output is logged to.
42 bool m_AutoFlush; ///< If the console buffer should be auto-flushed after each call to one of the Print() or Warning() methods.
46 #endif