brandingserver/bsclient/cbselement.h
changeset 0 e6b17d312c8b
child 21 cfd5c2994f10
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: cbselement.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CBSELEMENT_H__
       
    20 #define __CBSELEMENT_H__
       
    21 #include <e32std.h>
       
    22 
       
    23 #include "mbselement.h"
       
    24 #include "rbsobjowningptrarray.h"
       
    25 
       
    26 class RWriteStream;
       
    27 
       
    28 /**
       
    29  *
       
    30  */
       
    31 NONSHARABLE_CLASS( CBSElement ): public CBase,
       
    32 								 public MBSElement
       
    33     {
       
    34 	public:
       
    35 		/**
       
    36 		* Two-phased constructor.
       
    37 		*/
       
    38 		static CBSElement* NewL(
       
    39 						const TDesC8& aElementId,
       
    40 						TInt aData );
       
    41 
       
    42 		static CBSElement* NewL(
       
    43 						const TDesC8& aElementId,
       
    44 						const TDesC& aData,
       
    45 						TBSElementType aType = EBSText );
       
    46 
       
    47 		static CBSElement* NewL(
       
    48 						const TDesC8& aElementId,
       
    49 						const TDesC8& aData );
       
    50 
       
    51 		// Transfers ownership
       
    52 		static CBSElement* NewL(
       
    53 						const TDesC8& aElementId,
       
    54 						CBSBitmap* aBitmap );
       
    55 
       
    56 		static CBSElement* NewL(
       
    57 						const TDesC8& aElementId,
       
    58 						RBSObjOwningPtrArray<MBSElement>& aStructure );
       
    59 
       
    60 		void Close();
       
    61 
       
    62 		virtual ~CBSElement();
       
    63 
       
    64 	private:
       
    65 		CBSElement();
       
    66 
       
    67 
       
    68     	void ConstructL( TBSElementType aElementType,
       
    69 					 	 const TDesC8& aElementId,
       
    70 					 	 TInt aIntData,
       
    71 					 	 TBool aIntDataInitialized,
       
    72 					 	 CBSBitmap* aBitmap,
       
    73 					 	 const TDesC& aTextData,
       
    74 					 	 const TDesC8& aBufferData,
       
    75 					 	 RBSObjOwningPtrArray<MBSElement>* aStructure );
       
    76 
       
    77 	private:
       
    78 		TBSElementType ElementType();
       
    79 		const TDesC8& ElementId();
       
    80 
       
    81 		// Leaves with KErrArgument if trying to
       
    82 		// get wrong type
       
    83 		TInt IntDataL();
       
    84 		const TDesC& TextDataL();
       
    85 		const TDesC8& BufferDataL();
       
    86         const CBSBitmap& BitmapDataL();
       
    87 		TArray<MBSElement*> GetStructureL();
       
    88 
       
    89 		const MBSElement& FindSubEntryL( const TDesC& aElementId );
       
    90 
       
    91         void ExternalizeL( RWriteStream& aWriteStream );
       
    92 
       
    93 
       
    94 
       
    95 	private: // data
       
    96 		TBSElementType 			iElementType;
       
    97 		HBufC8*					iElementId;
       
    98 		TInt					iIntData;
       
    99 		TBool					iIntDataInitialized;
       
   100 		HBufC*					iTextData;
       
   101 		HBufC8*					iBufferData;
       
   102 		TBool					iArrayInitialized;
       
   103 		RBSObjOwningPtrArray<MBSElement>	iArray;
       
   104 		CBSBitmap*         		iBitmapData;
       
   105 
       
   106     };
       
   107 
       
   108 #endif      //  __CBSELEMENT_H__
       
   109 
       
   110 
       
   111 //  END OF FILE
       
   112