00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __OP_Gallery__
00020 #define __OP_Gallery__
00021
00022 #include "OP_API.h"
00023 #include <FS/FS_IndexFile.h>
00024 #include "OP_GalleryEntry.h"
00025
00026 class OP_GalleryManager;
00027
00028 class OP_API OP_Gallery
00029 {
00030 public:
00031 int getNumGalleryEntries() const;
00032 OP_GalleryEntry *getGalleryEntry(int index) const;
00033 OP_GalleryEntry *findGalleryEntry(const char *entryname) const;
00034 OP_GalleryEntry *newGalleryEntry(const char *entryname);
00035 void removeGalleryEntry(const char *entryname);
00036 void removeGalleryEntry(int index);
00037 void getMatchingEntries(OP_GalleryEntryList &found,
00038 OP_Node *node) const;
00039 void getMatchingEntries(OP_GalleryEntryList &found,
00040 const char *namepattern,
00041 const char *labelpattern,
00042 const char *keywordpattern,
00043 const char *category,
00044 const char *optable,
00045 const char *optype) const;
00046
00047 const UT_String &getFilePath() const;
00048 bool getFileIsValid() const;
00049 bool getFileIsWritable() const;
00050
00051 bool refresh(bool force);
00052 bool save();
00053
00054 protected:
00055 OP_Gallery(OP_GalleryManager *owner,
00056 const char *filepath);
00057 virtual ~OP_Gallery();
00058
00059 void clear();
00060
00061 private:
00062 static bool createBackupFile(const char *filename);
00063
00064 OP_GalleryManager *myGalleryManager;
00065 FS_IndexFile *myIndexFile;
00066 OP_GalleryEntryList myGalleryEntries;
00067 UT_String myFilePath;
00068
00069 friend class OP_GalleryManager;
00070 };
00071
00072 typedef UT_PtrArray<OP_Gallery *> OP_GalleryList;
00073
00074 #endif
00075