convert STRING_TYP to scoped enum

Change-Id: If0bcc6e13864fd534eb65eda06b1bc2b5498cee9
This commit is contained in:
Noel Grandin
2016-11-24 13:22:18 +02:00
parent 63a6de2cab
commit c2775560ab
10 changed files with 23 additions and 23 deletions

View File

@@ -103,9 +103,9 @@ enum class ExportListType {
NONE, String, Filter, Item, Paired NONE, String, Filter, Item, Paired
}; };
#define STRING_TYP_TEXT 0x0010 enum class StringType {
#define STRING_TYP_QUICKHELPTEXT 0x0040 Text, QuickHelpText, Title
#define STRING_TYP_TITLE 0x0080 };
typedef ::std::vector< ResData* > ResStack; typedef ::std::vector< ResData* > ResStack;
@@ -152,7 +152,7 @@ private:
static void CleanValue( OString &rValue ); static void CleanValue( OString &rValue );
static OString GetText(const OString &rSource, int nToken); static OString GetText(const OString &rSource, int nToken);
void ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OString& rTextType ); void ResData2Output( MergeEntrys *pEntry, StringType nType, const OString& rTextType );
void MergeRest( ResData *pResData ); void MergeRest( ResData *pResData );
static void ConvertMergeContent( OString &rText ); static void ConvertMergeContent( OString &rText );
static void ConvertExportContent( OString &rText ); static void ConvertExportContent( OString &rText );
@@ -204,7 +204,7 @@ public:
sTitle[ rId ] = rTitle; sTitle[ rId ] = rTitle;
bTitleFirst[ rId ] = true; bTitleFirst[ rId ] = true;
} }
bool GetText( OString &rReturn, sal_uInt16 nTyp, const OString &nLangIndex, bool bDel = false ); bool GetText( OString &rReturn, StringType nTyp, const OString &nLangIndex, bool bDel = false );
/** /**
Generate QTZ string with ResData Generate QTZ string with ResData

View File

@@ -471,7 +471,7 @@ void CfgMerge::WorkOnResourceEnd()
sCur = aLanguages[ i ]; sCur = aLanguages[ i ];
OString sContent; OString sContent;
pEntrys->GetText( sContent, STRING_TYP_TEXT, sCur , true ); pEntrys->GetText( sContent, StringType::Text, sCur , true );
if ( if (
( !sCur.equalsIgnoreAsciiCase("en-US") ) && !sContent.isEmpty()) ( !sCur.equalsIgnoreAsciiCase("en-US") ) && !sContent.isEmpty())
{ {

View File

@@ -996,7 +996,7 @@ void Export::ConvertExportContent( OString& rText )
rText = helper::unEscapeAll(rText,"\\n""\\t""\\\\""\\\"","\n""\t""\\""\""); rText = helper::unEscapeAll(rText,"\\n""\\t""\\\\""\\\"","\n""\t""\\""\"");
} }
void Export::ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OString& rTextType ) void Export::ResData2Output( MergeEntrys *pEntry, StringType nType, const OString& rTextType )
{ {
bool bAddSemicolon = false; bool bAddSemicolon = false;
bool bFirst = true; bool bFirst = true;
@@ -1058,13 +1058,13 @@ void Export::MergeRest( ResData *pResData )
if ( pEntry ) if ( pEntry )
{ {
if ( pResData->bText ) if ( pResData->bText )
ResData2Output( pEntry, STRING_TYP_TEXT, pResData->sTextTyp ); ResData2Output( pEntry, StringType::Text, pResData->sTextTyp );
if ( pResData->bQuickHelpText ) if ( pResData->bQuickHelpText )
ResData2Output( pEntry, STRING_TYP_QUICKHELPTEXT, OString("QuickHelpText") ); ResData2Output( pEntry, StringType::QuickHelpText, OString("QuickHelpText") );
if ( pResData->bTitle ) if ( pResData->bTitle )
ResData2Output( pEntry, STRING_TYP_TITLE, OString("Title") ); ResData2Output( pEntry, StringType::Title, OString("Title") );
} }
// Merge Lists // Merge Lists
@@ -1143,7 +1143,7 @@ void Export::MergeRest( ResData *pResData )
if( pEntrys ) if( pEntrys )
{ {
OString sText; OString sText;
pEntrys->GetText( sText, STRING_TYP_TEXT, sCur ); pEntrys->GetText( sText, StringType::Text, sCur );
if( !sText.isEmpty()) if( !sText.isEmpty())
{ {
ConvertMergeContent( sText ); ConvertMergeContent( sText );

View File

@@ -243,7 +243,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa
pEntrys = pMergeDataFile->GetMergeEntrys( pResData ); pEntrys = pMergeDataFile->GetMergeEntrys( pResData );
if( pEntrys != nullptr) if( pEntrys != nullptr)
{ {
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, true ); pEntrys->GetText( sNewText, StringType::Text, sCur, true );
if (helper::isWellFormedXML(XMLUtil::QuotHTML(sNewText))) if (helper::isWellFormedXML(XMLUtil::QuotHTML(sNewText)))
{ {
sNewdata = sSourceText.copy(0,nPreSpaces) + sNewText; sNewdata = sSourceText.copy(0,nPreSpaces) + sNewText;

View File

@@ -241,7 +241,7 @@ bool LngParser::Merge(
if( !sLang.isEmpty() ) if( !sLang.isEmpty() )
{ {
OString sNewText; OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sLang, true ); pEntrys->GetText( sNewText, StringType::Text, sLang, true );
if( sLang == "qtz" ) if( sLang == "qtz" )
continue; continue;
@@ -279,7 +279,7 @@ bool LngParser::Merge(
{ {
OString sNewText; OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, true ); pEntrys->GetText( sNewText, StringType::Text, sCur, true );
if( sCur == "qtz" ) if( sCur == "qtz" )
continue; continue;
if ( !sNewText.isEmpty() && sCur != "x-comment") if ( !sNewText.isEmpty() && sCur != "x-comment")

View File

@@ -92,25 +92,25 @@ ResData::ResData( const OString &rGId, const OString &rFilename)
bool MergeEntrys::GetText( OString &rReturn, bool MergeEntrys::GetText( OString &rReturn,
sal_uInt16 nTyp, const OString &nLangIndex, bool bDel ) StringType nTyp, const OString &nLangIndex, bool bDel )
{ {
bool bReturn = true; bool bReturn = true;
switch ( nTyp ) { switch ( nTyp ) {
case STRING_TYP_TEXT : case StringType::Text :
rReturn = sText[ nLangIndex ]; rReturn = sText[ nLangIndex ];
if ( bDel ) if ( bDel )
sText[ nLangIndex ] = ""; sText[ nLangIndex ] = "";
bReturn = bTextFirst[ nLangIndex ]; bReturn = bTextFirst[ nLangIndex ];
bTextFirst[ nLangIndex ] = false; bTextFirst[ nLangIndex ] = false;
break; break;
case STRING_TYP_QUICKHELPTEXT : case StringType::QuickHelpText :
rReturn = sQuickHelpText[ nLangIndex ]; rReturn = sQuickHelpText[ nLangIndex ];
if ( bDel ) if ( bDel )
sQuickHelpText[ nLangIndex ] = ""; sQuickHelpText[ nLangIndex ] = "";
bReturn = bQuickHelpTextFirst[ nLangIndex ]; bReturn = bQuickHelpTextFirst[ nLangIndex ];
bQuickHelpTextFirst[ nLangIndex ] = false; bQuickHelpTextFirst[ nLangIndex ] = false;
break; break;
case STRING_TYP_TITLE : case StringType::Title :
rReturn = sTitle[ nLangIndex ]; rReturn = sTitle[ nLangIndex ];
if ( bDel ) if ( bDel )
sTitle[ nLangIndex ] = ""; sTitle[ nLangIndex ] = "";

View File

@@ -205,7 +205,7 @@ void PropParser::Merge( const OString &rMergeSrc, const OString &rDestinationFil
MergeEntrys* pEntrys = pMergeDataFile->GetMergeEntrys( &aResData ); MergeEntrys* pEntrys = pMergeDataFile->GetMergeEntrys( &aResData );
if( pEntrys ) if( pEntrys )
{ {
pEntrys->GetText( sNewText, STRING_TYP_TEXT, m_sLang ); pEntrys->GetText( sNewText, StringType::Text, m_sLang );
} }
} }
if( !sNewText.isEmpty() ) if( !sNewText.isEmpty() )

View File

@@ -168,7 +168,7 @@ namespace
pMergeDataFile->GetMergeEntrys( &aResData ); pMergeDataFile->GetMergeEntrys( &aResData );
if( pEntrys ) if( pEntrys )
{ {
pEntrys->GetText( sNewText, STRING_TYP_TEXT, rLang ); pEntrys->GetText( sNewText, StringType::Text, rLang );
} }
} }
else if( rLang == "qtz" ) else if( rLang == "qtz" )

View File

@@ -108,7 +108,7 @@ namespace
MergeEntrys* pEntrys = aI->second->GetMergeEntries(); MergeEntrys* pEntrys = aI->second->GetMergeEntries();
OString sOut; OString sOut;
pEntrys->GetText( sOut, STRING_TYP_TEXT, rLanguage ); pEntrys->GetText( sOut, StringType::Text, rLanguage );
if (sOut.isEmpty()) if (sOut.isEmpty())
continue; continue;

View File

@@ -411,7 +411,7 @@ void XRMResMerge::WorkOnDesc(
OString sContent; OString sContent;
if ( !sCur.equalsIgnoreAsciiCase("en-US") && if ( !sCur.equalsIgnoreAsciiCase("en-US") &&
( pEntrys->GetText( ( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sCur, true )) && sContent, StringType::Text, sCur, true )) &&
!sContent.isEmpty()) !sContent.isEmpty())
{ {
OString sText( sContent ); OString sText( sContent );
@@ -499,7 +499,7 @@ void XRMResMerge::EndOfText(
OString sContent; OString sContent;
if (!sCur.equalsIgnoreAsciiCase("en-US") && if (!sCur.equalsIgnoreAsciiCase("en-US") &&
( pEntrys->GetText( ( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sCur, true )) && sContent, StringType::Text, sCur, true )) &&
!sContent.isEmpty() && !sContent.isEmpty() &&
helper::isWellFormedXML( sContent )) helper::isWellFormedXML( sContent ))
{ {