|
1 /* |
|
2 * Copyright (c) 2002-2004 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 LAYCDL2INSTO_H |
|
20 #define LAYCDL2INSTO_H |
|
21 |
|
22 #include <string> |
|
23 #include <vector> |
|
24 #include <iosfwd> |
|
25 #include "Layout.h" |
|
26 using namespace std; |
|
27 |
|
28 #include <cdlcompilertoolkit/cdltkinterface.h> |
|
29 #include <cdlcompilertoolkit/cdltkinstance.h> |
|
30 #include <cdlcompilertoolkit/cdltkprocess.h> |
|
31 using namespace CdlCompilerToolkit; |
|
32 |
|
33 class CLayoutInstOpt; |
|
34 class CLayoutInstOptImpl; |
|
35 typedef vector<CLayoutInstOptImpl*> CLayoutInstOptImpls; |
|
36 |
|
37 /** |
|
38 * SImplFunc |
|
39 * This class represents a layout data decompression function local to a layout instance. |
|
40 * These functions will call the corresponding DLL wide function for decompression. |
|
41 */ |
|
42 struct SImplFunc |
|
43 { |
|
44 enum TFuncType |
|
45 { |
|
46 EWindowLine, |
|
47 ETextLine, |
|
48 EMultilineTextLine, |
|
49 ETableLimits, |
|
50 EWindowTable, |
|
51 ETextTable |
|
52 }; |
|
53 TFuncType iType; |
|
54 int iParams; |
|
55 bool iParent; |
|
56 string iDefn; |
|
57 string iPtrRef; |
|
58 |
|
59 SImplFunc(TFuncType aType, int aParams, bool aParent, string aDefn, string aPtrRef) |
|
60 : iType(aType), iParams(aParams), iParent(aParent), iDefn(aDefn), iPtrRef(aPtrRef) |
|
61 {} |
|
62 }; |
|
63 |
|
64 |
|
65 /** |
|
66 * CAllFuncs |
|
67 * This represents a collection of all the SImplFunc objects that a layout instance may need |
|
68 */ |
|
69 class CAllFuncs : public vector<SImplFunc> |
|
70 { |
|
71 public: |
|
72 CAllFuncs(int aMaxParams); |
|
73 |
|
74 private: |
|
75 void AddLineFunc(SImplFunc::TFuncType aType, int aParams, bool aParent, const string& aReturn, const string& aFuncName); |
|
76 void AddTableFunc(SImplFunc::TFuncType aType, int aParams, bool aParent, const string& aReturn, const string& aFuncName); |
|
77 }; |
|
78 |
|
79 |
|
80 class CInstanceList |
|
81 { |
|
82 public: |
|
83 // ProcessOptions will remove "-i<instanceListFile>" from aArgs, if it appears at position [2]. |
|
84 void ProcessOptions(vector<string>& aArgs); |
|
85 bool IsInstanceOk(const string& aInstance) const; |
|
86 private: |
|
87 set<string> iInstances; |
|
88 bool iLoaded; |
|
89 }; |
|
90 |
|
91 /** |
|
92 * LayoutCdlInstanceOpt |
|
93 * Generate a set of optimised layout instances for a number of layouts with a common |
|
94 * CDL interface |
|
95 */ |
|
96 class LayoutCdlInstanceOpt |
|
97 { |
|
98 private: |
|
99 typedef vector<CLayoutInstOpt*> CLayouts; |
|
100 |
|
101 public: |
|
102 static int Process(vector<string>& args); |
|
103 static void ShowHelp(ostream& stream); |
|
104 |
|
105 CCdlTkInterface& Interface(); |
|
106 CLayouts& Layouts(); |
|
107 CLayoutInstOptImpl* FindSimilarImpl(TLayoutLine& aLine); |
|
108 int FindSimilarBytes(CLayoutInstOptImpl* aImpl); |
|
109 void AddImpl(CLayoutInstOptImpl* aImpl); |
|
110 |
|
111 private: |
|
112 LayoutCdlInstanceOpt(CCdlTkInterface& aIface); |
|
113 ~LayoutCdlInstanceOpt(); |
|
114 |
|
115 void AddLayout(auto_ptr<TLayout>& aLayout, const string& aInstName); |
|
116 void Process(); |
|
117 void WriteInstances(); |
|
118 void ProcessCommonImpl(); |
|
119 bool LinesAreEqual(TLayoutLine& aLine1, TLayoutLine& aLine2); |
|
120 |
|
121 private: |
|
122 CLayouts iLayouts; |
|
123 CCdlTkInterface& iInterface; |
|
124 CLayoutInstOptImpls iImpls; |
|
125 int iByteCodeIndex; |
|
126 vector<char> iBytesAggregated; |
|
127 }; |
|
128 |
|
129 #endif |