Mercurial > hg > octave-terminal
changeset 15397:231d8d3b8225
provide command_hist::clear_history function
* cmd-hist.h, cmd-hist.cc (command_history::clear,
command_history::do_clear): New functions.
* cmd-hist.cc (gnu_history::do_clear): New function.
* oct-rl-hist.h, oct-rl-hist.c (octave_clear_history): New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 17 Sep 2012 18:34:29 -0400 |
parents | 1054ab58cd58 |
children | 2e5ba861898f |
files | liboctave/util/cmd-hist.cc liboctave/util/cmd-hist.h liboctave/util/oct-rl-hist.c liboctave/util/oct-rl-hist.h |
diffstat | 4 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/cmd-hist.cc +++ b/liboctave/util/cmd-hist.cc @@ -69,6 +69,8 @@ void do_remove (int); + void do_clear (void); + int do_where (void) const; int do_length (void) const; @@ -201,6 +203,12 @@ ::octave_remove_history (n); } +void +gnu_history::do_clear (void) +{ + ::octave_clear_history (); +} + int gnu_history::do_where (void) const { @@ -587,6 +595,13 @@ instance->do_remove (n); } +void +command_history::clear (void) +{ + if (instance_ok ()) + instance->do_clear (); +} + int command_history::where (void) { @@ -807,6 +822,11 @@ { } +void +command_history::do_clear (void) +{ +} + int command_history::do_where (void) const {
--- a/liboctave/util/cmd-hist.h +++ b/liboctave/util/cmd-hist.h @@ -65,6 +65,8 @@ static void remove (int); + static void clear (void); + static int where (void); static int length (void); @@ -158,6 +160,8 @@ virtual void do_remove (int); + virtual void do_clear (void); + virtual int do_where (void) const; virtual int do_length (void) const;