Mercurial > hg > octave-nkf
changeset 11500:7aeb4eb7403f
cmd-hist.h, cmd-hist.cc: sprinkle with const
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Jan 2011 02:48:07 -0500 |
parents | 8f23b6757225 |
children | 331fcc41ca23 |
files | liboctave/ChangeLog liboctave/cmd-hist.cc liboctave/cmd-hist.h |
diffstat | 3 files changed, 52 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2011-01-13 John W. Eaton <jwe@octave.org> + + * cmd-hist.h, cmd-hist.cc: Sprinkle with const. + 2011-01-13 John W. Eaton <jwe@octave.org> * CmplxCHOL.h (ComplexCHOL::ComplexCHOL): Initialize all data
--- a/liboctave/cmd-hist.cc +++ b/liboctave/cmd-hist.cc @@ -65,21 +65,21 @@ void do_remove (int); - int do_where (void); + int do_where (void) const; - int do_length (void); + int do_length (void) const; - int do_max_input_history (void); + int do_max_input_history (void) const; - int do_base (void); + int do_base (void) const; - int do_current_number (void); + int do_current_number (void) const; void do_stifle (int); int do_unstifle (void); - int do_is_stifled (void); + int do_is_stifled (void) const; void do_set_mark (int); @@ -89,15 +89,15 @@ void do_read_range (const std::string&, int, int, bool); - void do_write (const std::string&); + void do_write (const std::string&) const; void do_append (const std::string&); - void do_truncate_file (const std::string&, int); + void do_truncate_file (const std::string&, int) const; - string_vector do_list (int, bool); + string_vector do_list (int, bool) const; - std::string do_get_entry (int); + std::string do_get_entry (int) const; void do_replace_entry (int, const std::string&); @@ -128,31 +128,31 @@ } int -gnu_history::do_where (void) +gnu_history::do_where (void) const { return ::octave_where_history (); } int -gnu_history::do_length (void) +gnu_history::do_length (void) const { return ::octave_history_length (); } int -gnu_history::do_max_input_history (void) +gnu_history::do_max_input_history (void) const { return ::octave_max_input_history (); } int -gnu_history::do_base (void) +gnu_history::do_base (void) const { return ::octave_history_base (); } int -gnu_history::do_current_number (void) +gnu_history::do_current_number (void) const { return (xsize > 0) ? do_base () + do_where () : -1; } @@ -170,7 +170,7 @@ } int -gnu_history::do_is_stifled (void) +gnu_history::do_is_stifled (void) const { return ::octave_history_is_stifled (); } @@ -249,7 +249,7 @@ } void -gnu_history::do_write (const std::string& f_arg) +gnu_history::do_write (const std::string& f_arg) const { if (initialized) { @@ -316,7 +316,7 @@ } void -gnu_history::do_truncate_file (const std::string& f_arg, int n) +gnu_history::do_truncate_file (const std::string& f_arg, int n) const { if (initialized) { @@ -333,7 +333,7 @@ } string_vector -gnu_history::do_list (int limit, bool number_lines) +gnu_history::do_list (int limit, bool number_lines) const { string_vector retval; @@ -344,7 +344,7 @@ } std::string -gnu_history::do_get_entry (int n) +gnu_history::do_get_entry (int n) const { std::string retval; @@ -765,7 +765,7 @@ } int -command_history::do_size (void) +command_history::do_size (void) const { return xsize; } @@ -777,7 +777,7 @@ } bool -command_history::do_ignoring_entries (void) +command_history::do_ignoring_entries (void) const { return ignoring_additions; } @@ -793,31 +793,31 @@ } int -command_history::do_where (void) +command_history::do_where (void) const { return 0; } int -command_history::do_length (void) +command_history::do_length (void) const { return 0; } int -command_history::do_max_input_history (void) +command_history::do_max_input_history (void) const { return 0; } int -command_history::do_base (void) +command_history::do_base (void) const { return 0; } int -command_history::do_current_number (void) +command_history::do_current_number (void) const { return (xsize > 0) ? do_base () + do_where () : -1; } @@ -834,7 +834,7 @@ } int -command_history::do_is_stifled (void) +command_history::do_is_stifled (void) const { return 0; } @@ -865,7 +865,7 @@ } void -command_history::do_write (const std::string& f_arg) +command_history::do_write (const std::string& f_arg) const { if (initialized) { @@ -903,7 +903,7 @@ } void -command_history::do_truncate_file (const std::string& f_arg, int) +command_history::do_truncate_file (const std::string& f_arg, int) const { if (initialized) { @@ -918,13 +918,13 @@ } string_vector -command_history::do_list (int, bool) +command_history::do_list (int, bool) const { return string_vector (); } std::string -command_history::do_get_entry (int) +command_history::do_get_entry (int) const { return std::string (); } @@ -950,13 +950,13 @@ } void -command_history::error (int err_num) +command_history::error (int err_num) const { (*current_liboctave_error_handler) ("%s", gnulib::strerror (err_num)); } void -command_history::error (const std::string& s) +command_history::error (const std::string& s) const { (*current_liboctave_error_handler) ("%s", s.c_str ()); }
--- a/liboctave/cmd-hist.h +++ b/liboctave/cmd-hist.h @@ -146,31 +146,31 @@ virtual void do_set_size (int); - virtual int do_size (void); + virtual int do_size (void) const; virtual void do_ignore_entries (bool); - virtual bool do_ignoring_entries (void); + virtual bool do_ignoring_entries (void) const; virtual void do_add (const std::string&); virtual void do_remove (int); - virtual int do_where (void); + virtual int do_where (void) const; - virtual int do_length (void); + virtual int do_length (void) const; - virtual int do_max_input_history (void); + virtual int do_max_input_history (void) const; - virtual int do_base (void); + virtual int do_base (void) const; - virtual int do_current_number (void); + virtual int do_current_number (void) const; virtual void do_stifle (int); virtual int do_unstifle (void); - virtual int do_is_stifled (void); + virtual int do_is_stifled (void) const; virtual void do_set_mark (int); @@ -180,23 +180,23 @@ virtual void do_read_range (const std::string&, int, int, bool); - virtual void do_write (const std::string&); + virtual void do_write (const std::string&) const; virtual void do_append (const std::string&); - virtual void do_truncate_file (const std::string&, int); + virtual void do_truncate_file (const std::string&, int) const; - virtual string_vector do_list (int, bool); + virtual string_vector do_list (int, bool) const; - virtual std::string do_get_entry (int); + virtual std::string do_get_entry (int) const; virtual void do_replace_entry (int, const std::string&); virtual void do_clean_up_and_save (const std::string&, int); - void error (int); + void error (int) const; - void error (const std::string&); + void error (const std::string&) const; // TRUE means we have initialized the history file name and number of // lines to save.