MinitScript  0.9.31 PRE-BETA
ErrorConsole.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string_view>
5 
8 
9 using std::string_view;
10 using std::unique_ptr;
11 
12 /**
13  * Console class
14  * @author Andreas Drewke
15  * @versio $Id$
16  */
18 {
19 public:
20  /**
21  * Console logger
22  */
23  struct Logger
24  {
25  /**
26  * Destructor
27  */
28  virtual ~Logger() {}
29 
30  /**
31  * Print given string and trailing newline to console
32  * @param str string
33  */
34  virtual void printLine(const string_view& str) = 0;
35 
36  /**
37  * Print given string without trainling newline to console
38  * @param str string
39  */
40  virtual void print(const string_view& str) = 0;
41 
42  /**
43  * Print given string and trailing newline to console
44  * @param str string
45  */
46  virtual void printLine() = 0;
47  };
48 
49  /**
50  * Set logger
51  * @param logger logger
52  */
53  static void setLogger(Logger* logger);
54 
55  /**
56  * Print given string and trailing newline to error console
57  * @param str string
58  */
59  static void printLine(const string_view& str);
60 
61  /**
62  * Print given string to error console without trainling new line
63  * @param str string
64  */
65  static void print(const string_view& str);
66 
67  /**
68  * Print newline to error console
69  */
70  static void printLine();
71 
72 private:
73  MINITSCRIPT_STATIC_DLL_IMPEXT static unique_ptr<Logger> logger;
74 };
static void printLine()
Print newline to error console.
static void setLogger(Logger *logger)
Set logger.
static void print(const string_view &str)
Print given string to error console without trainling new line.
static MINITSCRIPT_STATIC_DLL_IMPEXT unique_ptr< Logger > logger
Definition: ErrorConsole.h:73
#define MINITSCRIPT_STATIC_DLL_IMPEXT
Definition: minitscript.h:18
virtual void print(const string_view &str)=0
Print given string without trainling newline to console.
virtual void printLine()=0
Print given string and trailing newline to console.
virtual void printLine(const string_view &str)=0
Print given string and trailing newline to console.