Mercurial > hg > octave-nkf
changeset 5715:edf82d02be75
[project @ 2006-03-24 16:42:43 by jwe]
author | jwe |
---|---|
date | Fri, 24 Mar 2006 16:42:44 +0000 |
parents | 24f6a13878c2 |
children | 7f79a99e273e |
files | src/ChangeLog src/ov-base.cc src/ov-base.h src/ov-cell.cc src/ov-cell.h src/ov-str-mat.cc src/ov-str-mat.h src/ov.h |
diffstat | 8 files changed, 31 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2006-03-24 John W. Eaton <jwe@octave.org> + + * ov-cell.h (octave_cell::convert_to_str_internal): + Undo previous change for pad arg. + * ov-cell.cc (octave_cell::all_strings): Reinstate pad arg, pass + it on to all_strings. + * ov.h (octave_value::all_strings): Reinstate pad arg. + * ov-base.cc (octave_base_value::all_strings): Likewise. + * ov-str-mat.cc (octave_char_matrix_str::all_strings): Likewise. + * ov.h, ov-base.h, ov-cell.h, ov-str-mat.h: Fix all_strings decls. + 2005-10-25 David Bateman <dbateman@free.fr> * data.cc (do_cat): With 1 arg, return [](0x0) for compatibility.
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -597,11 +597,11 @@ } string_vector -octave_base_value::all_strings (void) const +octave_base_value::all_strings (bool pad) const { string_vector retval; - octave_value tmp = convert_to_str (false, true); + octave_value tmp = convert_to_str (pad, true); if (! error_state) retval = tmp.all_strings ();
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -265,7 +265,7 @@ uint64NDArray uint64_array_value (void) const; - string_vector all_strings (void) const; + string_vector all_strings (bool pad = false) const; std::string string_value (bool force = false) const;
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -291,7 +291,7 @@ } string_vector -octave_cell::all_strings (void) const +octave_cell::all_strings (bool pad) const { string_vector retval; @@ -333,7 +333,15 @@ int n = s.length (); for (octave_idx_type ii = 0; ii < n; ii++) - retval[k++] = s[ii]; + { + std::string t = s[ii]; + int t_len = t.length (); + + if (pad && max_len > t_len) + t += std::string (max_len - t_len, ' '); + + retval[k++] = t; + } } }
--- a/src/ov-cell.h +++ b/src/ov-cell.h @@ -101,10 +101,10 @@ octave_value_list list_value (void) const; - octave_value convert_to_str_internal (bool, bool, char type) const - { return octave_value (all_strings (), type); } + octave_value convert_to_str_internal (bool pad, bool, char type) const + { return octave_value (all_strings (pad), type); } - string_vector all_strings (void) const; + string_vector all_strings (bool pad = false) const; bool print_as_scalar (void) const;
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -210,7 +210,7 @@ } string_vector -octave_char_matrix_str::all_strings (void) const +octave_char_matrix_str::all_strings (bool) const { string_vector retval;
--- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -125,7 +125,7 @@ ComplexNDArray complex_array_value (bool = false) const; - string_vector all_strings (void) const; + string_vector all_strings (bool pad = false) const; std::string string_value (bool force = false) const;
--- a/src/ov.h +++ b/src/ov.h @@ -651,8 +651,8 @@ virtual uint64NDArray uint64_array_value (void) const { return rep->uint64_array_value (); } - virtual string_vector all_strings (void) const - { return rep->all_strings (); } + virtual string_vector all_strings (bool pad = false) const + { return rep->all_strings (pad); } virtual std::string string_value (bool force = false) const { return rep->string_value (force); }