epoc32/include/app/obexheaderlist.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
2:2fe1408b6811 3:e1b950c65cb4
       
     1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __OBEXHEADERLIST_H__
       
    17 #define __OBEXHEADERLIST_H__
       
    18 
       
    19 
       
    20 
       
    21 #include <e32std.h> 
       
    22 #include <e32base.h>    //CBase 
       
    23 
       
    24 //forward declaration
       
    25 class RReadStream;
       
    26 class RWriteStream;
       
    27 class CObexHeader;
       
    28 class CObexBaseObject;
       
    29 class CObexServerSendOperation;
       
    30 
       
    31 
       
    32 class CMsvAttachment;
       
    33 
       
    34 const TUid KUidObexHeaders = {0x10204282};
       
    35 
       
    36 class CObexHeaderList : public CBase
       
    37 /**
       
    38 Encapsulates and owns a list of CObexHeader objects.
       
    39 Public users of this class can add CObexHeader objects 
       
    40                         
       
    41 @publishedAll
       
    42 @released
       
    43 */
       
    44 	{
       
    45 public:
       
    46 
       
    47 	/*
       
    48     It provides functionalities for its friend classes to internalize and 
       
    49     externalize itself from a CMsvStore stream, and add all its contained 
       
    50     CObexHeader objects to a CObexBaseObject, as well as two general list
       
    51     functions to return the number of objects it contained and a contained
       
    52     object at a specified index into the list.
       
    53     */  
       
    54 	friend class CObexServerSendOperation;		// requires the use of 'AddHeadersToBaseObjectL'
       
    55 
       
    56 	/**
       
    57 	 * Factory function to return a new CObexHeaderList.
       
    58 	 @return New CObexHeaderList object 
       
    59 	 */
       
    60 	IMPORT_C static CObexHeaderList* NewL();
       
    61 	
       
    62 	
       
    63 	/**
       
    64 	 * Factory function to return a new CObexHeaderList and leave it on the 
       
    65 	 * cleanup stack.
       
    66 	 @return New CObexHeaderList object 
       
    67 	 */
       
    68 	IMPORT_C static CObexHeaderList* NewLC();
       
    69 
       
    70 
       
    71 	/**
       
    72 	 * Destructor which frees all allocated memory with the list.
       
    73 	 */
       
    74     IMPORT_C ~CObexHeaderList();
       
    75     
       
    76     /**
       
    77 	 * Add a CObexHeader object to the list. The CObexHeader object added 
       
    78 	 * should have its attribute, header ID and header value set before
       
    79 	 * it is added to the list. CObexHeaderlist will not change these
       
    80 	 * values of its contained CObexHeader objects
       
    81 	 * @param  aHeader Pointer to a constant CObexHeader object
       
    82 	 *  
       
    83 	 * @return KErrNone, if the operation is successful, otherwise
       
    84 	 *         one of the system wide error codes  
       
    85 	 */
       
    86 	IMPORT_C TInt AddHeader(const CObexHeader*  aHeader);
       
    87 	
       
    88 	IMPORT_C void ExportToAttachmentL(CMsvAttachment& aAttachment) const;
       
    89 	
       
    90 	IMPORT_C void ImportFromAttachmentL(CMsvAttachment& aAttachment);
       
    91 
       
    92 	IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const;
       
    93 	
       
    94 	IMPORT_C void InternalizeL(RReadStream& aReadStream);
       
    95 
       
    96 protected:
       
    97 
       
    98 
       
    99 
       
   100     /**
       
   101 	 * Add all the CObexHeader objects contained in a list to a 
       
   102 	 * CObexBaseObject.
       
   103 	 *
       
   104 	 *
       
   105 	 * @param aObexBaseObj CObexBaseObject to add the objects to
       
   106 	 *  
       
   107 	 * @leave Error System wide error code 
       
   108 	 * 
       
   109 	 */
       
   110     IMPORT_C void AddHeadersToBaseObjectL(CObexBaseObject& aObexBaseObj);
       
   111 
       
   112 	
       
   113 	//General list processing functions
       
   114 
       
   115     /**
       
   116 	 * Return the number of CObexHeader object pointers contained in the list.
       
   117 	 *
       
   118 	 * 
       
   119 	 * @return The number of CObexHeader object pointers in the list
       
   120 	 */
       
   121 	IMPORT_C TInt Count() const;
       
   122 
       
   123 	/**
       
   124 	 * Get a non constant reference to the CObexHeader object pointer at 
       
   125 	 * position aPos into the list.
       
   126 	 *
       
   127 	 *
       
   128 	 * @param aPos A list index specifying the CObexHeader object pointer to 
       
   129 	 *        be returned
       
   130 	 *  
       
   131 	 * @leave KErrArgument aPos is out of range
       
   132 	 * @leave KErrNotFound The list is empty
       
   133 	 *        
       
   134 	 * @return A non constant reference to the CObexHeader object 
       
   135 	 *         pointer
       
   136 	 */
       
   137 	IMPORT_C CObexHeader*& ObexHeaderL(TInt aPos); 
       
   138 
       
   139 private:
       
   140 	/**
       
   141 	 * Leaving constructor function used in 2 phase construction in NewLC()
       
   142 	 */
       
   143 	void ConstructL();
       
   144 
       
   145     /**
       
   146 	 *  Constructor function used in 2 phase construction in NewLC()
       
   147 	 */
       
   148 	CObexHeaderList();
       
   149 
       
   150 private:
       
   151     ///<pointer to the CObexHeader object pointer array
       
   152 	RPointerArray<CObexHeader>*	iObexHeaders;
       
   153 	};
       
   154 	
       
   155 #endif	// __OBEXHEADERLIST_H__