compilerplugins/clang/refcounting.cxx | 2 toolkit/source/controls/grid/initguard.hxx | 56 ----------------- toolkit/source/controls/grid/sortablegriddatamodel.cxx | 18 ++++- 3 files changed, 14 insertions(+), 62 deletions(-)
New commits: commit 978ff8f55cfa47b6ced80a6adc3d92327e0303f4 Author: Noel Grandin <[email protected]> Date: Fri Jan 13 11:58:14 2017 +0200 inline InitGuard since it is only used in one place Change-Id: Ie541a255ddbe71105f6b58f02f372f4f45667d7a diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index cc3a56b..ab34624 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -211,8 +211,6 @@ bool containsXInterfaceSubclass(const Type* pType0) { || dc.Class("mem_fun_t").StdNamespace() || dc.Class("mem_fun1_t").StdNamespace() || dc.Class("SwIterator").GlobalNamespace() - || (dc.Class("InitGuard").Namespace("toolkit") - .GlobalNamespace()) || (dc.Class("SharedUNOComponent").Namespace("utl") .GlobalNamespace()) || (dc.Class("OAutoRegistration").Namespace("utl") diff --git a/toolkit/source/controls/grid/initguard.hxx b/toolkit/source/controls/grid/initguard.hxx deleted file mode 100644 index 75d84c0..0000000 --- a/toolkit/source/controls/grid/initguard.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_INITGUARD_HXX -#define INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_INITGUARD_HXX - -#include <com/sun/star/lang/NotInitializedException.hpp> - -#include <comphelper/componentguard.hxx> - - -namespace toolkit -{ - - - //= InitGuard - - template < class IMPL > - class InitGuard : public ::comphelper::ComponentGuard - { - public: - InitGuard( IMPL& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper ) - :comphelper::ComponentGuard( i_component, i_broadcastHelper ) - { - if ( !i_component.isInitialized() ) - throw css::lang::NotInitializedException( OUString(), *&i_component ); - } - - ~InitGuard() - { - } - }; - - -} // namespace toolkit - - -#endif // INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_INITGUARD_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx index af7898d..59463e8 100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx @@ -17,13 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "initguard.hxx" - #include <com/sun/star/i18n/Collator.hpp> #include <com/sun/star/i18n/XCollator.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/NotInitializedException.hpp> #include <com/sun/star/ucb/AlreadyInitializedException.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/awt/grid/XGridDataListener.hpp> @@ -33,6 +32,7 @@ #include <cppuhelper/compbase.hxx> #include <cppuhelper/implbase1.hxx> #include <comphelper/anycompare.hxx> +#include <comphelper/componentguard.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <tools/diagnose_ex.h> @@ -45,12 +45,11 @@ using namespace css::i18n; using namespace css::lang; using namespace css::ucb; using namespace css::uno; -using namespace toolkit; namespace { class SortableGridDataModel; -typedef InitGuard< SortableGridDataModel > MethodGuard; +class MethodGuard; typedef ::cppu::WeakComponentImplHelper < css::awt::grid::XSortableMutableGridDataModel , css::lang::XServiceInfo @@ -197,6 +196,17 @@ private: ::std::vector< ::sal_Int32 > m_privateToPublicRowIndex; }; +class MethodGuard : public ::comphelper::ComponentGuard +{ +public: + MethodGuard( SortableGridDataModel& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper ) + :comphelper::ComponentGuard( i_component, i_broadcastHelper ) + { + if ( !i_component.isInitialized() ) + throw css::lang::NotInitializedException( OUString(), *&i_component ); + } +}; + namespace { template< class STLCONTAINER > _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
