xc
StandardOutputWrapper.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //log_file.h
22 //Standard output redirection.
23 
24 #ifndef STANDARD_OUTPUT_WRAPPER_H
25 #define STANDARD_OUTPUT_WRAPPER_H
26 
27 #include <iostream>
28 #include <fstream>
29 #include <string>
30 #include "StandardStreamWrapper.h"
31 
33 //
36  {
37  StandardStreamWrapper errorStream;
38  StandardStreamWrapper logStream;
39  StandardStreamWrapper outStream;
40  public:
42  void reset(void);
43  // Error stream.
46  std::ostream &getErrStream(void);
47  const std::string &getErrFileName(void) const;
48  void setErrFileName(const std::string &filename);
49  // Log stream.
50  const StandardStreamWrapper &getLogStreamWrapper(void) const;
52  std::ostream &getLogStream(void);
53  const std::string &getLogFileName(void) const;
54  void setLogFileName(const std::string &filename);
55  // Output stream.
58  std::ostream &getOutputStream(void);
59  const std::string &getOutputFileName(void) const;
60  void setOutputFileName(const std::string &filename);
61  };
62 
63 #endif
std::ostream & getOutputStream(void)
return the current output stream.
Definition: StandardOutputWrapper.cc:89
const StandardStreamWrapper & getErrorStreamWrapper(void) const
return the stream wrapper for errors.
Definition: StandardOutputWrapper.cc:41
const std::string & getOutputFileName(void) const
return the current file name for the output stream.
Definition: StandardOutputWrapper.cc:97
void reset(void)
Fall back to the standard buffers.
Definition: StandardOutputWrapper.cc:33
Standard stream redirection.
Definition: StandardStreamWrapper.h:34
void setLogFileName(const std::string &filename)
Set the file to use for standard logging.
Definition: StandardOutputWrapper.cc:73
const std::string & getErrFileName(void) const
return the current file name for the error stream.
Definition: StandardOutputWrapper.cc:57
void setOutputFileName(const std::string &filename)
Set the file to use for standard output.
Definition: StandardOutputWrapper.cc:93
std::ostream & getLogStream(void)
return the current log stream.
Definition: StandardOutputWrapper.cc:69
const StandardStreamWrapper & getLogStreamWrapper(void) const
return the stream wrapper for logging.
Definition: StandardOutputWrapper.cc:61
Standard output redirection.
Definition: StandardOutputWrapper.h:35
const std::string & getLogFileName(void) const
return the current file name for the log stream.
Definition: StandardOutputWrapper.cc:77
const StandardStreamWrapper & getOutputStreamWrapper(void) const
return the stream wrapper for regular output.
Definition: StandardOutputWrapper.cc:81
void setErrFileName(const std::string &filename)
Set the file to use for standard error logging.
Definition: StandardOutputWrapper.cc:53
std::ostream & getErrStream(void)
return the current error stream.
Definition: StandardOutputWrapper.cc:49