diff --git a/textmodel.h b/textmodel.h
index 8eb26eb47d419c2a2d2b7d5e30765161e4898d91..e6faa6ec8ee2a25d792f6fd451ca2f29d61fd43e 100644 (file)
--- a/textmodel.h
+++ b/textmodel.h
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:
~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:
~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;
};
/**