diff -r 22de2e391156 -r 20ac952a623c bluetooth/btsdp/database/responsesizevisitor.h --- a/bluetooth/btsdp/database/responsesizevisitor.h Thu Sep 23 17:06:47 2010 +0300 +++ b/bluetooth/btsdp/database/responsesizevisitor.h Wed Oct 13 16:20:29 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2000-2010 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" @@ -35,34 +35,30 @@ class CSdpAttr; /** - CAttrSizeItem + TAttrSizeItem contains the attribute ID, the size of the attribute and a pointer to the attribute This object is attached to a list (CArrayPtrFlat) contained in CHandleItem object **/ -NONSHARABLE_CLASS(CAttrSizeItem) // not a cbase because no benefit, just overhead -{ +NONSHARABLE_CLASS(TAttrSizeItem) + { friend class CSizeAccumulator; public: - CAttrSizeItem(){}; - ~CAttrSizeItem(){iAttribute=0;}; - CAttrSizeItem(const TSdpAttributeID aAttributeID, TUint aSize, CSdpAttr* aAttribute): + TAttrSizeItem(){}; + TAttrSizeItem(const TSdpAttributeID aAttributeID, TUint aSize, CSdpAttr* aAttribute): iAttributeID(aAttributeID), iSize(aSize), iAttribute(aAttribute) {}; - inline TSdpAttributeID AttID(); - inline TUint Size(); - inline CSdpAttr* Attr(); + inline TSdpAttributeID AttID() {return iAttributeID;} + inline TUint Size() {return iSize;} + inline CSdpAttr* Attr() {return iAttribute;} private: TSdpAttributeID iAttributeID; TUint iSize; CSdpAttr* iAttribute; -}; -inline TSdpAttributeID CAttrSizeItem::AttID() {return iAttributeID;}; -inline TUint CAttrSizeItem::Size() {return iSize;}; -inline CSdpAttr* CAttrSizeItem::Attr() {return iAttribute;}; + }; -// const TUint KSDPAttListGran = 8*(sizeof(CAttrSizeItem*)); granularity for a Seg +// const TUint KSDPAttListGran = 8*(sizeof(TAttrSizeItem*)); granularity for a Seg const TUint KSDPAttListGran = 8; // granularity for a flat /** @@ -71,28 +67,25 @@ for that record which match the Attribute ID match list **/ NONSHARABLE_CLASS(CHandleItem) : public CBase -{ + { friend class CSizeAccumulator; public: CHandleItem(){}; + static CHandleItem* NewLC(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord); ~CHandleItem(); - IMPORT_C static CHandleItem* NewL(); - IMPORT_C static CHandleItem* NewLC(); - IMPORT_C static CHandleItem* CHandleItemL(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord); - -// PutRecord(TSdpServRecordHandle aHandleID, const CSdpServRecord* aRecord); // update the NULL data - - void AddAttrItemL(CAttrSizeItem* aItem); + + void AddAttrItemL(TAttrSizeItem* aItem); void AddAttrItemL(const TSdpAttributeID aAttributeID, TUint aSize, CSdpAttr* aAttribute); - inline TInt Count(); + inline TInt Count() {return iAttrSizeList->Count();} + private: + CHandleItem(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord); void ConstructL(); TSdpServRecordHandle iHandleID; CSdpServRecord* iRecord; TUint iRecordSize; - CArrayPtrFlat* iAttrSizeList; // stores the attributes found -}; -inline TInt CHandleItem::Count() {return iAttrSizeList->Count();}; + CArrayPtrFlat* iAttrSizeList; // stores the attributes found + }; // const TUint KSDPHandListGran = 8*(sizeof(CHandleItem*)); granularity for a Seg const TUint KSDPHandListGran = 8; // granularity for a flat @@ -105,8 +98,6 @@ IMPORT_C static CSizeAccumulator* NewL(); IMPORT_C static CSizeAccumulator* NewLC(); void AddHandleL(CHandleItem* aHandleItem); // create a new array element -// void AddHandle(TSdpServRecordHandle aHandleID, CSdpServRecord* aRecord); // create a new array element -// void AddAttrib(TSdpAttributeID aAttributeID, CSdpAttr* aAttribute, TUint aSize); // these methods are used in building the server response once the search has been carried out IMPORT_C TUint SizeLeft(); // can be called before or after setting the start point @@ -116,7 +107,7 @@ IMPORT_C TSdpServRecordHandle HandleAt(TInt aOffset); // returns the Record handle at offset i IMPORT_C TUint HandleSize(TInt aOffset); // returns the size of the record at offset aOffset IMPORT_C TInt AttrCount(TInt aOffset); // returns the count of attributes for record at offset i - IMPORT_C CAttrSizeItem* AttributeOf(TInt aHandleOffset, TInt aAttOffset); // returns the attribute size object (CAttrSizeItem) at i,j + IMPORT_C TAttrSizeItem* AttributeOf(TInt aHandleOffset, TInt aAttOffset); // returns the attribute size object (TAttrSizeItem) at i,j private: CSizeAccumulator():iFirstRec(0),iFirstAtt(0){}; @@ -137,40 +128,50 @@ b carries out the same selection of attributes as CAttrExtractVisitor::EncodeAttributesL **/ -class CSizeEncVisitorAdaptor; +class CResponseSizeVisitor; + +// need this because CResponseSizeVisitor already has start list method... +NONSHARABLE_CLASS(TSizeEncVisitorAdaptor) : public MIgnorer + { +public: + TSizeEncVisitorAdaptor(CResponseSizeVisitor& aVisitor); + MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID); + +private: + CResponseSizeVisitor& iVisitor; + }; NONSHARABLE_CLASS(CResponseSizeVisitor) : public CBase, public MAttributeVisitor { +friend class TSizeEncVisitorAdaptor; public: - ~CResponseSizeVisitor(); - + ~CResponseSizeVisitor(); + IMPORT_C static void SizeRespSSL(CSdpDatabase& aDb, const CSdpSearchPattern& aPattern, CSizeAccumulator& aCollector); IMPORT_C static void SizeRespARL(CSdpServRecord& aRec, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector); IMPORT_C static void SizeRespSAL(CSdpDatabase& aDb, const CSdpSearchPattern& aPattern, const CSdpAttrIdMatchList& aList, CSizeAccumulator& aCollector); - - void FoundUUIDL(const TUUID& aUUID); // needs to be public because of the encoder visitor adaptor - + private: - static CResponseSizeVisitor* NewL(); static CResponseSizeVisitor* NewLC(); - CResponseSizeVisitor(); + CResponseSizeVisitor(); void ConstructL(); - + void SearchRecordL(CSdpServRecord& aRec); - + + void FoundUUIDL(const TUUID& aUUID); + // MAttributeVisitor interface - void VisitAttributeL(CSdpAttr &aAttribute); - void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType); - void StartListL(CSdpAttrValueList &aList); - void EndListL(); - + void VisitAttributeL(CSdpAttr &aAttribute); + void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType); + void StartListL(CSdpAttrValueList &aList); + void EndListL(); + private: - CSizeEncVisitorAdaptor* iAdapter; + TSizeEncVisitorAdaptor iAdapter; CElementParser* iParser; // used by the encoded UUID parser const CSdpSearchPattern* iSearchPattern; // a local pointer to the UUID search list CSizeAccumulator* iCollector; // a local pointer to the size collector object supplied const CSdpAttrIdMatchList* iAtMatList; // a local pointer to the attribute match list or NULL - CHandleItem* iCurrentRec; // we build the handle and attribute list and perhaps throw it away CBitMapAllocator* iFoundIndex; // a simpler match TInt iSearchSize; // how many items in search pattern TBool iUseThis; // do we use this record ?