parser/html/nsHtml5UTF16BufferCppSupplement.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/html/nsHtml5UTF16BufferCppSupplement.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(char16_t* aBuffer, int32_t aEnd)
     1.9 +  : buffer(aBuffer)
    1.10 +  , start(0)
    1.11 +  , end(aEnd)
    1.12 +{
    1.13 +  MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
    1.14 +}
    1.15 +
    1.16 +nsHtml5UTF16Buffer::~nsHtml5UTF16Buffer()
    1.17 +{
    1.18 +  MOZ_COUNT_DTOR(nsHtml5UTF16Buffer);
    1.19 +}
    1.20 +
    1.21 +void
    1.22 +nsHtml5UTF16Buffer::DeleteBuffer()
    1.23 +{
    1.24 +  delete[] buffer;
    1.25 +}
    1.26 +
    1.27 +void
    1.28 +nsHtml5UTF16Buffer::Swap(nsHtml5UTF16Buffer* aOther)
    1.29 +{
    1.30 +  char16_t* tempBuffer = buffer;
    1.31 +  int32_t tempStart = start;
    1.32 +  int32_t tempEnd = end;
    1.33 +  buffer = aOther->buffer;
    1.34 +  start = aOther->start;
    1.35 +  end = aOther->end;
    1.36 +  aOther->buffer = tempBuffer;
    1.37 +  aOther->start = tempStart;
    1.38 +  aOther->end = tempEnd;
    1.39 +}

mercurial