epoc32/include/obexheader.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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@2
     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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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
// $Workfile: obexHeader.h $
williamr@2
    15
// $Author: Stevep $
williamr@2
    16
// $Revision: 13 $
williamr@2
    17
// $Date: 25/03/02 10:57 $
williamr@2
    18
// 
williamr@2
    19
//
williamr@2
    20
williamr@2
    21
#if !defined (__OBEXHEADER_H__)
williamr@2
    22
#define __OBEXHEADER_H__
williamr@2
    23
williamr@2
    24
williamr@2
    25
#include <e32std.h> 
williamr@2
    26
#include <e32base.h>    //CBase 
williamr@2
    27
williamr@2
    28
class CMsvStore;
williamr@2
    29
class RMsvReadStream;
williamr@2
    30
class RMsvWriteStream;
williamr@2
    31
williamr@2
    32
// Stream version -- increment by one each time the externalized data format changes
williamr@2
    33
// for a significant release.
williamr@2
    34
const TInt32 KObexMessageStreamVersion = 1;///<Stream version
williamr@2
    35
const TInt KObexBadStreamVersion = 1;
williamr@2
    36
williamr@2
    37
williamr@2
    38
class CObexMtmHeader : public CBase
williamr@2
    39
/**
williamr@2
    40
Base class for OBEX object headers. Allows them to be stored and restored to and from the
williamr@2
    41
CMsvStore.
williamr@2
    42
 
williamr@2
    43
@internalTechnology
williamr@2
    44
@released
williamr@2
    45
*/
williamr@2
    46
	{
williamr@2
    47
public:
williamr@2
    48
williamr@2
    49
	/**
williamr@2
    50
	* Destructor which deletes all of the HBufC members
williamr@2
    51
	*/
williamr@2
    52
williamr@2
    53
    IMPORT_C ~CObexMtmHeader();
williamr@2
    54
williamr@2
    55
	/**
williamr@2
    56
	 * Creates a stream in aStore and externalises this object to it.
williamr@2
    57
	 *
williamr@2
    58
	 *
williamr@2
    59
	 * @param aStore The store to which this object is to be stored. Note this must be open with write access or 
williamr@2
    60
	 *  this function will leave.
williamr@2
    61
	 * @leave KErrXXX Standard EPOC stream leave codes.
williamr@2
    62
	 * @leave KErrAccessDenied aStore is not opened with write access.
williamr@2
    63
	 */
williamr@2
    64
    
williamr@2
    65
	IMPORT_C void StoreL(CMsvStore& aStore) const;
williamr@2
    66
    
williamr@2
    67
	/**
williamr@2
    68
	 * Opens a stream in aStore and internalises this object from it.
williamr@2
    69
	 * @param aStore The store from which this object is to be restored. Note this must be open with read or 
williamr@2
    70
	 *  read/write access or this function will leave.
williamr@2
    71
	 * @leave KErrXXX Standard EPOC stream leave codes. 
williamr@2
    72
	 * @leave KErrAccessDenied aStore is not opened with read access.
williamr@2
    73
	 */
williamr@2
    74
williamr@2
    75
	IMPORT_C void RestoreL(const CMsvStore& aStore);
williamr@2
    76
williamr@2
    77
	//Setters/Getters
williamr@2
    78
    
williamr@2
    79
	/**
williamr@2
    80
	 * Returns the Name header value.
williamr@2
    81
	 * @return The Name header value. This will be a zero-length descriptor if this Name has not been set.
williamr@2
    82
	 */
williamr@2
    83
	
williamr@2
    84
	IMPORT_C TPtrC Name() const;
williamr@2
    85
williamr@2
    86
	/**
williamr@2
    87
	 * Sets the Name header value.
williamr@2
    88
	 * @param aName The new Name header value
williamr@2
    89
	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Name header fails.
williamr@2
    90
	 */
williamr@2
    91
williamr@2
    92
    IMPORT_C void SetNameL(const TDesC& aSubject);
williamr@2
    93
williamr@2
    94
	/**
williamr@2
    95
	 * Returns the Subject header value.
williamr@2
    96
	 * @return The Subject header value. This will be a zero-length descriptor if this Subject has not been set.
williamr@2
    97
	 */
williamr@2
    98
williamr@2
    99
    IMPORT_C TPtrC Subject() const;
williamr@2
   100
    
williamr@2
   101
	/**
williamr@2
   102
	 * Sets the Subject header value.
williamr@2
   103
	 *
williamr@2
   104
	 * @param aName The new Subject header value
williamr@2
   105
	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Subject header fails.
williamr@2
   106
	 */
williamr@2
   107
williamr@2
   108
	IMPORT_C void SetSubjectL(const TDesC& aSubject);
williamr@2
   109
williamr@2
   110
    /**
williamr@2
   111
	 * Returns the Type header value.
williamr@2
   112
	 * @return The Type header value. This will be a zero-length descriptor if this Type has not been set.
williamr@2
   113
	 */
williamr@2
   114
	
williamr@2
   115
	IMPORT_C TPtrC8 Type() const;
williamr@2
   116
    
williamr@2
   117
	/**
williamr@2
   118
	 * Sets the Type header value.
williamr@2
   119
	 *
williamr@2
   120
	 * @param aType The new Type header value
williamr@2
   121
	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Type header fails.
williamr@2
   122
	 */
williamr@2
   123
williamr@2
   124
	IMPORT_C void SetTypeL(const TDesC8& aSubject);
williamr@2
   125
williamr@2
   126
    /**
williamr@2
   127
	 * Returns the Target header value.
williamr@2
   128
	 * @return The Target header value. This will be a zero-length descriptor if this Target has not been set.
williamr@2
   129
	 */
williamr@2
   130
williamr@2
   131
	IMPORT_C TPtrC8 Target() const;
williamr@2
   132
    
williamr@2
   133
	/**
williamr@2
   134
	 * Sets the ConnectionID header value.
williamr@2
   135
	 * 
williamr@2
   136
	 * @param ConnectionID The new Target header value
williamr@2
   137
	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Target header fails.
williamr@2
   138
	 */
williamr@2
   139
	
williamr@2
   140
	IMPORT_C void SetTargetL(const TDesC8& aSubject);
williamr@2
   141
williamr@2
   142
    /**
williamr@2
   143
	 * Returns the ConnectionID header value.
williamr@2
   144
	 * @return The ConnectionID header value. This will be a zero-length descriptor if this ConnectionID has not been set.
williamr@2
   145
	 */
williamr@2
   146
	
williamr@2
   147
	IMPORT_C TPtrC8 ConnectionID() const;
williamr@2
   148
    
williamr@2
   149
	/**
williamr@2
   150
	 * Sets the ConnectionID header value.
williamr@2
   151
	 * 
williamr@2
   152
	 * @param ConnectionID The new ConnectionID header value
williamr@2
   153
	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the ConnectionID header fails.
williamr@2
   154
	 */
williamr@2
   155
	
williamr@2
   156
	IMPORT_C void SetConnectionIDL(const TDesC8& aSubject);
williamr@2
   157
williamr@2
   158
	/**
williamr@2
   159
	 * Returns the Length header value
williamr@2
   160
	 * @return Length header value
williamr@2
   161
	 */
williamr@2
   162
	
williamr@2
   163
	IMPORT_C TInt Length() const;
williamr@2
   164
	
williamr@2
   165
	/**
williamr@2
   166
	 * Sets the Length header value
williamr@2
   167
	 * @param aLength The new Length header value
williamr@2
   168
	 */
williamr@2
   169
williamr@2
   170
	IMPORT_C void SetLength(TInt aLength);
williamr@2
   171
williamr@2
   172
	/**
williamr@2
   173
	 * Returns the Time header value
williamr@2
   174
	 * @return Time header value
williamr@2
   175
	 */
williamr@2
   176
williamr@2
   177
	IMPORT_C const TTime& Time() const;
williamr@2
   178
	
williamr@2
   179
	/**
williamr@2
   180
	 * Sets the Time header value
williamr@2
   181
	 * @param aTime The new Time header value
williamr@2
   182
	 */
williamr@2
   183
williamr@2
   184
	IMPORT_C void SetTime(const TTime& aTime);
williamr@2
   185
williamr@2
   186
	///Transport specific address getter, therefore implemented in the derived classes
williamr@2
   187
    IMPORT_C virtual TPtrC8 Addr() const = 0;
williamr@2
   188
	///Transport specific address setter, therefore implemented in the derived classes
williamr@2
   189
    IMPORT_C virtual void SetAddrL(const TDesC8& aSubject) = 0;
williamr@2
   190
williamr@2
   191
	///Called by Store/Restore -- must be implemented in the derived class and call BaseInternaliseL first
williamr@2
   192
    IMPORT_C virtual void InternalizeL(RMsvReadStream& aReadStream) = 0;
williamr@2
   193
	///Called by Store/Restore -- must be implemented in the derived class and call BaseExternaliseL first
williamr@2
   194
    IMPORT_C virtual void ExternalizeL(RMsvWriteStream& aWriteStream) const = 0;
williamr@2
   195
williamr@2
   196
protected:
williamr@2
   197
	//Base class functions that MUST be called by the derived classes
williamr@2
   198
    
williamr@2
   199
	/**
williamr@2
   200
	 * Internalizes the CObexMtmHeader object from a stream.Must be called by the derived class BEFORE 
williamr@2
   201
	 * that class internalizes
williamr@2
   202
	 *
williamr@2
   203
	 * @param aReadStream The stream to be read from
williamr@2
   204
	 * @leave KErrXXX Standard EPOC stream leave codes
williamr@2
   205
	 */
williamr@2
   206
	
williamr@2
   207
	IMPORT_C void BaseInternalizeL(RMsvReadStream& aReadStream);
williamr@2
   208
williamr@2
   209
	/**
williamr@2
   210
	 * Externalizes CObexMtmHeader object to a stream. Must be called by the derived class BEFORE 
williamr@2
   211
	 * that class externalizes
williamr@2
   212
	 * @param aWriteStream The stream to be written to
williamr@2
   213
	 * @leave KErrXXX Standard EPOC stream leave codes
williamr@2
   214
	 */
williamr@2
   215
williamr@2
   216
    IMPORT_C void BaseExternalizeL(RMsvWriteStream& aWriteStream) const;
williamr@2
   217
	
williamr@2
   218
	/**
williamr@2
   219
	 * Leaving constructor, which must be called by the base classes to initialise the HBufC members
williamr@2
   220
	 */
williamr@2
   221
	
williamr@2
   222
	IMPORT_C void BaseConstructL();
williamr@2
   223
williamr@2
   224
protected:
williamr@2
   225
	
williamr@2
   226
	/**
williamr@2
   227
	 * Default constructor, which assigns the TUid for the stream and stream version
williamr@2
   228
	 *
williamr@2
   229
	 * @param aStreamUid Uid of the header stream--specified in the derived class
williamr@2
   230
	 * @param aStreamVersion Version number for the stream, must be specified in the derived classes 
williamr@2
   231
	 * and incremented each time a new version of the stream is implemented.
williamr@2
   232
	 */
williamr@2
   233
williamr@2
   234
	IMPORT_C CObexMtmHeader(TUid aStreamUid, TInt32 aStreamVersion);
williamr@2
   235
williamr@2
   236
protected:
williamr@2
   237
	HBufC*			iName; ///< The name of the Obex object
williamr@2
   238
	HBufC*			iSubject; ///< The subject of the Obex object
williamr@2
   239
	HBufC8*			iType; ///< The type of the Obex object
williamr@2
   240
	TInt			iLength; ///< The size of the Obex object
williamr@2
   241
	TTime			iTime; ///< Date and time of last modification of Obex object
williamr@2
   242
	HBufC8*			iTarget; ///< Byte sequence identifying intended target
williamr@2
   243
	HBufC8*			iConnectionID; ///< The transport type
williamr@2
   244
williamr@2
   245
	const TUid		iStreamUid; ///< Uid of the header stream
williamr@2
   246
	const TInt32	iStreamVersion; ///< Version number for the streams
williamr@2
   247
	};
williamr@2
   248
#endif	//!defined (__OBEXHEADER_H__)