File tree Expand file tree Collapse file tree 4 files changed +80
-3
lines changed Expand file tree Collapse file tree 4 files changed +80
-3
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ console_message_handlert::console_message_handlert(bool _always_flush)
70
70
// / \param c: ECMA-48 command code
71
71
std::string console_message_handlert::command (unsigned c) const
72
72
{
73
+ // quote_begin and quote_end
74
+ if (c == ' <' || c == ' >' )
75
+ return " '" ;
76
+
73
77
if (!use_SGR)
74
78
return std::string ();
75
79
Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ const messaget::commandt messaget::bright_yellow(93);
95
95
const messaget::commandt messaget::bright_blue (94 );
96
96
const messaget::commandt messaget::bright_magenta (95 );
97
97
const messaget::commandt messaget::bright_cyan (96 );
98
+ const messaget::commandt messaget::quote_begin (' <' );
99
+ const messaget::commandt messaget::quote_end (' >' );
98
100
99
101
// / Parse a (user-)provided string as a verbosity level and set it as the
100
102
// / verbosity of dest.
Original file line number Diff line number Diff line change @@ -390,6 +390,12 @@ class messaget
390
390
// / render underlined text
391
391
static const commandt underline;
392
392
393
+ // / start quoted text
394
+ static const commandt quote_begin;
395
+
396
+ // / start quoted text
397
+ static const commandt quote_end;
398
+
393
399
mstreamt &get_mstream (unsigned message_level) const
394
400
{
395
401
mstream.message_level =message_level;
Original file line number Diff line number Diff line change @@ -96,10 +96,75 @@ class ui_message_handlert : public message_handlert
96
96
97
97
std::string command (unsigned c) const override
98
98
{
99
- if (message_handler)
100
- return message_handler->command (c);
101
- else
99
+ if (!message_handler)
102
100
return std::string ();
101
+
102
+ switch (_ui)
103
+ {
104
+ case uit::PLAIN:
105
+ switch (c)
106
+ {
107
+ case ' <' : // fall through
108
+ case ' >' :
109
+ return " '" ;
110
+ }
111
+ break ;
112
+ case uit::XML_UI:
113
+ switch (c)
114
+ {
115
+ case 0 : // reset
116
+ case 1 : // bold
117
+ case 2 : // faint
118
+ case 3 : // italic
119
+ case 4 : // underline
120
+ case 31 : // red
121
+ case 32 : // green
122
+ case 33 : // yellow
123
+ case 34 : // blue
124
+ case 35 : // magenta
125
+ case 36 : // cyan
126
+ case 91 : // bright_red
127
+ case 92 : // bright_green
128
+ case 93 : // bright_yellow
129
+ case 94 : // bright_blue
130
+ case 95 : // bright_magenta
131
+ case 96 : // bright_cyan
132
+ return std::string ();
133
+ case ' <' : // quote_begin
134
+ return " '" ; // could use something like <quote> here
135
+ case ' >' : // quote_end
136
+ return " '" ; // could use something like </quote> here
137
+ }
138
+ break ;
139
+ case uit::JSON_UI:
140
+ switch (c)
141
+ {
142
+ case 0 : // reset
143
+ case 1 : // bold
144
+ case 2 : // faint
145
+ case 3 : // italic
146
+ case 4 : // underline
147
+ case 31 : // red
148
+ case 32 : // green
149
+ case 33 : // yellow
150
+ case 34 : // blue
151
+ case 35 : // magenta
152
+ case 36 : // cyan
153
+ case 91 : // bright_red
154
+ case 92 : // bright_green
155
+ case 93 : // bright_yellow
156
+ case 94 : // bright_blue
157
+ case 95 : // bright_magenta
158
+ case 96 : // bright_cyan
159
+ return std::string ();
160
+ case ' <' : // quote_begin
161
+ case ' >' : // quote_end
162
+ return " '" ;
163
+ }
164
+ break ;
165
+ }
166
+
167
+ return message_handler->command (c);
103
168
}
104
169
};
105
170
You can’t perform that action at this time.
0 commit comments