- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages
- Examples

# fastformat/fastformat.h File Reference

## Detailed Description

[C, C++] Primary include file for the The FastFormat Core Library.

`#include <stddef.h>`
`#include <fastformat/internal/string_encoding.h>`
`#include "./internal/shim_macros.h"`

Go to the source code of this file.

## Namespaces
namespace | fastformat
namespace | fastformat::util
namespace | fastformat::filters
namespace | fastformat::iterators
namespace | fastformat::sinks
namespace | fastformat::internal
namespace | stlsoft
## Classes
struct | ff_string_slice_t
| Read-only string slice. More...
struct | ff_illformed_handler_info_t
| Structure returned from fastformat_getProcessIllformedHandler(), fastformat_setProcessIllformedHandler(), fastformat_getThreadIllformedHandler(), and fastformat_setThreadIllformedHandler(). More...
struct | ff_mismatched_handler_info_t
| Structure returned from fastformat_getProcessMismatchedHandler(), fastformat_setProcessMismatchedHandler(), fastformat_getThreadMismatchedHandler(), and fastformat_setThreadMismatchedHandler(). More...
## Defines
#define | FASTFORMAT_VER_MAJOR 0
| The major version number of FastFormat.
#define | FASTFORMAT_VER_MINOR 6
| The minor version number of FastFormat.
#define | FASTFORMAT_VER_REVISION 1
| The revision version number of FastFormat.
#define | FASTFORMAT_VER FASTFORMAT_VER_0_6_1_ALPHA_1
| The current composite version number of FastFormat.
#define | FASTFORMAT_DECLSPEC
| Storage class specifier to be applied to all FastFormat API functions.
#define | FASTFORMAT_EXTERN_C extern "C"
| Resolves to `extern` when compiling in C, and `extern "C"` when compiling in C++.
#define | FASTFORMAT_CALLCONV
| Calling convention specifier to be applied to all FastFormat API functions.
#define | FASTFORMAT_CALL(rt) FASTFORMAT_DECLSPEC FASTFORMAT_EXTERN_C rt FASTFORMAT_CALLCONV
| Used to declare and define FastFormat API functions.
## Typedefs
typedef char | ff_char_t
| Character type used by the library.
typedef ff_string_slice_t | string_slice_t
| Equivalent to ff_string_slice_t.
typedef ff_format_element_t | format_element_t
| Equivalent to ff_format_element_t.
typedef ff_parse_code_t | parse_code_t
| Equivalent to ff_parse_code_t.
typedef ff_replacement_code_t | replacement_code_t
| Equivalent to ff_replacement_code_t.
typedef int(* | fastformat_illformedHandler_t )(void *param, ff_parse_code_t code, ff_char_t const *format, size_t formatLen, size_t replacementIndex, ff_char_t const *defect, size_t defectLen, int parameterIndex, void *reserved0, size_t reserved1, void *reserved2)
| Ill-formed format handler callback function.
typedef fastformat_illformedHandler_t | illformedHandler_t
| Equivalent to fastformat_illformedHandler_t.
typedef ff_illformed_handler_info_t | illformed_handler_info_t
| Equivalent to ff_illformed_handler_info_t.
typedef int(* | fastformat_mismatchedHandler_t )(void *param, ff_replacement_code_t code, size_t numParameters, int parameterIndex, ff_string_slice_t *slice, void *reserved0, size_t reserved1, void *reserved2)
| Mismatched replacement index handler callback function.
typedef fastformat_mismatchedHandler_t | mismatchedHandler_t
| Equivalent to fastformat_mismatchedHandler_t.
typedef ff_mismatched_handler_info_t | mismatched_handler_info_t
| Equivalent to ff_mismatched_handler_info_t.
## Enumerations
enum | ff_parse_code_t { FF_PARSECODE_SUCCESS = 0, FF_PARSECODE_INCOMPLETEREPLACEMENT = 1, FF_PARSECODE_INVALIDINDEX = 2 }
| Represents format parsing conditions. More...
enum | ff_replacement_code_t { FF_REPLACEMENTCODE_SUCCESS = 0, FF_REPLACEMENTCODE_MISSING_ARGUMENT = 1, FF_REPLACEMENTCODE_UNREFERENCED_ARGUMENT = 2 }
| Represents parameter replacement conditions. More...
## Functions
int | fastformat_init (void)
| Initialises the FastFormat library.
void | fastformat_uninit (void)
| Uninitialises the FastFormat library.
ff_char_t const * | fastformat_getInitCodeString (int code)
| Returns a constant pointer to a non-NULL non-modifiable nul-terminated string representing the initialisation code.
size_t | fastformat_getInitCodeStringLength (int code)
| Returns the length of the string returned by fastformat_getInitCodeString().
int | init ()
| Equivalent to fastformat_init().
void | uninit ()
| Equivalent to fastformat_uninit().
ff_char_t const * | getInitCodeString (int code)
| Equivalent to fastformat_getInitCodeString().
size_t | getInitCodeStringLength (int code)
| Equivalent to fastformat_getInitCodeStringLength().
ff_illformed_handler_info_t | fastformat_getProcessIllformedHandler (void)
| Gets the ill-formed format handler for the calling process.
ff_illformed_handler_info_t | fastformat_setProcessIllformedHandler (fastformat_illformedHandler_t handler, void *param)
| Sets the ill-formed format handler for the calling process.
ff_illformed_handler_info_t | fastformat_getThreadIllformedHandler (void)
| Gets the ill-formed format handler for the calling thread.
ff_illformed_handler_info_t | fastformat_setThreadIllformedHandler (fastformat_illformedHandler_t handler, void *param)
| Sets the ill-formed format handler for the calling thread.
ff_mismatched_handler_info_t | fastformat_getProcessMismatchedHandler (void)
| Gets the mismatched parameter handler for the calling process.
ff_mismatched_handler_info_t | fastformat_setProcessMismatchedHandler (fastformat_mismatchedHandler_t handler, void *param)
| Sets the mismatched parameter handler for the calling process.
ff_mismatched_handler_info_t | fastformat_getThreadMismatchedHandler (void)
| Gets the mismatched parameter handler for the calling thread.
ff_mismatched_handler_info_t | fastformat_setThreadMismatchedHandler (fastformat_mismatchedHandler_t handler, void *param)
| Sets the mismatched parameter handler for the calling thread.
size_t | fastformat_calculateNumberOfRequiredReplacements (ff_char_t const *format, size_t cchFormat)
| Calculates the exact number of replacements required for the given format.
unsigned | fastformat_parseFormat (ff_char_t const *format, size_t cchFormat, ff_format_element_t *formatElements, size_t numFormatElements, fastformat_illformedHandler_t handler, void *param)
| Parses a format string into an array of replacement element descriptors.
size_t | fastformat_fillReplacements (ff_string_slice_t *resultElements, ff_format_element_t const *formatElements, size_t numElements, ff_string_slice_t const *arguments, size_t numArguments, fastformat_mismatchedHandler_t handler, void *param, size_t *pnumResultElements)
| Takes a number of pattern and replacement elements and populates an array of result elements.
size_t | fastformat_accumulateSliceLengths (size_t numSlices, ff_string_slice_t const *slices)
| Calculates the total length of an array of string slices.
unsigned | fastformat_lookupPattern (ff_char_t const *pattern, size_t cchPattern, ff_format_element_t const **elements)
| Looks up the array of replacement element descriptors, corresponding to the given pattern, from the pattern cache.
ff_string_slice_t | fastformat_getNewlineForPlatform (void)
| Returns a slice representing the CR/LF combination for the current platform.
ff_illformed_handler_info_t | getProcessIllformedHandler ()
| Equivalent to fastformat_getProcessIllformedHandler().
ff_illformed_handler_info_t | setProcessIllformedHandler (illformedHandler_t handler, void *param)
| Equivalent to fastformat_setProcessIllformedHandler().
ff_illformed_handler_info_t | getThreadIllformedHandler ()
| Equivalent to fastformat_getThreadIllformedHandler().
ff_illformed_handler_info_t | setThreadIllformedHandler (illformedHandler_t handler, void *param)
| Equivalent to fastformat_setThreadIllformedHandler().
ff_mismatched_handler_info_t | getProcessMismatchedHandler ()
| Equivalent to fastformat_getProcessMismatchedHandler().
ff_mismatched_handler_info_t | setProcessMismatchedHandler (mismatchedHandler_t handler, void *param)
| Equivalent to fastformat_setProcessMismatchedHandler().
ff_mismatched_handler_info_t | getThreadMismatchedHandler ()
| Equivalent to fastformat_getThreadMismatchedHandler().
ff_mismatched_handler_info_t | setThreadMismatchedHandler (mismatchedHandler_t handler, void *param)
| Equivalent to fastformat_setThreadMismatchedHandler().
string_slice_t | getNewlineForPlatform ()
| Equivalent to fastformat_getNewlineForPlatform().
char const * | c_str_data_a (ff_string_slice_t const &slice)
| Returns a possibly non-nul-terminated non-NULL C-style string representing the slice.
ff_char_t const * | c_str_data (ff_string_slice_t const &slice)
| Returns a possibly non-nul-terminated non-NULL C-style string representing the slice.
size_t | c_str_len_a (ff_string_slice_t const &slice)
| Returns the number of characters in the length of the C-style string representing the slice.
size_t | c_str_len (ff_string_slice_t const &slice)
| Returns the number of characters in the length of the C-style string representing the slice.

