26 #if ! defined (octave_cmd_hist_h)
27 #define octave_cmd_hist_h 1
29 #include "octave-config.h"
44 : m_initialized (false), m_ignoring_additions (false),
45 m_history_control (0), m_lines_in_file (0),
46 m_lines_this_session (0), m_file (), m_size (-1)
59 static void initialize (
bool,
const std::string&,
int,
const std::string&);
61 static bool is_initialized (
void);
63 static void set_file (
const std::string&);
65 static std::string file (
void);
67 static void process_histcontrol (
const std::string&);
69 static std::string histcontrol (
void);
71 static void set_size (
int);
73 static int size (
void);
75 static void ignore_entries (
bool =
true);
77 static bool ignoring_entries (
void);
79 static bool add (
const std::string&);
81 static void remove (
int);
83 static void clear (
void);
85 static int where (
void);
89 static int max_input_history (
void);
91 static int base (
void);
93 static int current_number (
void);
95 static void stifle (
int);
97 static int unstifle (
void);
99 static int is_stifled (
void);
101 static void set_mark (
int n);
106 static int goto_mark (
void);
108 static void read (
bool =
true);
110 static void read (
const std::string&,
bool =
true);
112 static void read_range (
int = -1,
int = -1,
bool =
true);
114 static void read_range (
const std::string&,
int = -1,
int = -1,
117 static void write (
const std::string& =
"");
119 static void append (
const std::string& =
"");
121 static void truncate_file (
const std::string& =
"",
int = -1);
125 static std::string get_entry (
int);
127 static void replace_entry (
int,
const std::string&);
129 static void clean_up_and_save (
const std::string& =
"",
int = -1);
133 static bool instance_ok (
void);
135 static void make_command_history (
void);
143 s_instance =
nullptr;
152 virtual void do_set_file (
const std::string&);
154 virtual std::string do_file (
void);
156 virtual void do_process_histcontrol (
const std::string&);
160 virtual void do_initialize (
bool,
const std::string&,
int,
163 virtual bool do_is_initialized (
void)
const;
165 virtual void do_set_size (
int);
167 virtual int do_size (
void)
const;
169 virtual void do_ignore_entries (
bool);
171 virtual bool do_ignoring_entries (
void)
const;
173 virtual bool do_add (
const std::string&);
175 virtual void do_remove (
int);
177 virtual void do_clear (
void);
179 virtual int do_where (
void)
const;
181 virtual int do_length (
void)
const;
183 virtual int do_max_input_history (
void)
const;
185 virtual int do_base (
void)
const;
187 virtual int do_current_number (
void)
const;
189 virtual void do_stifle (
int);
191 virtual int do_unstifle (
void);
193 virtual int do_is_stifled (
void)
const;
195 virtual void do_set_mark (
int);
197 virtual int do_goto_mark (
void);
199 virtual void do_read (
const std::string&,
bool);
201 virtual void do_read_range (
const std::string&,
int,
int,
bool);
203 virtual void do_write (
const std::string&)
const;
205 virtual void do_append (
const std::string&);
207 virtual void do_truncate_file (
const std::string&,
int)
const;
211 virtual std::string do_get_entry (
int)
const;
213 virtual void do_replace_entry (
int,
const std::string&);
215 virtual void do_clean_up_and_save (
const std::string&,
int);
217 void error (
int,
const std::string& msg =
"")
const;
219 void error (
const std::string&)
const;
virtual std::string do_histcontrol(void) const
bool m_ignoring_additions
virtual ~command_history(void)=default
command_history(const command_history &)=delete
static command_history * s_instance
static void cleanup_instance(void)
void error(const char *fmt,...)
static void initialize(void)