summaryrefslogtreecommitdiff
path: root/misc/uClibc++/include/cxx/iomanip
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-31 19:13:18 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-31 19:13:18 +0000
commit329b6095ddda830433e6000b943fab82d1c83cf1 (patch)
tree605301a07119dea4433c994f9000743eed20d165 /misc/uClibc++/include/cxx/iomanip
parent8f6e28f194274bde92d11c6383167ddbcc496cb3 (diff)
downloadnuttx-329b6095ddda830433e6000b943fab82d1c83cf1.tar.gz
nuttx-329b6095ddda830433e6000b943fab82d1c83cf1.tar.bz2
nuttx-329b6095ddda830433e6000b943fab82d1c83cf1.zip
Add misc/uClibc++ and build hooks in nuttx/
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5283 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'misc/uClibc++/include/cxx/iomanip')
-rw-r--r--misc/uClibc++/include/cxx/iomanip170
1 files changed, 170 insertions, 0 deletions
diff --git a/misc/uClibc++/include/cxx/iomanip b/misc/uClibc++/include/cxx/iomanip
new file mode 100644
index 000000000..14a82607c
--- /dev/null
+++ b/misc/uClibc++/include/cxx/iomanip
@@ -0,0 +1,170 @@
+/* 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>
+
+#ifndef __STD_IOMANIP
+#define __STD_IOMANIP 1
+
+#pragma GCC visibility push(default)
+
+namespace std{
+
+// These are the helper classes which we are going to be using to
+// hold the required data
+
+class _UCXXEXPORT __resetiosflags{
+public:
+ ios_base::fmtflags m;
+ _UCXXEXPORT __resetiosflags(ios_base::fmtflags mask) : m(mask){ }
+};
+
+class _UCXXEXPORT __setiosflags{
+public:
+ ios_base::fmtflags m;
+ _UCXXEXPORT __setiosflags(ios_base::fmtflags mask) : m(mask){ }
+};
+
+class _UCXXEXPORT __setbase{
+public:
+ int base;
+ _UCXXEXPORT __setbase(int b) : base(b){ }
+};
+
+class _UCXXEXPORT __setfill{
+public:
+ int character;
+ _UCXXEXPORT __setfill(int c): character(c){ }
+};
+
+class _UCXXEXPORT __setprecision{
+public:
+ int digits;
+ _UCXXEXPORT __setprecision(int n): digits(n) { }
+};
+
+class _UCXXEXPORT __setw{
+public:
+ int width;
+ _UCXXEXPORT __setw(int n): width(n) { }
+};
+
+
+//Actual manipulator functions
+
+inline __resetiosflags resetiosflags(ios_base::fmtflags mask){
+ return __resetiosflags(mask);
+}
+
+inline __setiosflags setiosflags(ios_base::fmtflags mask){
+ return __setiosflags(mask);
+}
+
+inline __setbase setbase(int b){
+ return __setbase(b);
+}
+
+inline __setfill setfill(int c){
+ return __setfill(c);
+}
+
+inline __setprecision setprecision(int n){
+ return __setprecision(n);
+}
+
+inline __setw setw(int n){
+ return __setw(n);
+}
+
+
+//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)
+{
+ 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)
+{
+ 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)
+{
+ 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;
+}
+
+template<class Ch, class Tr> _UCXXEXPORT basic_ostream<Ch, Tr>&
+ operator<<(basic_ostream<Ch, Tr>& os, const __setfill s)
+{
+ 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)
+{
+ 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)
+{
+ os.width(s.width);
+ return os;
+}
+
+
+
+}
+
+#pragma GCC visibility pop
+
+#endif
+