DebugWriter.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #if ENABLE_REGEX_CONFIG_OPTIONS
  6. #pragma once
  7. namespace UnifiedRegex
  8. {
  9. class DebugWriter : private Chars<char16>
  10. {
  11. private:
  12. static const Char* const hex;
  13. static const int bufLen = 2048;
  14. Char buf[bufLen];
  15. int indent;
  16. bool nlPending;
  17. public:
  18. DebugWriter();
  19. void __cdecl Print(const Char *form, ...);
  20. void __cdecl PrintEOL(const Char *form, ...);
  21. void PrintEscapedString(const Char *str, CharCount len);
  22. void PrintQuotedString(const Char *str, CharCount len);
  23. void PrintEscapedChar(Char c);
  24. void PrintQuotedChar(Char c);
  25. void EOL();
  26. void Indent();
  27. void Unindent();
  28. void Flush();
  29. private:
  30. inline void CheckForNewline()
  31. {
  32. if (nlPending)
  33. {
  34. BeginLine();
  35. nlPending = false;
  36. }
  37. }
  38. void BeginLine();
  39. };
  40. }
  41. #endif