From ce3441c2d5b6267c437b7af362fc8d29e38c1dd4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 15 Feb 2017 15:44:07 +0200 Subject: convert HelpProcessingErrorClass to scoped enum and drop unused HELPPROCESSING_INTERNAL_ERROR enumerator Change-Id: I0f2cf063a3f1472e1d52bab5039b1c3158d4865e --- compilerplugins/clang/unusedenumconstants.py | 2 + .../source/deployment/registry/help/dp_help.cxx | 5 +-- helpcompiler/inc/HelpCompiler.hxx | 2 +- helpcompiler/source/HelpCompiler.cxx | 2 +- helpcompiler/source/HelpLinker.cxx | 52 +++++++++++----------- include/helpcompiler/compilehelp.hxx | 15 +++---- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py index 122e5911fd15..64aaa597ec9d 100755 --- a/compilerplugins/clang/unusedenumconstants.py +++ b/compilerplugins/clang/unusedenumconstants.py @@ -159,6 +159,7 @@ for d in definitionSet: "sd/source/ui/dlg/PhotoAlbumDialog.hxx", # SlideImageLayout (from UI) "sd/inc/pres.hxx", # AutoLayout (from UI) "sc/source/ui/inc/scuitphfedit.hxx", # ScHFEntryId (from UI) + "include/i18nlangtag/languagetag.hxx", # LanguageTag::ScriptType # represents constants from an external API "opencl/inc/opencl_device_selection.h", "vcl/inc/sft.hxx", @@ -166,6 +167,7 @@ for d in definitionSet: "vcl/unx/gtk/xid_fullscreen_on_all_monitors.c", "vcl/unx/gtk/salnativewidgets-gtk.cxx", "sc/inc/callform.hxx", # ParamType + "include/i18nlangtag/applelangid.hxx", # AppleLanguageId ]): continue diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index e84676cc43e6..5c265a46d16a 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -486,9 +486,8 @@ void BackendImpl::implProcessHelp( sal_uInt16 nErrStrId = 0; switch( aErrorInfo.m_eErrorClass ) { - case HELPPROCESSING_GENERAL_ERROR: - case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; - case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; + case HelpProcessingErrorClass::General: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; + case HelpProcessingErrorClass::XmlParsing: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; default: ; }; diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx index e0c1b67823f1..0e4975424d9d 100644 --- a/helpcompiler/inc/HelpCompiler.hxx +++ b/helpcompiler/inc/HelpCompiler.hxx @@ -199,7 +199,7 @@ struct HelpProcessingException , m_nXMLParsingLine( 0 ) {} HelpProcessingException( const std::string& aErrorMsg, const std::string& aXMLParsingFile, int nXMLParsingLine ) - : m_eErrorClass( HELPPROCESSING_XMLPARSING_ERROR ) + : m_eErrorClass( HelpProcessingErrorClass::XmlParsing ) , m_aErrorMsg( aErrorMsg ) , m_aXMLParsingFile( aXMLParsingFile ) , m_nXMLParsingLine( nXMLParsingLine ) diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx index 0eb89533382b..e456f5acd5b5 100644 --- a/helpcompiler/source/HelpCompiler.cxx +++ b/helpcompiler/source/HelpCompiler.cxx @@ -449,7 +449,7 @@ bool HelpCompiler::compile() { std::stringstream aStrStream; aStrStream << "ERROR: file not existing: " << inputFile.native_file_string().c_str() << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } } diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index 243a5fb2f4dc..b06295fdf22c 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -387,7 +387,7 @@ void HelpLinker::link() << "' for language '" << lang << "' failed!"; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } if (!m_bCreateIndex) @@ -567,7 +567,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "extension source missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } extsource = args[i]; } @@ -580,7 +580,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "extension destination missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } extdestination = args[i]; } @@ -591,7 +591,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "sourceroot missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } bSrcOption = true; sourceRoot = fs::path(args[i], fs::native); @@ -603,7 +603,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "compactStylesheet missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } compactStylesheet = fs::path(args[i], fs::native); @@ -615,7 +615,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "embeddingStylesheet missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } embeddStylesheet = fs::path(args[i], fs::native); @@ -627,7 +627,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "idxtemp missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } zipdir = fs::path(args[i], fs::native); @@ -639,7 +639,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "idxcaption stylesheet missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } idxCaptionStylesheet = fs::path(args[i], fs::native); @@ -651,7 +651,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "idxcontent stylesheet missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } idxContentStylesheet = fs::path(args[i], fs::native); @@ -663,7 +663,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "outputfilename missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } outputFile = fs::path(args[i], fs::native); @@ -675,7 +675,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "module name missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } module = args[i]; @@ -687,7 +687,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "language name missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } lang = args[i]; @@ -695,7 +695,7 @@ void HelpLinker::main( std::vector &args, else if (args[i].compare("-hid") == 0) { ++i; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, "obsolete -hid argument used" ); + throw HelpProcessingException( HelpProcessingErrorClass::General, "obsolete -hid argument used" ); } else if (args[i].compare("-add") == 0) { @@ -705,7 +705,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "pathname missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } addFileUnderPath = args[i]; @@ -714,7 +714,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "pathname missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } addFile = args[i]; if (!addFileUnderPath.empty() && !addFile.empty()) @@ -746,7 +746,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "-extlangdest is missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } else { @@ -767,7 +767,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "-src must not be used together with -extsource missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } } @@ -775,7 +775,7 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "no index dir given" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } if ( (!bExtensionMode && idxCaptionStylesheet.empty()) @@ -786,7 +786,7 @@ void HelpLinker::main( std::vector &args, // -idxcaption parameter is required std::stringstream aStrStream; aStrStream << "no index caption stylesheet given" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } else if ( bExtensionMode && extsource.empty()) { @@ -810,7 +810,7 @@ void HelpLinker::main( std::vector &args, // -idxcontent parameter is required std::stringstream aStrStream; aStrStream << "no index content stylesheet given" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } else if ( bExtensionMode && extsource.empty()) { @@ -830,31 +830,31 @@ void HelpLinker::main( std::vector &args, { std::stringstream aStrStream; aStrStream << "no embedding resolving file given" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } if (sourceRoot.empty()) { std::stringstream aStrStream; aStrStream << "no sourceroot given" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } if (!bExtensionMode && outputFile.empty()) { std::stringstream aStrStream; aStrStream << "no output file given" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } if (module.empty()) { std::stringstream aStrStream; aStrStream << "module missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } if (!bExtensionMode && lang.empty()) { std::stringstream aStrStream; aStrStream << "language missing" << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() ); } link(); } @@ -974,7 +974,7 @@ bool compileExtensionHelp if (XML_STATUS_ERROR == parsed) { XML_Error nError = XML_GetErrorCode( parser ); - o_rHelpProcessingErrorInfo.m_eErrorClass = HELPPROCESSING_XMLPARSING_ERROR; + o_rHelpProcessingErrorInfo.m_eErrorClass = HelpProcessingErrorClass::XmlParsing; o_rHelpProcessingErrorInfo.m_aErrorMsg = OUString::createFromAscii( XML_ErrorString( nError ) ); o_rHelpProcessingErrorInfo.m_aXMLParsingFile = aTreeFileURL; // CRASHES!!! o_rHelpProcessingErrorInfo.m_nXMLParsingLine = XML_GetCurrentLineNumber( parser ); diff --git a/include/helpcompiler/compilehelp.hxx b/include/helpcompiler/compilehelp.hxx index c9643ac0c28a..04c573a2596e 100644 --- a/include/helpcompiler/compilehelp.hxx +++ b/include/helpcompiler/compilehelp.hxx @@ -31,23 +31,22 @@ #include -enum HelpProcessingErrorClass +enum class HelpProcessingErrorClass { - HELPPROCESSING_NO_ERROR, - HELPPROCESSING_GENERAL_ERROR, // Missing files, options etc. - HELPPROCESSING_INTERNAL_ERROR, // Unexpected problems - HELPPROCESSING_XMLPARSING_ERROR // Errors thrown by libxml + NONE, + General, // Missing files, options etc. + XmlParsing // Errors thrown by libxml }; struct HelpProcessingErrorInfo { - HelpProcessingErrorClass m_eErrorClass; + HelpProcessingErrorClass m_eErrorClass; OUString m_aErrorMsg; OUString m_aXMLParsingFile; - sal_Int32 m_nXMLParsingLine; + sal_Int32 m_nXMLParsingLine; HelpProcessingErrorInfo() - : m_eErrorClass( HELPPROCESSING_NO_ERROR ) + : m_eErrorClass( HelpProcessingErrorClass::NONE ) , m_nXMLParsingLine( -1 ) {} -- cgit