brandingserver/bsserver/cbsbrandhandler.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:31:29 +0300
branchRCL_3
changeset 21 cfd5c2994f10
parent 0 e6b17d312c8b
child 22 113b91e0a2ad
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
* 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 the License "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:  CBSBrandHandler.h
*
*/



#ifndef __CBSBRANDHANDLER_H__
#define __CBSBRANDHANDLER_H__

#include "rbsobjowningptrarray.h"

#include <e32std.h>
#include <e32base.h>
#include <barsc.h>
#include <bamdesca.h>
#include <f32file.h>
#include <s32file.h>

// FORWARD DECLARATIONS
class MBSElement;
class CBSStorageManager;
class CBSSession;

/**
 *
 *
 */
NONSHARABLE_CLASS( CBSBrandHandler ): public CBase
	{
	public:
		/**
		* Two-phased constructor.
		*/
		static CBSBrandHandler* NewL( const TDesC& aApplicationId,
									  const TDesC& aBrandId, 
									  const TDesC& aDefaultBrandId, 
									  TLanguage aLanguage,
									  CBSSession* aSession,
									  TInt aReserved = 0);



    	virtual ~CBSBrandHandler();

	private: // constructors
	
		void ConstructL( const TDesC& aApplicationId,
						 const TDesC& aBrandId,
						 const TDesC& aDefaultBrandId,
						 CBSSession* aSession );
						 
		CBSBrandHandler( TLanguage aLanguage,
						 TInt aReserved );

	public:
		HBufC* GetTextL( const TDesC8& aId );
		HBufC8* GetBufferL( const TDesC8& aId );
		TInt GetIntL( const TDesC8& aId );
		MBSElement* GetSeveralL( RBSObjOwningPtrArray<HBufC8>& aIds );
		void GetFileL( const TDesC8& aId, RFile& aFile );
		MBSElement* GetStructureL( TDesC8& aId );
    	void SetDefaultBrandIdL( const TDesC8& aBrandId );


		TInt isBrandUpdateRequiredL ();

    private:     // New methods

		MBSElement* ReadElementLC( const TDesC8& aId, TBool aForceDefault = EFalse );
		
		MBSElement* ReadStreamL( const TDesC8& aId, 
								 RFileReadStream& aStream, 
								 TBool aAllowEmptyId = EFalse );

		void VerifyVersionL();
		void VerifyVersionL( RFileReadStream& aStream );

	private: // data
		HBufC* iDefaultBrand;
        ///<File server session, owned
        RFs                     iFs;

		HBufC* iApplicationId;
		HBufC* iBrandId;
		HBufC* iDefaultBrandId;
	    TLanguage iLanguage;
	    
	    TBool isDefaultBrandUsed;
		
	    RFile* iHandle;
	    
	    CBSStorageManager* iStorageManager;
	    
	    // doesn't own: session
	    CBSSession* iSession;
	    TInt iReserved ;

    };

#endif      //  __CBSBRANDHANDLER_H__


//  END OF FILE