15 #ifndef INCG_IRIS_IUTEST_MESSAGE_HPP_0A05C876_F204_41F5_895F_F8454AB283B1_
16 #define INCG_IRIS_IUTEST_MESSAGE_HPP_0A05C876_F204_41F5_895F_F8454AB283B1_
20 #include "../iutest_env.hpp"
21 #include "../iutest_printers.hpp"
32 ::std::string FormatFileLocation(
const char* file,
int line);
36 ::std::string FormatCompilerIndependentFileLocation(
const char* file,
int line);
47 explicit iuStreamMessage(
const char* message) : m_stream(message) {}
48 iuStreamMessage(
const iuStreamMessage& rhs) : m_stream(rhs.GetString()) {}
51 ::std::string GetString()
const {
return m_stream.str(); }
54 iuStreamMessage& operator << (
const T& value)
56 #if !defined(IUTEST_NO_ARGUMENT_DEPENDENT_LOOKUP)
64 #if !defined(IUTEST_NO_ARGUMENT_DEPENDENT_LOOKUP)
65 template<
typename T,
size_t SIZE>
66 iuStreamMessage& operator << (
const T(&value)[SIZE])
72 iuStreamMessage& operator << (
bool b)
74 m_stream << (b ?
"true" :
"false");
79 #if IUTEST_HAS_IOMANIP
80 iuStreamMessage& operator << (iu_basic_iomanip val)
91 void add_message(
const char* str) { append(str); }
93 void append(
const char* str);
96 iuStreamMessage& operator = (
const iuStreamMessage&);
99 iu_global_format_stringstream m_stream;
102 inline iu_ostream& operator << (iu_ostream& os,
const iuStreamMessage& msg)
104 return os << msg.GetString();
112 ::std::string m_message;
116 iuCodeMessage(
const char* file,
int line,
const char* message)
118 , m_file(file ? file : kStrings::UnknownFile)
121 iuCodeMessage(
const char* file,
int line,
const iuStreamMessage& message)
122 : m_message(message.GetString())
123 , m_file(file ? file : kStrings::UnknownFile)
127 const char* message()
const {
return m_message.c_str(); }
134 iuCodeMessage& operator << (
const T& value)
136 m_message += (iuStreamMessage() << value).GetString();
144 void add_message(const ::std::string& str);
148 ::std::string make_message()
const;
149 ::std::string make_newline_message()
const
151 return make_message() +
"\n";
159 # include "../impl/iutest_message.ipp"
162 #endif // INCG_IRIS_IUTEST_MESSAGE_HPP_0A05C876_F204_41F5_895F_F8454AB283B1_