parser/html/nsHtml5ByteReadable.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.

     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/. */
     5 #ifndef nsHtml5ByteReadable_h
     6 #define nsHtml5ByteReadable_h
     8 /**
     9  * A weak reference wrapper around a byte array.
    10  */
    11 class nsHtml5ByteReadable
    12 {
    13   public:
    15     nsHtml5ByteReadable(const uint8_t* aCurrent, const uint8_t* aEnd)
    16      : current(aCurrent),
    17        end(aEnd)
    18     {
    19     }
    21     inline int32_t read() {
    22       if (current < end) {
    23         return *(current++);
    24       } else {
    25         return -1;
    26       }
    27     }
    29   private:
    30     const uint8_t* current;
    31     const uint8_t* end;
    32 };
    33 #endif

mercurial