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/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

View File

@@ -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: ;
};

View File

@@ -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 )

View File

@@ -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() );
}
}

View File

@@ -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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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<std::string> &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 );

View File

@@ -31,12 +31,11 @@
#include <rtl/ustring.hxx>
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
@@ -47,7 +46,7 @@ struct HelpProcessingErrorInfo
sal_Int32 m_nXMLParsingLine;
HelpProcessingErrorInfo()
: m_eErrorClass( HELPPROCESSING_NO_ERROR )
: m_eErrorClass( HelpProcessingErrorClass::NONE )
, m_nXMLParsingLine( -1 )
{}