changeset 23355:08db4e9dd149

* Cell.h, Cell.cc (Cell::string_vector_value): New function.
author John W. Eaton <jwe@octave.org>
date Thu, 06 Apr 2017 13:12:09 -0400
parents 1a2941fb8ffd
children ef20eee0247d
files libinterp/corefcn/Cell.cc libinterp/corefcn/Cell.h
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/Cell.cc	Wed Apr 05 16:54:21 2017 -0700
+++ b/libinterp/corefcn/Cell.cc	Thu Apr 06 13:12:09 2017 -0400
@@ -151,6 +151,19 @@
   return retval;
 }
 
+string_vector
+Cell::string_vector_value (void) const
+{
+  octave_idx_type n = numel ();
+
+  string_vector retval (n);
+
+  for (octave_idx_type i = 0; i < n; i++)
+    retval.xelem (i) = elem (i).string_value ();
+
+  return retval;
+}
+
 Cell
 Cell::index (const octave_value_list& idx_arg, bool resize_ok) const
 {
--- a/libinterp/corefcn/Cell.h	Wed Apr 05 16:54:21 2017 -0700
+++ b/libinterp/corefcn/Cell.h	Thu Apr 06 13:12:09 2017 -0400
@@ -76,6 +76,8 @@
 
   Array<std::string> cellstr_value (void) const;
 
+  string_vector string_vector_value (void) const;
+
   using Array<octave_value>::index;
 
   Cell index (const octave_value_list& idx, bool resize_ok = false) const;