#pragma once #include "Reader.h" #include "ReferenceCounter.h" #include "Writer.h" namespace Framework { class InMemoryBuffer : public Reader, public Writer, public virtual ReferenceCounter { private: char** buffer; int readPos; int writePos; int numBuffers; int maxWritePos; public: DLLEXPORT InMemoryBuffer(); DLLEXPORT ~InMemoryBuffer(); //! Reads from the resource //! \param bytes An array to be filled with bytes from the resource //! \param len How many bytes should be read from the resource DLLEXPORT void lese(char* bytes, int len) override; //! Writes to the resource //! \param bytes An array containing the bytes to be written to the //! resource //! \param len How many bytes should be written to the resource DLLEXPORT void schreibe(const char* bytes, int len) override; //! Reads the next line of the resource //! \return The read line as Text with line break DLLEXPORT Text* leseZeile() override; //! Checks whether the resource has been fully read //! return 1 if the resource has been fully read. 0 otherwise DLLEXPORT bool istEnde() const override; //! Sets the position of the byte to be read next //! \param pos The index of the byte //! \param ende 1 if the index counts from the end of the resource. 0 if //! the index counts from the beginning of the resource DLLEXPORT void setLPosition(__int64 pos, bool ende) override; //! Sets the position of the byte to be written next //! \param pos The index of the byte //! \param ende 1 if the index counts from the end of the resource. 0 if //! the index counts from the beginning of the resource DLLEXPORT void setSPosition(__int64 pos, bool ende) override; //! Returns the index of the byte from the resource that would be read next //! return -1 if an error occurred. Otherwise the position of the read pointer DLLEXPORT __int64 getLPosition() const override; //! Returns the index of the byte from the resource that would be written next //! return -1 if an error occurred. Otherwise the position of the write pointer DLLEXPORT __int64 getSPosition() const override; //! Returns the number of bytes to be read DLLEXPORT __int64 getSize() const override; }; } // namespace Framework