aboutsummaryrefslogtreecommitdiff
path: root/libs/libbsarch/src/utils/convertible_ostream.cpp
blob: d5ac23897cb19ff0667a1c258a7b5e6b1854c6c8 (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) 2019 G'k
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#include "convertible_ostream.hpp"

namespace libbsarch {
convertible_ostream &convertible_ostream::operator<<(const std::string &rh)
{
    std::cout << rh;
    return *this;
}
convertible_ostream &convertible_ostream::operator<<(const char *rh)
{
    std::cout << rh;
    return *this;
}
convertible_ostream &convertible_ostream::operator<<(const char rh)
{
    std::cout << rh;
    return *this;
}
convertible_ostream &convertible_ostream::operator<<(const std::wstring &rh)
{
    std::wcout << rh;
    return *this;
}
convertible_ostream &convertible_ostream::operator<<(const void *rh)
{
    std::cout << rh;
    return *this;
}
convertible_ostream &convertible_ostream::operator<<(const convertible_string &rh)
{
    return *this << std::string(rh);
}

convertible_ostream::operator std::ostream &()
{
    return std::cout;
}
convertible_ostream::operator std::wostream &()
{
    return std::wcout;
}

#ifdef LIBBSARCH_QT_SUPPORT
convertible_ostream::operator QDebug()
{
    return qDebug();
}
convertible_ostream &convertible_ostream::operator<<(const QString &rh)
{
    qDebug() << rh;
    return *this;
}
#endif
} // namespace libbsarch