epoc32/include/comms-infras/metabuffer.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/comms-infras/metabuffer.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,109 @@
     1.4 +// Copyright (c) 2004-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 +// MetaBuffer.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file MetaBuffer.h
    1.25 + @internalTechnology
    1.26 +*/
    1.27 +
    1.28 +#if (!defined METABUFFER_H)
    1.29 +#define METABUFFER_H
    1.30 +
    1.31 +#include <comms-infras/metatypevariablelen.h>
    1.32 +
    1.33 +namespace Meta
    1.34 +{
    1.35 +
    1.36 +class TMetaBuf8 : public TMetaVarLen8<RBuf8>
    1.37 +/**
    1.38 +
    1.39 +Implementation of MMetaType for dynamicaly allocated RBuf8
    1.40 +
    1.41 +@internalComponent
    1.42 +@released since v9.0
    1.43 +*/
    1.44 +	{
    1.45 +public:
    1.46 +	inline static MMetaType* NewL(const TAny* aMem, const TAny* aData);
    1.47 +
    1.48 +	IMPORT_C virtual TInt Load(TPtrC8& aBuffer);
    1.49 +	IMPORT_C virtual TInt Store(TDes8& aBuffer) const;
    1.50 +	IMPORT_C virtual void Copy(const TAny* aData);
    1.51 +	IMPORT_C virtual TInt Length() const;
    1.52 +
    1.53 +protected:
    1.54 +	TMetaBuf8(const TAny* aData) :
    1.55 +		TMetaVarLen8<RBuf8>( aData )
    1.56 +		{
    1.57 +		}
    1.58 +	};
    1.59 +
    1.60 +class TMetaBuf16 : public TMetaVarLen16<RBuf16>
    1.61 +/**
    1.62 +
    1.63 +Implementation of MMetaType for dynamicaly allocated RBuf16
    1.64 +
    1.65 +@internalComponent
    1.66 +@released since v9.0
    1.67 +*/
    1.68 +	{
    1.69 +public:
    1.70 +	inline static MMetaType* NewL(const TAny* aMem, const TAny* aData);
    1.71 +
    1.72 +	IMPORT_C virtual TInt Load(TPtrC8& aBuffer);
    1.73 +	IMPORT_C virtual TInt Store(TDes8& aBuffer) const;
    1.74 +	IMPORT_C virtual void Copy(const TAny* aData);
    1.75 +	IMPORT_C virtual TInt Length() const;
    1.76 +
    1.77 +protected:
    1.78 +	TMetaBuf16(const TAny* aData) :
    1.79 +		TMetaVarLen16<RBuf16>( aData )
    1.80 +		{
    1.81 +		}
    1.82 +
    1.83 +	};
    1.84 +
    1.85 +MMetaType* TMetaBuf8::NewL(const TAny* aMem, const TAny* aData)
    1.86 +/**
    1.87 + * Instantiates a meta type for RBuf8.
    1.88 + * Used for attribure registration (in the data v-table).
    1.89 + */
    1.90 +    {
    1.91 +    return ::new ((TUint8*)aMem) TMetaBuf8(aData);
    1.92 +    }
    1.93 +
    1.94 +MMetaType* TMetaBuf16::NewL(const TAny* aMem, const TAny* aData)
    1.95 +/**
    1.96 + * Instantiates a meta type for RBuf8.
    1.97 + * Used for attribure registration (in the data v-table).
    1.98 + */
    1.99 +    {
   1.100 +    return ::new ((TUint8*)aMem) TMetaBuf16(aData);
   1.101 +    }
   1.102 +
   1.103 +
   1.104 +#if defined(_UNICODE)
   1.105 +typedef TMetaBuf16 TMetaBuf;
   1.106 +#else
   1.107 +typedef TMetaBuf8 TMetaBuf;
   1.108 +#endif
   1.109 +} //namespace Meta
   1.110 +
   1.111 +
   1.112 +#endif //METABUFFER_H