aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qtcreatorcdbext/outputcallback.h
blob: b2100a0e551932c0d246519b6e94d9e73056c369 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include "common.h"

/* OutputCallback catches DEBUG_OUTPUT_DEBUGGEE and reports it
 * hex-encoded back to Qt Creator. */
class OutputCallback : public IDebugOutputCallbacksWide
{
public:
    explicit OutputCallback(IDebugOutputCallbacksWide *wrapped);
    virtual ~OutputCallback();
    // IUnknown.
    STDMETHOD(QueryInterface)(
            THIS_
            IN REFIID InterfaceId,
            OUT PVOID* Interface
            );
    STDMETHOD_(ULONG, AddRef)(
            THIS
            );
    STDMETHOD_(ULONG, Release)(
            THIS
            );

    // IDebugOutputCallbacks.
    STDMETHOD(Output)(
            THIS_
            IN ULONG mask,
            IN PCWSTR text
            );

    void startRecording();
    std::wstring stopRecording();

private:
    IDebugOutputCallbacksWide *m_wrapped;
    bool m_recording = false;
    std::wstring m_recorded;
};