brandingserver/BSClient/cbselement.h
changeset 31 9dbc70490d9a
child 33 bb46c9d56bcb
equal deleted inserted replaced
30:1fa9b890f29c 31:9dbc70490d9a
       
     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 the License "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 
       
    20 #ifndef __CBSELEMENT_H__
       
    21 #define __CBSELEMENT_H__
       
    22 #include <e32std.h>
       
    23 
       
    24 #include "mbselement.h"
       
    25 #include "RBSObjOwningPtrArray.h"
       
    26 
       
    27 class RWriteStream;
       
    28 
       
    29 /**
       
    30  *
       
    31  */
       
    32 NONSHARABLE_CLASS( CBSElement ): public CBase,
       
    33 								 public MBSElement
       
    34     {
       
    35 	public:
       
    36 		/**
       
    37 		* Two-phased constructor.
       
    38 		*/
       
    39 		static CBSElement* NewL(
       
    40 						const TDesC8& aElementId,
       
    41 						TInt aData );
       
    42 
       
    43 		static CBSElement* NewL(
       
    44 						const TDesC8& aElementId,
       
    45 						const TDesC& aData,
       
    46 						TBSElementType aType = EBSText );
       
    47 
       
    48 		static CBSElement* NewL(
       
    49 						const TDesC8& aElementId,
       
    50 						const TDesC8& aData );
       
    51 
       
    52 		// Transfers ownership
       
    53 		static CBSElement* NewL(
       
    54 						const TDesC8& aElementId,
       
    55 						CBSBitmap* aBitmap );
       
    56 
       
    57 		static CBSElement* NewL(
       
    58 						const TDesC8& aElementId,
       
    59 						RBSObjOwningPtrArray<MBSElement>& aStructure );
       
    60 
       
    61 		void Close();
       
    62 
       
    63 		virtual ~CBSElement();
       
    64 
       
    65 	private:
       
    66 		CBSElement();
       
    67 
       
    68 
       
    69     	void ConstructL( TBSElementType aElementType,
       
    70 					 	 const TDesC8& aElementId,
       
    71 					 	 TInt aIntData,
       
    72 					 	 TBool aIntDataInitialized,
       
    73 					 	 CBSBitmap* aBitmap,
       
    74 					 	 const TDesC& aTextData,
       
    75 					 	 const TDesC8& aBufferData,
       
    76 					 	 RBSObjOwningPtrArray<MBSElement>* aStructure );
       
    77 
       
    78 	private:
       
    79 		TBSElementType ElementType();
       
    80 		const TDesC8& ElementId();
       
    81 
       
    82 		// Leaves with KErrArgument if trying to
       
    83 		// get wrong type
       
    84 		TInt IntDataL();
       
    85 		const TDesC& TextDataL();
       
    86 		const TDesC8& BufferDataL();
       
    87         const CBSBitmap& BitmapDataL();
       
    88 		TArray<MBSElement*> GetStructureL();
       
    89 
       
    90 		const MBSElement& FindSubEntryL( const TDesC& aElementId );
       
    91 
       
    92         void ExternalizeL( RWriteStream& aWriteStream );
       
    93 
       
    94 
       
    95 
       
    96 	private: // data
       
    97 		TBSElementType 			iElementType;
       
    98 		HBufC8*					iElementId;
       
    99 		TInt					iIntData;
       
   100 		TBool					iIntDataInitialized;
       
   101 		HBufC*					iTextData;
       
   102 		HBufC8*					iBufferData;
       
   103 		TBool					iArrayInitialized;
       
   104 		RBSObjOwningPtrArray<MBSElement>	iArray;
       
   105 		CBSBitmap*         		iBitmapData;
       
   106 
       
   107     };
       
   108 
       
   109 #endif      //  __CBSELEMENT_H__
       
   110 
       
   111 
       
   112 //  END OF FILE
       
   113