diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-30 15:35:46 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-30 15:54:56 +0100 |
commit | 48a697ef1c123812c47e7e7c33688ca2b2c5e93a (patch) | |
tree | 992f59ab9f9551f70cca144da862bd4f9cdb16ed /dbaccess/source/core/dataaccess/databasedocument.hxx | |
parent | 535780bd4b911cb86b3587cead72ea15d23df871 (diff) |
coverity#706394 Uncaught exception
and hopefully a bunch more of those in dbaccess
Change-Id: I5aefcfe56a697f9e6b18dfe167fdd8a4f54ab6e0
Diffstat (limited to 'dbaccess/source/core/dataaccess/databasedocument.hxx')
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.hxx | 85 |
1 files changed, 69 insertions, 16 deletions
diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 73096e5b1d5c..bd5f9463797f 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -631,18 +631,49 @@ private: class DocumentGuard : private ModelMethodGuard { public: - enum MethodType + enum __InitMethod { // a method which is to initialize the document InitMethod, + }; + + enum __DefaultMethod + { // a default method - DefaultMethod, + DefaultMethod + }; + + enum __MethodUsedDuringInit + { // a method which is used (externally) during the initialization phase - MethodUsedDuringInit, + MethodUsedDuringInit + }; + + enum __MethodWithoutInit + { // a method which does not need initialization - use with care! MethodWithoutInit }; + + /** constructs the guard + + @param _document + the ODatabaseDocument instance + + @throws ::com::sun::star::lang::DisposedException + If the given component is already disposed + + @throws ::com::sun::star::lang::NotInitializedException + if the given component is not yet initialized + */ + DocumentGuard(const ODatabaseDocument& _document, __DefaultMethod) + : ModelMethodGuard(_document) + , m_document(_document ) + { + m_document.checkInitialized(); + } + /** constructs the guard @param _document @@ -652,24 +683,46 @@ public: If the given component is already disposed @throws ::com::sun::star::frame::DoubleInitializationException - if _eType is InitMethod, and the given component is already initialized, or currently being initialized. + if the given component is already initialized, or currently being initialized. + */ + DocumentGuard(const ODatabaseDocument& _document, __InitMethod) + : ModelMethodGuard(_document) + , m_document(_document) + { + m_document.checkNotInitialized(); + } + + /** constructs the guard + + @param _document + the ODatabaseDocument instance + + @throws ::com::sun::star::lang::DisposedException + If the given component is already disposed @throws ::com::sun::star::lang::NotInitializedException - if _eType is DefaultMethod, and the given component is not yet initialized; or if _eType - is MethodUsedDuringInit, and the component is still uninitialized, and not in the initialization + if the component is still uninitialized, and not in the initialization phase currently. */ - DocumentGuard( const ODatabaseDocument& _document, MethodType _eType = DefaultMethod ) - :ModelMethodGuard( _document ) - ,m_document( _document ) + DocumentGuard(const ODatabaseDocument& _document, __MethodUsedDuringInit) + : ModelMethodGuard(_document) + , m_document(_document) + { + m_document.checkNotUninitilized(); + } + + /** constructs the guard + + @param _document + the ODatabaseDocument instance + + @throws ::com::sun::star::lang::DisposedException + If the given component is already disposed + */ + DocumentGuard(const ODatabaseDocument& _document, __MethodWithoutInit) + : ModelMethodGuard( _document ) + , m_document( _document ) { - switch ( _eType ) - { - case InitMethod: m_document.checkNotInitialized(); break; - case DefaultMethod: m_document.checkInitialized(); break; - case MethodUsedDuringInit: m_document.checkNotUninitilized(); break; - case MethodWithoutInit: break; - } } ~DocumentGuard() |