Changeset 382 for cpp/common/virtfile/stringfile.h
- Timestamp:
- 05/22/15 04:15:14 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/virtfile/stringfile.h
r295 r382 7 7 8 8 #include "virtfile.h" 9 #include <frams/util/sstring.h> 9 #include <common/nonstd_stl.h> 10 #include <string.h> 10 11 11 12 class StringFILE : public VirtFILE 12 13 { 13 14 protected: 14 SString& str;15 longpos;15 string& str; 16 int pos; 16 17 public: 17 StringFILE( SString& s): VirtFILE(""), str(s), pos(0) {}18 StringFILE(string& s): VirtFILE(""), str(s), pos(0) {} 18 19 size_t Vread(void *ptr, size_t size, size_t nmemb); 19 20 size_t Vwrite(const void *ptr, size_t size, size_t nmemb) { str.append((const char*)ptr, (int)(size*nmemb)); return size*nmemb; } 20 int Veof() { return pos >= str.len(); }21 int Veof() { return pos >= int(str.size()); } 21 22 int Vputc(int c) { str += (char)c; return c; } 22 23 int Vputs(const char *s) { str.append(s, (int)strlen(s)); return 0; } … … 31 32 class StringFILE2 : public StringFILE 32 33 { 33 SString string;34 string str; 34 35 public: 35 StringFILE2(const SString& s) :StringFILE(string), string(s) {}36 StringFILE2() :StringFILE(str ing) {}37 const SString& getString() { return string; }36 StringFILE2(const string& s) :StringFILE(str), str(s) {} 37 StringFILE2() :StringFILE(str) {} 38 const string& getString() { return str; } 38 39 }; 39 40
Note: See TracChangeset
for help on using the changeset viewer.