[llvm-commits] [llvm] r55370 - /llvm/trunk/include/llvm/Support/raw_ostream.h
Ted Kremenek
kremenek at apple.com
Tue Aug 26 09:34:10 PDT 2008
Author: kremenek
Date: Tue Aug 26 11:34:01 2008
New Revision: 55370
URL: http://llvm.org/viewvc/llvm-project?rev=55370&view=rev
Log:
Added "str()" method to raw_string_ostream.
str() mirrors the same method in std::ostringstream.
str() flushes the buffered stream contents to string and returns a reference to the string.
Modified:
llvm/trunk/include/llvm/Support/raw_ostream.h
Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=55370&r1=55369&r2=55370&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Aug 26 11:34:01 2008
@@ -219,6 +219,13 @@
raw_string_ostream(std::string &O) : OS(O) {}
~raw_string_ostream();
+ /// str - Flushes the stream contents to the target string and returns
+ /// the strings reference.
+ std::string& str() {
+ flush();
+ return OS;
+ }
+
/// flush_impl - The is the piece of the class that is implemented by
/// subclasses. This outputs the currently buffered data and resets the
/// buffer to empty.
More information about the llvm-commits
mailing list