summaryrefslogtreecommitdiffstats
path: root/tests/auto/conversion/testutil_p.h
blob: a70641071e93e23755d54a55f3c9ccde3dd318f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef TESTUTIL_P_H
#define TESTUTIL_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <qtcore/qt_windows.h>
#include <qtcore/private/qcomobject_p.h>
#include <qtcore/qtglobal>
#include <QtCore/private/qcomptr_p.h>
#include <atomic>

template <typename T>
ULONG refCount(const ComPtr<T> &p)
{
    p->AddRef();
    return p->Release();
}

struct IUnknownStub : QComObject<IUnknown>
{
};

struct IDispatchStub : QComObject<IDispatch>
{
    HRESULT GetTypeInfoCount(UINT * /*pctinfo*/) override { return E_NOTIMPL; }

    HRESULT GetTypeInfo(UINT /*iTInfo*/, LCID /*lcid*/, ITypeInfo ** /*ppTInfo*/) override
    {
        return E_NOTIMPL;
    }

    HRESULT GetIDsOfNames(const IID & /*riid*/, LPOLESTR * /*rgszNames*/, UINT /*cNames*/,
                          LCID /*lcid*/, DISPID * /*rgDispId*/) override
    {
        return E_NOTIMPL;
    }

    HRESULT Invoke(DISPID /*dispIdMember*/, const IID & /*riid*/, LCID /*lcid*/, WORD /*wFlags*/,
                   DISPPARAMS * /*pDispParams*/, VARIANT * /*pVarResult*/,
                   EXCEPINFO * /*pExcepInfo*/, UINT * /*puArgErr*/) override
    {
        return E_NOTIMPL;
    }
};

#endif