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 NAME_INDEX_H 6 #define NAME_INDEX_H 7 8 #include "EntryListener.h" 9 #include "Index.h" 10 #include "TwoKeyAVLTree.h" 11 12 class NameIndexEntryIterator; 13 14 // NameIndex 15 class NameIndex : public Index, private EntryListener { 16 public: 17 NameIndex(Volume *volume); 18 virtual ~NameIndex(); 19 20 virtual int32 CountEntries() const; 21 22 virtual status_t Changed(Entry *entry, const char *oldName); 23 24 private: 25 virtual void EntryAdded(Entry *entry); 26 virtual void EntryRemoved(Entry *entry); 27 28 protected: 29 virtual AbstractIndexEntryIterator *InternalGetIterator(); 30 virtual AbstractIndexEntryIterator *InternalFind(const uint8 *key, 31 size_t length); 32 33 private: 34 class EntryTree; 35 friend class NameIndexEntryIterator; 36 37 void _UpdateLiveQueries(Entry* entry, const char* oldName, 38 const char* newName); 39 40 private: 41 EntryTree *fEntries; 42 }; 43 44 #endif // NAME_INDEX_H 45