]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/tuple/tuple_io.hpp
update to boost 1.39: update existing files
[lyx.git] / boost / boost / tuple / tuple_io.hpp
index 2869ff32d7b20ab80f14d76752f8487b4e757bdc..b355e56dc06a00f4c3f3b6ba269d60b57ad66f65 100644 (file)
@@ -1,16 +1,11 @@
 // tuple_io.hpp --------------------------------------------------------------
 
-// Copyright (C) 2001 Jaakko Jรคrvi (jaakko.jarvi@cs.utu.fi)
+// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
 //               2001 Gary Powell (gary.powell@sierra.com)
 //
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies. 
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice 
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty, 
-// and with no claim as to its suitability for any purpose.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
 // For more information, see http://www.boost.org 
 
 // ----------------------------------------------------------------------------
 
 #include "boost/tuple/tuple.hpp"
 
+// This is ugly: one should be using twoargument isspace since whitspace can
+// be locale dependent, in theory at least.
+// not all libraries implement have the two-arg version, so we need to 
+// use the one-arg one, which one should get with <cctype> but there seem
+// to be exceptions to this.
+
+#if !defined (BOOST_NO_STD_LOCALE)
+
+#include <locale> // for two-arg isspace
+
+#else 
+
+#include <cctype> // for one-arg (old) isspace 
+#include <ctype.h> // Metrowerks does not find one-arg isspace from cctype
+
+#endif
+
 namespace boost {
 namespace tuples {
 
@@ -69,9 +81,9 @@ public:
      // parentheses and space are the default manipulators
      if (!c) {
        switch(m) {
-         case open : c = '('; break;
-         case close : c = ')'; break;
-         case delimiter : c = ' '; break;
+         case detail::format_info::open : c = '('; break;
+         case detail::format_info::close : c = ')'; break;
+         case detail::format_info::delimiter : c = ' '; break;
        }
      }
      return c;
@@ -92,9 +104,9 @@ public:
      // parentheses and space are the default manipulators
      if (!c) {
        switch(m) {
-         case open :  c = i.widen('('); break;
-         case close : c = i.widen(')'); break;
-         case delimiter : c = i.widen(' '); break;
+         case detail::format_info::open :  c = i.widen('('); break;
+         case detail::format_info::close : c = i.widen(')'); break;
+         case detail::format_info::delimiter : c = i.widen(' '); break;
        }
      }
      return c;
@@ -328,12 +340,16 @@ extract_and_check_delimiter(
 {
   const char d = format_info::get_manipulator(is, del);
 
-  const bool is_delimiter = (!isspace(d) );      
+#if defined (BOOST_NO_STD_LOCALE)
+  const bool is_delimiter = !isspace(d);
+#else
+  const bool is_delimiter = (!std::isspace(d, is.getloc()) );            
+#endif
 
   char c;
   if (is_delimiter) { 
     is >> c; 
-    if (c!=d) {
+    if (is.good() && c!=d) {
       is.setstate(std::ios::failbit);
     } 
   }
@@ -415,12 +431,19 @@ extract_and_check_delimiter(
 {
   const CharType d = format_info::get_manipulator(is, del);
 
-  const bool is_delimiter = (!isspace(d) );      
+#if defined (BOOST_NO_STD_LOCALE)
+  const bool is_delimiter = !isspace(d);
+#elif defined ( __BORLANDC__ )
+  const bool is_delimiter = !std::use_facet< std::ctype< CharType > >
+    (is.getloc() ).is( std::ctype_base::space, d);
+#else
+  const bool is_delimiter = (!std::isspace(d, is.getloc()) );            
+#endif
 
   CharType c;
   if (is_delimiter) { 
     is >> c;
-    if (c!=d) { 
+    if (is.good() && c!=d) { 
       is.setstate(std::ios::failbit);
     }
   }