1/* 2 * Copyright 2011, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Clemens Zeidler <haiku@clemens-zeidler.de> 7 */ 8#ifndef QUERY_MONITOR_H 9#define QUERY_MONITOR_H 10 11 12#include <Query.h> 13 14#include <ObjectList.h> 15 16#include "FileMonitor.h" 17 18 19/*! Handle live query messages, query reader messages, and node monitor messages 20and dispatch them to a EntryViewInterface. */ 21class QueryHandler : public FileMonitor { 22public: 23 QueryHandler(EntryViewInterface* listener); 24 25 void MessageReceived(BMessage* message); 26}; 27 28 29typedef BObjectList<BQuery> BQueryList; 30 31 32class QueryReader : public ReadThread { 33public: 34 QueryReader(QueryHandler* handler); 35 ~QueryReader(); 36 37 bool AddQuery(BQuery* query); 38 void Reset(); 39 40protected: 41 bool ReadNextEntry(entry_ref& entry); 42 43private: 44 BQueryList fQueries; 45 BQueryList fLiveQueries; 46}; 47 48 49#endif // QUERY_MONITOR_H 50