changeset 11037:e7864673c31f

new Cell (std::list<std::string>&) constructor
author John W. Eaton <jwe@octave.org>
date Tue, 28 Sep 2010 18:12:12 -0400
parents 169f59f626d3
children 35416c9baf76
files src/Cell.cc src/Cell.h src/ChangeLog
diffstat 3 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/Cell.cc
+++ b/src/Cell.cc
@@ -63,6 +63,25 @@
     }
 }
 
+Cell::Cell (const std::list<std::string>& lst)
+  : Array<octave_value> ()
+{
+  size_t n = lst.size ();
+
+  if (n > 0)
+    {
+      resize (dim_vector (n, 1));
+
+      octave_idx_type i = 0;
+
+      for (std::list<std::string>::const_iterator it = lst.begin ();
+           it != lst.end (); it++)
+        {
+          elem(i++,0) = *it;
+        }
+    }
+}
+
 Cell::Cell (const Array<std::string>& sa)
   : Array<octave_value> (sa.dims ())
 {
--- a/src/Cell.h
+++ b/src/Cell.h
@@ -63,6 +63,8 @@
 
   Cell (const string_vector& sv, bool trim = false);
 
+  Cell (const std::list<std::string>& lst);
+
   Cell (const Array<std::string>& sa);
 
   Cell (const dim_vector& dv, const string_vector& sv, bool trim = false);
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-28  John W. Eaton  <jwe@octave.org>
+
+	* Cell.h, Cell.cc (Cell::Cell (const std::list<std::string>&)):
+	New constructor.
+
 2010-09-28  John P. Swensen  <jpswensen@gmail.com>
 
 	* DLD-FUNCTIONS/__magick_read__.cc (maybe_initialize_magick):