summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests/wrapllerrs.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-03-05 13:03:23 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-03-05 13:03:23 -0500
commitb3b51f012f49d82c3b7f6f5cadfc0d76ef82f8bf (patch)
tree05576ff2b181ccce3e1350266c0827636019ed57 /indra/llcommon/tests/wrapllerrs.h
parent30e8e23d7cf666c406901d85a59d16401dca67ab (diff)
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".
Diffstat (limited to 'indra/llcommon/tests/wrapllerrs.h')
-rw-r--r--indra/llcommon/tests/wrapllerrs.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h
index a9c0c19c28..f79acacb22 100644
--- a/indra/llcommon/tests/wrapllerrs.h
+++ b/indra/llcommon/tests/wrapllerrs.h
@@ -136,25 +136,31 @@ public:
<< *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) */