Update of /cvsroot/smartwin/SmartWin/source
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17484
Modified Files:
Application.cpp CommandLine.cpp
Log Message:
Unicode command line support
Index: CommandLine.cpp
===================================================================
RCS file: /cvsroot/smartwin/SmartWin/source/CommandLine.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CommandLine.cpp 22 Aug 2007 12:04:48 -0000 1.6
+++ CommandLine.cpp 26 Aug 2007 22:20:35 -0000 1.7
@@ -96,9 +96,34 @@
return retVal;
}
-CommandLine::CommandLine( const char * cmdLine )
+CommandLine::CommandLine( const TCHAR * cmdLine )
{
- itsRawCmdLine = SmartUtil::Ascii2CurrentBuild::doConvert( cmdLine, SmartUtil::ConversionCodepage::ANSI );
+ itsRawCmdLine = cmdLine;
+ // Remove the exe name from the command line
+ while ( itsRawCmdLine.at( 0 ) == _T(' ') )
+ {
+ itsRawCmdLine.erase( 0, 1 );
+ }
+ if ( itsRawCmdLine.at( 0 ) == _T('"') )
+ {
+ SmartUtil::tstring::size_type pos = itsRawCmdLine.find( _T('"'), 1 );
+ if ( pos != SmartUtil::tstring::npos )
+ {
+ itsRawCmdLine.erase( 0, pos + 1 );
+ }
+ }
+ else
+ {
+ SmartUtil::tstring::size_type pos = itsRawCmdLine.find( _T(' '), 0 );
+ if ( pos != SmartUtil::tstring::npos )
+ {
+ itsRawCmdLine.erase( 0, pos + 1 );
+ }
+ else
+ {
+ itsRawCmdLine = _T("");
+ }
+ }
itsCmdLine = buildCommandLine( itsRawCmdLine );
}
Index: Application.cpp
===================================================================
RCS file: /cvsroot/smartwin/SmartWin/source/Application.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- Application.cpp 18 Jun 2007 01:48:42 -0000 1.48
+++ Application.cpp 26 Aug 2007 22:20:35 -0000 1.49
@@ -75,11 +75,7 @@
unsigned int retVal = 0;
bool corruptMemMemLeak = false;
-#ifndef WINCE
- std::string cmdLineString = lpCmdLine;
-#else
- std::string cmdLineString = SmartUtil::AsciiGuaranteed::doConvert( lpCmdLine, SmartUtil::ConversionCodepage::ANSI );
-#endif
+ SmartUtil::tstring cmdLineString = GetCommandLine();
Application::neededSmartWinInit( hInstance, nCmdShow, cmdLineString.c_str() );
try
@@ -102,7 +98,7 @@
/** Initializes the runtime for SmartWin++
Typically only called by WinMain or DllMain.
*/
- void Application::neededSmartWinInit( HINSTANCE hInstance, int nCmdShow, const char * cmdLine )
+ void Application::neededSmartWinInit( HINSTANCE hInstance, int nCmdShow, const TCHAR * cmdLine )
{
Application::Instantiate( hInstance, nCmdShow, cmdLine );
@@ -183,14 +179,14 @@
return itsHInstance;
}
-Application::Application( HINSTANCE hInst, int nCmdShow, const char * cmdLine )
+Application::Application( HINSTANCE hInst, int nCmdShow, const TCHAR * cmdLine )
: itsHInstance( hInst )
, itsCmdLine( cmdLine )
, itsHeartBeatObject( 0 )
{
}
-void Application::Instantiate( HINSTANCE hInst, int nCmdShow, const char * cmdLine )
+void Application::Instantiate( HINSTANCE hInst, int nCmdShow, const TCHAR * cmdLine )
{
itsInstance = new Application( hInst, nCmdShow, cmdLine );
}
|