/src/libreoffice/chart2/source/inc/DisposeHelper.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | #pragma once |
20 | | |
21 | | #include <com/sun/star/uno/Reference.h> |
22 | | #include <com/sun/star/lang/XComponent.hpp> |
23 | | #include <rtl/ref.hxx> |
24 | | |
25 | | namespace chart::DisposeHelper |
26 | | { |
27 | | template <class T> void Dispose(const T& xInterface) |
28 | 0 | { |
29 | 0 | css::uno::Reference<css::lang::XComponent> xComponent(xInterface, css::uno::UNO_QUERY); |
30 | 0 | if (xComponent.is()) |
31 | 0 | xComponent->dispose(); |
32 | 0 | } Unexecuted instantiation: void chart::DisposeHelper::Dispose<com::sun::star::uno::Reference<com::sun::star::chart::XChartData> >(com::sun::star::uno::Reference<com::sun::star::chart::XChartData> const&) Unexecuted instantiation: void chart::DisposeHelper::Dispose<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> >(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) Unexecuted instantiation: void chart::DisposeHelper::Dispose<com::sun::star::uno::Reference<com::sun::star::awt::XRequestCallback> >(com::sun::star::uno::Reference<com::sun::star::awt::XRequestCallback> const&) Unexecuted instantiation: void chart::DisposeHelper::Dispose<com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> >(com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> const&) |
33 | | |
34 | | template <class T> void DisposeAndClear(css::uno::Reference<T>& rInterface) |
35 | 0 | { |
36 | 0 | Dispose<css::uno::Reference<T>>(rInterface); |
37 | 0 | rInterface.clear(); |
38 | 0 | } Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<com::sun::star::chart::XChartData>(com::sun::star::uno::Reference<com::sun::star::chart::XChartData>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<com::sun::star::beans::XPropertySet>(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<com::sun::star::awt::XRequestCallback>(com::sun::star::uno::Reference<com::sun::star::awt::XRequestCallback>&) |
39 | | |
40 | | template <class T> void DisposeAndClear(rtl::Reference<T>& rInterface) |
41 | 0 | { |
42 | 0 | if (rInterface) |
43 | 0 | { |
44 | 0 | rInterface->dispose(); |
45 | 0 | rInterface.clear(); |
46 | 0 | } |
47 | 0 | } Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::TitleWrapper>(rtl::Reference<chart::wrapper::TitleWrapper>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::LegendWrapper>(rtl::Reference<chart::wrapper::LegendWrapper>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::DiagramWrapper>(rtl::Reference<chart::wrapper::DiagramWrapper>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::AxisWrapper>(rtl::Reference<chart::wrapper::AxisWrapper>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::WallFloorWrapper>(rtl::Reference<chart::wrapper::WallFloorWrapper>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::MinMaxLineWrapper>(rtl::Reference<chart::wrapper::MinMaxLineWrapper>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::UpDownBarWrapper>(rtl::Reference<chart::wrapper::UpDownBarWrapper>&) Unexecuted instantiation: void chart::DisposeHelper::DisposeAndClear<chart::wrapper::GridWrapper>(rtl::Reference<chart::wrapper::GridWrapper>&) |
48 | | |
49 | | template <class Container> void DisposeAllElements(Container& rContainer) |
50 | 0 | { |
51 | 0 | for (const auto& rElement : rContainer) |
52 | 0 | { |
53 | 0 | Dispose<typename Container::value_type>(rElement); |
54 | 0 | } |
55 | 0 | } |
56 | | |
57 | | } // namespace chart::DisposeHelper |
58 | | |
59 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |