diff liboctave/array/chNDArray.h @ 19508:6c9ea5be96bf

Change charMatrix to subclass charNDArray rather than be another Array<char>. * chMatrix.h: both charMatrix and charNDArray are Array<char>, the first being simply 2 dimensional. We change this so that charMatrix inherits from charNDArray instead. * chMatrix.cc: remove all constructors which are now inherited from charNDArray. * chNDArray.h, chNDArray.cc: implement all constructors here rather than calling charMatrix. Remove matrix_value() since a charMatrix constructor is now enough. * pr-output.cc, octave-value/ov-ch-mat.h, octave-value/ov-str-mat.cc: replace calls to charNDArray::matrix_value () with the charMatrix constructor.
author Carnë Draug <carandraug@octave.org>
date Fri, 24 Oct 2014 01:31:53 +0100
parents ebb3ef964372
children 4197fc428c7d
line wrap: on
line diff
--- a/liboctave/array/chNDArray.h
+++ b/liboctave/array/chNDArray.h
@@ -23,12 +23,14 @@
 #if !defined (octave_chNDArray_h)
 #define octave_chNDArray_h 1
 
+#include <string>
+
 #include "Array.h"
-#include "chMatrix.h"
 
 #include "mx-defs.h"
 #include "mx-op-decl.h"
 #include "bsxfun-decl.h"
+#include "str-vec.h"
 
 class
 OCTAVE_API
@@ -46,17 +48,15 @@
 
   charNDArray (const charNDArray& a) : Array<char> (a) { }
 
-  charNDArray (const charMatrix& a) : Array<char> (a) { }
+  charNDArray (const Array<char>& a) : Array<char> (a) { }
 
-  charNDArray (char c) : Array<char> (charMatrix (c)) { }
-
-  charNDArray (const char *s) : Array<char> (charMatrix (s)) { }
+  charNDArray (char c);
 
-  charNDArray (const std::string& s) : Array<char> (charMatrix (s)) { }
+  charNDArray (const char *s);
 
-  charNDArray (const string_vector& s) : Array<char> (charMatrix (s)) { }
+  charNDArray (const std::string& s);
 
-  charNDArray (const Array<char>& a) : Array<char> (a) { }
+  charNDArray (const string_vector& s, char fill_value = '\0');
 
   charNDArray& operator = (const charNDArray& a)
   {
@@ -84,8 +84,6 @@
   charNDArray& insert (const charNDArray& a,
                        const Array<octave_idx_type>& ra_idx);
 
-  charMatrix matrix_value (void) const;
-
   charNDArray squeeze (void) const { return Array<char>::squeeze (); }
 
   static void increment_index (Array<octave_idx_type>& ra_idx,