Mercurial > octave
changeset 23575:e95738a119da
maint: Deprecate is_cellstr and replace with iscellstr.
* ov.h (is_cellstr): Use OCTAVE_DEPRECATED macro for is_cellstr.
* ov.h (iscellstr): New function.
* Cell.cc, Cell.h, data.cc, graphics.cc, graphics.in.h, lookup.cc, strfns.cc,
sysdep.cc, __delaunayn__.cc, __voronoi__.cc, convhulln.cc, ov-base.h,
ov-cell.cc, ov-cell.h, ov-java.cc, ov-struct.cc:
Replace occurrences of is_cellstr with iscellstr.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 11 Jun 2017 15:26:14 -0700 |
parents | 5faefc310a21 |
children | 00e518162fda |
files | libinterp/corefcn/Cell.cc libinterp/corefcn/Cell.h libinterp/corefcn/data.cc libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h libinterp/corefcn/lookup.cc libinterp/corefcn/strfns.cc libinterp/corefcn/sysdep.cc libinterp/dldfcn/__delaunayn__.cc libinterp/dldfcn/__voronoi__.cc libinterp/dldfcn/convhulln.cc libinterp/octave-value/ov-base.h libinterp/octave-value/ov-cell.cc libinterp/octave-value/ov-cell.h libinterp/octave-value/ov-java.cc libinterp/octave-value/ov-struct.cc libinterp/octave-value/ov.h |
diffstat | 17 files changed, 37 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/Cell.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/Cell.cc Sun Jun 11 15:26:14 2017 -0700 @@ -120,7 +120,7 @@ } bool -Cell::is_cellstr (void) const +Cell::iscellstr (void) const { bool retval = true;
--- a/libinterp/corefcn/Cell.h Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/Cell.h Sun Jun 11 15:26:14 2017 -0700 @@ -72,7 +72,7 @@ Cell (const Cell& c) : Array<octave_value> (c) { } - bool is_cellstr (void) const; + bool iscellstr (void) const; Array<std::string> cellstr_value (void) const;
--- a/libinterp/corefcn/data.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/data.cc Sun Jun 11 15:26:14 2017 -0700 @@ -6915,7 +6915,7 @@ #undef MAKE_INT_BRANCH default: - if (argx.is_cellstr ()) + if (argx.iscellstr ()) retval = argx.cellstr_value ().nth_element (n, dim); else err_wrong_type_arg ("nth_element", argx);
--- a/libinterp/corefcn/graphics.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/graphics.cc Sun Jun 11 15:26:14 2017 -0700 @@ -6605,7 +6605,7 @@ { octave_value retval = val; - if (val.is_cellstr ()) + if (val.iscellstr ()) { // Always return a column vector for Matlab compatibility if (val.columns () > 1) @@ -6703,7 +6703,7 @@ { octave_value retval = val; - if (val.is_cellstr ()) + if (val.iscellstr ()) { // Always return a column vector for Matlab Compatibility if (val.columns () > 1) @@ -10434,7 +10434,7 @@ if (! go) error ("set: invalid handle (= %g)", hcv(n)); - if (nargin == 3 && args(1).is_cellstr () && args(2).is_cell ()) + if (nargin == 3 && args(1).iscellstr () && args(2).is_cell ()) { if (args(2).cell_value ().rows () == 1) go.set (args(1).cellstr_value (), args(2).cell_value (), 0); @@ -10558,7 +10558,7 @@ Cell vals; bool use_cell_format = false; - if (nargin > 1 && args(1).is_cellstr ()) + if (nargin > 1 && args(1).iscellstr ()) { Array<std::string> plist = args(1).cellstr_value ();
--- a/libinterp/corefcn/graphics.in.h Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/graphics.in.h Sun Jun 11 15:26:14 2017 -0700 @@ -496,7 +496,7 @@ const desired_enum& typ = string_t) : base_property (s, h), desired_type (typ), separator (sep), str () { - if (! c.is_cellstr ()) + if (! c.iscellstr ()) error ("set: invalid order property value for \"%s\"", get_name ().c_str ()); @@ -617,7 +617,7 @@ return true; } } - else if (val.is_cellstr ()) + else if (val.iscellstr ()) { bool replace = false; Cell new_cell = val.cell_value ();
--- a/libinterp/corefcn/lookup.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/lookup.cc Sun Jun 11 15:26:14 2017 -0700 @@ -252,7 +252,7 @@ bool num_case = ((table.is_numeric_type () && y.is_numeric_type ()) || (table.is_char_matrix () && y.is_char_matrix ())); - bool str_case = table.is_cellstr () && (y.is_string () || y.is_cellstr ()); + bool str_case = table.iscellstr () && (y.is_string () || y.iscellstr ()); bool left_inf = false; bool right_inf = false; bool match_idx = false; @@ -319,7 +319,7 @@ Array<std::string> str_table = table.cellstr_value (); Array<std::string> str_y (dim_vector (1, 1)); - if (y.is_cellstr ()) + if (y.iscellstr ()) str_y = y.cellstr_value (); else str_y(0) = y.string_value ();
--- a/libinterp/corefcn/strfns.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/strfns.cc Sun Jun 11 15:26:14 2017 -0700 @@ -357,7 +357,7 @@ std::string s = (r == 0 ? "" : str[0]); - if (cell_val.is_cellstr ()) + if (cell_val.iscellstr ()) { const Array<std::string> cellstr = cell_val.cellstr_value (); for (octave_idx_type i = 0; i < cellstr.numel (); i++) @@ -402,7 +402,7 @@ if (cell.numel () == r) { - if (cell_val.is_cellstr ()) + if (cell_val.iscellstr ()) { const Array<std::string> cellstr = cell_val.cellstr_value (); @@ -463,7 +463,7 @@ { const std::string str2 = cell2(0).string_value (); - if (cell1_val.is_cellstr ()) + if (cell1_val.iscellstr ()) { const Array<std::string> cellstr = cell1_val.cellstr_value (); for (octave_idx_type i = 0; i < cellstr.numel (); i++) @@ -488,7 +488,7 @@ if (size1 != size2) error ("%s: nonconformant cell arrays", fcn_name); - if (cell1.is_cellstr () && cell2.is_cellstr ()) + if (cell1.iscellstr () && cell2.iscellstr ()) { const Array<std::string> cellstr1 = cell1_val.cellstr_value (); const Array<std::string> cellstr2 = cell2_val.cellstr_value ();
--- a/libinterp/corefcn/sysdep.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/corefcn/sysdep.cc Sun Jun 11 15:26:14 2017 -0700 @@ -914,7 +914,7 @@ sv = octave::sys::file_ops::tilde_expand (sv); - if (arg.is_cellstr ()) + if (arg.iscellstr ()) return ovl (Cell (arg.dims (), sv)); else return ovl (sv);
--- a/libinterp/dldfcn/__delaunayn__.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/dldfcn/__delaunayn__.cc Sun Jun 11 15:26:14 2017 -0700 @@ -127,7 +127,7 @@ options = args(1).string_value (); else if (args(1).is_empty ()) ; // Use default options - else if (args(1).is_cellstr ()) + else if (args(1).iscellstr ()) { options = ""; Array<std::string> tmp = args(1).cellstr_value ();
--- a/libinterp/dldfcn/__voronoi__.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/dldfcn/__voronoi__.cc Sun Jun 11 15:26:14 2017 -0700 @@ -126,7 +126,7 @@ options = " " + opt_arg.string_value (); else if (opt_arg.is_empty ()) ; // Use default options. - else if (opt_arg.is_cellstr ()) + else if (opt_arg.iscellstr ()) { options = "";
--- a/libinterp/dldfcn/convhulln.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/dldfcn/convhulln.cc Sun Jun 11 15:26:14 2017 -0700 @@ -143,7 +143,7 @@ options = " " + args(1).string_value (); else if (args(1).is_empty ()) ; // Use default options. - else if (args(1).is_cellstr ()) + else if (args(1).iscellstr ()) { options = "";
--- a/libinterp/octave-value/ov-base.h Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/octave-value/ov-base.h Sun Jun 11 15:26:14 2017 -0700 @@ -341,7 +341,7 @@ virtual bool is_cell (void) const { return false; } - virtual bool is_cellstr (void) const { return false; } + virtual bool iscellstr (void) const { return false; } virtual bool is_real_scalar (void) const { return false; }
--- a/libinterp/octave-value/ov-cell.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/octave-value/ov-cell.cc Sun Jun 11 15:26:14 2017 -0700 @@ -403,14 +403,14 @@ } bool -octave_cell::is_cellstr (void) const +octave_cell::iscellstr (void) const { bool retval; if (cellstr_cache.get ()) retval = true; else { - retval = matrix.is_cellstr (); + retval = matrix.iscellstr (); // Allocate empty cache to mark that this is indeed a cellstr. if (retval) cellstr_cache.reset (new Array<std::string> ()); @@ -456,7 +456,7 @@ { octave_value retval; - if (! is_cellstr ()) + if (! iscellstr ()) error ("sort: only cell arrays of character strings may be sorted"); Array<std::string> tmp = cellstr_value (); @@ -475,7 +475,7 @@ { octave_value retval; - if (! is_cellstr ()) + if (! iscellstr ()) error ("sort: only cell arrays of character strings may be sorted"); Array<std::string> tmp = cellstr_value (); @@ -493,7 +493,7 @@ { sortmode retval = UNSORTED; - if (! is_cellstr ()) + if (! iscellstr ()) error ("issorted: A is not a cell array of strings"); Array<std::string> tmp = cellstr_value (); @@ -508,7 +508,7 @@ { Array<octave_idx_type> retval; - if (! is_cellstr ()) + if (! iscellstr ()) error ("sortrows: only cell arrays of character strings may be sorted"); Array<std::string> tmp = cellstr_value (); @@ -523,7 +523,7 @@ { sortmode retval = UNSORTED; - if (! is_cellstr ()) + if (! iscellstr ()) error ("issorted: A is not a cell array of strings"); Array<std::string> tmp = cellstr_value (); @@ -612,7 +612,7 @@ { Array<std::string> retval; - if (! is_cellstr ()) + if (! iscellstr ()) error ("invalid conversion from cell array to array of strings"); if (cellstr_cache->is_empty ()) @@ -1275,7 +1275,7 @@ if (args.length () != 1) print_usage (); - return ovl (args(0).is_cellstr ()); + return ovl (args(0).iscellstr ()); } DEFUN (cellstr, args, ,
--- a/libinterp/octave-value/ov-cell.h Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/octave-value/ov-cell.h Sun Jun 11 15:26:14 2017 -0700 @@ -121,7 +121,7 @@ builtin_type_t builtin_type (void) const { return btyp_cell; } - bool is_cellstr (void) const; + bool iscellstr (void) const; bool is_true (void) const;
--- a/libinterp/octave-value/ov-java.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/octave-value/ov-java.cc Sun Jun 11 15:26:14 2017 -0700 @@ -1503,7 +1503,7 @@ jobj = jni_env->NewStringUTF (s.c_str ()); jcls = jni_env->GetObjectClass (jobj); } - else if (val.is_cellstr ()) + else if (val.iscellstr ()) { const Array<std::string> str_arr = val.cellstr_value (); const octave_idx_type n = str_arr.numel ();
--- a/libinterp/octave-value/ov-struct.cc Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/octave-value/ov-struct.cc Sun Jun 11 15:26:14 2017 -0700 @@ -1969,7 +1969,7 @@ if (! args(0).is_cell ()) error ("cell2struct: argument CELL must be of type cell"); - if (! (args(1).is_cellstr () || args(1).is_char_matrix ())) + if (! (args(1).iscellstr () || args(1).is_char_matrix ())) error ("cell2struct: FIELDS must be a cell array of strings or a character matrix"); int dim = 0;
--- a/libinterp/octave-value/ov.h Fri Jun 09 15:32:33 2017 -0400 +++ b/libinterp/octave-value/ov.h Sun Jun 11 15:26:14 2017 -0700 @@ -531,8 +531,12 @@ bool is_cell (void) const { return rep->is_cell (); } + bool iscellstr (void) const + { return rep->iscellstr (); } + + OCTAVE_DEPRECATED ("use 'iscellstr' instead") bool is_cellstr (void) const - { return rep->is_cellstr (); } + { return iscellstr (); } bool is_real_scalar (void) const { return rep->is_real_scalar (); }