LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
QsDebugOutput.cpp
Go to the documentation of this file.
1// Copyright (c) 2010, Razvan Petru
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6// Redistribution and use in source and binary forms, with or without modification,
7// are permitted provided that the following conditions are met:
8
9// * Redistributions of source code must retain the above copyright notice, this
10// list of conditions and the following disclaimer.
11// * Redistributions in binary form must reproduce the above copyright notice, this
12// list of conditions and the following disclaimer in the documentation and/or other
13// materials provided with the distribution.
14// * The name of the contributors may not be used to endorse or promote products
15// derived from this software without specific prior written permission.
16
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
26// OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#include "QsDebugOutput.h"
29#include <QString>
30#include <QtGlobal>
31
32#if defined(Q_OS_WIN)
33#define WIN32_LEAN_AND_MEAN
34#include <Windows.h>
35#include <iostream>
36void QsDebugOutput::output( const QString& message )
37{
38// std::cerr << qPrintable(message) << std::endl;
39 OutputDebugStringW(reinterpret_cast<const WCHAR*>(message.utf16()));
40 OutputDebugStringW(L"");
41}
42#elif defined(Q_OS_SYMBIAN)
43#include <e32debug.h>
44void QsDebugOutput::output( const QString& message )
45{
46 TPtrC8 symbianMessage(reinterpret_cast<const TUint8*>(qPrintable(message)));
47 RDebug::RawPrint(symbianMessage);
48}
49#elif defined(Q_OS_UNIX)
50#include <cstdio>
51void QsDebugOutput::output( const QString& message )
52{
53 fprintf(stderr, "%s\n", qPrintable(message));
54 fflush(stderr);
55}
56#endif
57
static void output(const QString &a_message)