aknlayoutcompiler/src/Lay2LayPerf.cpp
changeset 0 f58d6ec98e88
child 1 b700e12870ca
equal deleted inserted replaced
-1:000000000000 0:f58d6ec98e88
       
     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 
       
    20 // disable "identifier was truncated to '255' characters in the browser information" warning
       
    21 #pragma warning (disable:4786)
       
    22 
       
    23 #include "Lay2LayPerf.h"
       
    24 #include "LayoutParse.h"
       
    25 #include "LayoutCompilerErr.h"
       
    26 #include <cdlcompilertoolkit/cdltkprocess.h>
       
    27 #include <fstream>
       
    28 #include <iostream>
       
    29 #include <algorithm>
       
    30 #include "LayPerfWriter.h"
       
    31 
       
    32 typedef LayoutProcessArgsErr<LayoutToLayPerf> LayoutToLayPerfArgsErr;
       
    33 
       
    34 
       
    35 string LayoutToLayPerf::InterfaceName(const string& aFileName)
       
    36 	{
       
    37 	return aFileName.substr(0,aFileName.find_last_of('.'));
       
    38 	}
       
    39 
       
    40 int LayoutToLayPerf::Process(const vector<string>& args)
       
    41 	{
       
    42 	if (args.size() != 5)
       
    43 		throw LayoutToLayPerfArgsErr();
       
    44 
       
    45 	string cdlName = args[2];
       
    46 
       
    47 	auto_ptr<TLayParseLayout> sourceLayout(TLayParseLayout::Parse(args[3]));
       
    48 	string destLayout = args[4];
       
    49 
       
    50 	LayoutToLayPerf layPerf(cdlName, *sourceLayout, destLayout);
       
    51 	layPerf.WriteLayout();
       
    52 
       
    53 	return 0;
       
    54 	}
       
    55 
       
    56 void LayoutToLayPerf::ShowHelp(ostream& stream)
       
    57 	{
       
    58 	stream << "Lay2LayPerf <layout.cdl> <source.lay> <layPerf.cpp> " << endl;
       
    59 	stream << "Lay2LayPerf ..\\cdl\\AknLayout.cdl ..\\layout\\AknElaf.lay \\s60\\akntest\\layperf\\generated\\LayPerf_AknElaf.cpp " << endl;
       
    60 	stream << "  This converts a LAY file into a specialised format for inclusion in the LayPerf test app." << endl;
       
    61 	stream << "  LayPerf runs on the device, calling each API that would be generated from the LAY file." << endl;
       
    62 	}
       
    63 
       
    64 
       
    65 
       
    66 LayoutToLayPerf::LayoutToLayPerf(const string& aCdlName, TLayout& aSourceLayout, const string& aDestLayoutName)
       
    67 :	
       
    68 	iCdlName(aCdlName),
       
    69 	iLayout(aSourceLayout),
       
    70 	iDestLayoutName(aDestLayoutName)
       
    71 	{
       
    72 	}
       
    73 
       
    74 void LayoutToLayPerf::WriteLayout()
       
    75 	{
       
    76 	TLayPerfWriter writer(iLayout, iDestLayoutName);
       
    77 	writer.Write(iCdlName);
       
    78 	}
       
    79