Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Burger::SafePrint::ProcessResults_t Struct Reference

struct to hold the results of parsing. More...

Public Member Functions

intptr_t ErrorHandler (const char *pFormatString, uintptr_t uArgCount, const ArgumentType **ppArgs) noexcept
 Error handler.
 
uintptr_t FormatArgument (char *pOutputBuffer, uintptr_t uOutputBufferSize, const ParamInfo_t *pParamInfo, const ArgumentType *pArgument) noexcept
 Output argument text.
 
uintptr_t GenerateFormatOutputToBuffer (char *pOutputBuffer, uintptr_t uOutputBufferSize, uintptr_t uArgCount, const ArgumentType **ppArgs, uintptr_t uParamInfoCount, const ParamInfo_t *pParamInfos) noexcept
 Output formatted text.
 
uint_t WriteBufferToFile (FILE *fp, const char *pBuffer, uintptr_t uBufferSize, uintptr_t uCharsSoFar) noexcept
 Write data to ANSI FILE record.
 
uintptr_t GenerateFormattedOutputToFile (FILE *fp, uintptr_t uArgCount, const ArgumentType **ppArgs, uintptr_t uParamInfoCount, const ParamInfo_t *pParamInfos) noexcept
 Output formatted text to a file.
 
uint_t FormatPreProcess (eParseOptions uOptions, const char *pFormat, uintptr_t uFormatLength, uintptr_t uArgCount, const ArgumentType **ppArgs, uintptr_t uParamInfoCount, ParamInfo_t *pParamInfos) noexcept
 Analyzes a format string, and creates a list of output commands that would created the output using it.
 

Public Attributes

uintptr_t m_uNumOutputCommands
 Number of output commands created.
 
uintptr_t m_uFormattedOutputLength
 Size of formatted output (no trailing null) in bytes.
 
uintptr_t m_uErrorFormatSequencePos
 Position of sequence that contains error.
 
uintptr_t m_uErrorCharPos
 Position of character that triggered error.
 
eError m_uPhaseResults
 Results of the parsing or output phase.
 

Detailed Description

struct to hold the results of parsing.


struct to hold the results of the parsing phase and output phases of a formatted output operation

Member Function Documentation

◆ ErrorHandler()

intptr_t BURGER_API Burger::SafePrint::ProcessResults_t::ErrorHandler ( const char * pFormatString,
uintptr_t uArgCount,
const ArgumentType ** ppArgs )
noexcept

Error handler.


Your opportunity to do additional error handling and reporting. The format string and parameters that were passed in are provided to this function so that detailed information on exactly what the error was

Parameters
pFormatStringPointer to the original format string
uArgCountCount of arguments in array
ppArgsArray of parsed arguments
Returns
Error code (Always negative)

◆ FormatArgument()

uintptr_t BURGER_API Burger::SafePrint::ProcessResults_t::FormatArgument ( char * pOutputBuffer,
uintptr_t uOutputBufferSize,
const ParamInfo_t * pParamInfo,
const ArgumentType * pArgument )
noexcept

Output argument text.


Given an argument, the output buffer is sanity checked and then the argument is converted to text and stored in the output buffer.

Parameters
pOutputBufferPointer to the output buffer
uOutputBufferSizeNumber of bytes in the output buffer
pParamInfoPointer to the structure with the information on how to print out the argument
pArgumentPointer to the structure with the argument data
Returns
Number of bytes outputted

◆ FormatPreProcess()

uint_t BURGER_API Burger::SafePrint::ProcessResults_t::FormatPreProcess ( eParseOptions uOptions,
const char * pFormat,
uintptr_t uFormatLength,
uintptr_t uArgCount,
const ArgumentType ** ppArgs,
uintptr_t uParamInfoCount,
ParamInfo_t * pParamInfos )
noexcept

Analyzes a format string, and creates a list of output commands that would created the output using it.


