15 #ifndef INCG_IRIS_IUTEST_MESSAGE_HPP_0A05C876_F204_41F5_895F_F8454AB283B1_
16 #define INCG_IRIS_IUTEST_MESSAGE_HPP_0A05C876_F204_41F5_895F_F8454AB283B1_
21 #include "../iutest_env.hpp"
22 #include "../iutest_printers.hpp"
34 ::std::string FormatFileLocation(
const char* file,
int line);
38 ::std::string FormatCompilerIndependentFileLocation(
const char* file,
int line);
49 explicit iuStreamMessage(
const char* message) : m_stream(message) {}
50 iuStreamMessage(
const iuStreamMessage& rhs) : m_stream(rhs.GetString()) {}
53 ::std::string GetString()
const {
return m_stream.str(); }
56 iuStreamMessage& operator << (
const T& value)
58 #if !defined(IUTEST_NO_ARGUMENT_DEPENDENT_LOOKUP)
66 #if !defined(IUTEST_NO_ARGUMENT_DEPENDENT_LOOKUP)
67 template<
typename T,
size_t SIZE>
68 iuStreamMessage& operator << (
const T(&value)[SIZE])
74 iuStreamMessage& operator << (
bool b)
76 m_stream << (b ?
"true" :
"false");
81 #if IUTEST_HAS_IOMANIP
82 iuStreamMessage& operator << (iu_basic_iomanip val)
93 void add_message(
const char* str) { append(str); }
95 void append(
const char* str);
98 iuStreamMessage& operator = (
const iuStreamMessage&);
101 iu_global_format_stringstream m_stream;
104 inline iu_ostream& operator << (iu_ostream& os,
const iuStreamMessage& msg)
106 return os << msg.GetString();
114 ::std::string m_message;
118 iuCodeMessage(
const char* file,
int line,
const char* message)
120 , m_file(file ? file : kStrings::UnknownFile)
123 iuCodeMessage(
const char* file,
int line,
const iuStreamMessage& message)
124 : m_message(message.GetString())
125 , m_file(file ? file : kStrings::UnknownFile)
129 const char* message()
const {
return m_message.c_str(); }
136 iuCodeMessage& operator << (
const T& value)
138 m_message += (iuStreamMessage() << value).GetString();
146 void add_message(const ::std::string& str);
150 ::std::string make_message()
const;
151 ::std::string make_newline_message()
const
153 return make_message() +
"\n";
161 # include "../impl/iutest_message.ipp"
#define IUTEST_CXX_NOEXCEPT_SPEC
noexcept specification definition
Definition: iutest_compiler.hpp:811
iutest root namespace
Definition: iutest_charcode.hpp:33
std::string PrintToString(const T &v)
文字列化
Definition: iutest_printers.hpp:767