Go to the documentation of this file.00001
00008
00009
00010
00011
00012 #ifndef ECL_DEVICES_STRING_HPP_
00013 #define ECL_DEVICES_STRING_HPP_
00014
00015
00016
00017
00018
00019 #include <string>
00020 #include "traits.hpp"
00021 #include "macros.hpp"
00022
00023
00024
00025
00026
00027 namespace ecl {
00028
00029
00030
00031
00049 class ecl_devices_PUBLIC String {
00050 public:
00059 explicit String(const char* str = "");
00065 virtual ~String();
00066
00067
00068
00069
00078 const char* c_str();
00087 std::string str();
00094 void clear();
00095
00096
00097
00098
00107 long read(char &c);
00116 long read(char* s, unsigned long n);
00125 unsigned long remaining();
00126
00127
00128
00129
00139 long write(char c);
00151 long write(const char* s, unsigned long n);
00152
00153
00154
00155
00165 unsigned long size();
00172 void flush() {};
00173
00174
00175
00176
00185 bool open() { return true; };
00194 bool isOpen() { return true; };
00196 private:
00197 unsigned long buffer_length;
00198 char *buffer;
00199 char* buffer_cur_write;
00200 char* buffer_cur_read;
00210 void grow(int no_bytes = 256);
00211
00212 };
00213
00214
00215
00216
00217
00223 template <>
00224 class is_sink<String> : public True {};
00225
00231 template <>
00232 class is_source<String> : public True {};
00233
00239 template <>
00240 class is_sourcesink<String> : public True {};
00241
00242 }
00243
00244
00245 #endif