michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsHtml5ByteReadable_h michael@0: #define nsHtml5ByteReadable_h michael@0: michael@0: /** michael@0: * A weak reference wrapper around a byte array. michael@0: */ michael@0: class nsHtml5ByteReadable michael@0: { michael@0: public: michael@0: michael@0: nsHtml5ByteReadable(const uint8_t* aCurrent, const uint8_t* aEnd) michael@0: : current(aCurrent), michael@0: end(aEnd) michael@0: { michael@0: } michael@0: michael@0: inline int32_t read() { michael@0: if (current < end) { michael@0: return *(current++); michael@0: } else { michael@0: return -1; michael@0: } michael@0: } michael@0: michael@0: private: michael@0: const uint8_t* current; michael@0: const uint8_t* end; michael@0: }; michael@0: #endif