00001 /******************************************************************************* 00002 00003 Copyright (C) 2007 by Brendon Costa 00004 00005 This library is free software; you can redistribute it and/or modify 00006 it under the terms of the "LGPL Like" License defined in the file COPYING 00007 that should have been distributed along with this source. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 You should have received a copy of the "LGPL Like" License 00014 along with this library; see the file COPYING. if not, it can be 00015 obtained from the EDoc++ website: 00016 http://edoc.sourceforge.net/license.html 00017 00018 *******************************************************************************/ 00019 #ifndef EDOC_ARCHIVEIFACE_H 00020 #define EDOC_ARCHIVEIFACE_H 00021 00022 #include "EDoc/ManagedFile.h" 00023 00024 #include <string> 00025 #include <list> 00026 00027 namespace EDoc 00028 { 00029 //=========================================================================== 00030 /** \brief Standard interface for accessing files inside different types 00031 * of archives. 00032 * 00033 * An archive is considerd a group of one or more files. Current existing 00034 * archives used for EDoc might include: 00035 * - BFD : Binary File Archive with data stored in .EDoc section 00036 * - Directory : A directory of files 00037 * - Zip : A zip file that may contain .edc files (Currently 00038 * un-implemented). 00039 * . 00040 */ 00041 class ArchiveIFace 00042 { 00043 public: 00044 00045 //------------------------------------------------------------------------ 00046 /** \brief Destructor. 00047 */ 00048 virtual ~ArchiveIFace() {} 00049 00050 //------------------------------------------------------------------------ 00051 /** \brief Returns true if this factory type can process the given 00052 * archive. 00053 */ 00054 virtual bool HandlesType(const ManagedFile& arch_filename) = 0; 00055 00056 //------------------------------------------------------------------------ 00057 /** \brief Extracts all files from archive and returns a list of 00058 * ManagedFile object to those extracted files. 00059 */ 00060 virtual std::list<ManagedFile> ReadExtractAll(const ManagedFile& 00061 arch_filename) = 0; 00062 00063 //------------------------------------------------------------------------ 00064 /** \brief Returns a ManagedFile instance for a file that can be written 00065 * to in the archive. 00066 * 00067 * Many archive formats will return a temporary file that can be written 00068 * to and will then insert the contents of the temporay file into the 00069 * archive when the ManagedFile object is destroyed. This is not always 00070 * the case though for example the DirectoryArchive will just return a 00071 * reference to a writable file itself. 00072 */ 00073 virtual ManagedFile WriteOpen(const ManagedFile& arch_filename, 00074 std::string item_filename="default.edc") = 0; 00075 00076 //------------------------------------------------------------------------ 00077 00078 }; 00079 //=========================================================================== 00080 typedef std::list<ArchiveIFace*> ArchiveList; 00081 00082 } 00083 00084 00085 #endif // EDOC_ARCHIVEIFACE_H