base_text_stream.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_STREAMS_BASE_TEXT_STREAM_HPP_
13 #define ECL_STREAMS_BASE_TEXT_STREAM_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <ecl/config/macros.hpp>
20 #include <ecl/errors/handlers.hpp>
21 #include "../macros.hpp"
22 
23 /*****************************************************************************
24 ** Namespaces
25 *****************************************************************************/
26 
27 namespace ecl {
28 namespace interfaces {
29 
30 /*****************************************************************************
31 ** Interface [BaseTextStream]
32 *****************************************************************************/
42 template <typename Device>
43 class ECL_PUBLIC BaseTextStream {
44 public:
45  BaseTextStream() : error(ecl::NoError) {};
46  virtual ~BaseTextStream() {}
47  Device& device();
48  bool fail() const;
49  const ecl::Error& errorStatus() const;
50 
51 protected:
52  ecl::Error error;
53  Device io_device;
54 };
55 
56 /*****************************************************************************
57 ** Implementation [BaseTextStream]
58 *****************************************************************************/
65 template <typename Device>
66 Device& BaseTextStream<Device>::device() { return io_device; }
67 
77 template <typename Device>
79  if ( error.flag() != ecl::NoError ) {
80  return true;
81  } else {
82  return false;
83  }
84 }
93 template <typename Device>
95  return error;
96 }
97 
98 } // namespace interfaces
99 } // namespace ecl
100 
101 #endif /* ECL_STREAMS_BASE_TEXT_STREAM_HPP_ */
ecl::Error
ecl::interfaces::BaseTextStream::fail
bool fail() const
Denotes the status of the last device operation.
Definition: base_text_stream.hpp:90
ecl::interfaces::BaseTextStream::device
Device & device()
Provides access to the underlying output device.
Definition: base_text_stream.hpp:78
ecl::NoError
NoError
handlers.hpp
macros.hpp
ecl
ECL_PUBLIC
#define ECL_PUBLIC
ecl::interfaces::BaseTextStream::errorStatus
const ecl::Error & errorStatus() const
Enumeration indicating the exit status of the last read operation.
Definition: base_text_stream.hpp:106


ecl_streams
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:48