| |
| |
| #ifndef TSTREAM_H |
| #define TSTREAM_H |
| |
| |
| #include "tpixel.h" |
| |
| |
| #ifndef TNZCORE_LIGHT |
| #include <QString> |
| #endif |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TSTREAM_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| |
| |
| |
| class TPersist; |
| class TFilePath; |
| |
| typedef std::pair<int, int> VersionNumber; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TIStream |
| { |
| class Imp; |
| Imp *m_imp; |
| |
| public: |
| |
| |
| |
| |
| |
| |
| |
| |
| TIStream(const TFilePath &is); |
| ~TIStream(); |
| |
| |
| operator bool() const; |
| |
| TIStream &operator>>(int &v); |
| TIStream &operator>>(double &v); |
| TIStream &operator>>(string &v); |
| TIStream &operator>>(wstring &v); |
| TIStream &operator>>(TFilePath &v); |
| TIStream &operator>>(TPixel32 &v); |
| TIStream &operator>>(TPixel64 &v); |
| |
| #ifndef TNZCORE_LIGHT |
| TIStream &operator>>(QString &v); |
| #endif |
| |
| |
| |
| |
| |
| |
| |
| |
| TIStream &operator>>(TPersist &v); |
| TIStream &operator>>(TPersist *&v); |
| |
| |
| |
| string getString(); |
| |
| |
| bool eos(); |
| |
| |
| |
| |
| |
| |
| bool matchTag(string &tagName); |
| |
| |
| bool matchEndTag(); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| bool getTagParam(string paramName, string &value); |
| bool getTagParam(string paramName, int &value); |
| |
| bool isBeginEndTag(); |
| |
| bool openChild(string &tagName); |
| void closeChild(); |
| |
| bool match(char c) const; |
| |
| string getTagAttribute(string name) const; |
| |
| |
| TFilePath getFilePath(); |
| TFilePath getRepositoryPath(); |
| |
| int getLine() const; |
| |
| |
| VersionNumber getVersion() const; |
| |
| |
| void setVersion(const VersionNumber &version); |
| |
| |
| |
| |
| |
| void skipCurrentTag(); |
| |
| private: |
| |
| TIStream(const TIStream &); |
| TIStream &operator=(const TIStream &); |
| }; |
| |
| |
| |
| template <class T> |
| TIStream &operator>>(TIStream &is, T *&v) |
| { |
| TPersist *persist = 0; |
| is >> persist; |
| v = persist ? dynamic_cast<T *>(persist) : 0; |
| return is; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TOStream |
| { |
| class Imp; |
| Imp *m_imp; |
| |
| private: |
| TOStream(Imp *imp); |
| |
| public: |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| TOStream(const TFilePath &fp, bool compressed = false); |
| ~TOStream(); |
| |
| |
| operator bool() const; |
| |
| TOStream &operator<<(int v); |
| TOStream &operator<<(double v); |
| TOStream &operator<<(string v); |
| TOStream &operator<<(wstring v); |
| TOStream &operator<<(const TFilePath &v); |
| TOStream &operator<<(const TPixel32 &v); |
| TOStream &operator<<(const TPixel64 &v); |
| |
| #ifndef TNZCORE_LIGHT |
| TOStream &operator<<(QString v); |
| #endif |
| |
| TOStream &operator<<(TPersist *v); |
| TOStream &operator<<(TPersist &v); |
| |
| |
| |
| TOStream child(string tagName); |
| |
| void openChild(string tagName); |
| void openChild(string tagName, |
| const map<string, string> &attributes); |
| |
| void openCloseChild(string tagName, |
| const map<string, string> &attributes); |
| |
| |
| |
| void closeChild(); |
| |
| void cr(); |
| |
| void tab(int dt); |
| |
| TFilePath getFilePath(); |
| TFilePath getRepositoryPath(); |
| |
| |
| |
| |
| |
| |
| |
| bool checkStatus() const; |
| |
| private: |
| |
| TOStream(const TOStream &); |
| TOStream &operator=(const TOStream &); |
| }; |
| |
| #endif |
| |