diff -r 000000000000 -r f58d6ec98e88 aknlayoutcompiler/inc/LayCdl2InstO.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/aknlayoutcompiler/inc/LayCdl2InstO.h Thu Dec 17 09:14:18 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2002-2004 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: +* +*/ + + +#ifndef LAYCDL2INSTO_H +#define LAYCDL2INSTO_H + +#include +#include +#include +#include "Layout.h" +using namespace std; + +#include +#include +#include +using namespace CdlCompilerToolkit; + +class CLayoutInstOpt; +class CLayoutInstOptImpl; +typedef vector CLayoutInstOptImpls; + +/** +* SImplFunc +* This class represents a layout data decompression function local to a layout instance. +* These functions will call the corresponding DLL wide function for decompression. +*/ +struct SImplFunc + { + enum TFuncType + { + EWindowLine, + ETextLine, + EMultilineTextLine, + ETableLimits, + EWindowTable, + ETextTable + }; + TFuncType iType; + int iParams; + bool iParent; + string iDefn; + string iPtrRef; + + SImplFunc(TFuncType aType, int aParams, bool aParent, string aDefn, string aPtrRef) + : iType(aType), iParams(aParams), iParent(aParent), iDefn(aDefn), iPtrRef(aPtrRef) + {} + }; + + +/** +* CAllFuncs +* This represents a collection of all the SImplFunc objects that a layout instance may need +*/ +class CAllFuncs : public vector + { +public: + CAllFuncs(int aMaxParams); + +private: + void AddLineFunc(SImplFunc::TFuncType aType, int aParams, bool aParent, const string& aReturn, const string& aFuncName); + void AddTableFunc(SImplFunc::TFuncType aType, int aParams, bool aParent, const string& aReturn, const string& aFuncName); + }; + + +class CInstanceList + { +public: + // ProcessOptions will remove "-i" from aArgs, if it appears at position [2]. + void ProcessOptions(vector& aArgs); + bool IsInstanceOk(const string& aInstance) const; +private: + set iInstances; + bool iLoaded; + }; + +/** +* LayoutCdlInstanceOpt +* Generate a set of optimised layout instances for a number of layouts with a common +* CDL interface +*/ +class LayoutCdlInstanceOpt + { +private: + typedef vector CLayouts; + +public: + static int Process(vector& args); + static void ShowHelp(ostream& stream); + + CCdlTkInterface& Interface(); + CLayouts& Layouts(); + CLayoutInstOptImpl* FindSimilarImpl(TLayoutLine& aLine); + int FindSimilarBytes(CLayoutInstOptImpl* aImpl); + void AddImpl(CLayoutInstOptImpl* aImpl); + +private: + LayoutCdlInstanceOpt(CCdlTkInterface& aIface); + ~LayoutCdlInstanceOpt(); + + void AddLayout(auto_ptr& aLayout, const string& aInstName); + void Process(); + void WriteInstances(); + void ProcessCommonImpl(); + bool LinesAreEqual(TLayoutLine& aLine1, TLayoutLine& aLine2); + +private: + CLayouts iLayouts; + CCdlTkInterface& iInterface; + CLayoutInstOptImpls iImpls; + int iByteCodeIndex; + vector iBytesAggregated; + }; + +#endif