File tree Expand file tree Collapse file tree 4 files changed +79
-3
lines changed
Expand file tree Collapse file tree 4 files changed +79
-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)
7070// / \param c: ECMA-48 command code
7171std::string console_message_handlert::command (unsigned c) const
7272{
73+ // quote_begin and quote_end
74+ if (c == ' <' || c == ' >' )
75+ return " '" ;
76+
7377 if (!use_SGR)
7478 return std::string ();
7579
Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ const messaget::commandt messaget::bright_yellow(93);
9595const messaget::commandt messaget::bright_blue (94 );
9696const messaget::commandt messaget::bright_magenta (95 );
9797const messaget::commandt messaget::bright_cyan (96 );
98+ const messaget::commandt messaget::quote_begin (' <' );
99+ const messaget::commandt messaget::quote_end (' >' );
98100
99101// / Parse a (user-)provided string as a verbosity level and set it as the
100102// / verbosity of dest.
Original file line number Diff line number Diff line change @@ -390,6 +390,12 @@ class messaget
390390 // / render underlined text
391391 static const commandt underline;
392392
393+ // / start quoted text
394+ static const commandt quote_begin;
395+
396+ // / start quoted text
397+ static const commandt quote_end;
398+
393399 mstreamt &get_mstream (unsigned message_level) const
394400 {
395401 mstream.message_level =message_level;
Original file line number Diff line number Diff line change @@ -96,10 +96,74 @@ class ui_message_handlert : public message_handlert
9696
9797 std::string command (unsigned c) const override
9898 {
99- if (message_handler)
100- return message_handler->command (c);
101- else
99+ if (!message_handler)
102100 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+ case ' >' : // quote_end
135+ return " '" ;
136+ }
137+ break ;
138+ case uit::JSON_UI:
139+ switch (c)
140+ {
141+ case 0 : // reset
142+ case 1 : // bold
143+ case 2 : // faint
144+ case 3 : // italic
145+ case 4 : // underline
146+ case 31 : // red
147+ case 32 : // green
148+ case 33 : // yellow
149+ case 34 : // blue
150+ case 35 : // magenta
151+ case 36 : // cyan
152+ case 91 : // bright_red
153+ case 92 : // bright_green
154+ case 93 : // bright_yellow
155+ case 94 : // bright_blue
156+ case 95 : // bright_magenta
157+ case 96 : // bright_cyan
158+ return std::string ();
159+ case ' <' : // quote_begin
160+ case ' >' : // quote_end
161+ return " '" ;
162+ }
163+ break ;
164+ }
165+
166+ return message_handler->command (c);
103167 }
104168};
105169
You can’t perform that action at this time.
0 commit comments