Documentation for ByteArray and ByteStream
Former-commit-id: 4d2d0de93562077e030b4304b57f6c95b32185b5
This commit is contained in:
@@ -9,6 +9,19 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \class Nz::ByteArray
|
||||
* \brief Core class that represents an array of bytes
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param byteArray The ByteArray to output
|
||||
*/
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::ByteArray& byteArray)
|
||||
{
|
||||
out << byteArray.ToHex();
|
||||
|
||||
@@ -11,24 +11,61 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \class Nz::ByteStream
|
||||
* \brief Core class that represents a stream of bytes
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a ByteStream object with a byte array
|
||||
*
|
||||
* \param byteArray Bytes to stream
|
||||
* \param openMode Reading/writing mode for the stream
|
||||
*/
|
||||
|
||||
ByteStream::ByteStream(ByteArray* byteArray, UInt32 openMode) :
|
||||
ByteStream()
|
||||
{
|
||||
SetStream(byteArray, openMode);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a ByteStream object with a raw memory and a size
|
||||
*
|
||||
* \param ptr Pointer to raw memory
|
||||
* \param size Size that can be read
|
||||
*
|
||||
* \remark If preallocated space of ptr is less than the size, the behaviour is undefined
|
||||
*/
|
||||
|
||||
ByteStream::ByteStream(void* ptr, Nz::UInt64 size) :
|
||||
ByteStream()
|
||||
{
|
||||
SetStream(ptr, size);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a ByteStream object with a raw memory and a size
|
||||
*
|
||||
* \param ptr Constant pointer to raw memory
|
||||
* \param size Size that can be read
|
||||
*
|
||||
* \remark If preallocated space of ptr is less than the size, the behaviour is undefined
|
||||
*/
|
||||
|
||||
ByteStream::ByteStream(const void* ptr, Nz::UInt64 size) :
|
||||
ByteStream()
|
||||
{
|
||||
SetStream(ptr, size);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets this with a byte array
|
||||
*
|
||||
* \param byteArray Bytes to stream
|
||||
* \param openMode Reading/writing mode for the stream
|
||||
*/
|
||||
|
||||
void ByteStream::SetStream(ByteArray* byteArray, UInt32 openMode)
|
||||
{
|
||||
std::unique_ptr<Stream> stream(new MemoryStream(byteArray, openMode));
|
||||
@@ -38,6 +75,15 @@ namespace Nz
|
||||
m_ownedStream = std::move(stream);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets this with a raw memory and a size
|
||||
*
|
||||
* \param ptr Pointer to raw memory
|
||||
* \param size Size that can be read
|
||||
*
|
||||
* \remark If preallocated space of ptr is less than the size, the behaviour is undefined
|
||||
*/
|
||||
|
||||
void ByteStream::SetStream(void* ptr, Nz::UInt64 size)
|
||||
{
|
||||
std::unique_ptr<Stream> stream(new MemoryView(ptr, size));
|
||||
@@ -47,6 +93,15 @@ namespace Nz
|
||||
m_ownedStream = std::move(stream);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets this with a raw memory and a size
|
||||
*
|
||||
* \param ptr Constant pointer to raw memory
|
||||
* \param size Size that can be read
|
||||
*
|
||||
* \remark If preallocated space of ptr is less than the size, the behaviour is undefined
|
||||
*/
|
||||
|
||||
void ByteStream::SetStream(const void* ptr, Nz::UInt64 size)
|
||||
{
|
||||
std::unique_ptr<Stream> stream(new MemoryView(ptr, size));
|
||||
@@ -56,6 +111,12 @@ namespace Nz
|
||||
m_ownedStream = std::move(stream);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Signal function (meant to be virtual)
|
||||
*
|
||||
* \remark Produces a NazaraError
|
||||
*/
|
||||
|
||||
void ByteStream::OnEmptyStream()
|
||||
{
|
||||
NazaraError("No stream");
|
||||
|
||||
Reference in New Issue
Block a user