|
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 LAYCDL2INST_H |
|
20 #define LAYCDL2INST_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 |
|
34 /** |
|
35 * CLayoutToInst |
|
36 * Generate customisation instance for a set of layouts which use a particular CDL |
|
37 * interface (unoptimised) |
|
38 */ |
|
39 class CLayoutToInst : public CCdlTkSourceFileWriter |
|
40 { |
|
41 public: |
|
42 CLayoutToInst(CLayoutToInst* aBase, CCdlTkInterface& aInterface, auto_ptr<TLayout>& aLayout, const string& aInstName); |
|
43 ~CLayoutToInst(); |
|
44 |
|
45 CCdlTkInstance& Instance(); |
|
46 string FwdDeclName(); |
|
47 void Process(); |
|
48 |
|
49 private: |
|
50 void AddTableToInstance(TLayoutTable& aTable); |
|
51 void AddWindowLineToInstance(TLayoutLine& aLine); |
|
52 void AddTextLineToInstance(TLayoutLine& aLine); |
|
53 void AddTableLimitsToInstance(TLayoutTable& aTable, TLayoutTable::TLayoutSubTable& aSubTable, int aTableNum); |
|
54 void AddSubTableToInstance(const string& aType, TLayoutTable& aTable, TLayoutTable::TLayoutSubTable& aSubTable, int aTableNum); |
|
55 bool HasApi(const string& aName); |
|
56 CCdlTkImplementation& FindImp(const string& aName); |
|
57 void SetDataLine(CCdlTkImplementation& aImp, TLayoutLine& aLine, const string& aType, const string aOutputOrder[], int aOutputOrderSize); |
|
58 void SetFuncLine(CCdlTkImplementation& aImp, TLayoutLine& aLine, const string& aType, const string aOutputOrder[], int aOutputOrderSize, const string& aPreExtra, const string& aPostExtra); |
|
59 void MirrorParamNames(std::string& aNames); |
|
60 void AddFwdRefToInstance(const string& aName, bool aCast); |
|
61 |
|
62 private: |
|
63 CLayoutToInst* iBase; |
|
64 CCdlTkInterface& iInterface; |
|
65 TLayout* iLayoutPtr; |
|
66 TLayout& iLayout; |
|
67 CCdlTkInstance* iInstance; |
|
68 std::string iInstName; |
|
69 }; |
|
70 |
|
71 class LayoutAndCdlToCdlInstance |
|
72 { |
|
73 public: |
|
74 static int Process(const vector<string>& args); |
|
75 static void ShowHelp(ostream& stream); |
|
76 static void CheckLayoutAgainstInterface(const TLayout& aLayout, const CCdlTkInterface& aIface); |
|
77 |
|
78 LayoutAndCdlToCdlInstance(CCdlTkInterface& aInterface); |
|
79 ~LayoutAndCdlToCdlInstance(); |
|
80 |
|
81 void AddLayout(auto_ptr<TLayout>& aLayout, const string& aInstName); |
|
82 void WriteInstances(); |
|
83 |
|
84 private: |
|
85 typedef vector<CLayoutToInst*> CLayouts; |
|
86 CLayouts iLayouts; |
|
87 CCdlTkInterface& iInterface; |
|
88 }; |
|
89 |
|
90 #endif |