## Define Documentation

#define FASTFORMAT_CALL | ( | rt |  | ) | FASTFORMAT_DECLSPEC FASTFORMAT_EXTERN_C rt FASTFORMAT_CALLCONV

Used to declare and define FastFormat API functions.

#define FASTFORMAT_CALLCONV

Calling convention specifier to be applied to all FastFormat API functions.

Used in the FASTFORMAT_CALL() macro.

#define FASTFORMAT_DECLSPEC

Storage class specifier to be applied to all FastFormat API functions.

Defaults to no symbol. Can be defined to a symbol appropriate to the operating system and linkage model. e.g. on Windows you might choose to define it to `__declspec(dllexport)` when building FastFormat and to `__declspec(dllimport)` in client code using FastFormat.

Used in the FASTFORMAT_CALL() macro.

#define FASTFORMAT_EXTERN_C extern "C"

Resolves to `extern` when compiling in C, and `extern "C"` when compiling in C++.

Used in the FASTFORMAT_CALL() macro.

#define FASTFORMAT_VER FASTFORMAT_VER_0_6_1_ALPHA_1

The current composite version number of FastFormat.

#define FASTFORMAT_VER_MAJOR 0

The major version number of FastFormat.

#define FASTFORMAT_VER_MINOR 6

The minor version number of FastFormat.

#define FASTFORMAT_VER_REVISION 1

The revision version number of FastFormat.

FastFormat Library documentation © Matthew Wilson, 2006-2009 |