Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: third_party/libc++/src/iostream.cpp

Issue 75213003: Add libc++ and libc++abi to third-party. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libc++/src/ios.cpp ('k') | third_party/libc++/src/locale.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 //===------------------------ iostream.cpp --------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "__std_stream"
11 #include "string"
12 #include "new"
13
14 _LIBCPP_BEGIN_NAMESPACE_STD
15
16 static mbstate_t state_types[6] = {};
17
18 _ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];
19 _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
20 _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
21 _ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin [sizeof(__stdinbuf <wcha r_t>)];
22 _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wcha r_t>)];
23 _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wcha r_t>)];
24
25 _ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin [sizeof(istream)];
26 _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)];
27 _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)];
28 _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)];
29 _ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin [sizeof(wistream)];
30 _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)];
31 _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)];
32 _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)];
33
34 ios_base::Init __start_std_streams;
35
36 ios_base::Init::Init()
37 {
38 istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdi n, state_types+0) );
39 ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdo ut, state_types+1));
40 ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stde rr, state_types+2));
41 ::new(clog) ostream(cerr_ptr->rdbuf());
42 cin_ptr->tie(cout_ptr);
43 _VSTD::unitbuf(*cerr_ptr);
44 cerr_ptr->tie(cout_ptr);
45
46 wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar _t>(stdin, state_types+3) );
47 wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar _t>(stdout, state_types+4));
48 wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar _t>(stderr, state_types+5));
49 ::new(wclog) wostream(wcerr_ptr->rdbuf());
50 wcin_ptr->tie(wcout_ptr);
51 _VSTD::unitbuf(*wcerr_ptr);
52 wcerr_ptr->tie(wcout_ptr);
53 }
54
55 ios_base::Init::~Init()
56 {
57 ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
58 ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
59 cout_ptr->flush();
60 clog_ptr->flush();
61
62 wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
63 wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
64 wcout_ptr->flush();
65 wclog_ptr->flush();
66 }
67
68 _LIBCPP_END_NAMESPACE_STD
OLDNEW
« no previous file with comments | « third_party/libc++/src/ios.cpp ('k') | third_party/libc++/src/locale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698