convert HelpProcessingErrorClass to scoped enum

and drop unused HELPPROCESSING_INTERNAL_ERROR enumerator

Change-Id: I0f2cf063a3f1472e1d52bab5039b1c3158d4865e
This commit is contained in:
Noel Grandin
2017-02-15 15:44:07 +02:00
parent 1b9f680853
commit ce3441c2d5
6 changed files with 39 additions and 39 deletions

View File

@@ -159,6 +159,7 @@ for d in definitionSet:
"sd/source/ui/dlg/PhotoAlbumDialog.hxx", # SlideImageLayout (from UI) "sd/source/ui/dlg/PhotoAlbumDialog.hxx", # SlideImageLayout (from UI)
"sd/inc/pres.hxx", # AutoLayout (from UI) "sd/inc/pres.hxx", # AutoLayout (from UI)
"sc/source/ui/inc/scuitphfedit.hxx", # ScHFEntryId (from UI) "sc/source/ui/inc/scuitphfedit.hxx", # ScHFEntryId (from UI)
"include/i18nlangtag/languagetag.hxx", # LanguageTag::ScriptType
# represents constants from an external API # represents constants from an external API
"opencl/inc/opencl_device_selection.h", "opencl/inc/opencl_device_selection.h",
"vcl/inc/sft.hxx", "vcl/inc/sft.hxx",
@@ -166,6 +167,7 @@ for d in definitionSet:
"vcl/unx/gtk/xid_fullscreen_on_all_monitors.c", "vcl/unx/gtk/xid_fullscreen_on_all_monitors.c",
"vcl/unx/gtk/salnativewidgets-gtk.cxx", "vcl/unx/gtk/salnativewidgets-gtk.cxx",
"sc/inc/callform.hxx", # ParamType "sc/inc/callform.hxx", # ParamType
"include/i18nlangtag/applelangid.hxx", # AppleLanguageId
]): ]):
continue continue

View File

@@ -486,9 +486,8 @@ void BackendImpl::implProcessHelp(
sal_uInt16 nErrStrId = 0; sal_uInt16 nErrStrId = 0;
switch( aErrorInfo.m_eErrorClass ) switch( aErrorInfo.m_eErrorClass )
{ {
case HELPPROCESSING_GENERAL_ERROR: case HelpProcessingErrorClass::General: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break;
case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; case HelpProcessingErrorClass::XmlParsing: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
default: ; default: ;
}; };

View File

@@ -199,7 +199,7 @@ struct HelpProcessingException
, m_nXMLParsingLine( 0 ) , m_nXMLParsingLine( 0 )
{} {}
HelpProcessingException( const std::string& aErrorMsg, const std::string& aXMLParsingFile, int nXMLParsingLine ) HelpProcessingException( const std::string& aErrorMsg, const std::string& aXMLParsingFile, int nXMLParsingLine )
: m_eErrorClass( HELPPROCESSING_XMLPARSING_ERROR ) : m_eErrorClass( HelpProcessingErrorClass::XmlParsing )
, m_aErrorMsg( aErrorMsg ) , m_aErrorMsg( aErrorMsg )
, m_aXMLParsingFile( aXMLParsingFile ) , m_aXMLParsingFile( aXMLParsingFile )
, m_nXMLParsingLine( nXMLParsingLine ) , m_nXMLParsingLine( nXMLParsingLine )

View File

@@ -449,7 +449,7 @@ bool HelpCompiler::compile()
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "ERROR: file not existing: " << inputFile.native_file_string().c_str() << std::endl; 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() );
} }
} }

View File

