GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/log.hh Lines: 0 4 0.0 %
Date: 2024-04-14 11:13:22 Branches: 0 2 0.0 %

Line Branch Exec Source
1
// Copyright (c) 2020, Joseph Mirabel
2
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3
//
4
// This file is part of gepetto-viewer.
5
// gepetto-viewer is free software: you can redistribute it
6
// and/or modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation, either version
8
// 3 of the License, or (at your option) any later version.
9
//
10
// gepetto-viewer is distributed in the hope that it will be
11
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
// General Lesser Public License for more details.  You should have
14
// received a copy of the GNU Lesser General Public License along with
15
// gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16
17
#include <QString>
18
#include <gepetto/viewer/config.hh>
19
#include <ostream>
20
21
namespace gepetto {
22
23
typedef char const* (*QStringInsertFunction)(QString const& s);
24
25
char const* use_toLocal8Bit(QString const& s) GEPETTO_VIEWER_LOCAL;
26
char const* use_toUtf8(QString const& s) GEPETTO_VIEWER_LOCAL;
27
char const* use_toLatin1(QString const& s) GEPETTO_VIEWER_LOCAL;
28
std::ostream& operator<<(std::ostream& out,
29
                         QStringInsertFunction fun) GEPETTO_VIEWER_LOCAL;
30
std::ostream& operator<<(std::ostream& out,
31
                         QString const& s) GEPETTO_VIEWER_LOCAL;
32
QStringInsertFunction& insertFunction() GEPETTO_VIEWER_LOCAL;
33
34
inline char const* use_toLocal8Bit(QString const& s) {
35
  return s.toLocal8Bit().constData();
36
}
37
38
inline char const* use_toUtf8(QString const& s) {
39
  return s.toUtf8().constData();
40
}
41
42
inline char const* use_toLatin1(QString const& s) {
43
  return s.toLatin1().constData();
44
}
45
46
inline std::ostream& operator<<(std::ostream& out, QStringInsertFunction fun) {
47
  insertFunction() = fun;
48
  return out;
49
}
50
51
inline std::ostream& operator<<(std::ostream& out, QString const& s) {
52
  return out << insertFunction()(s);
53
}
54
55
void setLogFile(const char* filename) GEPETTO_VIEWER_LOCAL;
56
57
std::ostream& log() GEPETTO_VIEWER_LOCAL;
58
}  // namespace gepetto