diff -r 000000000000 -r 29b1cd4cb562 bluetooth/btsdp/database/ServiceSearchVisitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetooth/btsdp/database/ServiceSearchVisitor.h Fri Jan 15 08:13:17 2010 +0200 @@ -0,0 +1,77 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +#ifndef SERVICESEARCHVISITOR_H +#define SERVICESEARCHVISITOR_H + +#include +#include +#include "SDPDatabase.h" +#include "MAttributeVisitor.h" +#include "mignorer.h" +#include + +class CSdpServRecord; +class MServiceSearchHandler + { +public: + virtual void RecordFoundL(CSdpServRecord& aMatchingRec)=0; + }; + +class CEncodedVisitorAdapter; + +/** + Class service search visitor. + Carries out the UUID search pattern search over the + attribute tree. + Will leave on a VisitAttributeValueL call, with KErrCompletion (!) + when the final UUID in the pattern is matched. + If the pattern is null, it will never leave. + If an attribute value visited is in encoded form, it builds a parser + and sets itself as visitor. +**/ +NONSHARABLE_CLASS(CServiceSearchVisitor) : public CBase, private MAttributeVisitor + { +public: + IMPORT_C static CServiceSearchVisitor* NewL(const CSdpSearchPattern& aPattern); + IMPORT_C static CServiceSearchVisitor* NewLC(const CSdpSearchPattern& aPattern); + ~CServiceSearchVisitor(); + + IMPORT_C static void SearchDbL(CSdpDatabase &aDb, const CSdpSearchPattern &aPattern, MServiceSearchHandler& aObserver); + + void FoundUUIDL(const TUUID& aUUID); + +private: + CServiceSearchVisitor(); + void ConstructL(const CSdpSearchPattern& aPattern); + + void SearchRecordL(CSdpServRecord& aRec); + + // MAttributeVisitor interface + void VisitAttributeL(CSdpAttr &aAttribute); + void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType); + void StartListL(CSdpAttrValueList &aList); + void EndListL(); + +private: + const CSdpSearchPattern *iSearchPattern; + CBitMapAllocator *iFoundIndexs; + + CEncodedVisitorAdapter* iAdapter; + CElementParser* iParser; + }; + +#endif