| #pragma once |
| |
| #ifndef TSTREAM_H |
| #define TSTREAM_H |
| |
| #include <memory> |
| |
| |
| #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; |
| std::unique_ptr<Imp> m_imp; |
| |
| public: |
| |
| |
| |
| |
| |
| |
| |
| |
| TIStream(const TFilePath &is); |
| ~TIStream(); |
| |
| |
| operator bool() const; |
| |
| TIStream &operator>>(int &v); |
| TIStream &operator>>(double &v); |
| TIStream &operator>>(std::string &v); |
| TIStream &operator>>(std::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); |
| |
| |
| |
| |
| std::string |
| getString(); |
| |
| |
| bool eos(); |
| |
| |
| |
| |
| |
| |
| |
| bool matchTag( |
| std::string &tagName); |
| |
| |
| bool matchEndTag(); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| bool getTagParam(std::string paramName, std::string &value); |
| bool getTagParam(std::string paramName, |
| int &value); |
| |
| bool isBeginEndTag(); |
| |
| |
| bool openChild( |
| std::string &tagName); |
| void closeChild(); |
| |
| bool match(char c) const; |
| |
| std::string getTagAttribute( |
| std::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; |
| std::shared_ptr<Imp> m_imp; |
| |
| private: |
| explicit TOStream(std::shared_ptr<Imp> imp); |
| |
| TOStream(TOStream &&); |
| TOStream &operator=(TOStream &&); |
| |
| public: |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| TOStream(const TFilePath &fp, |
| bool compressed = false); |
| ~TOStream(); |
| |
| |
| operator bool() const; |
| |
| TOStream &operator<<(int v); |
| TOStream &operator<<(double v); |
| TOStream &operator<<(std::string v); |
| TOStream &operator<<(std::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(std::string tagName); |
| |
| void openChild(std::string tagName); |
| |
| void openChild( |
| std::string tagName, |
| const std::map<std::string, std::string> |
| &attributes); |
| |
| void openCloseChild(std::string tagName, |
| const std::map<std::string, std::string> |
| &attributes); |
| |
| |
| |
| |
| void closeChild(); |
| |
| |
| void cr(); |
| |
| void tab(int dt); |
| |
| TFilePath getFilePath(); |
| |
| TFilePath getRepositoryPath(); |
| |
| |
| |
| |
| |
| |
| |
| bool checkStatus() const; |
| |
| private: |
| |
| TOStream(const TOStream &) = delete; |
| TOStream &operator=(const TOStream &) = delete; |
| }; |
| |
| #endif |