[Libreoffice-commits] core.git: basic/source

Noel Grandin noel at peralex.com
Wed Feb 24 10:21:28 UTC 2016


 basic/source/sbx/sbxbool.cxx |    8 ++++----
 basic/source/sbx/sbxcoll.cxx |    8 ++++----
 basic/source/sbx/sbxobj.cxx  |    4 ++--
 basic/source/sbx/sbxres.cxx  |    8 ++------
 basic/source/sbx/sbxres.hxx  |    8 +-------
 basic/source/sbx/sbxstr.cxx  |    4 ++--
 basic/source/sbx/sbxvar.cxx  |   16 ++++++++--------
 7 files changed, 23 insertions(+), 33 deletions(-)

New commits:
commit 670c2b3ca99c9ae4a75c508408023de198e3ac5e
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Feb 24 12:19:44 2016 +0200

    simply the SbxRes stuff, inheriting from OUString is icky
    
    Change-Id: Ie9794ea164d587ad87ee13d360cb3abc18166051

diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 402214b..563c9f4 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -70,9 +70,9 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
             nRes = SbxFALSE;
             if ( p->pOUString )
             {
-                if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( StringId::True ) ) )
+                if( p->pOUString->equalsIgnoreAsciiCase( GetSbxRes( StringId::True ) ) )
                     nRes = SbxTRUE;
-                else if( !p->pOUString->equalsIgnoreAsciiCase( SbxRes( StringId::False ) ) )
+                else if( !p->pOUString->equalsIgnoreAsciiCase( GetSbxRes( StringId::False ) ) )
                 {
                     // it can be convertible to a number
                     bool bError = true;
@@ -174,9 +174,9 @@ void ImpPutBool( SbxValues* p, sal_Int16 n )
         case SbxSTRING:
         case SbxLPSTR:
             if ( !p->pOUString )
-                p->pOUString = new OUString( SbxRes( n ? StringId::True : StringId::False ) );
+                p->pOUString = new OUString( GetSbxRes( n ? StringId::True : StringId::False ) );
             else
-                *p->pOUString = SbxRes( n ? StringId::True : StringId::False );
+                *p->pOUString = GetSbxRes( n ? StringId::True : StringId::False );
             break;
 
         case SbxOBJECT:
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index 6b8ba2f..58d7dec 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -35,10 +35,10 @@ SbxCollection::SbxCollection( const OUString& rClass )
 {
     if( !nCountHash )
     {
-        pCount  = OUString::createFromAscii(GetSbxRes( StringId::CountProp ));
-        pAdd    = OUString::createFromAscii(GetSbxRes( StringId::AddMeth ));
-        pItem   = OUString::createFromAscii(GetSbxRes( StringId::ItemMeth ));
-        pRemove = OUString::createFromAscii(GetSbxRes( StringId::RemoveMeth ));
+        pCount  = GetSbxRes( StringId::CountProp );
+        pAdd    = GetSbxRes( StringId::AddMeth );
+        pItem   = GetSbxRes( StringId::ItemMeth );
+        pRemove = GetSbxRes( StringId::RemoveMeth );
         nCountHash  = MakeHashCode( pCount );
         nAddHash    = MakeHashCode( pAdd );
         nItemHash   = MakeHashCode( pItem );
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 33dae80..ce7f866 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -40,8 +40,8 @@ SbxObject::SbxObject( const OUString& rClass )
     aData.pObj = this;
     if( !nNameHash )
     {
-        pNameProp = OUString::createFromAscii(GetSbxRes( StringId::NameProp ));
-        pParentProp = OUString::createFromAscii(GetSbxRes( StringId::ParentProp ));
+        pNameProp = GetSbxRes( StringId::NameProp );
+        pParentProp = GetSbxRes( StringId::ParentProp );
         nNameHash = MakeHashCode( pNameProp );
         nParentHash = MakeHashCode( pParentProp );
     }
diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx
index 608b3e2..125969e 100644
--- a/basic/source/sbx/sbxres.cxx
+++ b/basic/source/sbx/sbxres.cxx
@@ -72,13 +72,9 @@ static const char* pSbxRes[] = {
     "True"
 };
 
-const char* GetSbxRes( StringId nId )
+OUString GetSbxRes( StringId nId )
 {
-    return ( ( nId > StringId::LastValue ) ? "???" : pSbxRes[ static_cast<int>( nId ) ] );
+    return OUString::createFromAscii( ( nId > StringId::LastValue ) ? "???" : pSbxRes[ static_cast<int>( nId ) ] );
 }
 
-SbxRes::SbxRes( StringId nId )
-    : OUString( OUString::createFromAscii( GetSbxRes( nId ) ) )
-{}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxres.hxx b/basic/source/sbx/sbxres.hxx
index 82ffe7c..995c31d 100644
--- a/basic/source/sbx/sbxres.hxx
+++ b/basic/source/sbx/sbxres.hxx
@@ -47,13 +47,7 @@ enum class StringId {
     LastValue  = 44
 };
 
-class SbxRes : public OUString
-{
-public:
-    explicit SbxRes( StringId );
-};
-
-const char* GetSbxRes( StringId );
+OUString GetSbxRes( StringId );
 
 
 #endif
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index 465a72f..1bdc6fa 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -102,8 +102,8 @@ OUString ImpGetString( const SbxValues* p )
         }
         case SbxERROR:
             // Here the String "Error n" is generated
-            aRes = SbxRes( StringId::ErrorMsg );
-            aRes += OUString::number(p->nUShort); break;
+            aRes = GetSbxRes( StringId::ErrorMsg ) + OUString::number(p->nUShort);
+            break;
         case SbxDATE:
             ImpPutDate( &aTmp, p->nDouble ); break;
 
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 2a15eed..2036137 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -258,11 +258,11 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
         }
         if( i->nFlags & SbxFlagBits::Optional )
         {
-            aTmp += OUString( SbxRes( StringId::Optional ) );
+            aTmp += GetSbxRes( StringId::Optional );
         }
         if( i->eType & SbxBYREF )
         {
-            aTmp += OUString( SbxRes( StringId::ByRef ) );
+            aTmp += GetSbxRes( StringId::ByRef );
         }
         aTmp += i->aName;
         cType = ' ';
@@ -291,14 +291,14 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
             // long type?
             if( t != SbxNAME_SHORT )
             {
-                aTmp += OUString( SbxRes( StringId::As ) );
+                aTmp += GetSbxRes( StringId::As );
                 if( nt < 32 )
                 {
-                    aTmp += OUString( SbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) ) );
+                    aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) );
                 }
                 else
                 {
-                    aTmp += OUString( SbxRes( StringId::Any ) );
+                    aTmp += GetSbxRes( StringId::Any );
                 }
             }
         }
@@ -307,14 +307,14 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
     // Long type? Then fetch it
     if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
     {
-        aTmp += OUString( SbxRes( StringId::As ) );
+        aTmp += GetSbxRes( StringId::As );
         if( et < 32 )
         {
-            aTmp += OUString( SbxRes(  static_cast<StringId>( static_cast<int>( StringId::Types ) + et ) ) );
+            aTmp += GetSbxRes(  static_cast<StringId>( static_cast<int>( StringId::Types ) + et ) );
         }
         else
         {
-            aTmp += OUString( SbxRes( StringId::Any ) );
+            aTmp += GetSbxRes( StringId::Any );
         }
     }
     const_cast<SbxVariable*>(this)->aToolString = aTmp;


More information about the Libreoffice-commits mailing list