1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #ifndef INCLUDED_SHELL_INC_SPSUPP_COMREFCOUNTED_HPP
11 #define INCLUDED_SHELL_INC_SPSUPP_COMREFCOUNTED_HPP
16 template <class... Interfaces
>
17 class COMRefCounted
: public Interfaces
...
21 virtual ~COMRefCounted() {}
25 ULONG STDMETHODCALLTYPE
AddRef() override
27 return static_cast<ULONG
>(::InterlockedIncrement(&m_nRef
));
30 ULONG STDMETHODCALLTYPE
Release() override
33 if (::InterlockedDecrement(&m_nRef
) == 0)
38 return static_cast<ULONG
>(m_nRef
);
42 long m_nRef
= 1; // Created referenced
47 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */