diff libinterp/corefcn/file-io.cc @ 20700:68e3a747ca02

rename octave_value value extractors that accept error message args * ov.h, ov.cc (octave_value::xcell_value, octave_value::xstring_value, octave_value::xcellstr_value): Rename functions that accept error message args. Handle error directly. Only forward to functions that don't attempt type conversion. Change all uses. * ov-base.h, ov-base.cc (octave_base_value::xstring_value): Don't do type conversion. (octave_base_value::cell_value, octave_base_value::cellstr_value): Delete versions that accept error message args. * ov-str-mat.h, ov-str-mat.cc (octave_char_matrix_str::string_value, octave_char_matrix_str::cell_value): Delete.
author John W. Eaton <jwe@octave.org>
date Fri, 13 Nov 2015 14:10:26 -0500
parents 5f04bfc7c17a
children 85e5efae848a
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc	Thu Nov 12 19:27:25 2015 -0800
+++ b/libinterp/corefcn/file-io.cc	Fri Nov 13 14:10:26 2015 -0500
@@ -538,9 +538,9 @@
 
   fid = -1;
 
-  std::string name = tc_name.string_value ("%s: file name must be a string", fcn);
-  std::string mode = tc_mode.string_value ("%s: file mode must be a string", fcn);
-  std::string arch = tc_arch.string_value ("%s: architecture type must be a string", fcn);
+  std::string name = tc_name.xstring_value ("%s: file name must be a string", fcn);
+  std::string mode = tc_mode.xstring_value ("%s: file mode must be a string", fcn);
+  std::string arch = tc_arch.xstring_value ("%s: architecture type must be a string", fcn);
 
   retval = do_stream_open (name, mode, arch, fid);
 
@@ -1325,7 +1325,7 @@
 
   if (! error_state)
     {
-      std::string prec = prec_arg.string_value ("fread: PRECISION must be a string");
+      std::string prec = prec_arg.xstring_value ("fread: PRECISION must be a string");
 
       int block_size = 1;
       oct_data_conv::data_type input_type;
@@ -1340,7 +1340,7 @@
 
           if (! error_state)
             {
-              std::string arch = arch_arg.string_value ("fread: ARCH architecture type must be a string");
+              std::string arch = arch_arg.xstring_value ("fread: ARCH architecture type must be a string");
 
               oct_mach_info::float_format flt_fmt
                 = oct_mach_info::string_to_float_format (arch);
@@ -1586,7 +1586,7 @@
 {
   int retval = -1;
 
-  std::string prec = prec_arg.string_value ("fwrite: PRECISION must be a string");
+  std::string prec = prec_arg.xstring_value ("fwrite: PRECISION must be a string");
 
   int block_size = 1;
   oct_data_conv::data_type output_type;
@@ -1599,7 +1599,7 @@
 
       if (! error_state)
         {
-          std::string arch = arch_arg.string_value ("fwrite: ARCH architecture type must be a string");
+          std::string arch = arch_arg.xstring_value ("fwrite: ARCH architecture type must be a string");
 
           oct_mach_info::float_format flt_fmt
             = oct_mach_info::string_to_float_format (arch);
@@ -1801,8 +1801,8 @@
 
   if (nargin == 2)
     {
-      std::string name = args(0).string_value ("popen: COMMAND must be a string");
-      std::string mode = args(1).string_value ("popen: MODE must be a string");
+      std::string name = args(0).xstring_value ("popen: COMMAND must be a string");
+      std::string mode = args(1).xstring_value ("popen: MODE must be a string");
 
       if (mode == "r")
         {
@@ -1875,12 +1875,12 @@
       std::string dir;
 
       if (len > 0)
-        dir = args(0).string_value ("tempname: DIR must be a string");
+        dir = args(0).xstring_value ("tempname: DIR must be a string");
 
       std::string pfx ("oct-");
 
       if (len > 1)
-        pfx = args(1).string_value ("tempname: PREFIX must be a string");
+        pfx = args(1).xstring_value ("tempname: PREFIX must be a string");
 
       retval = octave_tempnam (dir, pfx);
     }
@@ -2023,7 +2023,7 @@
 
   if (nargin == 1 || nargin == 2)
     {
-      std::string tmpl8 = args(0).string_value ("mkstemp: TEMPLATE argument must be a string");
+      std::string tmpl8 = args(0).xstring_value ("mkstemp: TEMPLATE argument must be a string");
 
       OCTAVE_LOCAL_BUFFER (char, tmp, tmpl8.size () + 1);
       strcpy (tmp, tmpl8.c_str ());