diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-01-11 12:55:05 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-01-11 12:55:05 -0500 |
commit | be52cfe4526c24516c461109227f8ae86901bc68 (patch) | |
tree | 72ce955bc893aabeeafe8a049a6e07f6b3b73fb0 /desktop/source | |
parent | 86df5e193288093b7168c696dcdcdd8b551d2e88 (diff) |
Correct way to add deprecation warnings.
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/cmdlineargs.cxx | 54 |
1 files changed, 10 insertions, 44 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 2d342fd4e700..08412201e51a 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -387,14 +387,14 @@ void CommandLineArgs::SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue ) sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& aArg, ::rtl::OUString& oArg ) { + bool bDeprecated = false; if (aArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("--"))) { oArg = ::rtl::OUString(aArg.getStr()+2, aArg.getLength()-2); } else if (aArg.toChar() == '-') { - const sal_Char* s = rtl::OUStringToOString(aArg, RTL_TEXTENCODING_UTF8).getStr(); - fprintf(stderr, "Warning: %s is deprecated. Use -%s instead.\n", s, s); + bDeprecated = true; oArg = ::rtl::OUString(aArg.getStr()+1, aArg.getLength()-1); } else @@ -405,44 +405,36 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "minimized" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_MINIMIZED, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "invisible" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "norestore" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_NORESTORE, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "nodefault" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_NODEFAULT, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "bean" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_BEAN, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "plugin" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_PLUGIN, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "server" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_SERVER, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "headless" )) == sal_True ) { // Headless means also invisibile, so set this parameter to true! SetBoolParam_Impl( CMD_BOOLPARAM_HEADLESS, sal_True ); SetBoolParam_Impl( CMD_BOOLPARAM_INVISIBLE, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "quickstart" )) == sal_True ) { @@ -450,88 +442,71 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_True ); #endif SetBoolParam_Impl( CMD_BOOLPARAM_NOQUICKSTART, sal_False ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "quickstart=no" ))) { SetBoolParam_Impl( CMD_BOOLPARAM_NOQUICKSTART, sal_True ); SetBoolParam_Impl( CMD_BOOLPARAM_QUICKSTART, sal_False ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "terminate_after_init" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_TERMINATEAFTERINIT, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "nofirststartwizard" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_NOFIRSTSTARTWIZARD, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "nologo" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_NOLOGO, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "nolockcheck" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_NOLOCKCHECK, sal_True ); // Workaround for automated testing ::svt::DocumentLockFile::AllowInteraction( sal_False ); - - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "help" )) || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-h" )) || aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-?" ))) { SetBoolParam_Impl( CMD_BOOLPARAM_HELP, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpwriter" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_HELPWRITER, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpcalc" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_HELPCALC, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpdraw" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_HELPDRAW, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpimpress" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_HELPIMPRESS, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpbase" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASE, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpbasic" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_HELPBASIC, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpmath" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_HELPMATH, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "version" )) == sal_True ) { SetBoolParam_Impl( CMD_BOOLPARAM_VERSION, sal_True ); - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("splash-pipe=")) ) { AddStringListParam_Impl( CMD_STRINGPARAM_SPLASHPIPE, oArg.copy(RTL_CONSTASCII_LENGTH("splash-pipe=")) ); - return sal_True; } #ifdef MACOSX /* #i84053# ignore -psn on Mac @@ -548,22 +523,18 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("infilter="))) { AddStringListParam_Impl( CMD_STRINGPARAM_INFILTER, oArg.copy(RTL_CONSTASCII_LENGTH("infilter=")) ); - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("accept="))) { AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, oArg.copy(RTL_CONSTASCII_LENGTH("accept=")) ); - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("unaccept="))) { AddStringListParam_Impl( CMD_STRINGPARAM_UNACCEPT, oArg.copy(RTL_CONSTASCII_LENGTH("unaccept=")) ); - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("portal,"))) { AddStringListParam_Impl( CMD_STRINGPARAM_PORTAL, oArg.copy(RTL_CONSTASCII_LENGTH("portal,")) ); - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("userid"))) { @@ -575,81 +546,76 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ) ); } - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("clientdisplay="))) { AddStringListParam_Impl( CMD_STRINGPARAM_CLIENTDISPLAY, oArg.copy(RTL_CONSTASCII_LENGTH("clientdisplay=")) ); - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("version="))) { AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, oArg.copy(RTL_CONSTASCII_LENGTH("version=")) ); - return sal_True; } else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("language="))) { AddStringListParam_Impl( CMD_STRINGPARAM_LANGUAGE, oArg.copy(RTL_CONSTASCII_LENGTH("language=")) ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "writer" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WRITER ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "calc" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_CALC ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_CALC, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "draw" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_DRAW ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_DRAW, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "impress" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_IMPRESS ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_IMPRESS, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "base" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_BASE ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_BASE, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "global" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_GLOBAL ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_GLOBAL, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "math" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_MATH ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_MATH, sal_True ); - return sal_True; } else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "web" )) == sal_True ) { sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WEB ); if ( !bAlreadySet ) SetBoolParam_Impl( CMD_BOOLPARAM_WEB, sal_True ); - return sal_True; } + else + return sal_False; - return sal_False; + if (bDeprecated) + { + const sal_Char* s = rtl::OUStringToOString(aArg, RTL_TEXTENCODING_UTF8).getStr(); + fprintf(stderr, "Warning: %s is deprecated. Use -%s instead.\n", s, s); + } + return sal_True; } sal_Bool CommandLineArgs::CheckGroupMembers( GroupParamId nGroupId, BoolParam nExcludeMember ) const |