bluetooth/btsdp/database/ServiceSearchVisitor.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 #ifndef SERVICESEARCHVISITOR_H
       
    18 #define SERVICESEARCHVISITOR_H
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <btsdp.h>
       
    22 #include "SDPDatabase.h"
       
    23 #include "MAttributeVisitor.h"
       
    24 #include "mignorer.h"
       
    25 #include <e32base_private.h>
       
    26 
       
    27 class CSdpServRecord;
       
    28 class MServiceSearchHandler
       
    29 	{
       
    30 public:
       
    31 	virtual void RecordFoundL(CSdpServRecord& aMatchingRec)=0;
       
    32 	};
       
    33 
       
    34 class CEncodedVisitorAdapter;
       
    35 	
       
    36 /**
       
    37 	Class service search visitor.
       
    38 	Carries out the UUID search pattern search over the
       
    39 	attribute tree.
       
    40 	Will leave on a VisitAttributeValueL call, with KErrCompletion (!)
       
    41 	when the final UUID in the pattern is matched.
       
    42 	If the pattern is  null, it will never leave.
       
    43 	If an attribute value visited is in encoded form, it builds a parser
       
    44 	and sets itself as visitor.
       
    45 **/
       
    46 NONSHARABLE_CLASS(CServiceSearchVisitor) : public CBase, private MAttributeVisitor
       
    47 	{
       
    48 public:
       
    49 	IMPORT_C static CServiceSearchVisitor* NewL(const CSdpSearchPattern& aPattern);
       
    50 	IMPORT_C static CServiceSearchVisitor* NewLC(const CSdpSearchPattern& aPattern);
       
    51     ~CServiceSearchVisitor();
       
    52 
       
    53 	IMPORT_C static void SearchDbL(CSdpDatabase &aDb, const CSdpSearchPattern &aPattern, MServiceSearchHandler& aObserver);
       
    54 
       
    55 	void FoundUUIDL(const TUUID& aUUID);
       
    56 
       
    57 private:
       
    58     CServiceSearchVisitor();
       
    59 	void ConstructL(const CSdpSearchPattern& aPattern);
       
    60 
       
    61 	void SearchRecordL(CSdpServRecord& aRec);
       
    62 
       
    63 	// MAttributeVisitor interface
       
    64     void VisitAttributeL(CSdpAttr &aAttribute);
       
    65     void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType);
       
    66     void StartListL(CSdpAttrValueList &aList);
       
    67     void EndListL();
       
    68 
       
    69 private:
       
    70 	const CSdpSearchPattern *iSearchPattern;
       
    71 	CBitMapAllocator *iFoundIndexs;
       
    72 
       
    73 	CEncodedVisitorAdapter* iAdapter;
       
    74 	CElementParser* iParser;
       
    75 	};
       
    76 
       
    77 #endif