ActiveLib
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
active::utility::BufferOut Class Reference
Inheritance diagram for active::utility::BufferOut:
Inheritance graph
[legend]
Collaboration diagram for active::utility::BufferOut:
Collaboration graph
[legend]

Public Member Functions

 BufferOut ()
 
 BufferOut (file::File &destFile, Memory::sizeOption bufferSize=std::nullopt, DataFormat format=DataFormat{})
 
 BufferOut (Memory &memory, Memory::sizeOption bufferSize=std::nullopt, DataFormat format=DataFormat{})
 
 BufferOut (Memory &&memory, Memory::sizeOption bufferSize=std::nullopt, DataFormat format=DataFormat{})
 
 BufferOut (String &destString, Memory::sizeOption bufferSize=std::nullopt, DataFormat format=DataFormat{})
 
 BufferOut (BufferOut &&source) noexcept
 
 BufferOut (const BufferOut &source)=delete
 
virtual ~BufferOut ()
 
BufferOutoperator= (BufferOut &&source) noexcept
 
BufferOutoperator= (const BufferOut &)=delete
 
 operator bool () const
 
const BufferOutoperator<< (char val) const
 
const BufferOutoperator<< (const String &str) const
 
const BufferOutoperator<< (int16_t val) const
 
const BufferOutoperator<< (int32_t val) const
 
const BufferOutoperator<< (uint32_t val) const
 
const BufferOutoperator<< (int64_t val) const
 
const BufferOutoperator<< (uint64_t val) const
 
const BufferOutoperator<< (double val) const
 
Memory::sizeOption maxSize () const
 
Memory::sizeOption getPosition () const
 
DataFormat format () const
 
TextEncoding getEncoding () const
 
const BufferOutwrite (const String &toWrite) const
 
const BufferOutwrite (const String &toWrite, DataFormat format) const
 
const BufferOutwrite (const char *toWrite, Memory::size_type length) const
 
const BufferOutwrite (unsigned char toWrite) const
 
template<class T >
const BufferOutwriteBinary (const T &obj) const
 
const BufferOutflush () const
 
void setDestination (file::File *destFile)
 
void setDestination (Memory *memory)
 
void setDestination (String *destString)
 
void setEncoding (TextEncoding encoding)
 
- Public Member Functions inherited from active::file::IOBase
 IOBase () noexcept
 
 IOBase (const IOBase &source) noexcept
 
virtual ~IOBase () noexcept=default
 
bool operator! () const noexcept
 
 operator void * () const noexcept
 
virtual bool good () const noexcept
 
virtual bool eof () const noexcept
 
virtual bool fail () const noexcept
 
virtual bool bad () const noexcept
 
virtual flag_type state () const noexcept
 
virtual void clear (flag_type f=std::ios_base::goodbit)
 
virtual void setState (flag_type f)
 
virtual void unsetState (flag_type f)
 

Protected Member Functions

virtual bool isMyBuffer () const
 
const MemorygetBuffer () const
 
void setBuffer (void *buffer, Memory::size_type size) const
 
virtual bool confirmBuffer () const
 
- Protected Member Functions inherited from active::file::IOBase
void setCompleteState (flag_type state)
 
void clear (flag_type f=std::ios_base::goodbit) const
 
void setState (flag_type f) const
 
virtual void unsetState (flag_type f) const
 

Additional Inherited Members

- Public Types inherited from active::file::IOBase
using flag_type = std::ios_base::iostate
 The state flag representation type.
 

Constructor & Destructor Documentation

◆ BufferOut() [1/6]

BufferOut::BufferOut ( )

Default constructor

◆ BufferOut() [2/6]

BufferOut::BufferOut ( file::File & destFile,
Memory::sizeOption bufferSize = std::nullopt,
DataFormat format = DataFormat{} )

Constructor

Parameters
destFileThe destination data file
bufferSizeSuggested buffer size (can minimise overheads if a small number is suggested - large values will be ignored)
formatThe destination data format
Here is the call graph for this function:

◆ BufferOut() [3/6]

BufferOut::BufferOut ( Memory & memory,
Memory::sizeOption bufferSize = std::nullopt,
DataFormat format = DataFormat{} )

Constructor

Parameters
memoryThe destination memory block
bufferSizeSuggested buffer size (can minimise overheads if a small number is suggested - large values will be ignored)
formatThe destination data format
Here is the call graph for this function:

◆ BufferOut() [4/6]

BufferOut::BufferOut ( Memory && memory,
Memory::sizeOption bufferSize = std::nullopt,
DataFormat format = DataFormat{} )

Constructor

Parameters
memoryThe destination memory block
bufferSizeSuggested buffer size (can minimise overheads if a small number is suggested - large values will be ignored)
formatThe destination data format
Here is the call graph for this function:

◆ BufferOut() [5/6]

BufferOut::BufferOut ( String & destString,
Memory::sizeOption bufferSize = std::nullopt,
DataFormat format = DataFormat{} )

Constructor

Parameters
destStringThe destination string
bufferSizeSuggested buffer size (can minimise overheads if a small number is suggested - large values will be ignored)
formatThe destination data format
Here is the call graph for this function:

◆ BufferOut() [6/6]

BufferOut::BufferOut ( BufferOut && source)
noexcept

Move constructor

Parameters
sourceThe object to move

◆ ~BufferOut()

BufferOut::~BufferOut ( )
virtual

Destructor

Member Function Documentation

◆ confirmBuffer()

bool BufferOut::confirmBuffer ( ) const
protectedvirtual

Confirm the buffer is mine and prepared to receive data

