changeset 26127:37e3aa267374

Move function str2double inside octave::string namespace (patch #9084). * liboctave/util/oct-string.[cc/h]: Move function str2double inside octave::string namespace. * libgui/graphics/Table.cc, libinterp/corefcn/strfns.cc: Replace occurrences of "octave_str2double".
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 22 Nov 2018 22:17:28 +0100
parents f6f16b842d5d
children 20b87596b99a
files libgui/graphics/Table.cc libinterp/corefcn/strfns.cc liboctave/util/oct-string.cc liboctave/util/oct-string.h
diffstat 4 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Table.cc	Thu Nov 22 13:11:40 2018 -0800
+++ b/libgui/graphics/Table.cc	Thu Nov 22 22:17:28 2018 +0100
@@ -378,7 +378,7 @@
     else if (old_value.isnumeric () && ! old_value.isinteger ())
       {
         // Basically need to do str2double
-        Complex complex = octave_str2double (ov.string_value ());
+        Complex complex = octave::string::str2double (ov.string_value ());
         if (old_value.is_single_type ())
           retval = octave_value (FloatComplex (complex));
         else
@@ -394,7 +394,7 @@
           retval = octave_value (false);
       }
     else
-      retval = octave_value (octave_str2double (ov.string_value ()));
+      retval = octave_value (octave::string::str2double (ov.string_value ()));
     return retval;
   }
 
--- a/libinterp/corefcn/strfns.cc	Thu Nov 22 13:11:40 2018 -0800
+++ b/libinterp/corefcn/strfns.cc	Thu Nov 22 22:17:28 2018 +0100
@@ -796,12 +796,12 @@
       if (args(0).rows () == 0 || args(0).columns () == 0)
         retval = Matrix (1, 1, octave::numeric_limits<double>::NaN ());
       else if (args(0).rows () == 1 && args(0).ndims () == 2)
-        retval = octave_str2double (args(0).string_value ());
+        retval = octave::string::str2double (args(0).string_value ());
       else
         {
           const string_vector sv = args(0).string_vector_value ();
 
-          retval = sv.map<Complex> (octave_str2double);
+          retval = sv.map<Complex> (octave::string::str2double);
         }
     }
   else if (args(0).iscell ())
@@ -813,7 +813,7 @@
       for (octave_idx_type i = 0; i < cell.numel (); i++)
         {
           if (cell(i).is_string ())
-            output(i) = octave_str2double (cell(i).string_value ());
+            output(i) = octave::string::str2double (cell(i).string_value ());
         }
       retval = output;
     }
--- a/liboctave/util/oct-string.cc	Thu Nov 22 13:11:40 2018 -0800
+++ b/liboctave/util/oct-string.cc	Thu Nov 22 22:17:28 2018 +0100
@@ -450,7 +450,7 @@
 }
 
 Complex
-octave_str2double (const std::string& str_arg)
+octave::string::str2double (const std::string& str_arg)
 {
   Complex val (0.0, 0.0);
 
--- a/liboctave/util/oct-string.h	Thu Nov 22 13:11:40 2018 -0800
+++ b/liboctave/util/oct-string.h	Thu Nov 22 22:17:28 2018 +0100
@@ -122,12 +122,12 @@
     template <typename T>
     bool strncmpi (const T& str_a, const typename T::value_type *str_b,
                    const typename T::size_type n);
+
+    extern OCTAVE_API Complex
+    str2double (const std::string& str_arg);
   }
 }
 
-extern OCTAVE_API Complex
-octave_str2double (const std::string& str_arg);
-
 template <typename T>
 extern OCTAVE_API std::string
 rational_approx (T val, int len);