Output commands indicated either a section of text to literally* copy, or an argument to evaluate and convert (format).

Arguments and their corresponding conversion sequences are checked for syntactic errors and type compatibility

It can optionally suppress all argument checking - useful for quick error checking externally supplied format strings at load time

Returns results in ProcessResults_t :

  • Success in parsing the format string ( and arguments )
  • Accurate total OR estimated length of formatted output in bytes
  • Number of output commands created
  • Info on the format sequence that caused an error (if any)
Parameters
uOptions
pFormat
uFormatLength
uArgCountNumber of available arguments
ppArgsPointer to the array of pointers to arguments
uParamInfoCountNumber of parameter commands to process
pParamInfosPointer to an array of parameter commands
Returns
TRUE if successful in parsing, FALSE if there was an error

◆ GenerateFormatOutputToBuffer()

uintptr_t BURGER_API Burger::SafePrint::ProcessResults_t::GenerateFormatOutputToBuffer ( char * pOutputBuffer,
uintptr_t uOutputBufferSize,
uintptr_t uArgCount,
const ArgumentType ** ppArgs,
uintptr_t uParamInfoCount,
const ParamInfo_t * pParamInfos )
noexcept

Output formatted text.


Given a format string and a list of processed arguments, output the final string into the output buffer. If there are issues with the output or if the buffer is exhausted, parsing terminates.

Parameters
pOutputBufferPointer to the output buffer
uOutputBufferSizeNumber of bytes in the output buffer
uArgCountNumber of available arguments
ppArgsPointer to the array of pointers to arguments
uParamInfoCountNumber of parameter commands to process
pParamInfosPointer to an array of parameter commands
Returns
Number of bytes outputted

◆ GenerateFormattedOutputToFile()

uintptr_t BURGER_API Burger::SafePrint::ProcessResults_t::GenerateFormattedOutputToFile ( FILE * fp,
uintptr_t uArgCount,
const ArgumentType ** ppArgs,
uintptr_t uParamInfoCount,
const ParamInfo_t * pParamInfos )
noexcept

Output formatted text to a file.


Given a format string and a list of processed arguments, output the final string into a FILE. If there are issues with the output or if the buffer is exhausted, parsing terminates.

Parameters
fpPointer to the FILE
uArgCountNumber of available arguments
ppArgsPointer to the array of pointers to arguments
uParamInfoCountNumber of parameter commands to process
pParamInfosPointer to an array of parameter commands
Returns
Number of bytes outputted

◆ WriteBufferToFile()

uint_t BURGER_API Burger::SafePrint::ProcessResults_t::WriteBufferToFile ( FILE * fp,
const char * pBuffer,
uintptr_t uBufferSize,
uintptr_t uCharsSoFar )
noexcept

Write data to ANSI FILE record.


Write a data buffer to a FILE

Parameters
fpPointer to the FILE record
pBufferPointer to the buffer to write to the FILE
uBufferSizeNumber of bytes in the buffer to write
uCharsSoFarNumber of bytes written so far (Needed for error updating)
Returns
TRUE if successful, FALSE on failure

Member Data Documentation

◆ m_uErrorCharPos

uintptr_t Burger::SafePrint::ProcessResults_t::m_uErrorCharPos

Position of character that triggered error.

◆ m_uErrorFormatSequencePos

uintptr_t Burger::SafePrint::ProcessResults_t::m_uErrorFormatSequencePos

Position of sequence that contains error.

◆ m_uFormattedOutputLength

uintptr_t Burger::SafePrint::ProcessResults_t::m_uFormattedOutputLength

Size of formatted output (no trailing null) in bytes.

◆ m_uNumOutputCommands

uintptr_t Burger::SafePrint::ProcessResults_t::m_uNumOutputCommands

Number of output commands created.

◆ m_uPhaseResults

eError Burger::SafePrint::ProcessResults_t::m_uPhaseResults

Results of the parsing or output phase.