.. _program_listing_file__tmp_ws_src_ecl_core_ecl_devices_include_ecl_devices_console.hpp: Program Listing for File console.hpp ==================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/ecl_core/ecl_devices/include/ecl/devices/console.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /***************************************************************************** ** Ifdefs *****************************************************************************/ #ifndef ECL_DEVICES_CONSOLE_HPP_ #define ECL_DEVICES_CONSOLE_HPP_ /***************************************************************************** ** Includes *****************************************************************************/ #include "detail/character_buffer.hpp" #include "traits.hpp" #include #include #include "macros.hpp" /***************************************************************************** ** Namespaces *****************************************************************************/ namespace ecl { /***************************************************************************** ** Interface [OConsole] *****************************************************************************/ class ecl_devices_PUBLIC OConsole { public: OConsole() : error_handler(NoError) {} virtual ~OConsole() {} /********************* ** Output Device API **********************/ bool open() { return true; } long write(const char &c); long write(const char* s, unsigned long n); void flush(); const Error& error() const { return error_handler; } private: devices::CharStringBuffer buffer; Error error_handler; }; /***************************************************************************** ** Interface [EConsole] *****************************************************************************/ class ecl_devices_PUBLIC EConsole { public: EConsole() : error_handler(NoError) {} virtual ~EConsole() {} /********************* ** Output Device API **********************/ bool open() { return true; } long write(const char &c); long write(const char* s, unsigned long n); void flush(); const Error& error() const { return error_handler; } private: devices::CharStringBuffer buffer; Error error_handler; }; /***************************************************************************** ** Interface [IConsole] *****************************************************************************/ class ecl_devices_PUBLIC IConsole { public: IConsole() : error_handler(NoError) {} virtual ~IConsole() {} /********************* ** Input Device API **********************/ bool open() { return true; } long read(char &c); long read(char *s, const unsigned long &n); // long remaining() { // long pos = ftell(stdin); // get current position marker. // fseek(stdin,0,SEEK_END); // move pointer to the end of the file. // long size = ftell(stdin); // fseek(stdin,pos,SEEK_SET); // // return size; // } const Error& error() const { return error_handler; } private: Error error_handler; }; /***************************************************************************** ** Traits [Console] *****************************************************************************/ template <> class is_source : public True { }; template <> class is_sink : public True {}; template <> class is_sink : public True {}; } // namespace ecl #endif /* ECL_DEVICES_CONSOLE_HPP_ */