strigi/src/streams
archivereader.h
Go to the documentation of this file.00001 /* This file is part of Strigi Desktop Search 00002 * 00003 * Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef STRIGI_ARCHIVEREADER_H 00021 #define STRIGI_ARCHIVEREADER_H 00022 00023 #include <string> 00024 #include <strigi/strigiconfig.h> 00025 #include "substreamprovider.h" 00026 00027 namespace Strigi { 00028 00033 class STREAMS_EXPORT StreamOpener { 00034 public: 00036 virtual ~StreamOpener() {} 00047 virtual InputStream* openStream(const std::string& url) = 0; 00060 virtual int stat(const std::string& url, EntryInfo& e) = 0; 00061 }; 00062 00071 class STREAMS_EXPORT ArchiveReader : public StreamOpener { 00072 private: 00073 class ArchiveReaderPrivate; 00074 ArchiveReaderPrivate* const p; 00075 00076 public: 00080 class STREAMS_EXPORT DirLister { 00081 public: 00085 class Private; 00092 DirLister(Private* p); 00096 DirLister(const DirLister& dl); 00100 virtual ~DirLister(); 00104 const DirLister& operator=(const DirLister&); 00113 bool nextEntry(EntryInfo& e); 00114 private: 00115 Private* const p; 00116 }; 00117 00119 ArchiveReader(); 00121 ~ArchiveReader(); 00133 InputStream* openStream(const std::string& url); 00145 void closeStream(InputStream* stream); 00159 int stat(const std::string& url, EntryInfo& e); 00177 void addStreamOpener(StreamOpener* opener); 00192 DirLister dirEntries(const std::string& url); 00210 bool isArchive(const std::string& url); 00226 bool canHandle(const std::string& url); 00227 }; 00228 00229 class STREAMS_EXPORT FileStreamOpener : public StreamOpener { 00230 public: 00231 ~FileStreamOpener() {} 00238 InputStream* openStream(const std::string& url); 00247 int stat(const std::string& url, EntryInfo& e); 00248 }; 00249 00250 } // end namespace Strigi 00251 00252 #endif
KDE 4.4 API Reference