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 15 #include <util/DoublyLinkedList.h> 16 17 #include "Index.h" 18 #include "ramfs.h" 19 20 21 namespace QueryParser { 22 template<typename QueryPolicy> class Query; 23 }; 24 25 class Node; 26 class Volume; 27 28 29 #define B_QUERY_NON_INDEXED 0x00000002 30 31 32 class Query : public DoublyLinkedListLinkImpl<Query> { 33 public: 34 ~Query(); 35 36 static status_t Create(Volume* volume, const char* queryString, 37 uint32 flags, port_id port, uint32 token, 38 Query*& _query); 39 40 status_t Rewind(); 41 status_t GetNextEntry(struct dirent* entry, size_t size); 42 43 void LiveUpdate(Entry* entry, Node* node, 44 const char* attribute, int32 type, 45 const void* oldKey, size_t oldLength, 46 const void* newKey, size_t newLength); 47 48 private: 49 struct QueryPolicy; 50 friend struct QueryPolicy; 51 typedef QueryParser::Query<QueryPolicy> QueryImpl; 52 53 private: 54 Query(Volume* volume); 55 56 status_t _Init(const char* queryString, uint32 flags, 57 port_id port, uint32 token); 58 59 private: 60 Volume* fVolume; 61 QueryImpl* fImpl; 62 }; 63 64 65 #endif /* QUERY_H */ 66