1 #ifndef LIBSEX_UTILITY_HXX
2 #define LIBSEX_UTILITY_HXX
4 #include <libsex/Exception.hxx>
6 #include <cstdarg> // variadic argument fun
7 #include <cstdio> // size_t
12 * Formats a message and writes it into @a buffer.
14 * It is guaranteed that not more than @a length characters
15 * are written to @a buffer.
17 * @param buffer String to be filled.
18 * @param length Size of buffer.
19 * @param file Filename in which the error occured.
20 * @param line Line number in which the error occured.
21 * @param message printf formatstring template
22 * @param ap variadic argument list, holds parameters
23 * to be used when formatting (vsnprintf()).
24 * @return true if buffer was large enough, false otherwise
29 const char* const file
,
31 const char* const message
,
38 const char* const file
,
40 const char* const message
,
44 * Instanciates T with properly formatted message.
46 * T is supposed to have a static const char* TEMPLATE
47 * field, which will be used as formatstring for vformat().
49 * @param file To be passed on to format().
50 * @param line To be passed on to format().
51 * @param ... Passed to vformat() (sprintf() like).
52 * @return Instance of T.
56 const char* const file
,
61 * Instanciates T with properly formatted message and
62 * a previous exception.
68 const Exception
& previous
,
69 const char* const file
,
73 }; // End of namespace.
75 #include "utility.ixx"