diff -r 000000000000 -r e6b17d312c8b brandingserver/bsclient/cbselement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brandingserver/bsclient/cbselement.h Thu Dec 17 08:54:49 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2006 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: cbselement.h +* +*/ + + +#ifndef __CBSELEMENT_H__ +#define __CBSELEMENT_H__ +#include + +#include "mbselement.h" +#include "rbsobjowningptrarray.h" + +class RWriteStream; + +/** + * + */ +NONSHARABLE_CLASS( CBSElement ): public CBase, + public MBSElement + { + public: + /** + * Two-phased constructor. + */ + static CBSElement* NewL( + const TDesC8& aElementId, + TInt aData ); + + static CBSElement* NewL( + const TDesC8& aElementId, + const TDesC& aData, + TBSElementType aType = EBSText ); + + static CBSElement* NewL( + const TDesC8& aElementId, + const TDesC8& aData ); + + // Transfers ownership + static CBSElement* NewL( + const TDesC8& aElementId, + CBSBitmap* aBitmap ); + + static CBSElement* NewL( + const TDesC8& aElementId, + RBSObjOwningPtrArray& aStructure ); + + void Close(); + + virtual ~CBSElement(); + + private: + CBSElement(); + + + void ConstructL( TBSElementType aElementType, + const TDesC8& aElementId, + TInt aIntData, + TBool aIntDataInitialized, + CBSBitmap* aBitmap, + const TDesC& aTextData, + const TDesC8& aBufferData, + RBSObjOwningPtrArray* aStructure ); + + private: + TBSElementType ElementType(); + const TDesC8& ElementId(); + + // Leaves with KErrArgument if trying to + // get wrong type + TInt IntDataL(); + const TDesC& TextDataL(); + const TDesC8& BufferDataL(); + const CBSBitmap& BitmapDataL(); + TArray GetStructureL(); + + const MBSElement& FindSubEntryL( const TDesC& aElementId ); + + void ExternalizeL( RWriteStream& aWriteStream ); + + + + private: // data + TBSElementType iElementType; + HBufC8* iElementId; + TInt iIntData; + TBool iIntDataInitialized; + HBufC* iTextData; + HBufC8* iBufferData; + TBool iArrayInitialized; + RBSObjOwningPtrArray iArray; + CBSBitmap* iBitmapData; + + }; + +#endif // __CBSELEMENT_H__ + + +// END OF FILE +