libcrn  3.9.5
A document image processing library
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CRNFileMessenger.h
Go to the documentation of this file.
1 /* Copyright 2009-2015 Orange Labs, CoReNum, Université Paris Descartes
2  *
3  * This file is part of libcrn.
4  *
5  * libcrn is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * libcrn is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libcrn. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * file: CRNConsoleMessenger.h
19  * \author Guillaume ETIEVENT, Yann LEYDIER
20  */
21 
22 #ifndef CRNFileMessenger_HEADER
23 #define CRNFileMessenger_HEADER
24 
25 #include <fstream>
26 #include <CRNIO/CRNMessenger.h>
27 #include <CRNIO/CRNPath.h>
28 
29 namespace crn
30 {
38  class FileMessenger: public Messenger
39  {
40  public:
42  FileMessenger(const Path& filePath);
44  virtual ~FileMessenger() override;
46  virtual void PrintDebug(const String &msg) override;
48  virtual void PrintVerbose(const String &msg) override;
50  virtual void PrintWarning(const String &msg) override;
52  virtual void PrintError(const String &msg) override;
53 
54  protected:
56  std::ofstream _log;
59  };
60 }
61 
62 #endif
63 
64 
Base class for an object that prints messages.
Definition: CRNMessenger.h:37
A UTF32 character string class.
Definition: CRNString.h:61
std::ofstream _log
Stream to write in.
virtual void PrintError(const String &msg) override
Prints an error message.
A convenience class for file paths.
Definition: CRNPath.h:39
virtual ~FileMessenger() override
Destructor.
FileMessenger(const Path &filePath)
Constructor with filename.
virtual void PrintDebug(const String &msg) override
Prints a debug message.
virtual void PrintWarning(const String &msg) override
Prints a warning message.
Class to print messages to a file.
virtual void PrintVerbose(const String &msg) override
Prints a message.
Path _filePath
Path of the file to be written.