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