• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

strigi/src/streams

listinginprogress.h

Go to the documentation of this file.
00001 /* This file is part of Strigi Desktop Search
00002  *
00003  * Copyright (C) 2006,2009 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 LISTINGINPROGRESS_H
00021 #define LISTINGINPROGRESS_H
00022 
00023 #include "archiveentrycache.h"
00024 #include "archivereader.h"
00025 #include <list>
00026 #include <vector>
00027 
00028 typedef std::map<bool (*)(const char*, int32_t),
00029     Strigi::SubStreamProvider* (*)(Strigi::InputStream*)> Subs;
00030 
00035 class StreamPtr {
00036 private:
00037     Strigi::InputStream* stream;
00038     Strigi::SubStreamProvider* provider;
00039 public:
00040     StreamPtr() :stream(0), provider(0) {}
00041     StreamPtr(Strigi::InputStream* s) :stream(s), provider(0) {}
00042     StreamPtr(Strigi::SubStreamProvider* p) :stream(0), provider(p) {}
00043     void free() {
00044         delete stream;
00045         delete provider;
00046     }
00047 };
00048 
00049 Strigi::SubStreamProvider*
00050 subStreamProvider(const Subs& subs, Strigi::InputStream* input,
00051          std::list<StreamPtr>& streams);
00052 void free(std::list<StreamPtr>& l);
00053 
00054 class StackEntry {
00055 public:
00056     std::list<StreamPtr> streams; // stream stack that lead to this SubStreamProvider
00057     Strigi::SubStreamProvider* p;
00058     ArchiveEntryCache::SubEntry* entry; // the current entry
00059 };
00060 
00061 /*
00062  * This class contains a stack of SubStreamProviders and a growing cache
00063  * entry. It serves as a common entrypoint for requests to urls below a
00064  * common prefix that points to a physical file.
00065  * If a request is given to ArchiveReader for a path that is not in the
00066  * cache yet and that path could logically be part of a physical file,
00067  * ArchiveReader will look if there is a ListingInProgress. If there is,
00068  * the request is sent to the ListingInProgress. It may have the required
00069  * entry already in cache. If not, it should read from the stack of
00070  * SubStreamProviders until it can service the incoming request.
00071  */
00072 class ListingInProgress {
00073 private:
00074     const Subs subs;
00075     Strigi::InputStream* stream;
00076     std::vector<StackEntry> stack;
00077     int currentdepth;
00078     int refcount;
00079 public:
00080     ArchiveEntryCache::RootSubEntry* root;
00081     const std::string url;
00082 
00083     ListingInProgress(const Subs& sbs, const Strigi::EntryInfo& entry,
00084         const std::string& u, Strigi::InputStream* s);
00085     ~ListingInProgress();
00086     bool isDone() const;
00087     void fillEntry(Strigi::InputStream* s);
00088     int nextEntry(int depth);
00089     bool nextEntry();
00090     const ArchiveEntryCache::SubEntry* nextEntry(const std::string& url);
00091     bool nextEntry(const ArchiveEntryCache::SubEntry* entry);
00092     void ref() { refcount++; }
00093     bool unref() { return --refcount == 0; }
00094 };
00095 
00096 
00097 #endif

strigi/src/streams

Skip menu "strigi/src/streams"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • grantlee
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal