epoc32/include/obexheaderlist.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/obexheaderlist.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/obexheaderlist.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,155 @@
     1.4 -obexheaderlist.h
     1.5 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __OBEXHEADERLIST_H__
    1.21 +#define __OBEXHEADERLIST_H__
    1.22 +
    1.23 +
    1.24 +
    1.25 +#include <e32std.h> 
    1.26 +#include <e32base.h>    //CBase 
    1.27 +
    1.28 +//forward declaration
    1.29 +class RReadStream;
    1.30 +class RWriteStream;
    1.31 +class CObexHeader;
    1.32 +class CObexBaseObject;
    1.33 +class CObexServerSendOperation;
    1.34 +
    1.35 +
    1.36 +class CMsvAttachment;
    1.37 +
    1.38 +const TUid KUidObexHeaders = {0x10204282};
    1.39 +
    1.40 +class CObexHeaderList : public CBase
    1.41 +/**
    1.42 +Encapsulates and owns a list of CObexHeader objects.
    1.43 +Public users of this class can add CObexHeader objects 
    1.44 +                        
    1.45 +@publishedAll
    1.46 +@released
    1.47 +*/
    1.48 +	{
    1.49 +public:
    1.50 +
    1.51 +	/*
    1.52 +    It provides functionalities for its friend classes to internalize and 
    1.53 +    externalize itself from a CMsvStore stream, and add all its contained 
    1.54 +    CObexHeader objects to a CObexBaseObject, as well as two general list
    1.55 +    functions to return the number of objects it contained and a contained
    1.56 +    object at a specified index into the list.
    1.57 +    */  
    1.58 +	friend class CObexServerSendOperation;		// requires the use of 'AddHeadersToBaseObjectL'
    1.59 +
    1.60 +	/**
    1.61 +	 * Factory function to return a new CObexHeaderList.
    1.62 +	 @return New CObexHeaderList object 
    1.63 +	 */
    1.64 +	IMPORT_C static CObexHeaderList* NewL();
    1.65 +	
    1.66 +	
    1.67 +	/**
    1.68 +	 * Factory function to return a new CObexHeaderList and leave it on the 
    1.69 +	 * cleanup stack.
    1.70 +	 @return New CObexHeaderList object 
    1.71 +	 */
    1.72 +	IMPORT_C static CObexHeaderList* NewLC();
    1.73 +
    1.74 +
    1.75 +	/**
    1.76 +	 * Destructor which frees all allocated memory with the list.
    1.77 +	 */
    1.78 +    IMPORT_C ~CObexHeaderList();
    1.79 +    
    1.80 +    /**
    1.81 +	 * Add a CObexHeader object to the list. The CObexHeader object added 
    1.82 +	 * should have its attribute, header ID and header value set before
    1.83 +	 * it is added to the list. CObexHeaderlist will not change these
    1.84 +	 * values of its contained CObexHeader objects
    1.85 +	 * @param  aHeader Pointer to a constant CObexHeader object
    1.86 +	 *  
    1.87 +	 * @return KErrNone, if the operation is successful, otherwise
    1.88 +	 *         one of the system wide error codes  
    1.89 +	 */
    1.90 +	IMPORT_C TInt AddHeader(const CObexHeader*  aHeader);
    1.91 +	
    1.92 +	IMPORT_C void ExportToAttachmentL(CMsvAttachment& aAttachment) const;
    1.93 +	
    1.94 +	IMPORT_C void ImportFromAttachmentL(CMsvAttachment& aAttachment);
    1.95 +
    1.96 +	IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const;
    1.97 +	
    1.98 +	IMPORT_C void InternalizeL(RReadStream& aReadStream);
    1.99 +
   1.100 +protected:
   1.101 +
   1.102 +
   1.103 +
   1.104 +    /**
   1.105 +	 * Add all the CObexHeader objects contained in a list to a 
   1.106 +	 * CObexBaseObject.
   1.107 +	 *
   1.108 +	 *
   1.109 +	 * @param aObexBaseObj CObexBaseObject to add the objects to
   1.110 +	 *  
   1.111 +	 * @leave Error System wide error code 
   1.112 +	 * 
   1.113 +	 */
   1.114 +    IMPORT_C void AddHeadersToBaseObjectL(CObexBaseObject& aObexBaseObj);
   1.115 +
   1.116 +	
   1.117 +	//General list processing functions
   1.118 +
   1.119 +    /**
   1.120 +	 * Return the number of CObexHeader object pointers contained in the list.
   1.121 +	 *
   1.122 +	 * 
   1.123 +	 * @return The number of CObexHeader object pointers in the list
   1.124 +	 */
   1.125 +	IMPORT_C TInt Count() const;
   1.126 +
   1.127 +	/**
   1.128 +	 * Get a non constant reference to the CObexHeader object pointer at 
   1.129 +	 * position aPos into the list.
   1.130 +	 *
   1.131 +	 *
   1.132 +	 * @param aPos A list index specifying the CObexHeader object pointer to 
   1.133 +	 *        be returned
   1.134 +	 *  
   1.135 +	 * @leave KErrArgument aPos is out of range
   1.136 +	 * @leave KErrNotFound The list is empty
   1.137 +	 *        
   1.138 +	 * @return A non constant reference to the CObexHeader object 
   1.139 +	 *         pointer
   1.140 +	 */
   1.141 +	IMPORT_C CObexHeader*& ObexHeaderL(TInt aPos); 
   1.142 +
   1.143 +private:
   1.144 +	/**
   1.145 +	 * Leaving constructor function used in 2 phase construction in NewLC()
   1.146 +	 */
   1.147 +	void ConstructL();
   1.148 +
   1.149 +    /**
   1.150 +	 *  Constructor function used in 2 phase construction in NewLC()
   1.151 +	 */
   1.152 +	CObexHeaderList();
   1.153 +
   1.154 +private:
   1.155 +    ///<pointer to the CObexHeader object pointer array
   1.156 +	RPointerArray<CObexHeader>*	iObexHeaders;
   1.157 +	};
   1.158 +	
   1.159 +#endif	// __OBEXHEADERLIST_H__