xref: /haiku/src/add-ons/kernel/file_systems/ramfs/Query.h (revision b8a45b3a2df2379b4301bf3bd5949b9a105be4ba)
1 /* Query - query parsing and evaluation
2  *
3  * Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de.
4  * This file may be used under the terms of the MIT License.
5  *
6  * Adjusted by Ingo Weinhold <bonefish@cs.tu-berlin.de> for usage in RAM FS.
7  */
8 #ifndef QUERY_H
9 #define QUERY_H
10 
11 
12 #include <OS.h>
13 #include <SupportDefs.h>
14 #include <fs_query.h>
15 
16 #include <util/DoublyLinkedList.h>
17 
18 #include "Index.h"
19 #include "ramfs.h"
20 
21 
22 namespace QueryParser {
23 	template<typename QueryPolicy> class Query;
24 };
25 
26 class Node;
27 class Volume;
28 
29 
30 class Query : public DoublyLinkedListLinkImpl<Query> {
31 public:
32 							~Query();
33 
34 	static	status_t		Create(Volume* volume, const char* queryString,
35 								uint32 flags, port_id port, uint32 token,
36 								Query*& _query);
37 
38 			status_t		Rewind();
39 			status_t		GetNextEntry(struct dirent* entry, size_t size);
40 
41 			void			LiveUpdate(Entry* entry, Node* node,
42 								const char* attribute, int32 type,
43 								const void* oldKey, size_t oldLength,
44 								const void* newKey, size_t newLength);
45 
46 private:
47 			struct QueryPolicy;
48 			friend struct QueryPolicy;
49 			typedef QueryParser::Query<QueryPolicy> QueryImpl;
50 
51 private:
52 							Query(Volume* volume);
53 
54 			status_t		_Init(const char* queryString, uint32 flags,
55 								port_id port, uint32 token);
56 
57 private:
58 			Volume*			fVolume;
59 			QueryImpl*		fImpl;
60 };
61 
62 
63 #endif	/* QUERY_H */
64