Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
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, Buffer &destination)
 Constructs a StringFormatOutput object pushing to a destination buffer.
 
 StringFormatOutput (StringEncoding encoding, Console &destination)
 Constructs a StringFormatOutput object pushing to a console.
 
bool append (StringView text)
 Appends the StringView (eventually converting it) to destination buffer.
 
void onFormatBegin ()
 Method to be called when format begins, so that it can be rolled back on failure.
 
void onFormatFailed ()
 Method to be called when format fails (will rollback buffer to length before onFormatBegin)
 
bool onFormatSucceeded ()
 Method to be called when format succeeds.
 

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,
Buffer & 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)
nodiscard

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 ( )
nodiscard

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: