diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-16 13:45:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-17 07:52:09 +0200 |
commit | f1421a3e12167fafc966d069b3a4f7eb84ffda05 (patch) | |
tree | 478c783517a88afdcc238fe95eda06e57fa61a3f | |
parent | fb4bf693999b8a1ebf79bad0d223ae2d4398cf81 (diff) |
convert SbxNameType to scoped enum
and drop unused enumerators
Change-Id: I2b47828b2146fcda335f1dc1c1f61a1139abbe19
-rw-r--r-- | basic/source/sbx/sbxobj.cxx | 4 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 38 | ||||
-rwxr-xr-x | compilerplugins/clang/unusedenumconstants.py | 5 | ||||
-rw-r--r-- | include/basic/sbxdef.hxx | 8 | ||||
-rw-r--r-- | include/basic/sbxvar.hxx | 2 |
5 files changed, 22 insertions, 35 deletions
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 69533d97ccf4..7763e96d90bf 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -764,7 +764,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) SbxVariable* pVar = r.get(); if( pVar ) { - OUString aLine = aIndent + " - " + pVar->GetName( SbxNAME_SHORT_TYPES ); + OUString aLine = aIndent + " - " + pVar->GetName( SbxNameType::ShortTypes ); OUString aAttrs2; if( CollectAttrs( pVar, aAttrs2 ) ) { @@ -801,7 +801,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) SbxVariable* pVar = r.get(); if( pVar ) { - OUString aLine = aIndent + " - " + pVar->GetName( SbxNAME_SHORT_TYPES ); + OUString aLine = aIndent + " - " + pVar->GetName( SbxNameType::ShortTypes ); OUString aAttrs3; if( CollectAttrs( pVar, aAttrs3 ) ) { diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 097b04c0b1a6..dcd969426561 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -232,7 +232,7 @@ void SbxVariable::SetName( const OUString& rName ) const OUString& SbxVariable::GetName( SbxNameType t ) const { static const char cSuffixes[] = " %&!#@ $"; - if( t == SbxNAME_NONE ) + if( t == SbxNameType::NONE ) { return maName; } @@ -247,7 +247,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const OUString aTmp( maName ); // short type? Then fetch it, possible this is 0. SbxDataType et = GetType(); - if( t == SbxNAME_SHORT_TYPES ) + if( t == SbxNameType::ShortTypes ) { if( et <= SbxSTRING ) { @@ -279,7 +279,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const aTmp += i->aName; cType = ' '; // short type? Then fetch it, possible this is 0. - if( t == SbxNAME_SHORT_TYPES ) + if( t == SbxNameType::ShortTypes ) { if( nt <= SbxSTRING ) { @@ -301,34 +301,18 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const aTmp += "()"; } // long type? - if( t != SbxNAME_SHORT ) + aTmp += GetSbxRes( StringId::As ); + if( nt < 32 ) { - aTmp += GetSbxRes( StringId::As ); - if( nt < 32 ) - { - aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) ); - } - else - { - aTmp += GetSbxRes( StringId::Any ); - } + aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) ); + } + else + { + aTmp += GetSbxRes( StringId::Any ); } } } aTmp += ")"; - // Long type? Then fetch it - if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY ) - { - aTmp += GetSbxRes( StringId::As ); - if( et < 32 ) - { - aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + et ) ); - } - else - { - aTmp += GetSbxRes( StringId::Any ); - } - } const_cast<SbxVariable*>(this)->aToolString = aTmp; return aToolString; } @@ -699,7 +683,7 @@ void SbxAlias::Notify( SfxBroadcaster&, const SfxHint& rHint ) void SbxVariable::Dump( SvStream& rStrm, bool bFill ) { - OString aBNameStr(OUStringToOString(GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US)); + OString aBNameStr(OUStringToOString(GetName( SbxNameType::ShortTypes ), RTL_TEXTENCODING_ASCII_US)); rStrm.WriteCharPtr( "Variable( " ) .WriteCharPtr( OString::number(reinterpret_cast<sal_Int64>(this)).getStr() ).WriteCharPtr( "==" ) .WriteCharPtr( aBNameStr.getStr() ); diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py index ec7e73202170..8188c5a677f7 100755 --- a/compilerplugins/clang/unusedenumconstants.py +++ b/compilerplugins/clang/unusedenumconstants.py @@ -114,6 +114,7 @@ for d in definitionSet: "sd/source/filter/eppt/epptbase.hxx", # PPTExTextAttr "sc/source/filter/inc/tokstack.hxx", # E_TYPE "filter/source/graphicfilter/icgm/cgmtypes.hxx", + ":basic/source/inc/filefmt.hxx", # FileOffset # unit test code "cppu/source/uno/check.cxx", # general weird nonsense going on @@ -137,6 +138,9 @@ for d in definitionSet: "cppcanvas/source/mtfrenderer/emfpbrush.hxx", # EmfPlusHatchStyle "include/filter/msfilter/svdfppt.hxx", # PptPlaceholder, PptSlideLayout "include/filter/msfilter/escherex.hxx", # various + "basic/source/inc/opcodes.hxx", # SbiOpcode + "basic/source/inc/token.hxx", # SbiToken + "binaryurp/source/specialfunctionids.hxx", # binaryurp::SpecialFunctionIds # Windows or OSX only "include/canvas/rendering/icolorbuffer.hxx", "include/vcl/commandevent.hxx", @@ -170,6 +174,7 @@ for d in definitionSet: "cui/source/tabpages/tparea.cxx", # FillType (from UI) "include/editeng/svxenum.hxx", # css::style::NumberingType "include/editeng/bulletitem.hxx", # css::style::NumberingType + ":basic/source/sbx/sbxdec.hxx", # SbxDecimal::CmpResult, must match some Windows API # represents constants from an external API "opencl/inc/opencl_device_selection.h", "vcl/inc/sft.hxx", diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx index 44c75dbb03b6..77e3231a65a5 100644 --- a/include/basic/sbxdef.hxx +++ b/include/basic/sbxdef.hxx @@ -119,11 +119,9 @@ enum SbxOperator { SbxGE // this >= var }; -enum SbxNameType { // Type of the questioned name of a variable - SbxNAME_NONE, // plain name - SbxNAME_SHORT, // Name(A,B) - SbxNAME_SHORT_TYPES, // Name%(A%,B$) - SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer +enum class SbxNameType { // Type of the questioned name of a variable + NONE, // plain name + ShortTypes, // Name%(A%,B$) }; // from 1996/3/20: New error messages diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx index 82acb60f2982..4855e0973350 100644 --- a/include/basic/sbxvar.hxx +++ b/include/basic/sbxvar.hxx @@ -249,7 +249,7 @@ public: void Dump( SvStream&, bool bDumpAll ); void SetName( const OUString& ); - const OUString& GetName( SbxNameType = SbxNAME_NONE ) const; + const OUString& GetName( SbxNameType = SbxNameType::NONE ) const; sal_uInt16 GetHashCode() const { return nHash; } virtual void SetModified( bool ) override; |