JSONStringBuilder.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #pragma once
  6. namespace Js
  7. {
  8. class JSONStringBuilder
  9. {
  10. private:
  11. ScriptContext* scriptContext;
  12. const char16* endLocation;
  13. char16* currentLocation;
  14. JSONProperty* jsonContent;
  15. const char16* gap;
  16. charcount_t gapLength;
  17. uint32 indentLevel;
  18. void AppendGap(uint32 count);
  19. void AppendCharacter(char16 character);
  20. void AppendBuffer(_In_ const char16* buffer, charcount_t length);
  21. void AppendString(_In_ JavascriptString* str);
  22. void EscapeAndAppendString(_In_ JavascriptString* str);
  23. void AppendObjectString(_In_ JSONObject* valueList);
  24. void AppendArrayString(_In_ JSONArray* valueArray);
  25. void AppendJSONPropertyString(_In_ JSONProperty* prop);
  26. public:
  27. JSONStringBuilder(
  28. _In_ ScriptContext* scriptContext,
  29. _In_ JSONProperty* jsonContent,
  30. _In_ char16* buffer,
  31. charcount_t bufferLength,
  32. _In_opt_ const char16* gap,
  33. charcount_t gapLength);
  34. void Build();
  35. };
  36. } // namespace Js