#include "gdbsupport/gdb_obstack.h"
#include "gdbsupport/gdb_select.h"
#include "gdbsupport/filestuff.h"
+#include "cli-out.h"
#include "cli/cli-style.h"
#include <chrono>
va_list args;
va_start (args, format);
- vfprintf_unfiltered (this, format, args);
+ vprintf (format, args);
va_end (args);
}
printchar (str[i], quoter, async_safe);
}
-int
+void
ui_file::putc (int c)
{
- return fputc_unfiltered (c, this);
+ char copy = (char) c;
+ write (©, 1);
}
void
ui_file::vprintf (const char *format, va_list args)
{
- vfprintf_unfiltered (this, format, args);
+ ui_out_flags flags = disallow_ui_out_field;
+ cli_ui_out (this, flags).vmessage (m_applied_style, format, args);
+}
+
+/* See ui-file.h. */
+
+void
+ui_file::emit_style_escape (const ui_file_style &style)
+{
+ if (can_emit_style_escape () && style != m_applied_style)
+ {
+ m_applied_style = style;
+ this->puts (style.to_ansi ().c_str ());
+ }
+}
+
+/* See ui-file.h. */
+
+void
+ui_file::reset_style ()
+{
+ if (can_emit_style_escape ())
+ {
+ m_applied_style = ui_file_style ();
+ this->puts (m_applied_style.to_ansi ().c_str ());
+ }
}
/* See ui-file.h. */
bool
stdio_file::can_emit_style_escape ()
{
- return ((this == gdb_stdout || this == gdb_stderr)
- && this->isatty ()
+ return (this->isatty ()
&& term_cli_styling ());
}
\f
-tee_file::tee_file (ui_file *one, ui_file_up &&two)
+tee_file::tee_file (ui_file *one, ui_file *two)
: m_one (one),
- m_two (std::move (two))
+ m_two (two)
{}
tee_file::~tee_file ()
bool
tee_file::can_emit_style_escape ()
{
- return ((this == gdb_stdout || this == gdb_stderr)
- && m_one->term_out ()
+ return (m_one->term_out ()
&& term_cli_styling ());
}