Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::MemoryView Class Reference

Core class that represents a view of the memory behaving like a stream. More...

Inheritance diagram for Nz::MemoryView:
Nz::Stream

Public Member Functions

 MemoryView (void *ptr, UInt64 size)
 Constructs a MemoryView object with a raw memory and a size. More...
 
 MemoryView (const void *ptr, UInt64 size)
 Constructs a MemoryView object with a raw memory and a size. More...
 
 MemoryView (const MemoryView &)=delete
 
 MemoryView (MemoryView &&)=delete
 
 ~MemoryView ()=default
 TODO.
 
bool EndOfStream () const override
 Checks whether the stream reached the end of the stream. More...
 
UInt64 GetCursorPos () const override
 Gets the position of the cursor. More...
 
UInt64 GetSize () const override
 Gets the size of the raw memory. More...
 
bool SetCursorPos (UInt64 offset) override
 Sets the position of the cursor. More...
 
MemoryViewoperator= (const MemoryView &)=delete
 
MemoryViewoperator= (MemoryView &&)=delete
 
- Public Member Functions inherited from Nz::Stream
 Stream (const Stream &)=default
 
 Stream (Stream &&)=default
 
virtual ~Stream ()
 Destructs the object.
 
void EnableTextMode (bool textMode)
 Enables the text mode. More...
 
void Flush ()
 Flushes the stream. More...
 
virtual String GetDirectory () const
 Gets the directory of the stream. More...
 
virtual String GetPath () const
 Gets the path of the stream. More...
 
OpenModeFlags GetOpenMode () const
 Gets the open mode of the stream. More...
 
StreamOptionFlags GetStreamOptions () const
 Gets the options of the stream. More...
 
std::size_t Read (void *buffer, std::size_t size)
 Reads the stream and puts the result in a buffer. More...
 
virtual String ReadLine (unsigned int lineSize=0)
 Reads a line from the stream. More...
 
bool IsReadable () const
 Checks whether the stream is readable. More...
 
bool IsSequential () const
 Checks whether the stream is sequential. More...
 
bool IsTextModeEnabled () const
 Checks whether the stream has text mode enabled. More...
 
bool IsWritable () const
 Checks whether the stream can be written. More...
 
bool Write (const ByteArray &byteArray)
 Writes a ByteArray into the stream. More...
 
bool Write (const String &string)
 Writes a String into the stream. More...
 
std::size_t Write (const void *buffer, std::size_t size)
 Writes in the stream the content of a buffer. More...
 
Streamoperator= (const Stream &)=default
 
Streamoperator= (Stream &&)=default
 

Additional Inherited Members

- Protected Member Functions inherited from Nz::Stream
 Stream (StreamOptionFlags streamOptions=StreamOption_None, OpenModeFlags openMode=OpenMode_NotOpen)
 Constructs a Stream object with options. More...
 
- Protected Attributes inherited from Nz::Stream
OpenModeFlags m_openMode
 
StreamOptionFlags m_streamOptions
 

Detailed Description

Core class that represents a view of the memory behaving like a stream.

Constructor & Destructor Documentation

◆ MemoryView() [1/2]

Nz::MemoryView::MemoryView ( void *  ptr,
UInt64  size 
)

Constructs a MemoryView object with a raw memory and a size.

Parameters
ptrPointer to raw memory
sizeSize that can be read
Remarks
If preallocated space of ptr is less than the size, the behaviour is undefined

◆ MemoryView() [2/2]

Nz::MemoryView::MemoryView ( const void *  ptr,
UInt64  size 
)

Constructs a MemoryView object with a raw memory and a size.

Parameters
ptrConstant pointer to raw memory
sizeSize that can be read
Remarks
If preallocated space of ptr is less than the size, the behaviour is undefined

Member Function Documentation

◆ EndOfStream()

bool Nz::MemoryView::EndOfStream ( ) const
overridevirtual

Checks whether the stream reached the end of the stream.

Returns
true if cursor is at the end of the stream

Implements Nz::Stream.

◆ GetCursorPos()

UInt64 Nz::MemoryView::GetCursorPos ( ) const
overridevirtual

Gets the position of the cursor.

Returns
Position of the cursor

Implements Nz::Stream.

◆ GetSize()

UInt64 Nz::MemoryView::GetSize ( ) const
overridevirtual

Gets the size of the raw memory.

Returns
Size of the memory

Implements Nz::Stream.

◆ SetCursorPos()

bool Nz::MemoryView::SetCursorPos ( UInt64  offset)
overridevirtual

Sets the position of the cursor.

Returns
true
Parameters
offsetOffset according to the beginning of the stream

Implements Nz::Stream.


The documentation for this class was generated from the following files: