4 * Declarations of auxiliary formatting functions intended
5 * for internal use only.
8 #ifndef LIBSEX_UTILITY_HXX
9 #define LIBSEX_UTILITY_HXX
11 #include <source/Exception.hxx>
13 #include <cstdarg> // variadic argument fun
14 #include <cstdio> // size_t
19 * Formats a message and writes it into @a buffer.
21 * It is guaranteed that not more than @a length
22 * characters are written to @a buffer.
24 * @param buffer String to be filled.
25 * @param length Size of buffer.
26 * @param file Filename in which the error occured.
27 * @param line Line number in which the error occured.
28 * @param message printf formatstring template
29 * @param ap variadic argument list, holds parameters
30 * to be used when formatting (vsnprintf()).
31 * @return true if buffer was large enough, false otherwise
36 const char* const file
,
38 const char* const message
,
45 const char* const file
,
47 const char* const message
,
51 * Instanciates T with properly formatted message.
53 * T is supposed to have a static const char* TEMPLATE
54 * field, which will be used as formatstring for vformat().
56 * @param file To be passed on to format().
57 * @param line To be passed on to format().
58 * @param ... Passed to vformat() (sprintf() like).
59 * @return Instance of T.
63 const char* const file
,
68 * Instanciates T with properly formatted message and
69 * a previous exception.
75 const Exception
& previous
,
76 const char* const file
,
81 #include "utility.ixx"