ReactOS 0.4.16-dev-2621-gb0c8475
ciciface.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Cicero
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Cicero COM interface
5 * COPYRIGHT: Copyright 2026 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 */
7
8#pragma once
9
10#include "cicbase.h"
11
12template <typename T_IFACE>
14{
15protected:
16 T_IFACE* m_ptr;
17
18public:
20
22 {
23 if (m_ptr)
24 m_ptr->AddRef();
25 }
26
28 {
29 if (m_ptr)
30 m_ptr->Release();
31 }
32
33 void Attach(T_IFACE* ptr)
34 {
35 if (m_ptr)
36 m_ptr->Release();
37 m_ptr = ptr;
38 }
39
40 T_IFACE* Detach()
41 {
42 T_IFACE* old_ptr = m_ptr;
43 m_ptr = NULL;
44 return old_ptr;
45 }
46
47 operator T_IFACE*() { return m_ptr; }
48 T_IFACE* operator->() { return m_ptr; }
49
50 T_IFACE** operator&()
51 {
53 return &m_ptr;
54 }
55
56private:
59};
#define cicAssert
Definition: cicbase.h:11
T_IFACE * m_ptr
Definition: ciciface.h:16
T_IFACE * Detach()
Definition: ciciface.h:40
T_IFACE ** operator&()
Definition: ciciface.h:50
CicInterface_RefCnt(T_IFACE *ptr)
Definition: ciciface.h:21
T_IFACE * operator->()
Definition: ciciface.h:48
CicInterface_RefCnt(const CicInterface_RefCnt< T_IFACE > &)=delete
CicInterface_RefCnt< T_IFACE > & operator=(const CicInterface_RefCnt< T_IFACE > &)=delete
void Attach(T_IFACE *ptr)
Definition: ciciface.h:33
#define NULL
Definition: types.h:112
static PVOID ptr
Definition: dispmode.c:27