secureswitools/swisistools/source/interpretsis/commandparser.cpp
branchRCL_3
changeset 62 5cc91383ab1e
parent 23 09e5ea190d07
child 65 7333d7932ef7
equal deleted inserted replaced
61:cd189dac02f7 62:5cc91383ab1e
     1 /*
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   168 		<< "\tsucert\t\tTo indicate that the SIS file has been signed with a SU certificate\n\n";
   168 		<< "\tsucert\t\tTo indicate that the SIS file has been signed with a SU certificate\n\n";
   169     }
   169     }
   170 
   170 
   171 void CCommandParser::DisplayVersion()
   171 void CCommandParser::DisplayVersion()
   172 	{
   172 	{
   173 	std::cout << "\nINTERPRETSIS  " << " Version  2.1.3 ." << std::endl;
   173 	std::cout << "\nINTERPRETSIS  " << " Version  2.2.0 ." << std::endl;
   174 	std::cout << "Copyright (c) 2009 Symbian Software Ltd. All rights reserved.\n " << std::endl;
   174 	std::cout << "Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.\n " << std::endl;
   175 	}
   175 	}
   176  
   176  
   177 
   177 
   178 CParameterList* CCommandParser::ParseOptions(int argc, const char**argv)
   178 CParameterList* CCommandParser::ParseOptions(int argc, const char**argv)
   179     {
   179     {
   384 				aParamList->SetZDrive(*(++argv));
   384 				aParamList->SetZDrive(*(++argv));
   385 				break;
   385 				break;
   386 				}
   386 				}
   387 			default:
   387 			default:
   388 				{
   388 				{
   389 				LERROR(Utf8ToUcs2(std::string(optPtr)));
   389 				LERROR(string2wstring(std::string(optPtr)));
   390 				throw CCommandParser::ECmdLineUnknownOption;
   390 				throw CCommandParser::ECmdLineUnknownOption;
   391 				}
   391 				}
   392 			}
   392 			}
   393 
   393 
   394 		if (err)
   394 		if (err)
   445 	std::string::const_iterator currentPos = it;
   445 	std::string::const_iterator currentPos = it;
   446     //
   446     //
   447 	while (currentPos != end)
   447 	while (currentPos != end)
   448 	    {
   448 	    {
   449 		currentPos = std::find(it, end, ',');
   449 		currentPos = std::find(it, end, ',');
   450 		std::wstring x;
   450 		std::wstring x = string2wstring(std::string(it,(currentPos-it)));
   451 		Utf8ToUcs2(std::string(it,(currentPos-it)), x);
       
   452 		//aOptionsList.push_back(x);
   451 		//aOptionsList.push_back(x);
   453 		(aParamList.*aFilePtr)(x);
   452 		(aParamList.*aFilePtr)(x);
   454 
   453 
   455 		if (currentPos == end)
   454 		if (currentPos == end)
   456 			{
   455 			{
   473 	currentPos = std::find(it, end, ',');
   472 	currentPos = std::find(it, end, ',');
   474 
   473 
   475 	while (currentPos != end)
   474 	while (currentPos != end)
   476 	    {
   475 	    {
   477 		currentPos = std::find(it, end, ',');
   476 		currentPos = std::find(it, end, ',');
   478 		std::wstring x;
   477 		std::wstring x = string2wstring(std::string(it,(currentPos-it)));
   479 		Utf8ToUcs2(std::string(it,(currentPos-it)), x);
       
   480 
   478 
   481 		InstallSISFile sisFileName(x, '$', false);
   479 		InstallSISFile sisFileName(x, '$', false);
   482 		aParamList.AddSISFile(sisFileName);
   480 		aParamList.AddSISFile(sisFileName);
   483 
   481 
   484 		if (currentPos == end)
   482 		if (currentPos == end)
   492 	
   490 	
   493 	// At this stage, aArgv could be something like: file.sis +e +mcard +sucert
   491 	// At this stage, aArgv could be something like: file.sis +e +mcard +sucert
   494 	// As the sisfile attributes are predetermined input, therefore we can just
   492 	// As the sisfile attributes are predetermined input, therefore we can just
   495 	// parse according to the predetermined inputs.
   493 	// parse according to the predetermined inputs.
   496 
   494 
   497 	std::wstring fileName;
   495 	std::wstring fileName = string2wstring(sisFileOption);
   498 	Utf8ToUcs2(sisFileOption, fileName);
       
   499 
   496 
   500 	InstallSISFile sisFileName(fileName, '$', false);
   497 	InstallSISFile sisFileName(fileName, '$', false);
   501 		
   498 		
   502 	while (--aArgc > 0)
   499 	while (--aArgc > 0)
   503 		{ // Process associated SIS file attributes
   500 		{ // Process associated SIS file attributes