#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2013 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_STORAGE_FILESYSTEM_GENERIC_GENERICARCHIVEDFILE_H #define NUCLEX_STORAGE_FILESYSTEM_GENERIC_GENERICARCHIVEDFILE_H #include "Nuclex/Storage/Config.h" #include "Nuclex/Storage/FileSystem/File.h" #include namespace Nuclex { namespace Storage { namespace FileSystem { // ------------------------------------------------------------------------------------------- // /// File stored in an archive /// /// Type for a structure containing meta data about the archived file. Has to be /// derived from the MetaData structure in the class. /// class GenericArchivedFile : public File { /// Initializes a new file stored in an archive public: GenericArchivedFile() {} /// Frees all resources owned by the instance public: virtual ~GenericArchivedFile() {} /// Changes the name of the file /// New name the file will be known under public: void SetName(const std::string &name) { name; throw std::runtime_error("Renaming files in archives is not supported"); } /// Reads raw data from the file /// Absolute file position data will be read from /// Buffer into which data will be read /// Number of bytes that will be read public: virtual void ReadAt( std::uint64_t location, void *buffer, std::size_t count ) const = 0; /// Writes raw data into the file /// Absolute file position data will be written to /// Buffer from which data will be taken /// Number of bytes that will be written public: void WriteAt( std::uint64_t location, const void *buffer, std::size_t count ) { location; buffer; count; throw std::runtime_error("Writing to files in archives is not supported"); } /// Ensures changes to the file have been written to disk public: void Flush() { // Since writing isn't supported, there's nothing to do here. } private: GenericArchivedFile(const GenericArchivedFile &); private: GenericArchivedFile &operator =(const GenericArchivedFile &); }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Storage::FileSystem #endif // NUCLEX_STORAGE_FILESYSTEM_GENERIC_GENERICARCHIVEDFILE_H