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
...
20 virtual ~COMRefCounted() {}
24 ULONG STDMETHODCALLTYPE
AddRef() override
26 return static_cast<ULONG
>(::InterlockedIncrement(&m_nRef
));
29 ULONG STDMETHODCALLTYPE
Release() override
32 if (::InterlockedDecrement(&m_nRef
) == 0)
37 return static_cast<ULONG
>(m_nRef
);
41 LONG m_nRef
= 1; // Created referenced
46 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */