1 /* 2 * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * All rights reserved. Distributed under the terms of the MIT license. 4 */ 5 #ifndef INDEX_DIRECTORY_H 6 #define INDEX_DIRECTORY_H 7 8 #include "List.h" 9 10 class AttributeIndex; 11 class Index; 12 class LastModifiedIndex; 13 class NameIndex; 14 class SizeIndex; 15 class Volume; 16 17 class IndexDirectory { 18 public: 19 IndexDirectory(Volume *volume); 20 ~IndexDirectory(); 21 22 status_t InitCheck() const; 23 24 status_t CreateIndex(const char *name, uint32 type, 25 AttributeIndex **index = NULL); 26 bool DeleteIndex(const char *name, uint32 type); 27 bool DeleteIndex(Index *index); 28 29 Index *FindIndex(const char *name); 30 Index *FindIndex(const char *name, uint32 type); 31 AttributeIndex *FindAttributeIndex(const char *name); 32 AttributeIndex *FindAttributeIndex(const char *name, uint32 type); 33 34 bool IsSpecialIndex(Index *index) const; 35 NameIndex *GetNameIndex() const { return fNameIndex; } 36 LastModifiedIndex *GetLastModifiedIndex() const 37 { return fLastModifiedIndex; } 38 SizeIndex *GetSizeIndex() const { return fSizeIndex; } 39 40 Index *IndexAt(int32 index) const { return fIndices.ItemAt(index); } 41 42 private: 43 Volume *fVolume; 44 NameIndex *fNameIndex; 45 LastModifiedIndex *fLastModifiedIndex; 46 SizeIndex *fSizeIndex; 47 List<Index*> fIndices; 48 }; 49 50 #endif // INDEX_DIRECTORY_H 51