Skip to content
Snippets Groups Projects
Commit b3b51f01 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Move std::ostream << CaptureLog logic into CaptureLog::streamto().

That lets us reliably declare the operator<<() free function inline, which
permits multiple translation units in the same executable to #include
"wrapllerrs.h".
parent 30e8e23d
No related branches found
No related tags found
No related merge requests found
......@@ -136,25 +136,31 @@ class CaptureLog : public LLError::Recorder
<< *this));
}
std::ostream& streamto(std::ostream& out) const
{
MessageList::const_iterator mi(mMessages.begin()), mend(mMessages.end());
if (mi != mend)
{
// handle first message separately: it doesn't get a newline
out << *mi++;
for ( ; mi != mend; ++mi)
{
// every subsequent message gets a newline
out << '\n' << *mi;
}
}
return out;
}
typedef std::list<std::string> MessageList;
MessageList mMessages;
LLError::Settings* mOldSettings;
};
inline
std::ostream& operator<<(std::ostream& out, const CaptureLog& log)
{
CaptureLog::MessageList::const_iterator mi(log.mMessages.begin()), mend(log.mMessages.end());
if (mi != mend)
{
// handle first message separately: it doesn't get a newline
out << *mi++;
for ( ; mi != mend; ++mi)
{
// every subsequent message gets a newline
out << '\n' << *mi;
}
}
return out;
return log.streamto(out);
}
#endif /* ! defined(LL_WRAPLLERRS_H) */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment