X-Git-Url: http://deadsoftware.ru/gitweb?p=odcread.git;a=blobdiff_plain;f=textmodel.h;h=e6faa6ec8ee2a25d792f6fd451ca2f29d61fd43e;hp=8eb26eb47d419c2a2d2b7d5e30765161e4898d91;hb=7a97d981de20c2e9e9fa27d06f5b2c69ea09de16;hpb=41d9c65ec79728a8771cd2288dfc3458569c6801 diff --git a/textmodel.h b/textmodel.h index 8eb26eb..e6faa6e 100644 --- a/textmodel.h +++ b/textmodel.h @@ -38,11 +38,15 @@ namespace odc { virtual void read(Reader &reader) = 0; virtual std::string toString() const = 0; virtual void accept(Visitor &visitor) const = 0; + /** + * Size in bytes, excluding the null-character that terminates the string (i.e. the size that is read from file). + */ + unsigned size() const; }; /** - * TextPiece consisting of 16-bit characters. - * Not sure of the encoding. + * TextPiece consisting of 16-bit unicode characters. + * Not sure if the encoding is UCS-2 or UTF-16. */ class LongPiece : public TextPiece { private: @@ -52,16 +56,16 @@ namespace odc { ~LongPiece(); virtual void read(Reader &reader); virtual std::string toString() const; + virtual void accept(Visitor &visitor) const; + /** - * Return the text contained in this piece. - * Currently just casting the buffer to wchar_t* and hoping for the best. + * Get the buffer contents as 16-bit (UCS-2 or UTF-16 I don't know) unicode. */ - virtual std::wstring getText() const; - virtual void accept(Visitor &visitor) const; + CHAR *getBuffer() const; }; /** - * TextPiece consisting of 8-bit characters. + * TextPiece consisting of 8-bit characters in the Latin-1 extension of ASCII. */ class ShortPiece : public TextPiece { private: @@ -71,8 +75,12 @@ namespace odc { ~ShortPiece(); virtual void read(Reader &reader); virtual std::string toString() const; - virtual std::string getText() const; virtual void accept(Visitor &visitor) const; + + /** + * Get the buffer contents as 8-bit (Latin-1) characters. + */ + SHORTCHAR *getBuffer() const; }; /**