SubString.h 1.3 KB

1234567891011121314151617181920212223242526
  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 SubString sealed : public JavascriptString
  9. {
  10. void const * originalFullStringReference; // Only here to prevent recycler to free this buffer.
  11. SubString(void const * originalFullStringReference, const wchar_t* subString, charcount_t length, ScriptContext *scriptContext);
  12. protected:
  13. DEFINE_VTABLE_CTOR(SubString, JavascriptString);
  14. DECLARE_CONCRETE_STRING_CLASS;
  15. public:
  16. static JavascriptString* New(JavascriptString* string, charcount_t start, charcount_t length);
  17. static JavascriptString* New(const wchar_t* stringStr, charcount_t start, charcount_t length, ScriptContext *scriptContext);
  18. virtual const wchar_t* GetSz() override;
  19. virtual void const * GetOriginalStringReference() override;
  20. virtual size_t GetAllocatedByteCount() const override;
  21. virtual bool IsSubstring() const override;
  22. };
  23. }