diff src/ov-ch-mat.h @ 9689:34d6f005db4b

eliminate is_string argument from octave_value character array constructors
author John W. Eaton <jwe@octave.org>
date Mon, 05 Oct 2009 00:11:07 -0400
parents e793865ede63
children f42f0d707e8e
line wrap: on
line diff
--- a/src/ov-ch-mat.h
+++ b/src/ov-ch-mat.h
@@ -34,9 +34,10 @@
 #include "str-vec.h"
 
 #include "error.h"
+#include "ov.h"
 #include "ov-base.h"
-
 #include "ov-base-mat.h"
+#include "ov-re-mat.h"
 #include "ov-typeinfo.h"
 
 class Octave_map;
@@ -49,15 +50,15 @@
 class
 octave_char_matrix : public octave_base_matrix<charNDArray>
 {
-public:
+protected:
 
   octave_char_matrix (void)
     : octave_base_matrix<charNDArray> () { }
 
-  octave_char_matrix (const charMatrix& chm, bool = false)
+  octave_char_matrix (const charMatrix& chm)
     : octave_base_matrix<charNDArray> (chm) { }
 
-  octave_char_matrix (const charNDArray& chm, bool = false)
+  octave_char_matrix (const charNDArray& chm)
     : octave_base_matrix<charNDArray> (chm) { }
 
   octave_char_matrix (char c)
@@ -75,6 +76,8 @@
   octave_char_matrix (const octave_char_matrix& chm)
     : octave_base_matrix<charNDArray> (chm) { }
 
+public:
+
   ~octave_char_matrix (void) { }
 
   octave_base_value *clone (void) const { return new octave_char_matrix (*this); }
@@ -134,12 +137,62 @@
     { return matrix; }
 
   octave_value convert_to_str_internal (bool, bool, char type) const
-    { return octave_value (matrix, true, type); }
+    { return octave_value (matrix, type); }
 
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
   mxArray *as_mxArray (void) const;
 
+  octave_value xisalnum (void) const;
+  octave_value xisalpha (void) const;
+  octave_value xisascii (void) const;
+  octave_value xiscntrl (void) const;
+  octave_value xisdigit (void) const;
+  octave_value xisgraph (void) const;
+  octave_value xislower (void) const;
+  octave_value xisprint (void) const;
+  octave_value xispunct (void) const;
+  octave_value xisspace (void) const;
+  octave_value xisupper (void) const;
+  octave_value xisxdigit (void) const;
+  octave_value xtoascii (void) const;
+  octave_value xtolower (void) const;
+  octave_value xtoupper (void) const;
+
+#define MAT_MAPPER(MAP) \
+  octave_value MAP (void) const \
+    { \
+      octave_matrix m (array_value (true)); \
+      return m.MAP (); \
+    }
+
+  MAT_MAPPER (abs)
+  MAT_MAPPER (angle)
+  MAT_MAPPER (arg)
+  MAT_MAPPER (ceil)
+  MAT_MAPPER (conj)
+  MAT_MAPPER (fix)
+  MAT_MAPPER (floor)
+  MAT_MAPPER (imag)
+  MAT_MAPPER (real)
+  MAT_MAPPER (round)
+  MAT_MAPPER (signum)
+
+#undef MAT_MAPPER
+
+#define BOOL_MAT_MAPPER(MAP, VAL)	\
+  octave_value MAP (void) const \
+    { \
+      return boolNDArray (matrix.dims (), VAL); \
+    }
+
+  BOOL_MAT_MAPPER (finite, true)
+  BOOL_MAT_MAPPER (isinf, false)
+  BOOL_MAT_MAPPER (isna, false)
+  BOOL_MAT_MAPPER (isnan, false)
+
+#undef BOOL_MAT_MAPPER
+
 protected:
 
   DECLARE_OCTAVE_ALLOCATOR