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>
78 bool BaseTextStream<Device>::fail() const {
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_ */
bool fail() const
Denotes the status of the last device operation.
The primary error handler for ecl libraries.
Definition: handlers.hpp:58
Device & device()
Provides access to the underlying output device.
#define ECL_PUBLIC
const ecl::Error & errorStatus() const
Enumeration indicating the exit status of the last read operation.


xbot_node
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:28:13