Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::StringFormatOutput Struct Reference

Allows pushing results of StringFormat to a buffer or to the console. More...

#include <StringFormat.h>

Public Member Functions

 StringFormatOutput (StringEncoding encoding, Vector< char > &destination)
 Constructs a StringFormatOutput object pushing to a destination buffer. More...
 
 StringFormatOutput (StringEncoding encoding, Console &destination)
 Constructs a StringFormatOutput object pushing to a console. More...
 
bool append (StringView text)
 Appends the StringView (eventually converting it) to destination buffer. More...
 
void onFormatBegin ()
 Method to be called when format begins, so that it can be rolled back on failure. More...
 
void onFormatFailed ()
 Method to be called when format fails (will rollback buffer to length before onFormatBegin) More...
 
bool onFormatSucceeded ()
 Method to be called when format succeeds. More...
 

Detailed Description

Allows pushing results of StringFormat to a buffer or to the console.

Constructor & Destructor Documentation

◆ StringFormatOutput() [1/2]

SC::StringFormatOutput::StringFormatOutput ( StringEncoding  encoding,
Vector< char > &  destination 
)

Constructs a StringFormatOutput object pushing to a destination buffer.

Parameters
encodingThe given encoding
destinationThe destination buffer

◆ StringFormatOutput() [2/2]

SC::StringFormatOutput::StringFormatOutput ( StringEncoding  encoding,
Console destination 
)

Constructs a StringFormatOutput object pushing to a console.

Parameters
encodingThe given encoding
destinationThe destination console

Member Function Documentation

◆ append()

bool SC::StringFormatOutput::append ( StringView  text)

Appends the StringView (eventually converting it) to destination buffer.

Parameters
textThe StringView to be appended to buffer or console
Returns
true if conversion succeeded

◆ onFormatBegin()

void SC::StringFormatOutput::onFormatBegin ( )

Method to be called when format begins, so that it can be rolled back on failure.

◆ onFormatFailed()

void SC::StringFormatOutput::onFormatFailed ( )

Method to be called when format fails (will rollback buffer to length before onFormatBegin)

◆ onFormatSucceeded()

bool SC::StringFormatOutput::onFormatSucceeded ( )

Method to be called when format succeeds.

Returns
true if null terminator has been successfully added

The documentation for this struct was generated from the following file: