williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __OBEXHEADERLIST_H__ williamr@2: #define __OBEXHEADERLIST_H__ williamr@2: williamr@2: williamr@2: williamr@2: #include williamr@2: #include //CBase williamr@2: williamr@2: //forward declaration williamr@2: class RReadStream; williamr@2: class RWriteStream; williamr@2: class CObexHeader; williamr@2: class CObexBaseObject; williamr@2: class CObexServerSendOperation; williamr@2: williamr@2: williamr@2: class CMsvAttachment; williamr@2: williamr@2: const TUid KUidObexHeaders = {0x10204282}; williamr@2: williamr@2: class CObexHeaderList : public CBase williamr@2: /** williamr@2: Encapsulates and owns a list of CObexHeader objects. williamr@2: Public users of this class can add CObexHeader objects williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: williamr@2: /* williamr@2: It provides functionalities for its friend classes to internalize and williamr@2: externalize itself from a CMsvStore stream, and add all its contained williamr@2: CObexHeader objects to a CObexBaseObject, as well as two general list williamr@2: functions to return the number of objects it contained and a contained williamr@2: object at a specified index into the list. williamr@2: */ williamr@2: friend class CObexServerSendOperation; // requires the use of 'AddHeadersToBaseObjectL' williamr@2: williamr@2: /** williamr@2: * Factory function to return a new CObexHeaderList. williamr@2: @return New CObexHeaderList object williamr@2: */ williamr@2: IMPORT_C static CObexHeaderList* NewL(); williamr@2: williamr@2: williamr@2: /** williamr@2: * Factory function to return a new CObexHeaderList and leave it on the williamr@2: * cleanup stack. williamr@2: @return New CObexHeaderList object williamr@2: */ williamr@2: IMPORT_C static CObexHeaderList* NewLC(); williamr@2: williamr@2: williamr@2: /** williamr@2: * Destructor which frees all allocated memory with the list. williamr@2: */ williamr@2: IMPORT_C ~CObexHeaderList(); williamr@2: williamr@2: /** williamr@2: * Add a CObexHeader object to the list. The CObexHeader object added williamr@2: * should have its attribute, header ID and header value set before williamr@2: * it is added to the list. CObexHeaderlist will not change these williamr@2: * values of its contained CObexHeader objects williamr@2: * @param aHeader Pointer to a constant CObexHeader object williamr@2: * williamr@2: * @return KErrNone, if the operation is successful, otherwise williamr@2: * one of the system wide error codes williamr@2: */ williamr@2: IMPORT_C TInt AddHeader(const CObexHeader* aHeader); williamr@2: williamr@2: IMPORT_C void ExportToAttachmentL(CMsvAttachment& aAttachment) const; williamr@2: williamr@2: IMPORT_C void ImportFromAttachmentL(CMsvAttachment& aAttachment); williamr@2: williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: IMPORT_C void InternalizeL(RReadStream& aReadStream); williamr@2: williamr@2: protected: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: * Add all the CObexHeader objects contained in a list to a williamr@2: * CObexBaseObject. williamr@2: * williamr@2: * williamr@2: * @param aObexBaseObj CObexBaseObject to add the objects to williamr@2: * williamr@2: * @leave Error System wide error code williamr@2: * williamr@2: */ williamr@2: IMPORT_C void AddHeadersToBaseObjectL(CObexBaseObject& aObexBaseObj); williamr@2: williamr@2: williamr@2: //General list processing functions williamr@2: williamr@2: /** williamr@2: * Return the number of CObexHeader object pointers contained in the list. williamr@2: * williamr@2: * williamr@2: * @return The number of CObexHeader object pointers in the list williamr@2: */ williamr@2: IMPORT_C TInt Count() const; williamr@2: williamr@2: /** williamr@2: * Get a non constant reference to the CObexHeader object pointer at williamr@2: * position aPos into the list. williamr@2: * williamr@2: * williamr@2: * @param aPos A list index specifying the CObexHeader object pointer to williamr@2: * be returned williamr@2: * williamr@2: * @leave KErrArgument aPos is out of range williamr@2: * @leave KErrNotFound The list is empty williamr@2: * williamr@2: * @return A non constant reference to the CObexHeader object williamr@2: * pointer williamr@2: */ williamr@2: IMPORT_C CObexHeader*& ObexHeaderL(TInt aPos); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * Leaving constructor function used in 2 phase construction in NewLC() williamr@2: */ williamr@2: void ConstructL(); williamr@2: williamr@2: /** williamr@2: * Constructor function used in 2 phase construction in NewLC() williamr@2: */ williamr@2: CObexHeaderList(); williamr@2: williamr@2: private: williamr@4: //* iObexHeaders; williamr@2: }; williamr@2: williamr@2: #endif // __OBEXHEADERLIST_H__