ducttape-engine  0.2.0
A universal game engine
 All Classes Functions Variables Typedefs Enumerations Enumerator
LogStream.hpp
00001 
00002 // ----------------------------------------------------------------------------
00003 // This file is part of the Ducttape Project (http://ducttape-dev.org) and is
00004 // licensed under the GNU LESSER PUBLIC LICENSE version 3. For the full license
00005 // text, please see the LICENSE file in the root of this project or at
00006 // http://www.gnu.org/licenses/lgpl.html
00007 // ----------------------------------------------------------------------------
00008 
00009 #ifndef DUCTTAPE_ENGINE_UTILS_LOGSTREAM
00010 #define DUCTTAPE_ENGINE_UTILS_LOGSTREAM
00011 
00012 #include <Config.hpp>
00013 
00014 #include <QString>
00015 
00016 #include <ostream>
00017 #include <memory>
00018 
00019 namespace dt {
00020 
00021 // forward declaration due to circular dependency
00022 class Logger;
00023 
00027 class DUCTTAPE_API LogStream {
00028 public:
00029     
00030     typedef std::shared_ptr<LogStream> LogStreamSP;
00031     
00032     static QString COLOR_RED;       
00033     static QString COLOR_GREEN;     
00034     static QString COLOR_YELLOW;    
00035     static QString COLOR_BLUE;      
00036     static QString COLOR_PURPLE;    
00037     static QString COLOR_CYAN;      
00038     static QString COLOR_NONE;      
00039 
00040 public:
00045     LogStream(const QString name);
00046 
00054     QString formatMessage(Logger* logger, const QString msg);
00055 
00063     void output(Logger* logger, const QString msg);
00064     
00072     void defaultOutput(Logger* logger, const QString& msg);
00073 
00078     void setStream(std::ostream& stream);
00079 
00084     void setName(const QString name);
00085 
00092     void setFormat(const QString format);
00093 
00098     const QString getName() const;
00099 
00105     void setDisabled(bool disabled);
00106 
00111     bool isDisabled() const;
00112 private:
00113     std::ostream* mStream;  
00114     QString mFormat;    
00115     QString mName;      
00116     bool mDisabled;         
00117 };
00118 
00119 } // namespace dt
00120 
00121 #endif