Backed out 5 changesets (bug 1672493) for causing process-crashes @ @ mozilla::Thread...
[gecko.git] / parser / html / nsHtml5ByteReadable.h
blobe2e318364c76a75fdb64ab6810b1c1d85dd62119
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.
11 class nsHtml5ByteReadable {
12 public:
13 nsHtml5ByteReadable(const uint8_t* aCurrent, const uint8_t* aEnd)
14 : current(aCurrent), end(aEnd) {}
16 inline int32_t read() {
17 if (current < end) {
18 return *(current++);
19 } else {
20 return -1;
24 private:
25 const uint8_t* current;
26 const uint8_t* end;
28 #endif