strigi/src/streams
listinginprogress.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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;
00057 Strigi::SubStreamProvider* p;
00058 ArchiveEntryCache::SubEntry* entry;
00059 };
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
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