Commit 52e2f8b140c85b59d03553393d5a944cf912d1ed

Authored by giumas
Committed by jarro2783
1 parent c2c22626

Remove curly single-quotes only on Windows (#68)

This uses normal single quotes when on a Windows platform.
Showing 1 changed file with 24 additions and 16 deletions
include/cxxopts.hpp
@@ -243,6 +243,14 @@ namespace cxxopts @@ -243,6 +243,14 @@ namespace cxxopts
243 243
244 namespace cxxopts 244 namespace cxxopts
245 { 245 {
  246 +#ifdef _WIN32
  247 + const std::string LQUOTE("\'");
  248 + const std::string RQUOTE("\'");
  249 +#else
  250 + const std::string LQUOTE("‘");
  251 + const std::string RQUOTE("’");
  252 +#endif
  253 +
246 class Value : public std::enable_shared_from_this<Value> 254 class Value : public std::enable_shared_from_this<Value>
247 { 255 {
248 public: 256 public:
@@ -319,7 +327,7 @@ namespace cxxopts @@ -319,7 +327,7 @@ namespace cxxopts
319 { 327 {
320 public: 328 public:
321 option_exists_error(const std::string& option) 329 option_exists_error(const std::string& option)
322 - : OptionSpecException(u8"Option ‘" + option + u8"’ already exists") 330 + : OptionSpecException(u8"Option " + LQUOTE + option + RQUOTE + u8" already exists")
323 { 331 {
324 } 332 }
325 }; 333 };
@@ -328,7 +336,7 @@ namespace cxxopts @@ -328,7 +336,7 @@ namespace cxxopts
328 { 336 {
329 public: 337 public:
330 invalid_option_format_error(const std::string& format) 338 invalid_option_format_error(const std::string& format)
331 - : OptionSpecException(u8"Invalid option format ‘" + format + u8"’") 339 + : OptionSpecException(u8"Invalid option format " + LQUOTE + format + RQUOTE)
332 { 340 {
333 } 341 }
334 }; 342 };
@@ -337,7 +345,7 @@ namespace cxxopts @@ -337,7 +345,7 @@ namespace cxxopts
337 { 345 {
338 public: 346 public:
339 option_not_exists_exception(const std::string& option) 347 option_not_exists_exception(const std::string& option)
340 - : OptionParseException(u8"Option ‘" + option + u8"’ does not exist") 348 + : OptionParseException(u8"Option " + LQUOTE + option + RQUOTE + u8" does not exist")
341 { 349 {
342 } 350 }
343 }; 351 };
@@ -346,7 +354,7 @@ namespace cxxopts @@ -346,7 +354,7 @@ namespace cxxopts
346 { 354 {
347 public: 355 public:
348 missing_argument_exception(const std::string& option) 356 missing_argument_exception(const std::string& option)
349 - : OptionParseException(u8"Option ‘" + option + u8"’ is missing an argument") 357 + : OptionParseException(u8"Option " + LQUOTE + option + RQUOTE + u8" is missing an argument")
350 { 358 {
351 } 359 }
352 }; 360 };
@@ -355,7 +363,7 @@ namespace cxxopts @@ -355,7 +363,7 @@ namespace cxxopts
355 { 363 {
356 public: 364 public:
357 option_requires_argument_exception(const std::string& option) 365 option_requires_argument_exception(const std::string& option)
358 - : OptionParseException(u8"Option ‘" + option + u8"’ requires an argument") 366 + : OptionParseException(u8"Option " + LQUOTE + option + RQUOTE + u8" requires an argument")
359 { 367 {
360 } 368 }
361 }; 369 };
@@ -368,9 +376,9 @@ namespace cxxopts @@ -368,9 +376,9 @@ namespace cxxopts
368 const std::string& option, 376 const std::string& option,
369 const std::string& arg 377 const std::string& arg
370 ) 378 )
371 - : OptionParseException(  
372 - u8"Option ‘" + option + u8"’ does not take an argument, but argument‘"  
373 - + arg + "’ given") 379 + : OptionParseException(
  380 + u8"Option " + LQUOTE + option + RQUOTE + u8" does not take an argument, but argument"
  381 + + LQUOTE + arg + RQUOTE + " given")
374 { 382 {
375 } 383 }
376 }; 384 };
@@ -379,7 +387,7 @@ namespace cxxopts @@ -379,7 +387,7 @@ namespace cxxopts
379 { 387 {
380 public: 388 public:
381 option_not_present_exception(const std::string& option) 389 option_not_present_exception(const std::string& option)
382 - : OptionParseException(u8"Option ‘" + option + u8"’ not present") 390 + : OptionParseException(u8"Option " + LQUOTE + option + RQUOTE + u8" not present")
383 { 391 {
384 } 392 }
385 }; 393 };
@@ -391,9 +399,9 @@ namespace cxxopts @@ -391,9 +399,9 @@ namespace cxxopts
391 ( 399 (
392 const std::string& arg 400 const std::string& arg
393 ) 401 )
394 - : OptionParseException(  
395 - u8"Argument ‘" + arg + u8"’ failed to parse"  
396 - ) 402 + : OptionParseException(
  403 + u8"Argument " + LQUOTE + arg + RQUOTE + u8" failed to parse"
  404 + )
397 { 405 {
398 } 406 }
399 }; 407 };
@@ -402,10 +410,10 @@ namespace cxxopts @@ -402,10 +410,10 @@ namespace cxxopts
402 { 410 {
403 public: 411 public:
404 option_required_exception(const std::string& option) 412 option_required_exception(const std::string& option)
405 - : OptionParseException  
406 - (  
407 - u8"Option ‘" + option + u8"’ is required but not present"  
408 - ) 413 + : OptionParseException
  414 + (
  415 + u8"Option " + LQUOTE + option + RQUOTE + u8" is required but not present"
  416 + )
409 { 417 {
410 } 418 }
411 }; 419 };