Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Moved itoa() functions from ztd namespace to ascii namespace since (A) it 
converts using only ASCII digits and (B) preparation for the forthcoming 
utf8::itoa() that will convert using an sequence of Unicode digits.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/152695

Moved itoa() functions from ztd namespace to ascii namespace since (A) it 
converts using only ASCII digits and (B) preparation for the forthcoming 
utf8::itoa() that will convert using an sequence of Unicode digits.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/152695
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/api/serialization/serializer.cpp'
--- src/api/serialization/serializer.cpp	2013-03-07 10:10:10 +0000
+++ src/api/serialization/serializer.cpp	2013-03-11 15:03:21 +0000
@@ -214,8 +214,8 @@
 
       if (cp >= 0x10000 && cp <= 0x10FFFF)
       {
-        ztd::itoa_buf_type cp_buf;
-        tr << "&#" << ztd::itoa(cp, cp_buf) << ';';
+        ascii::itoa_buf_type cp_buf;
+        tr << "&#" << ascii::itoa(cp, cp_buf) << ';';
         chars += (char_length-1);
       }
       else

=== modified file 'src/store/naive/loader_fast.cpp'
--- src/store/naive/loader_fast.cpp	2013-02-26 04:12:43 +0000
+++ src/store/naive/loader_fast.cpp	2013-03-11 15:03:21 +0000
@@ -41,6 +41,7 @@
 
 #include "diagnostics/xquery_diagnostics.h"
 #include "diagnostics/assert.h"
+#include "util/ascii_util.h"
 #include "util/stream_util.h"
 
 namespace zorba {
@@ -104,11 +105,11 @@
   if ( error->level == XML_ERR_NONE )
     return;
 
-  ztd::itoa_buf_type itoa_buf;
+  ascii::itoa_buf_type itoa_buf;
 
   zstring libxml_dict_key_4( ZED_PREFIX "libxml_" );
   libxml_dict_key_4 += error->level == XML_ERR_WARNING ? "WAR_" : "ERR_";
-  libxml_dict_key_4 += ztd::itoa( error->code, itoa_buf );
+  libxml_dict_key_4 += ascii::itoa( error->code, itoa_buf );
 
   char const *const error_str1_5 = error->str1 ? error->str1 : "";
   char const *const error_str2_6 = error->str2 ? error->str2 : "";
@@ -130,7 +131,7 @@
       case XML_ERR_INTERNAL_ERROR:
       case XML_ERR_TAG_NOT_FINISHED:
         // For these error codes, int1 is an int.
-        error_int1_8 = ztd::itoa( error->int1, itoa_buf );
+        error_int1_8 = ascii::itoa( error->int1, itoa_buf );
         break;
       default:
         // For an unaccounted-for error code, use a heuristic to guess whether
@@ -138,7 +139,7 @@
         if ( ascii::is_print( error->int1 ) )
           error_int1_8 = static_cast<char>( error->int1 );
         else
-          error_int1_8 = ztd::itoa( error->int1, itoa_buf );
+          error_int1_8 = ascii::itoa( error->int1, itoa_buf );
     } // switch
   } // if
 

=== modified file 'src/unit_tests/test_time_parse.cpp'
--- src/unit_tests/test_time_parse.cpp	2013-01-10 00:59:49 +0000
+++ src/unit_tests/test_time_parse.cpp	2013-03-11 15:03:21 +0000
@@ -22,6 +22,7 @@
 #include <stdexcept>
 #include <string>
 
+#include "util/ascii_util.h"
 #include "util/stl_util.h"
 #include "util/time_parse.h"
 #include "zorbatypes/zstring.h"