Returns
True if the buffer is confirmed (false = bad buffer state - writing will be rejected)

Reimplemented in active::utility::StackBufferOut< S >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

const BufferOut & active::utility::BufferOut::flush ( ) const
inline

Flush the buffer to the destination

Returns
A reference to this
Here is the caller graph for this function:

◆ format()

DataFormat active::utility::BufferOut::format ( ) const
inline

Get the destination data format

Returns
The data format
Here is the caller graph for this function:

◆ getBuffer()

const Memory & active::utility::BufferOut::getBuffer ( ) const
inlineprotected

Get the buffer memory

Returns
The buffer memory
Here is the caller graph for this function:

◆ getEncoding()

TextEncoding active::utility::BufferOut::getEncoding ( ) const
inline

Get the source text encoding (NB: for text input functionality only)

Returns
The text encoding type

◆ getPosition()

Memory::sizeOption BufferOut::getPosition ( ) const

Get the current write position in the destination (not the write position in the buffer)

Returns
The write position (e.g. the write position in a destination file, nullopt on error)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMyBuffer()

virtual bool active::utility::BufferOut::isMyBuffer ( ) const
inlineprotectedvirtual

Determine is the buffer is owned by this object

Returns
True if this object owns the buffer

Reimplemented in active::utility::StackBufferOut< S >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ maxSize()

Memory::sizeOption BufferOut::maxSize ( ) const

Get the maximum size of the output buffer (when a fixed-sized memory buffer is used)

Returns
The maximum number of bytes the buffer can hold (null-opt for any dynamic buffer target)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool()

active::utility::BufferOut::operator bool ( ) const
inline

Bool operator

Returns
True if the source is not is a failed state
Here is the call graph for this function:

◆ operator<<() [1/8]

const BufferOut & active::utility::BufferOut::operator<< ( char val) const
inline

Write operator

Parameters
valA character to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator<<() [2/8]

const BufferOut & active::utility::BufferOut::operator<< ( const String & str) const
inline

Write operator

Parameters
strA string to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator<<() [3/8]

const BufferOut & active::utility::BufferOut::operator<< ( double val) const
inline

Write operator

Parameters
valA double value to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator<<() [4/8]

const BufferOut & active::utility::BufferOut::operator<< ( int16_t val) const
inline

Write operator

Parameters
valA 16-bit integer to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator<<() [5/8]

const BufferOut & active::utility::BufferOut::operator<< ( int32_t val) const
inline

Write operator

Parameters
valA 32-bit integer to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator<<() [6/8]

const BufferOut & active::utility::BufferOut::operator<< ( int64_t val) const
inline

Write operator

Parameters
valA 64-bit integer to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator<<() [7/8]

const BufferOut & active::utility::BufferOut::operator<< ( uint32_t val) const
inline

Write operator

Parameters
valAn unsigned 32-bit integer to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator<<() [8/8]

const BufferOut & active::utility::BufferOut::operator<< ( uint64_t val) const
inline

Write operator

Parameters
valAn unsigned 64-bit integer to write
Returns
A reference to this
Here is the call graph for this function:

◆ operator=()

BufferOut & BufferOut::operator= ( BufferOut && source)
noexcept

Assignment with move operator

Parameters
sourceThe object to move
Returns
A reference to this object

◆ setBuffer()

void active::utility::BufferOut::setBuffer ( void * buffer,
Memory::size_type size ) const
inlineprotected

Set the buffer memory

Parameters
bufferThe buffer memory
sizeThe buffer size
Here is the caller graph for this function:

◆ setDestination() [1/3]

void BufferOut::setDestination ( file::File * destFile)

Set the buffer output destination

Parameters
destFileThe destination data file

◆ setDestination() [2/3]

void BufferOut::setDestination ( Memory * memory)

Set the buffer output destination

Parameters
memoryThe destination memory block

◆ setDestination() [3/3]

void BufferOut::setDestination ( String * destString)

Set the buffer output destination

Parameters
destStringThe destination string

◆ setEncoding()

void active::utility::BufferOut::setEncoding ( TextEncoding encoding)
inline

Set The source text encoding

Parameters
encodingThe text encoding type

◆ write() [1/4]

const BufferOut & BufferOut::write ( const char * toWrite,
Memory::size_type length ) const

Write a specified memory block (NB: The data is not assumed to be text - simply a stream of bytes. Avoid when buffering to a string)

Parameters
toWriteThe block address
lengthThe number of bytes to write
Returns
A reference to this
Here is the call graph for this function:

◆ write() [2/4]

const BufferOut & active::utility::BufferOut::write ( const String & toWrite) const
inline

Write the specified string (using the buffer text encoding)

Parameters
toWriteThe string to write
Returns
A reference to this
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [3/4]

const BufferOut & BufferOut::write ( const String & toWrite,
DataFormat format ) const

Write the specified string (using the specified text encoding)

Parameters
toWriteThe string to write
formatThe data format
Returns
A reference to this
Here is the call graph for this function:

◆ write() [4/4]

const BufferOut & BufferOut::write ( unsigned char toWrite) const

Write a single byte

Parameters
toWriteThe byte to write
Returns
A reference to this
Here is the call graph for this function:

◆ writeBinary()

template<class T >
const BufferOut & active::utility::BufferOut::writeBinary ( const T & obj) const
inline

Write an object to the buffer as binary data (NB: Avoid when buffering to a string)

Parameters
objThe object to write
Returns
A reference to this
Here is the call graph for this function:
Here is the caller graph for this function:

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