parser/html/nsHtml5UTF16BufferCppSupplement.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(char16_t* aBuffer, int32_t aEnd)
michael@0 6 : buffer(aBuffer)
michael@0 7 , start(0)
michael@0 8 , end(aEnd)
michael@0 9 {
michael@0 10 MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
michael@0 11 }
michael@0 12
michael@0 13 nsHtml5UTF16Buffer::~nsHtml5UTF16Buffer()
michael@0 14 {
michael@0 15 MOZ_COUNT_DTOR(nsHtml5UTF16Buffer);
michael@0 16 }
michael@0 17
michael@0 18 void
michael@0 19 nsHtml5UTF16Buffer::DeleteBuffer()
michael@0 20 {
michael@0 21 delete[] buffer;
michael@0 22 }
michael@0 23
michael@0 24 void
michael@0 25 nsHtml5UTF16Buffer::Swap(nsHtml5UTF16Buffer* aOther)
michael@0 26 {
michael@0 27 char16_t* tempBuffer = buffer;
michael@0 28 int32_t tempStart = start;
michael@0 29 int32_t tempEnd = end;
michael@0 30 buffer = aOther->buffer;
michael@0 31 start = aOther->start;
michael@0 32 end = aOther->end;
michael@0 33 aOther->buffer = tempBuffer;
michael@0 34 aOther->start = tempStart;
michael@0 35 aOther->end = tempEnd;
michael@0 36 }

mercurial