|
1 /* |
|
2 * Copyright (c) 2009 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 // disable "identifier was truncated to '255' characters in the browser information" warning |
|
19 #pragma warning (disable:4786) |
|
20 |
|
21 // disable "decorated name length exceeded, name was truncated" warning |
|
22 #pragma warning (disable:4503) |
|
23 |
|
24 #include "DllCreator.h" |
|
25 #include <CdlCompilerToolkit/CdlTkProcess.h> |
|
26 #include <sstream> |
|
27 |
|
28 DllCreator::DllCreator() |
|
29 : iInterface(*CCdlTkCdlFileParser("\\epoc32\\include\\platform\\mw\\MifHeader.cdl").LoadAndParse(true)), |
|
30 iInstance(iInterface) |
|
31 { |
|
32 iInstance.TemplateAllImplementations(); |
|
33 } |
|
34 |
|
35 void DllCreator::SetNameAndUid(const string& aDllName, const string& dllUid) |
|
36 { |
|
37 iUid = CdlTkUtil::ParseInt(dllUid); |
|
38 iName = aDllName; |
|
39 iInstance.SetName(iName+"_inst"); |
|
40 } |
|
41 |
|
42 void DllCreator::SetIndex(const MifIndex& index) |
|
43 { |
|
44 CCdlTkImplementation& impl = *iInstance.Impl().Find("indicies"); |
|
45 std::string content; |
|
46 for (MifIndex::const_iterator pIdx = index.begin(); pIdx != index.end(); ++pIdx) |
|
47 { |
|
48 stringstream strm; |
|
49 strm << "\t" << pIdx->iOffset << "," << endl; |
|
50 strm << "\t" << pIdx->iLength << "," << endl; |
|
51 CdlTkUtil::AppendString(content, strm.str()); |
|
52 } |
|
53 std::string defn = impl.Definition(); |
|
54 const std::string repTarget("?array_contents"); |
|
55 impl.SetDefinition(CdlTkUtil::Replace(repTarget, content, defn)); |
|
56 } |
|
57 |
|
58 void DllCreator::WriteSource() |
|
59 { |
|
60 CCdlTkWriteInstance writer(iInstance); |
|
61 writer.Process(); |
|
62 } |
|
63 |
|
64 void DllCreator::WriteDll() |
|
65 { |
|
66 CCdlTkDll dll; |
|
67 dll.AddInstance(iInstance); |
|
68 dll.SetName(iName); |
|
69 dll.SetUid(iUid); |
|
70 CCdlTkWriteDll writeDll(dll); |
|
71 writeDll.Process(); |
|
72 } |
|
73 |