Advertisement
Naohiro19

String Literal Macro (shortcut added and change Macro Name)

Apr 12th, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #pragma once
  2.  
  3. #ifndef STRING
  4. #define STRING(quote) quote
  5. #endif
  6.  
  7. #ifndef WSTRING
  8. #define WSTRING(quote) L ## quote
  9. #endif
  10.  
  11. #ifndef UTF8_STRING
  12. #define UTF8_STRING(quote) u8 ## quote
  13. #endif
  14.  
  15. #ifndef UTF16_STRING
  16. #define UTF16_STRING(quote) u ## quote
  17. #endif
  18.  
  19. #ifndef UTF32_STRING
  20. #define UTF32_STRING(quote) U ## quote
  21. #endif
  22.  
  23. #ifndef STR
  24. #define STR STRING
  25. #define S STRING
  26. #endif
  27.  
  28. #ifndef WSTR
  29. #define WSTR WSTRING
  30. #define W WSTRING
  31. #endif
  32.  
  33. #ifndef UTF8
  34. #define UTF8 UTF8_STRING
  35. #define U8 UTF8_STRING
  36. #endif
  37.  
  38. #ifndef UTF16
  39. #define UTF16 UTF16_STRING
  40. #define U16 UTF16_STRING
  41. #endif
  42.  
  43. #ifndef UTF32
  44. #define UTF32 UTF32_STRING
  45. #define U32 UTF32_STRING
  46. #endif
  47.  
  48. /*
  49.  S("string") → "string"
  50.  W("string") → L"string"
  51.  U8("string") → u8"string"
  52.  U16("string") → u"string"
  53.  U32("string") → U"string"
  54.  
  55. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement