2 // Boost format ----------------------------------------------------
3 // See http://www.boost.org for updates, documentation, and revision history.
5 // (C) Samuel Krempp 2003
6 // Permission to copy, use, modify, sell and
7 // distribute this software is granted provided this copyright notice appears
8 // in all copies. This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose.
11 // ------------------------------------------------------------------------------
12 // implementation included by outsstream.hpp.
13 // ------------------------------------------------------------------------------
18 #if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM)
20 template<class Ch, class Tr> inline
21 void steal_basic_stringbuf<Ch, Tr> :: clear_buffer() {
22 const Ch * p = pptr();
23 const Ch * b = pbase();
24 if(p != NULL && p != b) {
25 typedef typename Tr::pos_type pos_type;
26 pos_type pos = buff_t::seekpos(0, std::ios_base::out);
27 BOOST_ASSERT( pos != pos_type(std::streamoff(-1)) );
33 #else // BOOST_NO_STRINGSTREAM
36 template <class Tr> inline
37 basic_outsstream<char,Tr> ::basic_outsstream() :
41 stream_t::init(this); // the strem construction isnt enough with gcc-2.95
46 std::basic_string<char, Tr>
47 basic_outsstream<char, Tr> ::str() { // ! physically copy chars :
48 string_type s(buff_t::str(), pcount());
53 template<class Tr > inline
55 basic_outsstream<char, Tr>:: clear_buffer() {
58 const Ch * b = begin();
59 if(p != NULL && p != b) {
60 buff_t::seekpos(0, std::ios_base::out);