]> git.lyx.org Git - lyx.git/blob - boost/boost/format/outsstream_impl.hpp
64-bit fix to boost::format.
[lyx.git] / boost / boost / format / outsstream_impl.hpp
1 // -*- C++ -*-
2 //  Boost  format   ----------------------------------------------------
3 //  See http://www.boost.org for updates, documentation, and revision history.
4
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.
10
11 // ------------------------------------------------------------------------------
12 // implementation included by outsstream.hpp.
13 // ------------------------------------------------------------------------------
14
15 namespace boost {
16 namespace io {
17
18 #if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM)
19
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)) ); 
28     }
29 }
30
31
32
33 #else // BOOST_NO_STRINGSTREAM
34
35
36 template <class Tr> inline
37 basic_outsstream<char,Tr> ::basic_outsstream() : 
38   buff_t(),  
39   stream_t(this) 
40
41   stream_t::init(this);  // the strem construction isnt enough with gcc-2.95
42 }  
43   
44
45 template <class Tr>
46 std::basic_string<char, Tr> 
47 basic_outsstream<char, Tr> ::str() {   // ! physically copy chars :
48     string_type s(buff_t::str(), pcount());
49     freeze(false);
50     return s;
51 }
52
53 template<class Tr > inline
54 void
55 basic_outsstream<char, Tr>:: clear_buffer() { 
56     freeze(false);
57     const Ch * p = cur();
58     const Ch * b = begin();
59     if(p != NULL && p != b) {
60       buff_t::seekpos(0, std::ios_base::out); 
61     }
62     freeze(false);
63 }
64
65 #endif
66
67 } //namespace io
68 } //namespace boost