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)
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 @@ -382,6 +382,12 @@ class messaget
382382 // / render underlined text
383383 static const commandt underline;
384384
385+ // / start quoted text
386+ static const commandt quote_begin;
387+
388+ // / start quoted text
389+ static const commandt quote_end;
390+
385391 mstreamt &get_mstream (unsigned message_level) const
386392 {
387393 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
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+ 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);
103168 }
104169};
105170
You can’t perform that action at this time.
0 commit comments