1*1e7416d9SIngo Weinhold /* 2*1e7416d9SIngo Weinhold * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de. 3*1e7416d9SIngo Weinhold * Distributed under the terms of the MIT License. 4*1e7416d9SIngo Weinhold */ 5*1e7416d9SIngo Weinhold #ifndef QUERY_H 6*1e7416d9SIngo Weinhold #define QUERY_H 7*1e7416d9SIngo Weinhold 8*1e7416d9SIngo Weinhold 9*1e7416d9SIngo Weinhold #include <SupportDefs.h> 10*1e7416d9SIngo Weinhold 11*1e7416d9SIngo Weinhold #include <util/DoublyLinkedList.h> 12*1e7416d9SIngo Weinhold 13*1e7416d9SIngo Weinhold 14*1e7416d9SIngo Weinhold struct dirent; 15*1e7416d9SIngo Weinhold 16*1e7416d9SIngo Weinhold namespace QueryParser { 17*1e7416d9SIngo Weinhold template<typename QueryPolicy> class Query; 18*1e7416d9SIngo Weinhold }; 19*1e7416d9SIngo Weinhold 20*1e7416d9SIngo Weinhold class Node; 21*1e7416d9SIngo Weinhold class Volume; 22*1e7416d9SIngo Weinhold 23*1e7416d9SIngo Weinhold 24*1e7416d9SIngo Weinhold class Query : public DoublyLinkedListLinkImpl<Query> { 25*1e7416d9SIngo Weinhold public: 26*1e7416d9SIngo Weinhold ~Query(); 27*1e7416d9SIngo Weinhold 28*1e7416d9SIngo Weinhold static status_t Create(Volume* volume, const char* queryString, 29*1e7416d9SIngo Weinhold uint32 flags, port_id port, uint32 token, 30*1e7416d9SIngo Weinhold Query*& _query); 31*1e7416d9SIngo Weinhold 32*1e7416d9SIngo Weinhold status_t Rewind(); 33*1e7416d9SIngo Weinhold status_t GetNextEntry(struct dirent* entry, size_t size); 34*1e7416d9SIngo Weinhold 35*1e7416d9SIngo Weinhold void LiveUpdate(Node* node, 36*1e7416d9SIngo Weinhold const char* attribute, int32 type, 37*1e7416d9SIngo Weinhold const void* oldKey, size_t oldLength, 38*1e7416d9SIngo Weinhold const void* newKey, size_t newLength); 39*1e7416d9SIngo Weinhold 40*1e7416d9SIngo Weinhold private: 41*1e7416d9SIngo Weinhold struct QueryPolicy; 42*1e7416d9SIngo Weinhold friend struct QueryPolicy; 43*1e7416d9SIngo Weinhold typedef QueryParser::Query<QueryPolicy> QueryImpl; 44*1e7416d9SIngo Weinhold 45*1e7416d9SIngo Weinhold private: 46*1e7416d9SIngo Weinhold Query(Volume* volume); 47*1e7416d9SIngo Weinhold 48*1e7416d9SIngo Weinhold status_t _Init(const char* queryString, uint32 flags, 49*1e7416d9SIngo Weinhold port_id port, uint32 token); 50*1e7416d9SIngo Weinhold 51*1e7416d9SIngo Weinhold private: 52*1e7416d9SIngo Weinhold Volume* fVolume; 53*1e7416d9SIngo Weinhold QueryImpl* fImpl; 54*1e7416d9SIngo Weinhold }; 55*1e7416d9SIngo Weinhold 56*1e7416d9SIngo Weinhold 57*1e7416d9SIngo Weinhold typedef DoublyLinkedList<Query> QueryList; 58*1e7416d9SIngo Weinhold 59*1e7416d9SIngo Weinhold 60*1e7416d9SIngo Weinhold #endif // QUERY_H 61