//  // // # # ### # # -= Nuclex Library =-  // // ## # # # ## ## RarStream.h - Rar compressed file implementation  // // ### # # ###  // // # ### # ### Accesses a compressed file and allows to read data  // // # ## # # ## ## from it through nuclex' stream interface  // // # # ### # # R1 (C)2002-2004 Markus Ewald -> License.txt  // //  // #ifndef NUCLEX_STORAGE_RARSTREAM_H #define NUCLEX_STORAGE_RARSTREAM_H #include "RarPlugin/RarPlugin.h" #include "Nuclex/Support/String.h" #include "Nuclex/Support/Exception.h" #include "Nuclex/Storage/Stream.h" #include #define WIN32_LEAN_AND_MEAN #include #include namespace Nuclex { namespace Storage { class RarArchive; } } namespace Nuclex { namespace Storage { //  // //  Nuclex::Storage::RarStream  // //  // /// Rar data stream class /** Performs */ class RarStream : public Stream { public: /// Constructor RARPLUGIN_API RarStream( const RarArchive &RarArchive, const string &sArchiveName, unsigned long nIndex, const string &sFilename, size_t nSize, AccessMode eMode ); /// Destructor RARPLUGIN_API virtual ~RarStream(); // // Stream implementation // public: /// Get stream name RARPLUGIN_API string getName() const; /// Get stream size RARPLUGIN_API size_t getSize() const; /// Seek to position RARPLUGIN_API void seekTo(size_t nPos); /// Current location RARPLUGIN_API size_t getLocation() const; /// Read data RARPLUGIN_API size_t readData(void *pDest, size_t nBytes); /// Write data RARPLUGIN_API size_t writeData(const void *pDest, size_t nBytes); /// Retrieve access mode RARPLUGIN_API AccessMode getAccessMode() const; /// Flush stream cache RARPLUGIN_API void flush(); private: static int PASCAL RARCallbackProc(UINT nMessage, LONG nUserData, LONG nParam1, LONG nParam2); std::vector m_Memory; ///< The uncompressed file size_t m_nLoc; ///< Current read location std::exception m_Exception; ///< Last exception occured AccessMode m_eAccessMode; ///< Stream access mode }; }} // namespace Nuclex::Storage #endif // NUCLEX_STORAGE_RARSTREAM_H