aknlayoutcompiler/src/MLCompData2Cdl.cpp
changeset 1 b700e12870ca
parent 0 f58d6ec98e88
equal deleted inserted replaced
0:f58d6ec98e88 1:b700e12870ca
    21 
    21 
    22 #include "MLCompData2Cdl.h"
    22 #include "MLCompData2Cdl.h"
    23 #include "MLCompDataParse.h"
    23 #include "MLCompDataParse.h"
    24 #include "MLAttributesParse.h"
    24 #include "MLAttributesParse.h"
    25 #include "LayoutCompilerErr.h"
    25 #include "LayoutCompilerErr.h"
    26 #include <cdlcompilertoolkit/cdltkprocess.h>
    26 #include <CdlCompilerToolkit/CdlTkProcess.h>
    27 #include <fstream>
    27 #include <fstream>
    28 #include <iostream>
    28 #include <iostream>
    29 #include <algorithm>
    29 #include <algorithm>
    30 #include "CppWriter.h"
    30 #include "CppWriter.h"
    31 #include "CodeGenConsts.h"
    31 #include "CodeGenConsts.h"
    37 // constants
    37 // constants
    38 
    38 
    39 const int KGeneratedInterfaceMajorVer = 1;
    39 const int KGeneratedInterfaceMajorVer = 1;
    40 const int KGeneratedInterfaceMinorVer = 0;
    40 const int KGeneratedInterfaceMinorVer = 0;
    41 
    41 
    42 const string KCompDataFileNameSuffix("compData");
    42 const string KCompDataFileNameSuffix("compdata");
    43 const string KAttributesFileNameSuffix("attributes");
    43 const string KAttributesFileNameSuffix("attributes");
    44 
    44 
    45 
    45 
    46 // 
    46 // 
    47 // MLCompDataToCdl
    47 // MLCompDataToCdl
    55 
    55 
    56 int MLCompDataToCdl::Process(const vector<string>& args)
    56 int MLCompDataToCdl::Process(const vector<string>& args)
    57 	{
    57 	{
    58 	iInterfaceNamesUsed.clear();
    58 	iInterfaceNamesUsed.clear();
    59 
    59 
    60 	int numExpectedArgs = 4;
    60 	unsigned int numExpectedArgs = 4;
    61 	if(args.size() < numExpectedArgs)
    61 	if(args.size() < numExpectedArgs)
    62 		throw MLCompDataToCdlArgsErr();
    62 		throw MLCompDataToCdlArgsErr();
    63 
    63 
    64     int arg = 2;
    64     int arg = 2;
    65 	bool deletesAllowed = true;
    65 	bool deletesAllowed = true;
   149 
   149 
   150 	// ignore the args up to and including the app name, the mode name, and the optional flags, 
   150 	// ignore the args up to and including the app name, the mode name, and the optional flags, 
   151     arg = numExpectedArgs-2; 
   151     arg = numExpectedArgs-2; 
   152 
   152 
   153 	// so that we get a list of processed files to output to the comment
   153 	// so that we get a list of processed files to output to the comment
   154     for(ii = 0; ii < numLayouts; ii++)
   154     for(int ii = 0; ii < numLayouts; ii++)
   155 		comment << args[arg++] << ", ";
   155 		comment << args[arg++] << ", ";
   156     comment << endl; 
   156     comment << endl; 
   157 	comment << "// which was generated with timestamp " << mergedLayout->iTimestamp << endl;
   157 	comment << "// which was generated with timestamp " << mergedLayout->iTimestamp << endl;
   158 
   158 
   159 	SetHeaders(*iface, cdlName, comment.str(), uid, romOnly);
   159 	SetHeaders(*iface, cdlName, comment.str(), uid, romOnly);
   345 	string ifName(InterfaceName(CdlTkUtil::StripPath(aCdlName)));
   345 	string ifName(InterfaceName(CdlTkUtil::StripPath(aCdlName)));
   346 	aInterface.Header().SetName(ifName);
   346 	aInterface.Header().SetName(ifName);
   347 	aInterface.Header().SetVersion(CCdlTkInterfaceHeader::CVersion(KGeneratedInterfaceMajorVer, KGeneratedInterfaceMinorVer));
   347 	aInterface.Header().SetVersion(CCdlTkInterfaceHeader::CVersion(KGeneratedInterfaceMajorVer, KGeneratedInterfaceMinorVer));
   348 
   348 
   349 	CCdlTkCpp& cpp = aInterface.Cpp();
   349 	CCdlTkCpp& cpp = aInterface.Cpp();
   350 	int size = cpp.size();
   350 //	int size = cpp.size();
   351 	if(!find(cpp.begin(), cpp.end(), KIncludeLayoutInstanceHeaderScalableDef))
   351 	if(!find(cpp.begin(), cpp.end(), KIncludeLayoutInstanceHeaderScalableDef))
   352 		cpp.push_back(KIncludeLayoutInstanceHeaderScalableDef);
   352 		cpp.push_back(KIncludeLayoutInstanceHeaderScalableDef);
   353 	}
   353 	}
   354 
   354 
   355 string MLCompDataToCdl::SubTableApiName(TMLCompDataTable::TMLCompDataSubTable& aSubTable)
   355 string MLCompDataToCdl::SubTableApiName(TMLCompDataTable::TMLCompDataSubTable& aSubTable)