changeset 21488:9dbc8f8bc2d7

move textscan constructor out of header file * textscan.cc (init_inf_nan): New static function. (textscan::textscan): Move here from textscan.h. Initialize all data members in initializer list.
author John W. Eaton <jwe@octave.org>
date Fri, 18 Mar 2016 17:52:30 -0400
parents 71cd12d22804
children ea81c2fdd568
files libinterp/corefcn/textscan.cc libinterp/corefcn/textscan.h
diffstat 2 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/textscan.cc	Fri Mar 18 17:39:37 2016 -0400
+++ b/libinterp/corefcn/textscan.cc	Fri Mar 18 17:52:30 2016 -0400
@@ -1213,6 +1213,29 @@
 
 // Perform actual textscan: read data from stream, and create cell array.
 
+static Cell
+init_inf_nan (void)
+{
+  Cell retval (dim_vector (1, 2));
+
+  retval(0) = Cell (octave_value ("inf"));
+  retval(1) = Cell (octave_value ("nan"));
+
+  return retval;
+}
+
+textscan::textscan (void)
+  : buf (), whitespace_table (), delim_table (), delims (),
+    comment_style (), comment_len (0), comment_char (-2),
+    buffer_size (0), date_locale (), inf_nan (init_inf_nan ()),
+    empty_value (octave_NaN), exp_chars ("edED"),
+    header_lines (0), treat_as_empty (), treat_as_empty_len (0),
+    whitespace (" \b\t"), eol1 ('\r'), eol2 ('\n'),
+    return_on_error (2), collect_output (false),
+    multiple_delims_as_one (false), default_exp (true),
+    numeric_delim (false), lines (0)
+{ }
+
 octave_value
 textscan::scan (std::istream *isp, const octave_value_list& args)
 {
--- a/libinterp/corefcn/textscan.h	Fri Mar 18 17:39:37 2016 -0400
+++ b/libinterp/corefcn/textscan.h	Fri Mar 18 17:52:30 2016 -0400
@@ -57,19 +57,7 @@
 {
 public:
 
-  textscan (void)
-    : buf (""), delim_table (""), delims (), comment_len (0), comment_char(-2),
-      buffer_size (0),
-      empty_value (octave_NaN), exp_chars ("edED"), header_lines (0),
-      treat_as_empty_len (0), whitespace (" \b\t"), eol1('\r'), eol2('\n'),
-      return_on_error (2), collect_output (false),
-      multiple_delims_as_one (false), default_exp (true),
-      numeric_delim (false), lines (0)
-    {
-      inf_nan = Cell (dim_vector (1,2));
-      inf_nan(0) = Cell (octave_value ("inf"));
-      inf_nan(1) = Cell (octave_value ("nan"));
-    };
+  textscan (void);
 
   ~textscan (void) { }