 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
10 #include <QListWidget>
28 : m_printFn(
std::move(printFn))
43 void write(
const char *messagePart)
46 const size_t len = strlen(messagePart);
47 const char *messageEnd = messagePart + len;
48 const char *start = messagePart;
50 const char *newLinePos;
51 while ((newLinePos = strchr(start,
'\n')) !=
nullptr)
53 m_currentMessage += QString::fromUtf8(start,
static_cast<int>(newLinePos - start));
54 m_printFn(m_currentMessage);
55 m_currentMessage.clear();
56 start = newLinePos + 1;
59 if (start != messageEnd)
61 m_currentMessage += QString::fromUtf8(start,
static_cast<int>(messageEnd - start));
67 m_printFn(m_currentMessage);
71 QString m_currentMessage{};
72 std::function<void(
const QString &)> m_printFn;
82 void write(
const char *messagePart)
90 m_output.
write(messagePart);
105 const QString m_prefix;
108 if (m_prefix.isEmpty())
137 m_output.
write(messagePart);
158 auto *messageItem =
new QListWidgetItem(message);
159 messageItem->setForeground(m_brush);
160 m_view->addItem(messageItem);
164 if (m_prefix.isEmpty())
ConsoleWrapper(std::function< void(const QString &)> printFn)
Definition: Consoles.h:27
static bool Print(const char *format,...)
Prints out a formatted message in console.
Definition: CVLog.cpp:113
math::float4 color
Definition: LineSetBuffers.cpp:46
void flush() const
Definition: Consoles.h:99
Redirects messages to ACloudViewer's console output.
Definition: Consoles.h:76
void write(const char *messagePart)
Definition: Consoles.h:43
ccConsoleOutput()=default
Definition: Consoles.h:22
void flush() const
Definition: Consoles.h:65
void write(const char *messagePart)
Definition: Consoles.h:82
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
ccConsoleOutput(const char *prefix)
Definition: Consoles.h:80
bool isatty() const
Definition: Consoles.h:94