Mercurial > octave
diff libinterp/octave-value/ov.h @ 20700:68e3a747ca02
rename octave_value value extractors that accept error message args
* ov.h, ov.cc (octave_value::xcell_value, octave_value::xstring_value,
octave_value::xcellstr_value): Rename functions that accept error
message args. Handle error directly. Only forward to functions that
don't attempt type conversion. Change all uses.
* ov-base.h, ov-base.cc (octave_base_value::xstring_value): Don't do
type conversion.
(octave_base_value::cell_value, octave_base_value::cellstr_value):
Delete versions that accept error message args.
* ov-str-mat.h, ov-str-mat.cc (octave_char_matrix_str::string_value,
octave_char_matrix_str::cell_value): Delete.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 13 Nov 2015 14:10:26 -0500 |
parents | 0dfeb5c82750 |
children | 85e5efae848a |
line wrap: on
line diff
--- a/libinterp/octave-value/ov.h Thu Nov 12 19:27:25 2015 -0800 +++ b/libinterp/octave-value/ov.h Fri Nov 13 14:10:26 2015 -0500 @@ -770,8 +770,6 @@ Cell cell_value (void) const; - Cell cell_value (const char *fmt, ...) const; - Matrix matrix_value (bool frc_str_conv = false) const { return rep->matrix_value (frc_str_conv); } @@ -899,29 +897,9 @@ std::string string_value (bool force = false) const { return rep->string_value (force); } - std::string string_value (const char *fmt, ...) const - { - std::string retval; - va_list args; - va_start (args,fmt); - retval = rep->string_value (fmt, args); - va_end (args); - return retval; - } - Array<std::string> cellstr_value (void) const { return rep->cellstr_value (); } - Array<std::string> cellstr_value (const char *fmt, ...) const - { - Array<std::string> retval; - va_list args; - va_start (args,fmt); - retval = rep->cellstr_value (fmt, args); - va_end (args); - return retval; - } - Range range_value (void) const { return rep->range_value (); } @@ -1016,6 +994,21 @@ float_complex_vector_value (bool frc_str_conv = false, bool frc_vec_conv = false) const; + // Extract values of specific types without any implicit type + // conversions. Throw an error if an object is the wrong type for + // the requested value extraction. + // + // These functions are intended to provide a simple way to extract + // values of specific types and display error messages that are more + // meaningful than the generic "error: wrong type argument 'cell'" + // message. + + Cell xcell_value (const char *fmt, ...) const; + + std::string xstring_value (const char *fmt, ...) const; + + Array<std::string> xcellstr_value (const char *fmt, ...) const; + // Possibly economize a lazy-indexed value. void maybe_economize (void)