1 #ifndef LIBSEX_UTILITY_HXX
2 #define LIBSEX_UTILITY_HXX
4 #include <cstdarg> // variadic argument fun
5 #include <cstdio> // size_t
10 * Formats a message and writes it into @a buffer.
12 * It is guaranteed that not more than @a length characters
13 * are written to @a buffer.
15 * @param buffer String to be filled.
16 * @param length Size of buffer.
17 * @param file Filename in which the error occured.
18 * @param line Line number in which the error occured.
19 * @param message printf formatstring template
20 * @param ap variadic argument list, holds parameters
21 * to be used when formatting (vsnprintf()).
22 * @return true if buffer was large enough, false otherwise
27 const char* const file
,
29 const char* const message
,
36 const char* const file
,
38 const char* const message
,
42 * Instanciates T with properly formatted message.
44 * T is supposed to have a static const char* TEMPLATE
45 * field, which will be used as formatstring for vformat().
47 * @param file To be passed on to format().
48 * @param line To be passed on to format().
49 * @param ... Passed to vformat() (sprintf() like).
50 * @return Instance of T.
54 const char* const file
,
58 }; // End of namespace.
60 #include "utility.ixx"