aknlayoutcompiler/inc/MLCompCdl2InstO.h
changeset 0 f58d6ec98e88
child 1 b700e12870ca
equal deleted inserted replaced
-1:000000000000 0:f58d6ec98e88
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MLCOMPCDL2INSTO_H
       
    20 #define MLCOMPCDL2INSTO_H
       
    21 
       
    22 #include <string>
       
    23 #include <vector>
       
    24 #include <iosfwd>
       
    25 #include "MLCompData.h"
       
    26 #include "MLAttributes.h"
       
    27 using namespace std;
       
    28 
       
    29 #include <cdlcompilertoolkit/cdltkinterface.h>
       
    30 #include <cdlcompilertoolkit/cdltkinstance.h>
       
    31 #include <cdlcompilertoolkit/cdltkprocess.h>
       
    32 using namespace CdlCompilerToolkit;
       
    33 
       
    34 // forward declares and typedefs
       
    35 class CInstanceList;
       
    36 class CMLCompDataInstOpt;
       
    37 class CMLCompDataInstOptImpl;
       
    38 typedef vector<CMLCompDataInstOptImpl*> CMLCompDataInstOptImpls;
       
    39 class CZoomLevelNames;
       
    40 
       
    41 /**
       
    42 *  MLCompDataCdlInstanceOpt
       
    43 *  Generate a set of optimised layout instances for a number of layouts with a common
       
    44 *  CDL interface
       
    45 */
       
    46 class MLCompDataCdlInstanceOpt
       
    47 	{
       
    48 private:
       
    49 	struct InstStruct
       
    50 		{
       
    51 		InstStruct(string aInstName, TMLCompData* aInst, TMLAttributes* aAttribs);
       
    52 		string iInstName;
       
    53 		TMLCompData* iInst;
       
    54 		TMLAttributes* iAttribs;
       
    55 		};
       
    56 
       
    57 	class InstList : public vector<InstStruct>
       
    58 		{
       
    59 	public:
       
    60 		~InstList();
       
    61 		};
       
    62 
       
    63 	typedef vector<TMLCompData*> CCompDataLayouts;
       
    64 	typedef vector<CMLCompDataInstOpt*> CCompDatas;
       
    65 	typedef map<int, CCompDatas> CCompDataZoomLevelDatas;
       
    66 public:
       
    67 	static int Process(vector<string>& args);
       
    68 	static void ShowHelp(ostream& stream);
       
    69 
       
    70 public:
       
    71 	CCdlTkInterface& Interface();
       
    72 	int FindSimilarBytes(CMLCompDataInstOptImpl* aImpl, int aBaseOffset);
       
    73 	void AddImpl(CMLCompDataInstOptImpl* aImpl);
       
    74 	void ResizeByteStream(int aSize);
       
    75 	int ByteStreamSize() const;
       
    76 
       
    77 
       
    78 private:
       
    79 	static void ProcessSeparators(vector<string>& args, vector<int>& aSeparators);
       
    80 	static bool CheckForUsedInstances(const CInstanceList& aUsedList, const CZoomLevelNames& aZoomLevelNames, const vector<string>& aArgs, const vector<int>& aSeparators, int aSepIndex);
       
    81 	static void ParseInstances(const vector<string>& aArgs, const vector<int>& aSeparators, int aSepIndex, InstList& aInstList);
       
    82 	static void MergeLayouts(CInstanceList& aInstUsedList, CZoomLevelNames& aZoomLevelNames, const InstList& aInstances, InstList& aMergedLayouts);
       
    83 
       
    84 private:
       
    85 	MLCompDataCdlInstanceOpt(CCdlTkInterface& aIface);
       
    86 	~MLCompDataCdlInstanceOpt();
       
    87 
       
    88 	void AddInst(const InstStruct& aInstStruct, CZoomLevelNames& aZoomLevelNames, bool aAllParams, bool aNonRomDelivery);
       
    89 	void Process();
       
    90 	void WriteInstances();
       
    91 	void ProcessCommonImpl();
       
    92 
       
    93 private:
       
    94 	CCompDataLayouts iLayouts; // the comp datas are owned
       
    95 	CCompDataZoomLevelDatas iZoomLevelDatas; // the comp data inst opts are owned
       
    96 	CCdlTkInterface& iInterface; // not owned
       
    97 	CMLCompDataInstOptImpls iImpls; // not owned
       
    98 	vector<char> iBytesAggregated;
       
    99 	};
       
   100 
       
   101 #endif