1
 
/*      Copyright (C) 2004 Garrett A. Kajmowicz
 
3
 
        This file is part of the uClibc++ Library.
 
5
 
        This library is free software; you can redistribute it and/or
 
6
 
        modify it under the terms of the GNU Lesser General Public
 
7
 
        License as published by the Free Software Foundation; either
 
8
 
        version 2.1 of the License, or (at your option) any later version.
 
10
 
        This library is distributed in the hope that it will be useful,
 
11
 
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 
        Lesser General Public License for more details.
 
15
 
        You should have received a copy of the GNU Lesser General Public
 
16
 
        License along with this library; if not, write to the Free Software
 
17
 
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
24
 
#ifdef __UCLIBCXX_HAS_WCHAR__
 
29
 
#ifndef __HEADER_STD_STRING_IOSTREAM
 
30
 
#define __HEADER_STD_STRING_IOSTREAM 1
 
32
 
#pragma GCC visibility push(default)
 
38
 
template<class charT, class traits, class Allocator> _UCXXEXPORT basic_ostream<charT, traits>&
 
39
 
        operator<<(basic_ostream<charT, traits>& os, const basic_string<charT,traits,Allocator>& str)
 
41
 
        return os.write(str.data(), str.length());
 
44
 
template<class charT, class traits, class Allocator> _UCXXEXPORT basic_istream<charT,traits>&
 
45
 
        operator>>(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str)
 
48
 
        typename basic_istream<charT, traits>::sentry s(is);
 
55
 
        typename basic_istream<charT, traits>::int_type c;
 
56
 
        typename Allocator::size_type n = is.width();
 
62
 
//      //Clear out preliminary spaces first
 
72
 
                if(c == traits::eof() || isspace(c) || n == 0){
 
76
 
                        str.append(1, traits::to_char_type(c) );
 
79
 
        }while(exitnow == false);
 
83
 
template<class charT, class traits, class Allocator> _UCXXEXPORT basic_istream<charT,traits>&
 
84
 
        getline(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str, charT delim)
 
86
 
        typename basic_istream<charT,traits>::sentry s(is);
 
94
 
        typename basic_istream<charT,traits>::int_type c_i;
 
96
 
        unsigned int n = str.max_size();
 
99
 
                if(c_i == traits::eof() ){
 
102
 
                c = traits::to_char_type(c_i);
 
111
 
template<class charT, class traits, class Allocator> _UCXXEXPORT basic_istream<charT,traits>&
 
112
 
        getline(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str)
 
114
 
        return getline(is, str, '\n');
 
118
 
#ifdef __UCLIBCXX_EXPAND_STRING_CHAR__
 
119
 
#ifndef __UCLIBCXX_COMPILE_STRING__
 
122
 
#ifdef __UCLIBCXX_EXPAND_ISTREAM_CHAR__
 
123
 
template<> _UCXXEXPORT basic_istream<char, char_traits<char> >& operator>>(
 
124
 
        basic_istream<char,char_traits<char> >& is,
 
125
 
        basic_string<char, char_traits<char>, allocator<char> >& str);
 
129
 
#ifdef __UCLIBCXX_EXPAND_OSTREAM_CHAR__
 
130
 
template<> _UCXXEXPORT basic_ostream<char, char_traits<char> >&
 
131
 
        operator<<(basic_ostream<char, char_traits<char> >& os, 
 
132
 
        const basic_string<char,char_traits<char>, std::allocator<char> >& str);
 
143
 
#pragma GCC visibility pop