foobar2000 SDK  2015-08-03
console.h
Go to the documentation of this file.
1 namespace console
3 {
4  void info(const char * p_message);
5  void error(const char * p_message);
6  void warning(const char * p_message);
7  void info_location(const playable_location & src);
8  void info_location(const metadb_handle_ptr & src);
9  void print_location(const playable_location & src);
10  void print_location(const metadb_handle_ptr & src);
11 
12  void print(const char*);
13  void printf(const char*,...);
14  void printfv(const char*,va_list p_arglist);
15 
18  public:
19  ~formatter() {if (!is_empty()) console::print(get_ptr());}
20  };
21 #define FB2K_console_formatter() ::console::formatter()._formatter()
22 
23  void complain(const char * what, const char * msg);
24  void complain(const char * what, std::exception const & e);
25 
26  class timer_scope {
27  public:
28  timer_scope(const char * name) : m_name(name) {m_timer.start();}
30  try {
31  FB2K_console_formatter() << m_name << ": " << pfc::format_time_ex(m_timer.query(), 6);
32  } catch(...) {}
33  }
34  private:
36  const char * const m_name;
37  };
38 };
39 
41 class NOVTABLE console_receiver : public service_base {
42 public:
43  virtual void print(const char * p_message,t_size p_message_length) = 0;
44 
45  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(console_receiver);
46 };
void warning(const char *p_message)
Definition: console.cpp:6
void info(const char *p_message)
Definition: console.cpp:4
Usage: console::formatter() << "blah " << somenumber << " asdf" << somestring;.
Definition: console.h:17
void info_location(const playable_location &src)
Definition: console.cpp:8
void complain(const char *what, const char *msg)
Definition: console.cpp:21
void printf(const char *,...)
Definition: console.cpp:37
pfc::hires_timer m_timer
Definition: console.h:35
timer_scope(const char *name)
Definition: console.h:28
size_t t_size
Definition: int_types.h:48
string8_fastalloc string_formatter
Definition: string_base.h:615
Interface receiving console output. Do not call directly; use console namespace functions instead...
Definition: console.h:41
void print(const char *)
Definition: console.cpp:28
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
const char *const m_name
Definition: console.h:36
std::exception exception
Definition: primitives.h:193
void print_location(const playable_location &src)
Definition: console.cpp:16
Namespace with functions for sending text to console. All functions are fully multi-thread safe...
Definition: console.h:2
void error(const char *p_message)
Definition: console.cpp:5
void printfv(const char *, va_list p_arglist)
Definition: console.cpp:45