skia2/docs/SkStream_Reference.bmh

530 lines
9.7 KiB
Plaintext
Raw Normal View History

#Topic Stream
#Alias Stream_Reference ##
#Class SkStream
SkStream describes an abstract class that provides readable serial access to
data. Subclass SkFILEStream stores readable data in a file. Subclass
SkMemoryStream stores readable data in memory.
SkStream data is immutable; data access is synchronous. Reading Stream data
returns only as many bytes as were available when Stream was created. Unlike
traditional streams, additional data will not become available at a later time
or on a subsequent read request.
#Subtopic Overview
#Populate
##
#Subtopic Constructor
#Populate
##
#Subtopic Member_Function
#Populate
##
# ------------------------------------------------------------------------------
#Method virtual ~SkStream()
#In Constructor
#Line # incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method SkStream()
#In Constructor
#Line # incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method static std::unique_ptr<SkStreamAsset> MakeFromFile(const char path[])
#In incomplete
#Line # incomplete ##
Attempts to open the specified file as a stream, returns nullptr on failure.
#Param path incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual size_t read(void* buffer, size_t size) = 0
#In incomplete
#Line # incomplete ##
Reads or skips size number of bytes.
If buffer is nullptr, skip size bytes, return how many were skipped.
If buffer is not nullptr, copy size bytes into buffer, return how many were copied.
#Param buffer when nullptr skip size bytes, otherwise copy size bytes into buffer
##
#Param size the number of bytes to skip or copy
##
#Return the number of bytes actually read.
##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method size_t skip(size_t size)
#In incomplete
#Line # incomplete ##
Skip size number of bytes. #Param size incomplete ##
#Return the actual number bytes that could be skipped
##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual size_t peek(void* buffer, size_t size) const
#In incomplete
#Line # incomplete ##
Attempt to peek at size bytes.
If this stream supports peeking, copy min(size, peekable bytes) into
buffer, and return the number of bytes copied.
If the stream does not support peeking, or cannot peek any bytes,
return 0 and leave buffer unchanged.
The stream is guaranteed to be in the same visible state after this
call, regardless of success or failure.
#Param buffer must not be nullptr, and must be at least size bytes. Destination
to copy bytes
##
#Param size number of bytes to copy
##
#Return number of bytes peeked/copied.
##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual bool isAtEnd() const = 0
#In incomplete
#Line # incomplete ##
Returns true when all the bytes in the stream have been read.
This may return true early (when there are no more bytes to be read)
or late (after the first unsuccessful read).
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readS8(int8_t* i)
#In incomplete
#Line # incomplete ##
#Param i incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readS16(int16_t* i)
#In incomplete
#Line # incomplete ##
#Param i incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readS32(int32_t* i)
#In incomplete
#Line # incomplete ##
#Param i incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readU8(uint8_t* i)
#In incomplete
#Line # incomplete ##
#Param i incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readU16(uint16_t* i)
#In incomplete
#Line # incomplete ##
#Param i incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readU32(uint32_t* i)
#In incomplete
#Line # incomplete ##
#Param i incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readBool(bool* b)
#In incomplete
#Line # incomplete ##
#Param b incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readScalar(SkScalar* s)
#In incomplete
#Line # incomplete ##
#Param s incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT readPackedUInt(size_t* u)
#In incomplete
#Line # incomplete ##
#Param u incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual bool rewind()
#In incomplete
#Line # incomplete ##
Rewinds to the beginning of the stream. Returns true if the stream is known
to be at the beginning after this call returns.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method std::unique_ptr<SkStream> duplicate() const
#In incomplete
#Line # incomplete ##
Duplicates this stream. If this cannot be done, returns NULL.
The returned stream will be positioned at the beginning of its data.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method std::unique_ptr<SkStream> fork() const
#In incomplete
#Line # incomplete ##
Duplicates this stream. If this cannot be done, returns NULL.
The returned stream will be positioned the same as this stream.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual bool hasPosition() const
#In incomplete
#Line # incomplete ##
Returns true if this stream can report its current position.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual size_t getPosition() const
#In incomplete
#Line # incomplete ##
Returns the current position in the stream. If this cannot be done, returns 0.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual bool seek(size_t position)
#In incomplete
#Line # incomplete ##
#Param position incomplete ##
Seeks to an absolute position in the stream. If this cannot be done, returns false.
If an attempt is made to seek past the end of the stream, the position will be set
to the end of the stream.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual bool move(long offset)
#In incomplete
#Line # incomplete ##
#Param offset incomplete ##
Seeks to an relative offset in the stream. If this cannot be done, returns false.
If an attempt is made to move to a position outside the stream, the position will be set
to the closest point within the stream (beginning or end).
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual bool hasLength() const
#In incomplete
#Line # incomplete ##
Returns true if this stream can report its total length.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual size_t getLength() const
#In incomplete
#Line # incomplete ##
Returns the total length of the stream. If this cannot be done, returns 0.
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
# ------------------------------------------------------------------------------
#Method virtual const void* getMemoryBase()
#In incomplete
#Line # incomplete ##
Returns the starting address for the data. If this cannot be done, returns NULL.
TODO: replace with virtual const SkData* getData()
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
#Method ##
#Class SkStream ##
#Topic Stream ##