diff src/ov-ch-mat.cc @ 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 d91fa4b20bbb
children f42f0d707e8e
line wrap: on
line diff
--- a/src/ov-ch-mat.cc	Sun Oct 04 01:04:29 2009 -0400
+++ b/src/ov-ch-mat.cc	Mon Oct 05 00:11:07 2009 -0400
@@ -155,6 +155,45 @@
   return retval;
 }
 
+#define MACRO_WRAPPER(FCN, CTYPE_FCN) \
+  static int x ## FCN (int c) { return CTYPE_FCN (c); }
+
+#define STRING_MAPPER(FCN, AMAP, CTYPE_FCN) \
+  MACRO_WRAPPER (FCN, CTYPE_FCN) \
+ \
+  octave_value \
+  octave_char_matrix::FCN (void) const \
+  { \
+    static charNDArray::mapper smap = x ## FCN; \
+    return matrix.AMAP (smap);  \
+  }
+
+#define TOSTRING_MAPPER(FCN, AMAP, CTYPE_FCN) \
+  MACRO_WRAPPER (FCN, CTYPE_FCN) \
+ \
+  octave_value \
+  octave_char_matrix::FCN (void) const \
+  { \
+    static charNDArray::mapper smap = x ## FCN; \
+    return octave_value (matrix.AMAP (smap), is_sq_string () ? '\'' : '"'); \
+  }
+
+STRING_MAPPER (xisalnum, bmap, isalnum)
+STRING_MAPPER (xisalpha, bmap, isalpha)
+STRING_MAPPER (xisascii, bmap, isascii)
+STRING_MAPPER (xiscntrl, bmap, iscntrl)
+STRING_MAPPER (xisdigit, bmap, isdigit)
+STRING_MAPPER (xisgraph, bmap, isgraph)
+STRING_MAPPER (xislower, bmap, islower)
+STRING_MAPPER (xisprint, bmap, isprint)
+STRING_MAPPER (xispunct, bmap, ispunct)
+STRING_MAPPER (xisspace, bmap, isspace)
+STRING_MAPPER (xisupper, bmap, isupper)
+STRING_MAPPER (xisxdigit, bmap, isxdigit)
+STRING_MAPPER (xtoascii, dmap, toascii)
+TOSTRING_MAPPER (xtolower, smap, tolower)
+TOSTRING_MAPPER (xtoupper, smap, toupper)
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***