diff options
Diffstat (limited to 'misc/uClibc++/include/uClibc++/iomanip')
-rw-r--r-- | misc/uClibc++/include/uClibc++/iomanip | 199 |
1 files changed, 106 insertions, 93 deletions
diff --git a/misc/uClibc++/include/uClibc++/iomanip b/misc/uClibc++/include/uClibc++/iomanip index 14a82607c..82125268a 100644 --- a/misc/uClibc++/include/uClibc++/iomanip +++ b/misc/uClibc++/include/uClibc++/iomanip @@ -1,21 +1,21 @@ -/* Copyright (C) 2005 Garrett A. Kajmowicz - - This file is part of the uClibc++ Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ +/* Copyright (C) 2005 Garrett A. Kajmowicz + * + * This file is part of the uClibc++ Library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <exception> #include <ios> @@ -25,144 +25,157 @@ #pragma GCC visibility push(default) -namespace std{ +extern "C++" +{ +namespace std +{ // These are the helper classes which we are going to be using to // hold the required data -class _UCXXEXPORT __resetiosflags{ +class _UCXXEXPORT __resetiosflags +{ public: - ios_base::fmtflags m; - _UCXXEXPORT __resetiosflags(ios_base::fmtflags mask) : m(mask){ } + ios_base::fmtflags m; + _UCXXEXPORT __resetiosflags(ios_base::fmtflags mask) : m(mask){ } }; -class _UCXXEXPORT __setiosflags{ +class _UCXXEXPORT __setiosflags +{ public: - ios_base::fmtflags m; - _UCXXEXPORT __setiosflags(ios_base::fmtflags mask) : m(mask){ } + ios_base::fmtflags m; + _UCXXEXPORT __setiosflags(ios_base::fmtflags mask) : m(mask){ } }; -class _UCXXEXPORT __setbase{ +class _UCXXEXPORT __setbase +{ public: - int base; - _UCXXEXPORT __setbase(int b) : base(b){ } + int base; + _UCXXEXPORT __setbase(int b) : base(b){ } }; -class _UCXXEXPORT __setfill{ +class _UCXXEXPORT __setfill +{ public: - int character; - _UCXXEXPORT __setfill(int c): character(c){ } + int character; + _UCXXEXPORT __setfill(int c): character(c){ } }; -class _UCXXEXPORT __setprecision{ +class _UCXXEXPORT __setprecision +{ public: - int digits; - _UCXXEXPORT __setprecision(int n): digits(n) { } + int digits; + _UCXXEXPORT __setprecision(int n): digits(n) { } }; -class _UCXXEXPORT __setw{ +class _UCXXEXPORT __setw +{ public: - int width; - _UCXXEXPORT __setw(int n): width(n) { } + int width; + _UCXXEXPORT __setw(int n): width(n) { } }; +// Actual manipulator functions -//Actual manipulator functions - -inline __resetiosflags resetiosflags(ios_base::fmtflags mask){ - return __resetiosflags(mask); +inline __resetiosflags resetiosflags(ios_base::fmtflags mask) +{ + return __resetiosflags(mask); } -inline __setiosflags setiosflags(ios_base::fmtflags mask){ - return __setiosflags(mask); +inline __setiosflags setiosflags(ios_base::fmtflags mask) +{ + return __setiosflags(mask); } -inline __setbase setbase(int b){ - return __setbase(b); +inline __setbase setbase(int b) +{ + return __setbase(b); } -inline __setfill setfill(int c){ - return __setfill(c); +inline __setfill setfill(int c) +{ + return __setfill(c); } -inline __setprecision setprecision(int n){ - return __setprecision(n); +inline __setprecision setprecision(int n) +{ + return __setprecision(n); } -inline __setw setw(int n){ - return __setw(n); +inline __setw setw(int n) +{ + return __setw(n); } - -//How to handle interaction with [i|o]stream classes +// How to handle interaction with [i|o]stream classes template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>& - operator<<(basic_ostream<Ch, Tr>& os, const __resetiosflags s) + operator<<(basic_ostream<Ch, Tr>& os, const __resetiosflags s) { - os.setf(ios_base::fmtflags(0),s.m); - return os; + os.setf(ios_base::fmtflags(0),s.m); + return os; } template<class Ch, class Tr> _UCXXEXPORT basic_istream<Ch, Tr>& - operator>>(basic_istream<Ch, Tr>& is, const __resetiosflags s) + operator>>(basic_istream<Ch, Tr>& is, const __resetiosflags s) { - is.setf(ios_base::fmtflags(0),s.m); - return is; + is.setf(ios_base::fmtflags(0),s.m); + return is; } template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>& - operator<<(basic_ostream<Ch, Tr>& os, const __setiosflags s) + operator<<(basic_ostream<Ch, Tr>& os, const __setiosflags s) { - os.setf(s.m); - return os; + os.setf(s.m); + return os; } template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>& - operator<<(basic_ostream<Ch, Tr>& os, const __setbase s) -{ - ios_base::fmtflags f(0); - switch(s.base){ - case 8: - f = ios_base::oct; - break; - case 10: - f = ios_base::dec; - break; - case 16: - f = ios_base::hex; - break; - default: - break; - - } - os.setf(f, ios_base::basefield); - return os; + operator<<(basic_ostream<Ch, Tr>& os, const __setbase s) +{ + ios_base::fmtflags f(0); + switch(s.base) + { + case 8: + f = ios_base::oct; + break; + case 10: + f = ios_base::dec; + break; + case 16: + f = ios_base::hex; + break; + default: + break; + } + + os.setf(f, ios_base::basefield); + return os; } template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>& - operator<<(basic_ostream<Ch, Tr>& os, const __setfill s) + operator<<(basic_ostream<Ch, Tr>& os, const __setfill s) { - os.fill(s.character); - return os; + os.fill(s.character); + return os; } template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>& - operator<<(basic_ostream<Ch, Tr>& os, const __setprecision s) + operator<<(basic_ostream<Ch, Tr>& os, const __setprecision s) { - os.precision(s.digits); - return os; + os.precision(s.digits); + return os; } template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>& - operator<<(basic_ostream<Ch, Tr>& os, const __setw s) + operator<<(basic_ostream<Ch, Tr>& os, const __setw s) { - os.width(s.width); - return os; + os.width(s.width); + return os; } - - -} +} // namespace +} // extern "C++" #pragma GCC visibility pop |