diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2014-12-02 12:19:32 +0000 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-03 08:25:02 +0000 |
commit | 57fe57677887dd951000d3317690f8c628a58e02 (patch) | |
tree | 6457e6e54e190aee83ec547fe1af28eeb44830ed | |
parent | 02ef3abd83f2d5f702349a8cd47928621ee5c620 (diff) |
fdo#84938 replace BASERR_REASON_ constants -> enum
Change-Id: I80fe0108c2d27b72d2fadc23032cf2b52c3193a6
Reviewed-on: https://gerrit.libreoffice.org/13268
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 20 | ||||
-rw-r--r-- | include/basic/basmgr.hxx | 34 |
2 files changed, 28 insertions, 26 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index b0f05216a4a0..8029d1851a28 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -358,7 +358,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::Cont } } -BasicError::BasicError( sal_uInt64 nId, sal_uInt16 nR, const OUString& rErrStr ) : +BasicError::BasicError( sal_uInt64 nId, BasicErrorReason nR, const OUString& rErrStr ) : aErrStr( rErrStr ) { nErrorId = nId; @@ -796,7 +796,7 @@ void BasicManager::ImpMgrNotLoaded( const OUString& rStorageName ) // pErrInf is only destroyed if the error os processed by an // ErrorHandler StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, rStorageName, ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENMGRSTREAM, rStorageName)); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENMGRSTREAM, rStorageName)); // Create a stdlib otherwise we crash! BasicLibInfo* pStdLibInfo = CreateLibInfo(); @@ -936,7 +936,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) if( !ImplLoadBasic( *xManagerStream, pLibs->GetObject(0)->GetLibRef() ) ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, aStorName, ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENMGRSTREAM, aStorName)); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENMGRSTREAM, aStorName)); // and it proceeds ... } xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator @@ -985,7 +985,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) else { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_STORAGENOTFOUND, aStorName)); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::STORAGENOTFOUND, aStorName)); } } } @@ -1078,7 +1078,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora if ( !xBasicStorage.Is() || xBasicStorage->GetError() ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, xStorage->GetName(), ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENLIBSTORAGE, pLibInfo->GetLibName())); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTORAGE, pLibInfo->GetLibName())); } else { @@ -1087,7 +1087,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora if ( !xBasicStream.Is() || xBasicStream->GetError() ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD , pLibInfo->GetLibName(), ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENLIBSTREAM, pLibInfo->GetLibName())); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTREAM, pLibInfo->GetLibName())); } else { @@ -1121,7 +1121,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora if ( !bLoaded ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, pLibInfo->GetLibName(), ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_BASICLOADERROR, pLibInfo->GetLibName())); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::BASICLOADERROR, pLibInfo->GetLibName())); } else { @@ -1309,7 +1309,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ) if ( !pLibInfo || !nLib ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_STDLIB, pLibInfo->GetLibName())); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::STDLIB, pLibInfo->GetLibName())); return false; } @@ -1343,7 +1343,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ) if ( !xBasicStorage.Is() || xBasicStorage->GetError() ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENLIBSTORAGE, pLibInfo->GetLibName())); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTORAGE, pLibInfo->GetLibName())); } else if ( xBasicStorage->IsStream( pLibInfo->GetLibName() ) ) { @@ -1504,7 +1504,7 @@ bool BasicManager::LoadLib( sal_uInt16 nLib ) else { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), ERRCODE_BUTTON_OK ); - aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_LIBNOTFOUND, OUString::number(nLib))); + aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::LIBNOTFOUND, OUString::number(nLib))); } return bDone; } diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx index d6a93d737c65..31712456a943 100644 --- a/include/basic/basmgr.hxx +++ b/include/basic/basmgr.hxx @@ -32,35 +32,37 @@ BASIC_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::script::XStarBas class SotStorage; -#define BASERR_REASON_OPENSTORAGE 0x0001 -#define BASERR_REASON_OPENLIBSTORAGE 0x0002 -#define BASERR_REASON_OPENMGRSTREAM 0x0004 -#define BASERR_REASON_OPENLIBSTREAM 0x0008 -#define BASERR_REASON_LIBNOTFOUND 0x0010 -#define BASERR_REASON_STORAGENOTFOUND 0x0020 -#define BASERR_REASON_BASICLOADERROR 0x0040 -#define BASERR_REASON_NOSTORAGENAME 0x0080 - -#define BASERR_REASON_STDLIB 0x0100 +enum class BasicErrorReason +{ + OPENSTORAGE = 0x0001, + OPENLIBSTORAGE = 0x0002, + OPENMGRSTREAM = 0x0004, + OPENLIBSTREAM = 0x0008, + LIBNOTFOUND = 0x0010, + STORAGENOTFOUND = 0x0020, + BASICLOADERROR = 0x0040, + NOSTORAGENAME = 0x0080, + STDLIB = 0x0100 +}; class BASIC_DLLPUBLIC BasicError { private: sal_uInt64 nErrorId; - sal_uInt16 nReason; + BasicErrorReason nReason; OUString aErrStr; public: BasicError( const BasicError& rErr ); - BasicError( sal_uInt64 nId, sal_uInt16 nR, const OUString& rErrStr ); + BasicError( sal_uInt64 nId, BasicErrorReason nR, const OUString& rErrStr ); sal_uInt64 GetErrorId() const { return nErrorId; } - sal_uInt16 GetReason() const { return nReason; } - OUString GetErrorStr() { return aErrStr; } + BasicErrorReason GetReason() const { return nReason; } + OUString GetErrorStr() { return aErrStr; } void SetErrorId( sal_uInt64 n ) { nErrorId = n; } - void SetReason( sal_uInt16 n ) { nReason = n; } - void SetErrorStr( const OUString& rStr) { aErrStr = rStr; } + void SetReason( BasicErrorReason n ) { nReason = n; } + void SetErrorStr( const OUString& rStr) { aErrStr = rStr; } }; class BasicLibs; |