@@ -178,13 +179,13 @@
 static void test_range( char const *conv, int low, int high,
                         ztm_int_ptr ztm_mbr,
                         unary_fn_type unary_fn = &my_identity ) {
-  ztd::itoa_buf_type buf;
+  ascii::itoa_buf_type buf;
   iso639_1::type lang = iso639_1::unknown;
   iso3166_1::type country = iso3166_1::unknown;
   ztm tm;
 
   for ( int i = low; i <= high; ++i ) {
-    ztd::itoa( i, buf );
+    ascii::itoa( i, buf );
     size_t const len = ::strlen( buf );
     char const *bp;
     ::memset( &tm, 0, sizeof( tm ) );
@@ -196,14 +197,14 @@
     time::parse( "JUNK", conv, lang, country, &tm ), invalid_value
   );
 
-  ztd::itoa( --low, buf );
+  ascii::itoa( --low, buf );
   ASSERT_EXCEPTION(
     time::parse( buf, conv, lang, country, &tm ), invalid_value
   );
 
   int const high2 = high + 1;
   if ( num_digits( high2 ) == num_digits( high ) ) {
-    ztd::itoa( ++high, buf );
+    ascii::itoa( ++high, buf );
     ASSERT_EXCEPTION(
       time::parse( buf, conv, lang, country, &tm ), invalid_value
     );

=== modified file 'src/util/ascii_util.cpp'
--- src/util/ascii_util.cpp	2013-02-26 04:12:43 +0000
+++ src/util/ascii_util.cpp	2013-03-11 15:03:21 +0000
@@ -37,6 +37,44 @@
   return true;
 }
 
+char* itoa( long long n, char *buf ) {
+  //
+  // This implementation is much faster than using sprintf(3).
+  //
+  char *s = buf;
+  long long n_prev;
+  do { 
+    n_prev = n;
+    n /= 10; 
+    *s++ = "9876543210123456789" [ 9 + n_prev - n * 10 ];
+  } while ( n );
+
+  if ( n_prev < 0 ) *s++ = '-';
+  *s = '\0';
+
+  for ( char *t = buf; t < s; ++t ) {
+    char const c = *--s; *s = *t; *t = c;
+  }
+  return buf;
+}
+
+char* itoa( unsigned long long n, char *buf ) {
+  char *s = buf;
+  unsigned long long n_prev;
+  do { 
+    n_prev = n;
+    n /= 10; 
+    *s++ = "0123456789" [ n_prev - n * 10 ];
+  } while ( n );
+
+  *s = '\0';
+
+  for ( char *t = buf; t < s; ++t ) {
+    char const c = *--s; *s = *t; *t = c;
+  }
+  return buf;
+}
+
 ostream& printable_char( ostream &o, char c ) {
   if ( ascii::is_print( c ) )
     o << c;

=== modified file 'src/util/ascii_util.h'
--- src/util/ascii_util.h	2013-02-28 11:15:32 +0000
+++ src/util/ascii_util.h	2013-03-11 15:03:21 +0000
@@ -661,6 +661,142 @@
   return replace_all( s, from.data(), from.size(), to.data(), to.size() );
 }
 
+////////// Integer-to-string conversion ///////////////////////////////////////
+
+/**
+ * A type that can hold the largest possible C string equivalent of the largest
+ * possible integral value.
+ */
+typedef char itoa_buf_type[48];
+
+/**
+ * Converts a <code>long long</code> to a C string.
+ *
+ * @param n The <code>long long</code> to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+char* itoa( long long n, char *buf );
+
+/**
+ * Converts a \c char to a C string.
+ *
+ * @param n The \c char to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( char n, char *buf ) {
+  return itoa( static_cast<long long>( n ), buf );
+}
+
+/**
+ * Converts a <code>signed char</code> to a C string.
+ *
+ * @param n The <code>signed char</code> to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( signed char n, char *buf ) {
+  return itoa( static_cast<long long>( n ), buf );
+}
+
+/**
+ * Converts a \c short to a C string.
+ *
+ * @param n The \c short to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( short n, char *buf ) {
+  return itoa( static_cast<long long>( n ), buf );
+}
+
+/**
+ * Converts an \c int to a C string.
+ *
+ * @param n The \c int to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( int n, char *buf ) {
+  return itoa( static_cast<long long>( n ), buf );
+}
+
+/**
+ * Converts a \c long to a C string.
+ *
+ * @param n The \c long to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( long n, char *buf ) {
+  return itoa( static_cast<long long>( n ), buf );
+}
+
+/**
+ * Converts an <code>unsigned long long</code> to a C string.
+ *
+ * @param n The <code>unsigned long long</code> to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+char* itoa( unsigned long long n, char *buf );
+
+/**
+ * Converts an <code>unsigned char</code> to a C string.
+ *
+ * @param n The <code>unsigned char</code> to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( unsigned char n, char *buf ) {
+  return itoa( static_cast<unsigned long long>( n ), buf );
+}
+
+/**
+ * Converts an <code>unsigned short</code> to a C string.
+ *
+ * @param n The <code>unsigned short</code> to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( unsigned short n, char *buf ) {
+  return itoa( static_cast<unsigned long long>( n ), buf );
+}
+
+/**
+ * Converts an <code>unsigned int</code> to a C string.
+ *
+ * @param n The <code>unsigned int</code> to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( unsigned int n, char *buf ) {
+  return itoa( static_cast<unsigned long long>( n ), buf );
+}
+
+/**
+ * Converts an <code>unsigned long</code> to a C string.
+ *
+ * @param n The <code>unsigned long</code> to convert.
+ * @param buf The buffer for the result.  The caller must ensure it's of
+ * sufficient size.
+ * @return Returns \a buf for convenience.
+ */
+inline char* itoa( unsigned long n, char *buf ) {
+  return itoa( static_cast<unsigned long long>( n ), buf );
+}
+
 ////////// Whitespace /////////////////////////////////////////////////////////
 
 /**

=== modified file 'src/util/string_util.cpp'
--- src/util/string_util.cpp	2013-03-06 01:20:25 +0000
+++ src/util/string_util.cpp	2013-03-11 15:03:21 +0000
@@ -168,44 +168,6 @@
   return n;
 }
 
-char* itoa( long long n, char *buf ) {
-  //
-  // This implementation is much faster than using sprintf(3).
-  //
-  char *s = buf;
-  long long n_prev;
-  do { 
-    n_prev = n;
-    n /= 10; 
-    *s++ = "9876543210123456789" [ 9 + n_prev - n * 10 ];
-  } while ( n );
-
-  if ( n_prev < 0 ) *s++ = '-';
-  *s = '\0';
-
-  for ( char *t = buf; t < s; ++t ) {
-    char const c = *--s; *s = *t; *t = c;
-  }
-  return buf;
-}
-
-char* itoa( unsigned long long n, char *buf ) {
-  char *s = buf;
-  unsigned long long n_prev;
-  do { 
-    n_prev = n;
-    n /= 10; 
-    *s++ = "0123456789" [ n_prev - n * 10 ];
-  } while ( n );
-
-  *s = '\0';
-
-  for ( char *t = buf; t < s; ++t ) {
-    char const c = *--s; *s = *t; *t = c;
-  }
-  return buf;
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 } // namespace ztd

=== modified file 'src/util/string_util.h'
--- src/util/string_util.h	2013-03-02 15:51:30 +0000
+++ src/util/string_util.h	2013-03-11 15:03:21 +0000
@@ -25,6 +25,7 @@
 #include <string>
 
 #include <zorba/internal/ztd.h>
+#include "ascii_util.h"
 #include "cxx_util.h"
 #include "stl_util.h"
 
@@ -657,140 +658,6 @@
 using internal::ztd::to_string;
 
 /**
- * A type that can hold the largest possible C string equivalent of the largest
- * possible integral value.
- */
-typedef char itoa_buf_type[48];
-
-/**
- * Converts a <code>long long</code> to a C string.
- *
- * @param n The <code>long long</code> to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-char* itoa( long long n, char *buf );
-
-/**
- * Converts a \c char to a C string.
- *
- * @param n The \c char to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( char n, char *buf ) {
-  return itoa( static_cast<long long>( n ), buf );
-}
-
-/**
- * Converts a <code>signed char</code> to a C string.
- *
- * @param n The <code>signed char</code> to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( signed char n, char *buf ) {
-  return itoa( static_cast<long long>( n ), buf );
-}
-
-/**
- * Converts a \c short to a C string.
- *
- * @param n The \c short to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( short n, char *buf ) {
-  return itoa( static_cast<long long>( n ), buf );
-}
-
-/**
- * Converts an \c int to a C string.
- *
- * @param n The \c int to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( int n, char *buf ) {
-  return itoa( static_cast<long long>( n ), buf );
-}
-
-/**
- * Converts a \c long to a C string.
- *
- * @param n The \c long to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( long n, char *buf ) {
-  return itoa( static_cast<long long>( n ), buf );
-}
-
-/**
- * Converts an <code>unsigned long long</code> to a C string.
- *
- * @param n The <code>unsigned long long</code> to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-char* itoa( unsigned long long n, char *buf );
-
-/**
- * Converts an <code>unsigned char</code> to a C string.
- *
- * @param n The <code>unsigned char</code> to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( unsigned char n, char *buf ) {
-  return itoa( static_cast<unsigned long long>( n ), buf );
-}
-
-/**
- * Converts an <code>unsigned short</code> to a C string.
- *
- * @param n The <code>unsigned short</code> to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( unsigned short n, char *buf ) {
-  return itoa( static_cast<unsigned long long>( n ), buf );
-}
-
-/**
- * Converts an <code>unsigned int</code> to a C string.
- *
- * @param n The <code>unsigned int</code> to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( unsigned int n, char *buf ) {
-  return itoa( static_cast<unsigned long long>( n ), buf );
-}
-
-/**
- * Converts an <code>unsigned long</code> to a C string.
- *
- * @param n The <code>unsigned long</code> to convert.
- * @param buf The buffer for the result.  The caller must ensure it's of
- * sufficient size.
- * @return Returns \a buf for convenience.
- */
-inline char* itoa( unsigned long n, char *buf ) {
-  return itoa( static_cast<unsigned long long>( n ), buf );
-}
-
-/**
  * Converts an object to its string representation.
  *
  * @tparam T The object type that:
@@ -823,8 +690,8 @@
 template<typename T,class OutputStringType> inline
 typename std::enable_if<ZORBA_TR1_NS::is_integral<T>::value,void>::type
 to_string( T t, OutputStringType *out ) {
-  itoa_buf_type buf;
-  *out = itoa( t, buf );
+  ascii::itoa_buf_type buf;
+  *out = ascii::itoa( t, buf );
 }
 
 /**

=== modified file 'src/util/xml_util.tcc'
--- src/util/xml_util.tcc	2013-02-07 17:24:36 +0000
+++ src/util/xml_util.tcc	2013-03-11 15:03:21 +0000
@@ -21,7 +21,7 @@
 # error "This file is not meant to be included directly."
 #endif /* ZORBA_XML_UTIL_H */
 
-#include "string_util.h"
+#include "ascii_util.h"
 
 namespace zorba {
 namespace xml {
@@ -36,7 +36,7 @@
     case '\'':
     case '<':
     case '>':
-      ztd::itoa( c, buf_ + 2 /* skip over "&#" */ );
+      ascii::itoa( c, buf_ + 2 /* skip over "&#" */ );
       buf_[4] = ';'; // because it gets overwritten with null by itoa()
       this->container->append( buf_, 5 );
       break;

=== modified file 'src/zorbatypes/datetime/duration.cpp'
--- src/zorbatypes/datetime/duration.cpp	2013-02-28 11:15:32 +0000
+++ src/zorbatypes/datetime/duration.cpp	2013-03-11 15:03:21 +0000
@@ -909,27 +909,28 @@
 
   if (facet != DAYTIMEDURATION_FACET)
   {
+    ascii::itoa_buf_type buf;
+
     if (data[YEAR_DATA] != 0)
     {
-      ztd::itoa_buf_type buf;
-      result += ztd::itoa(data[YEAR_DATA], buf);
+      result += ascii::itoa(data[YEAR_DATA], buf);
       result.append("Y", 1);
     }
 
     if (data[MONTH_DATA] != 0)
     {
-      ztd::itoa_buf_type buf;
-      result += ztd::itoa(data[MONTH_DATA], buf);
+      result += ascii::itoa(data[MONTH_DATA], buf);
       result.append("M", 1);
     }
   }
 
   if (facet != YEARMONTHDURATION_FACET)
   {
+    ascii::itoa_buf_type buf;
+
     if (data[DAY_DATA] != 0)
     {
-      ztd::itoa_buf_type buf;
-      result += ztd::itoa(data[DAY_DATA], buf);
+      result += ascii::itoa(data[DAY_DATA], buf);
       result.append("D", 1);
     }
 
@@ -944,22 +945,19 @@
 
     if (data[HOUR_DATA] != 0)
     {
-      ztd::itoa_buf_type buf;
-      result += ztd::itoa(data[HOUR_DATA], buf);
+      result += ascii::itoa(data[HOUR_DATA], buf);
       result.append("H", 1);
     }
 
     if (data[MINUTE_DATA] != 0)
     {
-      ztd::itoa_buf_type buf;
-      result += ztd::itoa(data[MINUTE_DATA], buf);
+      result += ascii::itoa(data[MINUTE_DATA], buf);
       result.append("M", 1);
     }
 
     if (data[SECONDS_DATA] != 0 || data[FRACSECONDS_DATA] != 0)
     {
-      ztd::itoa_buf_type buf;
-      result += ztd::itoa(data[SECONDS_DATA], buf);
+      result += ascii::itoa(data[SECONDS_DATA], buf);
 
       if ( data[FRACSECONDS_DATA] != 0 )
       {

=== modified file 'src/zorbatypes/decimal.cpp'
--- src/zorbatypes/decimal.cpp	2013-02-26 04:12:43 +0000
+++ src/zorbatypes/decimal.cpp	2013-03-11 15:03:21 +0000
@@ -21,7 +21,6 @@
 
 #include "common/common.h"
 #include "util/ascii_util.h"
-#include "util/string_util.h"
 
 #include "decimal.h"
 #include "integer.h"
@@ -180,18 +179,18 @@
 ////////// constructors ///////////////////////////////////////////////////////
 
 Decimal::Decimal( long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
 }
 
 Decimal::Decimal( unsigned long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
 }
 
 Decimal::Decimal( unsigned long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
 }
 
 Decimal::Decimal( float f ) {
@@ -233,14 +232,14 @@
 ////////// assignment operators ///////////////////////////////////////////////
 
 Decimal& Decimal::operator=( long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
   return *this;
 }
 
 Decimal& Decimal::operator=( unsigned long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
   return *this;
 }
 

=== modified file 'src/zorbatypes/integer.cpp'
--- src/zorbatypes/integer.cpp	2013-02-26 04:12:43 +0000
+++ src/zorbatypes/integer.cpp	2013-03-11 15:03:21 +0000
@@ -73,26 +73,26 @@
 
 #ifdef ZORBA_WITH_BIG_INTEGER
 IntegerImpl::IntegerImpl( long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
 }
 
 #if ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG
 TEMPLATE_DECL(T)
 INTEGER_IMPL(T)::IntegerImpl( unsigned int n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
 }
 #endif /* ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG */
 
 IntegerImpl::IntegerImpl( unsigned long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
 }
 
 IntegerImpl::IntegerImpl( unsigned long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
 
@@ -119,20 +119,20 @@
 
 #ifdef ZORBA_WITH_BIG_INTEGER
 IntegerImpl& IntegerImpl::operator=( long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
   return *this;
 }
 
 IntegerImpl& IntegerImpl::operator=( unsigned long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
   return *this;
 }
 
 IntegerImpl& IntegerImpl::operator=( unsigned long long n ) {
-  ztd::itoa_buf_type buf;
-  value_ = ztd::itoa( n, buf );
+  ascii::itoa_buf_type buf;
+  value_ = ascii::itoa( n, buf );
   return *this;
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
@@ -186,14 +186,14 @@
 
 #ifdef ZORBA_WITH_BIG_INTEGER
 
-#define ZORBA_INTEGER_OP(OP,T)                                          \
-  IntegerImpl operator OP( IntegerImpl const &i, T n ) {                \
-    ztd::itoa_buf_type buf;                                             \
-    return i.value_ OP IntegerImpl::value_type( ztd::itoa( n, buf ) );  \
-  }                                                                     \
-  IntegerImpl operator OP( T n, IntegerImpl const &i ) {                \
-    ztd::itoa_buf_type buf;                                             \
-    return IntegerImpl::value_type( ztd::itoa( n, buf ) ) OP i.value_;  \
+#define ZORBA_INTEGER_OP(OP,T)                                            \
+  IntegerImpl operator OP( IntegerImpl const &i, T n ) {                  \
+    ascii::itoa_buf_type buf;                                             \
+    return i.value_ OP IntegerImpl::value_type( ascii::itoa( n, buf ) );  \
+  }                                                                       \
+  IntegerImpl operator OP( T n, IntegerImpl const &i ) {                  \
+    ascii::itoa_buf_type buf;                                             \
+    return IntegerImpl::value_type( ascii::itoa( n, buf ) ) OP i.value_;  \
   }
 
 ZORBA_INTEGER_OP(+,long long)
@@ -210,16 +210,16 @@
 ZORBA_INTEGER_OP(%,unsigned long long)
 #undef ZORBA_INTEGER_OP
 
-#define ZORBA_INTEGER_OP(T)                                     \
-  IntegerImpl operator/( IntegerImpl const &i, T n ) {          \
-    ztd::itoa_buf_type buf;                                     \
-    IntegerImpl::value_type const temp( ztd::itoa( n, buf ) );  \
-    return IntegerImpl::ftoi( i.value_ / temp );                \
-  }                                                             \
-  IntegerImpl operator/( T n, IntegerImpl const &i ) {          \
-    ztd::itoa_buf_type buf;                                     \
-    IntegerImpl::value_type const temp( ztd::itoa( n, buf ) );  \
-    return IntegerImpl::ftoi( temp / i.value_ );                \
+#define ZORBA_INTEGER_OP(T)                                       \
+  IntegerImpl operator/( IntegerImpl const &i, T n ) {            \
+    ascii::itoa_buf_type buf;                                     \
+    IntegerImpl::value_type const temp( ascii::itoa( n, buf ) );  \
+    return IntegerImpl::ftoi( i.value_ / temp );                  \
+  }                                                               \
+  IntegerImpl operator/( T n, IntegerImpl const &i ) {            \
+    ascii::itoa_buf_type buf;                                     \
+    IntegerImpl::value_type const temp( ascii::itoa( n, buf ) );  \
+    return IntegerImpl::ftoi( temp / i.value_ );                  \
   }
 
 ZORBA_INTEGER_OP(long long)
@@ -227,12 +227,12 @@
 ZORBA_INTEGER_OP(unsigned long long)
 #undef ZORBA_INTEGER_OP
 
-#define ZORBA_INTEGER_OP(OP,T)                    \
-  IntegerImpl& IntegerImpl::operator OP( T n ) {  \
-    ztd::itoa_buf_type buf;                       \
-    value_type const temp( ztd::itoa( n, buf ) ); \
-    value_ OP temp;                               \
-    return *this;                                 \
+#define ZORBA_INTEGER_OP(OP,T)                      \
+  IntegerImpl& IntegerImpl::operator OP( T n ) {    \
+    ascii::itoa_buf_type buf;                       \
+    value_type const temp( ascii::itoa( n, buf ) ); \
+    value_ OP temp;                                 \
+    return *this;                                   \
   }
 
 ZORBA_INTEGER_OP(+=,long long)
@@ -250,11 +250,11 @@
 #undef ZORBA_INTEGER_OP
 
 #define ZORBA_INTEGER_OP(T) \
-  IntegerImpl& IntegerImpl::operator/=( T n ) {   \
-    ztd::itoa_buf_type buf;                       \
-    value_type const temp( ztd::itoa( n, buf ) ); \
-    value_ = ftoi( value_ / temp );               \
-    return *this;                                 \
+  IntegerImpl& IntegerImpl::operator/=( T n ) {     \
+    ascii::itoa_buf_type buf;                       \
+    value_type const temp( ascii::itoa( n, buf ) ); \
+    value_ = ftoi( value_ / temp );                 \
+    return *this;                                   \
   }
 
 ZORBA_INTEGER_OP(long long)
@@ -286,14 +286,14 @@
 #ifdef ZORBA_WITH_BIG_INTEGER
 
 #define ZORBA_INTEGER_OP(OP,T) \
-  bool operator OP( IntegerImpl const &i, T n ) {                       \
-    ztd::itoa_buf_type buf;                                             \
-    return i.value_ OP IntegerImpl::value_type( ztd::itoa( n, buf ) );  \
-  }                                                                     \
-                                                                        \
-  bool operator OP( T n, IntegerImpl const &i ) {                       \
-    ztd::itoa_buf_type buf;                                             \
-    return IntegerImpl::value_type( ztd::itoa( n, buf ) ) OP i.value_;  \
+  bool operator OP( IntegerImpl const &i, T n ) {                         \
+    ascii::itoa_buf_type buf;                                             \
+    return i.value_ OP IntegerImpl::value_type( ascii::itoa( n, buf ) );  \
+  }                                                                       \
+                                                                          \
+  bool operator OP( T n, IntegerImpl const &i ) {                         \
+    ascii::itoa_buf_type buf;                                             \
+    return IntegerImpl::value_type( ascii::itoa( n, buf ) ) OP i.value_;  \
   }
 
 ZORBA_INTEGER_OP(==,long long)
@@ -376,8 +376,8 @@
 MAPM INTEGER_IMPL(T)::itod() const {
   if ( is_cxx_long() )
     return static_cast<long>( value_ );
-  ztd::itoa_buf_type buf;
-  return ztd::itoa( value_, buf );
+  ascii::itoa_buf_type buf;
+  return ascii::itoa( value_, buf );
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
 
@@ -438,8 +438,8 @@
   delete[] buf;
   return result;
 #else
-  ztd::itoa_buf_type buf;
-  return ztd::itoa( value_, buf );
+  ascii::itoa_buf_type buf;
+  return ascii::itoa( value_, buf );
 #endif /* ZORBA_WITH_BIG_INTEGER */
 }
 

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to