/*
 * searchquery.h
 *
 * Copyright (c) 2002, 2003 Frerich Raabe <raabe@kde.org>
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
 * accompanying file 'COPYING'.
 */
#ifndef SEARCHQUERY_H
#define SEARCHQUERY_H

#include <qregexp.h>
#include <qstring.h>

namespace Barry
{
	class Port;
	class SearchQuery
	{
		public:
			enum Flags {
				NoFlags = 0x0, RegExp = 0x1, CaseSensitive = 0x2
			};
			enum DataCollections {
				Names = 0x1, Comments = 0x2, Descriptions = 0x4
			};
			
			SearchQuery();
			SearchQuery( const QString &term, Flags flags = NoFlags,
			             DataCollections collections = Names );
			bool operator==( const SearchQuery &rhs ) const;
			bool operator!=( const SearchQuery &rhs ) const
				{ return !operator==( rhs ); }
			bool isNull() const
				{ return m_searchTerm.isNull(); }

			bool matches( const Port &port ) const;

		private:
			QString m_searchTerm;
			Flags m_flags;
			DataCollections m_collections;
			QRegExp m_regexp;
	};
};

#endif // SEARCHQUERY_H
// vim:ts=4:sw=4:noet:list
