diff -r 000000000000 -r e6b17d312c8b imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/imfeatureplugin/srcimdatamodel/imapidataobjfactory.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Codec to pack and unpack data objects. +* +*/ + +#ifndef IMAPIDATAOBJFACTORY_H +#define IMAPIDATAOBJFACTORY_H + +#include +#include "imtypehelpers.h" +#include "ximpapidataobjbase.h" + +// internal interface for the factory +#include "apidataobjfactory.h" + +class RReadStream; +class RWriteStream; + + +/** + * Codec to pack and unpack data object arrays. + * + * @lib ximpdatamodel.dll + * @since S60 v3.2 + */ +NONSHARABLE_CLASS( CImApiDataObjFactory ) : public CBase, + public MApiDataObjFactory + { +public: + + static CImApiDataObjFactory* NewL(); + + // From base class + CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId, + RReadStream& aStream ); + /** + * Unpacks a request parameter array from a + * descriptor back to array format. + * @param aDataObjArrayData The packed array + * @param aArray The array which to fill + */ + static void InternalizeL( + RReadStream& aStream, + RImReqParamArray& aArray + ); + + /** + * Packs a given request parameter array into + * a stream. + * @param aWs The stream to pack into + * @param aArray The array to pack + */ + static void ExternalizeL( + RWriteStream& aWs, + const RImReqParamArray& aArray + ); + + /** + * Internalize a CXIMPApiDataObjBase-derived object + * from the given stream, ownership is returned to the caller. + * @param aStream The stream + * @return The object instance + */ + static CXIMPApiDataObjBase* InternalizeLC( + RReadStream& aStream ); + + /** + * Externalize a CXIMPApiDataObjBase-derived object + * to the given stream. + * @param aWs The write stream + * @param aDataObj The data object + */ + static void ExternalizeL( + RWriteStream& aWs, + const CXIMPApiDataObjBase& aDataObj ); + + + /* + * Packs a given array into a stream. + * @param aStream The stream + * @param aArray The array + */ + template< class INFOIMP> + static inline void InternalizeL( + RReadStream& aStream, + RPointerArray& aArray + ); + + /** + * Unpacks an array of info fields back to array format. + * @param aWs The stream + * @param aArray The array which to fill + */ + template< class INFOIMP > + static inline void ExternalizeL( + RWriteStream& aWs, + const RPointerArray& aArray + ); + + + ~CImApiDataObjFactory(); +private: + + CImApiDataObjFactory(); + + void ConstructL(); + + }; + +// template methods need inline implementation +#include "imapidataobjfactory.inl" + +#endif // IMAPIDATAOBJFACTORY_H