/* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file.
*/
Light weight class for reading data from a memory block. The RBuffer is given the buffer to read from, with either a specified size or no size (in which case no range checking is performed). It is iillegal to attempt to read a value from an empty RBuffer (data == null).
*/ class SkRBuffer : SkNoncopyable { public:
SkRBuffer() : fData(nullptr), fPos(nullptr), fStop(nullptr) {}
/** Initialize RBuffer with a data point and length.
*/
SkRBuffer(constvoid* data, size_t size) {
SkASSERT(data != nullptr || size == 0);
fData = (constchar*)data;
fPos = (constchar*)data;
fStop = (constchar*)data + size;
}
/** Return the number of bytes that have been read from the beginning of the data pointer.
*/
size_t pos() const { return fPos - fData; } /** Return the total size of the data pointer. Only defined if the length was specified in the constructor or in a call to reset().
*/
size_t size() const { return fStop - fData; } /** Return true if the buffer has read to the end of the data pointer. Only defined if the length was specified in the constructor or in a call to reset(). Always returns true if the length was not specified.
*/ bool eof() const { return fPos >= fStop; }
size_t available() const { return fStop - fPos; }
bool isValid() const { return fValid; }
/** Read the specified number of bytes from the data pointer. If buffer is not null, copy those bytes into buffer.
*/ bool read(void* buffer, size_t size); bool skipToAlign4();
Light weight class for writing data to a memory block. The WBuffer is given the buffer to write into, with either a specified size or no size, in which case no range checking is performed. An empty WBuffer is legal, in which case no data is ever written, but the relative pos() is updated.
*/ class SkWBuffer : SkNoncopyable { public:
SkWBuffer() : fData(nullptr), fPos(nullptr), fStop(nullptr) {}
SkWBuffer(void* data) { reset(data); }
SkWBuffer(void* data, size_t size) { reset(data, size); }
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.