epoc32/include/obexheader.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/obexheader.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,248 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// $Workfile: obexHeader.h $
    1.18 +// $Author: Stevep $
    1.19 +// $Revision: 13 $
    1.20 +// $Date: 25/03/02 10:57 $
    1.21 +// 
    1.22 +//
    1.23 +
    1.24 +#if !defined (__OBEXHEADER_H__)
    1.25 +#define __OBEXHEADER_H__
    1.26 +
    1.27 +
    1.28 +#include <e32std.h> 
    1.29 +#include <e32base.h>    //CBase 
    1.30 +
    1.31 +class CMsvStore;
    1.32 +class RMsvReadStream;
    1.33 +class RMsvWriteStream;
    1.34 +
    1.35 +// Stream version -- increment by one each time the externalized data format changes
    1.36 +// for a significant release.
    1.37 +const TInt32 KObexMessageStreamVersion = 1;///<Stream version
    1.38 +const TInt KObexBadStreamVersion = 1;
    1.39 +
    1.40 +
    1.41 +class CObexMtmHeader : public CBase
    1.42 +/**
    1.43 +Base class for OBEX object headers. Allows them to be stored and restored to and from the
    1.44 +CMsvStore.
    1.45 + 
    1.46 +@internalTechnology
    1.47 +@released
    1.48 +*/
    1.49 +	{
    1.50 +public:
    1.51 +
    1.52 +	/**
    1.53 +	* Destructor which deletes all of the HBufC members
    1.54 +	*/
    1.55 +
    1.56 +    IMPORT_C ~CObexMtmHeader();
    1.57 +
    1.58 +	/**
    1.59 +	 * Creates a stream in aStore and externalises this object to it.
    1.60 +	 *
    1.61 +	 *
    1.62 +	 * @param aStore The store to which this object is to be stored. Note this must be open with write access or 
    1.63 +	 *  this function will leave.
    1.64 +	 * @leave KErrXXX Standard EPOC stream leave codes.
    1.65 +	 * @leave KErrAccessDenied aStore is not opened with write access.
    1.66 +	 */
    1.67 +    
    1.68 +	IMPORT_C void StoreL(CMsvStore& aStore) const;
    1.69 +    
    1.70 +	/**
    1.71 +	 * Opens a stream in aStore and internalises this object from it.
    1.72 +	 * @param aStore The store from which this object is to be restored. Note this must be open with read or 
    1.73 +	 *  read/write access or this function will leave.
    1.74 +	 * @leave KErrXXX Standard EPOC stream leave codes. 
    1.75 +	 * @leave KErrAccessDenied aStore is not opened with read access.
    1.76 +	 */
    1.77 +
    1.78 +	IMPORT_C void RestoreL(const CMsvStore& aStore);
    1.79 +
    1.80 +	//Setters/Getters
    1.81 +    
    1.82 +	/**
    1.83 +	 * Returns the Name header value.
    1.84 +	 * @return The Name header value. This will be a zero-length descriptor if this Name has not been set.
    1.85 +	 */
    1.86 +	
    1.87 +	IMPORT_C TPtrC Name() const;
    1.88 +
    1.89 +	/**
    1.90 +	 * Sets the Name header value.
    1.91 +	 * @param aName The new Name header value
    1.92 +	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Name header fails.
    1.93 +	 */
    1.94 +
    1.95 +    IMPORT_C void SetNameL(const TDesC& aSubject);
    1.96 +
    1.97 +	/**
    1.98 +	 * Returns the Subject header value.
    1.99 +	 * @return The Subject header value. This will be a zero-length descriptor if this Subject has not been set.
   1.100 +	 */
   1.101 +
   1.102 +    IMPORT_C TPtrC Subject() const;
   1.103 +    
   1.104 +	/**
   1.105 +	 * Sets the Subject header value.
   1.106 +	 *
   1.107 +	 * @param aName The new Subject header value
   1.108 +	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Subject header fails.
   1.109 +	 */
   1.110 +
   1.111 +	IMPORT_C void SetSubjectL(const TDesC& aSubject);
   1.112 +
   1.113 +    /**
   1.114 +	 * Returns the Type header value.
   1.115 +	 * @return The Type header value. This will be a zero-length descriptor if this Type has not been set.
   1.116 +	 */
   1.117 +	
   1.118 +	IMPORT_C TPtrC8 Type() const;
   1.119 +    
   1.120 +	/**
   1.121 +	 * Sets the Type header value.
   1.122 +	 *
   1.123 +	 * @param aType The new Type header value
   1.124 +	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Type header fails.
   1.125 +	 */
   1.126 +
   1.127 +	IMPORT_C void SetTypeL(const TDesC8& aSubject);
   1.128 +
   1.129 +    /**
   1.130 +	 * Returns the Target header value.
   1.131 +	 * @return The Target header value. This will be a zero-length descriptor if this Target has not been set.
   1.132 +	 */
   1.133 +
   1.134 +	IMPORT_C TPtrC8 Target() const;
   1.135 +    
   1.136 +	/**
   1.137 +	 * Sets the ConnectionID header value.
   1.138 +	 * 
   1.139 +	 * @param ConnectionID The new Target header value
   1.140 +	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the Target header fails.
   1.141 +	 */
   1.142 +	
   1.143 +	IMPORT_C void SetTargetL(const TDesC8& aSubject);
   1.144 +
   1.145 +    /**
   1.146 +	 * Returns the ConnectionID header value.
   1.147 +	 * @return The ConnectionID header value. This will be a zero-length descriptor if this ConnectionID has not been set.
   1.148 +	 */
   1.149 +	
   1.150 +	IMPORT_C TPtrC8 ConnectionID() const;
   1.151 +    
   1.152 +	/**
   1.153 +	 * Sets the ConnectionID header value.
   1.154 +	 * 
   1.155 +	 * @param ConnectionID The new ConnectionID header value
   1.156 +	 * @leave KErrXXX Standard EPOC error codes if allocation of a buffer to hold the ConnectionID header fails.
   1.157 +	 */
   1.158 +	
   1.159 +	IMPORT_C void SetConnectionIDL(const TDesC8& aSubject);
   1.160 +
   1.161 +	/**
   1.162 +	 * Returns the Length header value
   1.163 +	 * @return Length header value
   1.164 +	 */
   1.165 +	
   1.166 +	IMPORT_C TInt Length() const;
   1.167 +	
   1.168 +	/**
   1.169 +	 * Sets the Length header value
   1.170 +	 * @param aLength The new Length header value
   1.171 +	 */
   1.172 +
   1.173 +	IMPORT_C void SetLength(TInt aLength);
   1.174 +
   1.175 +	/**
   1.176 +	 * Returns the Time header value
   1.177 +	 * @return Time header value
   1.178 +	 */
   1.179 +
   1.180 +	IMPORT_C const TTime& Time() const;
   1.181 +	
   1.182 +	/**
   1.183 +	 * Sets the Time header value
   1.184 +	 * @param aTime The new Time header value
   1.185 +	 */
   1.186 +
   1.187 +	IMPORT_C void SetTime(const TTime& aTime);
   1.188 +
   1.189 +	///Transport specific address getter, therefore implemented in the derived classes
   1.190 +    IMPORT_C virtual TPtrC8 Addr() const = 0;
   1.191 +	///Transport specific address setter, therefore implemented in the derived classes
   1.192 +    IMPORT_C virtual void SetAddrL(const TDesC8& aSubject) = 0;
   1.193 +
   1.194 +	///Called by Store/Restore -- must be implemented in the derived class and call BaseInternaliseL first
   1.195 +    IMPORT_C virtual void InternalizeL(RMsvReadStream& aReadStream) = 0;
   1.196 +	///Called by Store/Restore -- must be implemented in the derived class and call BaseExternaliseL first
   1.197 +    IMPORT_C virtual void ExternalizeL(RMsvWriteStream& aWriteStream) const = 0;
   1.198 +
   1.199 +protected:
   1.200 +	//Base class functions that MUST be called by the derived classes
   1.201 +    
   1.202 +	/**
   1.203 +	 * Internalizes the CObexMtmHeader object from a stream.Must be called by the derived class BEFORE 
   1.204 +	 * that class internalizes
   1.205 +	 *
   1.206 +	 * @param aReadStream The stream to be read from
   1.207 +	 * @leave KErrXXX Standard EPOC stream leave codes
   1.208 +	 */
   1.209 +	
   1.210 +	IMPORT_C void BaseInternalizeL(RMsvReadStream& aReadStream);
   1.211 +
   1.212 +	/**
   1.213 +	 * Externalizes CObexMtmHeader object to a stream. Must be called by the derived class BEFORE 
   1.214 +	 * that class externalizes
   1.215 +	 * @param aWriteStream The stream to be written to
   1.216 +	 * @leave KErrXXX Standard EPOC stream leave codes
   1.217 +	 */
   1.218 +
   1.219 +    IMPORT_C void BaseExternalizeL(RMsvWriteStream& aWriteStream) const;
   1.220 +	
   1.221 +	/**
   1.222 +	 * Leaving constructor, which must be called by the base classes to initialise the HBufC members
   1.223 +	 */
   1.224 +	
   1.225 +	IMPORT_C void BaseConstructL();
   1.226 +
   1.227 +protected:
   1.228 +	
   1.229 +	/**
   1.230 +	 * Default constructor, which assigns the TUid for the stream and stream version
   1.231 +	 *
   1.232 +	 * @param aStreamUid Uid of the header stream--specified in the derived class
   1.233 +	 * @param aStreamVersion Version number for the stream, must be specified in the derived classes 
   1.234 +	 * and incremented each time a new version of the stream is implemented.
   1.235 +	 */
   1.236 +
   1.237 +	IMPORT_C CObexMtmHeader(TUid aStreamUid, TInt32 aStreamVersion);
   1.238 +
   1.239 +protected:
   1.240 +	HBufC*			iName; ///< The name of the Obex object
   1.241 +	HBufC*			iSubject; ///< The subject of the Obex object
   1.242 +	HBufC8*			iType; ///< The type of the Obex object
   1.243 +	TInt			iLength; ///< The size of the Obex object
   1.244 +	TTime			iTime; ///< Date and time of last modification of Obex object
   1.245 +	HBufC8*			iTarget; ///< Byte sequence identifying intended target
   1.246 +	HBufC8*			iConnectionID; ///< The transport type
   1.247 +
   1.248 +	const TUid		iStreamUid; ///< Uid of the header stream
   1.249 +	const TInt32	iStreamVersion; ///< Version number for the streams
   1.250 +	};
   1.251 +#endif	//!defined (__OBEXHEADER_H__)