@@ -387,7 +387,7 @@ void HelpLinker::link()
<< "' for language '" << "' for language '"
<< lang << lang
<< "' failed!"; << "' failed!";
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
if (!m_bCreateIndex) if (!m_bCreateIndex)
@@ -567,7 +567,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "extension source missing" << std::endl; aStrStream << "extension source missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
extsource = args[i]; extsource = args[i];
} }
@@ -580,7 +580,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "extension destination missing" << std::endl; aStrStream << "extension destination missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
extdestination = args[i]; extdestination = args[i];
} }
@@ -591,7 +591,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "sourceroot missing" << std::endl; aStrStream << "sourceroot missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
bSrcOption = true; bSrcOption = true;
sourceRoot = fs::path(args[i], fs::native); sourceRoot = fs::path(args[i], fs::native);
@@ -603,7 +603,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "compactStylesheet missing" << std::endl; 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); compactStylesheet = fs::path(args[i], fs::native);
@@ -615,7 +615,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "embeddingStylesheet missing" << std::endl; 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); embeddStylesheet = fs::path(args[i], fs::native);
@@ -627,7 +627,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "idxtemp missing" << std::endl; 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); zipdir = fs::path(args[i], fs::native);
@@ -639,7 +639,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "idxcaption stylesheet missing" << std::endl; 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); idxCaptionStylesheet = fs::path(args[i], fs::native);
@@ -651,7 +651,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "idxcontent stylesheet missing" << std::endl; 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); idxContentStylesheet = fs::path(args[i], fs::native);
@@ -663,7 +663,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "outputfilename missing" << std::endl; 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); outputFile = fs::path(args[i], fs::native);
@@ -675,7 +675,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "module name missing" << std::endl; aStrStream << "module name missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
module = args[i]; module = args[i];
@@ -687,7 +687,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "language name missing" << std::endl; aStrStream << "language name missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
lang = args[i]; lang = args[i];
@@ -695,7 +695,7 @@ void HelpLinker::main( std::vector<std::string> &args,
else if (args[i].compare("-hid") == 0) else if (args[i].compare("-hid") == 0)
{ {
++i; ++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) else if (args[i].compare("-add") == 0)
{ {
@@ -705,7 +705,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "pathname missing" << std::endl; aStrStream << "pathname missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
addFileUnderPath = args[i]; addFileUnderPath = args[i];
@@ -714,7 +714,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "pathname missing" << std::endl; aStrStream << "pathname missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
addFile = args[i]; addFile = args[i];
if (!addFileUnderPath.empty() && !addFile.empty()) if (!addFileUnderPath.empty() && !addFile.empty())
@@ -746,7 +746,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "-extlangdest is missing" << std::endl; aStrStream << "-extlangdest is missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
else else
{ {
@@ -767,7 +767,7 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "-src must not be used together with -extsource missing" << std::endl; 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<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "no index dir given" << std::endl; aStrStream << "no index dir given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
if ( (!bExtensionMode && idxCaptionStylesheet.empty()) if ( (!bExtensionMode && idxCaptionStylesheet.empty())
@@ -786,7 +786,7 @@ void HelpLinker::main( std::vector<std::string> &args,
// -idxcaption parameter is required // -idxcaption parameter is required
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "no index caption stylesheet given" << std::endl; 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()) else if ( bExtensionMode && extsource.empty())
{ {
@@ -810,7 +810,7 @@ void HelpLinker::main( std::vector<std::string> &args,
// -idxcontent parameter is required // -idxcontent parameter is required
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "no index content stylesheet given" << std::endl; 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()) else if ( bExtensionMode && extsource.empty())
{ {
@@ -830,31 +830,31 @@ void HelpLinker::main( std::vector<std::string> &args,
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "no embedding resolving file given" << std::endl; aStrStream << "no embedding resolving file given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
if (sourceRoot.empty()) if (sourceRoot.empty())
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "no sourceroot given" << std::endl; aStrStream << "no sourceroot given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
if (!bExtensionMode && outputFile.empty()) if (!bExtensionMode && outputFile.empty())
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "no output file given" << std::endl; aStrStream << "no output file given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
if (module.empty()) if (module.empty())
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "module missing" << std::endl; aStrStream << "module missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
if (!bExtensionMode && lang.empty()) if (!bExtensionMode && lang.empty())
{ {
std::stringstream aStrStream; std::stringstream aStrStream;
aStrStream << "language missing" << std::endl; aStrStream << "language missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); throw HelpProcessingException( HelpProcessingErrorClass::General, aStrStream.str() );
} }
link(); link();
} }
@@ -974,7 +974,7 @@ bool compileExtensionHelp
if (XML_STATUS_ERROR == parsed) if (XML_STATUS_ERROR == parsed)
{ {
XML_Error nError = XML_GetErrorCode( parser ); 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_aErrorMsg = OUString::createFromAscii( XML_ErrorString( nError ) );
o_rHelpProcessingErrorInfo.m_aXMLParsingFile = aTreeFileURL; o_rHelpProcessingErrorInfo.m_aXMLParsingFile = aTreeFileURL;
// CRASHES!!! o_rHelpProcessingErrorInfo.m_nXMLParsingLine = XML_GetCurrentLineNumber( parser ); // CRASHES!!! o_rHelpProcessingErrorInfo.m_nXMLParsingLine = XML_GetCurrentLineNumber( parser );

View File

@@ -31,23 +31,22 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
enum HelpProcessingErrorClass enum class HelpProcessingErrorClass
{ {
HELPPROCESSING_NO_ERROR, NONE,
HELPPROCESSING_GENERAL_ERROR, // Missing files, options etc. General, // Missing files, options etc.
HELPPROCESSING_INTERNAL_ERROR, // Unexpected problems XmlParsing // Errors thrown by libxml
HELPPROCESSING_XMLPARSING_ERROR // Errors thrown by libxml
}; };
struct HelpProcessingErrorInfo struct HelpProcessingErrorInfo
{ {
HelpProcessingErrorClass m_eErrorClass; HelpProcessingErrorClass m_eErrorClass;
OUString m_aErrorMsg; OUString m_aErrorMsg;
OUString m_aXMLParsingFile; OUString m_aXMLParsingFile;
sal_Int32 m_nXMLParsingLine; sal_Int32 m_nXMLParsingLine;
HelpProcessingErrorInfo() HelpProcessingErrorInfo()
: m_eErrorClass( HELPPROCESSING_NO_ERROR ) : m_eErrorClass( HelpProcessingErrorClass::NONE )
, m_nXMLParsingLine( -1 ) , m_nXMLParsingLine( -1 )
{} {}