xref: /haiku/src/add-ons/kernel/file_systems/ramfs/IndexDirectory.h (revision b9795faf5d27edaf49acb9f884ba181c0f0ae66b)
1*b9795fafSAugustin Cavalier /*
2*b9795fafSAugustin Cavalier  * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
3*b9795fafSAugustin Cavalier  * All rights reserved. Distributed under the terms of the MIT license.
4*b9795fafSAugustin Cavalier  */
5224e7c42SIngo Weinhold #ifndef INDEX_DIRECTORY_H
6224e7c42SIngo Weinhold #define INDEX_DIRECTORY_H
7224e7c42SIngo Weinhold 
8224e7c42SIngo Weinhold #include "List.h"
9224e7c42SIngo Weinhold 
10224e7c42SIngo Weinhold class AttributeIndex;
11224e7c42SIngo Weinhold class Index;
12224e7c42SIngo Weinhold class LastModifiedIndex;
13224e7c42SIngo Weinhold class NameIndex;
14224e7c42SIngo Weinhold class SizeIndex;
15224e7c42SIngo Weinhold class Volume;
16224e7c42SIngo Weinhold 
17224e7c42SIngo Weinhold class IndexDirectory {
18224e7c42SIngo Weinhold public:
19224e7c42SIngo Weinhold 	IndexDirectory(Volume *volume);
20224e7c42SIngo Weinhold 	~IndexDirectory();
21224e7c42SIngo Weinhold 
22224e7c42SIngo Weinhold 	status_t InitCheck() const;
23224e7c42SIngo Weinhold 
24224e7c42SIngo Weinhold 	status_t CreateIndex(const char *name, uint32 type,
25224e7c42SIngo Weinhold 						 AttributeIndex **index = NULL);
26224e7c42SIngo Weinhold 	bool DeleteIndex(const char *name, uint32 type);
27224e7c42SIngo Weinhold 	bool DeleteIndex(Index *index);
28224e7c42SIngo Weinhold 
29224e7c42SIngo Weinhold 	Index *FindIndex(const char *name);
30224e7c42SIngo Weinhold 	Index *FindIndex(const char *name, uint32 type);
31224e7c42SIngo Weinhold 	AttributeIndex *FindAttributeIndex(const char *name);
32224e7c42SIngo Weinhold 	AttributeIndex *FindAttributeIndex(const char *name, uint32 type);
33224e7c42SIngo Weinhold 
34224e7c42SIngo Weinhold 	bool IsSpecialIndex(Index *index) const;
GetNameIndex()35224e7c42SIngo Weinhold 	NameIndex *GetNameIndex() const			{ return fNameIndex; }
GetLastModifiedIndex()36224e7c42SIngo Weinhold 	LastModifiedIndex *GetLastModifiedIndex() const
37224e7c42SIngo Weinhold 		{ return fLastModifiedIndex; }
GetSizeIndex()38224e7c42SIngo Weinhold 	SizeIndex *GetSizeIndex() const			{ return fSizeIndex; }
39224e7c42SIngo Weinhold 
IndexAt(int32 index)40224e7c42SIngo Weinhold 	Index *IndexAt(int32 index) const	{ return fIndices.ItemAt(index); }
41224e7c42SIngo Weinhold 
42224e7c42SIngo Weinhold private:
43224e7c42SIngo Weinhold 	Volume				*fVolume;
44224e7c42SIngo Weinhold 	NameIndex			*fNameIndex;
45224e7c42SIngo Weinhold 	LastModifiedIndex	*fLastModifiedIndex;
46224e7c42SIngo Weinhold 	SizeIndex			*fSizeIndex;
47224e7c42SIngo Weinhold 	List<Index*>		fIndices;
48224e7c42SIngo Weinhold };
49224e7c42SIngo Weinhold 
50224e7c42SIngo Weinhold #endif	// INDEX_DIRECTORY_H
51