Documentation for ByteArray and ByteStream

Former-commit-id: 4d2d0de93562077e030b4304b57f6c95b32185b5
This commit is contained in:
Gawaboumga
2016-02-21 14:32:59 +01:00
parent f540029825
commit d340553023
4 changed files with 594 additions and 0 deletions

View File

@@ -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");