diff liboctave/util/cmd-hist.cc @ 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 648dabbb4c6b
children 26cba49d7641
line wrap: on
line diff
--- a/liboctave/util/cmd-hist.cc	Mon Sep 17 19:52:20 2012 -0400
+++ b/liboctave/util/cmd-hist.cc	Mon Sep 17 18:34:29 2012 -0400
@@ -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
 {