.. _program_listing_file__tmp_ws_src_ecl_core_ecl_devices_include_ecl_devices_string.hpp: Program Listing for File string.hpp =================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/ecl_core/ecl_devices/include/ecl/devices/string.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /***************************************************************************** ** Ifdefs *****************************************************************************/ #ifndef ECL_DEVICES_STRING_HPP_ #define ECL_DEVICES_STRING_HPP_ /***************************************************************************** ** Includes *****************************************************************************/ #include #include "traits.hpp" #include "macros.hpp" /***************************************************************************** ** Namespaces *****************************************************************************/ namespace ecl { /***************************************************************************** ** Interface [String] *****************************************************************************/ class ecl_devices_PUBLIC String { public: explicit String(const char* str = ""); virtual ~String(); /********************* ** String Interface **********************/ const char* c_str(); std::string str(); void clear(); /****************************************** ** Device Source Interface *******************************************/ long read(char &c); long read(char* s, unsigned long n); unsigned long remaining(); /****************************************** ** Device Sink Interface *******************************************/ long write(char c); long write(const char* s, unsigned long n); /****************************************** ** Device Seekable Interface *******************************************/ unsigned long size(); void flush() {}; /********************* ** Device Interface **********************/ bool open() { return true; }; bool isOpen() { return true; }; private: unsigned long buffer_length; // Actual reserved memory is this +1 char *buffer; char* buffer_cur_write; char* buffer_cur_read; void grow(int no_bytes = 256); }; /***************************************************************************** ** Traits *****************************************************************************/ template <> class is_sink : public True {}; template <> class is_source : public True {}; template <> class is_sourcesink : public True {}; } // namespace ecl #endif /* ECL_DEVICES_STRING_HPP_ */