nsHtml5DependentUTF16Buffer.h (1120B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef nsHtml5DependentUTF16Buffer_h 6 #define nsHtml5DependentUTF16Buffer_h 7 8 #include "nscore.h" 9 #include "nsHtml5OwningUTF16Buffer.h" 10 11 class MOZ_STACK_CLASS nsHtml5DependentUTF16Buffer : public nsHtml5UTF16Buffer { 12 public: 13 /** 14 * Wraps a string without taking ownership of the buffer. aToWrap MUST NOT 15 * go away or be shortened while nsHtml5DependentUTF16Buffer is in use. 16 */ 17 explicit nsHtml5DependentUTF16Buffer(const nsAString& aToWrap); 18 19 ~nsHtml5DependentUTF16Buffer(); 20 21 /** 22 * Copies the currently unconsumed part of this buffer into a new 23 * heap-allocated nsHtml5OwningUTF16Buffer. The new object is allocated 24 * with a fallible allocator. If the allocation fails, nullptr is returned. 25 * @return heap-allocated copy or nullptr if memory allocation failed 26 */ 27 already_AddRefed<nsHtml5OwningUTF16Buffer> FalliblyCopyAsOwningBuffer(); 28 }; 29 30 #endif // nsHtml5DependentUTF16Buffer_h