michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsHtml5DependentUTF16Buffer_h michael@0: #define nsHtml5DependentUTF16Buffer_h michael@0: michael@0: #include "nscore.h" michael@0: #include "nsHtml5OwningUTF16Buffer.h" michael@0: michael@0: class MOZ_STACK_CLASS nsHtml5DependentUTF16Buffer : public nsHtml5UTF16Buffer michael@0: { michael@0: public: michael@0: /** michael@0: * Wraps a string without taking ownership of the buffer. aToWrap MUST NOT michael@0: * go away or be shortened while nsHtml5DependentUTF16Buffer is in use. michael@0: */ michael@0: nsHtml5DependentUTF16Buffer(const nsAString& aToWrap); michael@0: michael@0: ~nsHtml5DependentUTF16Buffer(); michael@0: michael@0: /** michael@0: * Copies the currently unconsumed part of this buffer into a new michael@0: * heap-allocated nsHtml5OwningUTF16Buffer. The new object is allocated michael@0: * with a fallible allocator. If the allocation fails, nullptr is returned. michael@0: * @return heap-allocated copy or nullptr if memory allocation failed michael@0: */ michael@0: already_AddRefed FalliblyCopyAsOwningBuffer(); michael@0: }; michael@0: michael@0: #endif // nsHtml5DependentUTF16Buffer_h