Ignore:
Timestamp:
05/22/15 04:15:14 (7 years ago)
Author:
sz
Message:

Moving frams/virtfile to common/virtfile:

  • file references updated (includes, makefile)
  • common/virtfile can no longer use the Framsticks specific SString (using std::string instead)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/virtfile/stringfile.h

    r295 r382  
    77
    88#include "virtfile.h"
    9 #include <frams/util/sstring.h>
     9#include <common/nonstd_stl.h>
     10#include <string.h>
    1011
    1112class StringFILE : public VirtFILE
    1213{
    1314protected:
    14         SString& str;
    15         long pos;
     15        string& str;
     16        int pos;
    1617public:
    17         StringFILE(SString& s): VirtFILE(""), str(s), pos(0) {}
     18        StringFILE(string& s): VirtFILE(""), str(s), pos(0) {}
    1819        size_t Vread(void *ptr, size_t size, size_t nmemb);
    1920        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()); }
    2122        int Vputc(int c) { str += (char)c; return c; }
    2223        int Vputs(const char *s) { str.append(s, (int)strlen(s)); return 0; }
     
    3132class StringFILE2 : public StringFILE
    3233{
    33         SString string;
     34        string str;
    3435public:
    35         StringFILE2(const SString& s) :StringFILE(string), string(s) {}
    36         StringFILE2() :StringFILE(string) {}
    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; }
    3839};
    3940
Note: See TracChangeset for help on using the changeset viewer.