comparison liboctave/cmd-hist.h @ 1797:28aefb5a7dec

[project @ 1996-01-29 05:05:57 by jwe] Initial revision
author jwe
date Mon, 29 Jan 1996 05:05:57 +0000
parents
children 1b57120c997b
comparison
equal deleted inserted replaced
1796:d9aaa9aaa1c0 1797:28aefb5a7dec
1 // cmd-hist.h -*- C++ -*-
2 /*
3
4 Copyright (C) 1996 John W. Eaton
5
6 This file is part of Octave.
7
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
11 later version.
12
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22 */
23
24 #if !defined (octave_cmd_hist_h)
25 #define octave_cmd_hist_h 1
26
27 #include <string>
28
29 #include "str-vec.h"
30
31 class
32 command_history
33 {
34 public:
35
36 command_history (const string& = string (), int = -1);
37
38 ~command_history (void) { initialized = false; }
39
40 void set_file (const string&);
41
42 string file (void);
43
44 void set_size (int);
45
46 int size (void);
47
48 void ignore_entries (bool = true);
49
50 bool ignoring_entries (void);
51
52 void add (const string&);
53
54 void remove (int);
55
56 int where (void);
57
58 int base (void);
59
60 int current_number (void);
61
62 void stifle (int);
63
64 int unstifle (void);
65
66 int is_stifled (void);
67
68 void read (const string& = string ());
69
70 void read_range (const string& = string (), int = -1, int = -1);
71
72 void write (const string& = string ());
73
74 void append (const string& = string ());
75
76 void truncate_file (const string& = string (), int = -1);
77
78 string_vector list (int = -1, int = 0);
79
80 string get_entry (int);
81
82 void replace_entry (int, const string&);
83
84 void clean_up_and_save (const string& = string (), int = -1);
85
86 private:
87
88 // We can only have one history object in any given program.
89 static bool initialized;
90
91 // TRUE means we are ignoring new additions.
92 bool ignoring_additions;
93
94 // The number of hisory lines we read from the history file.
95 int lines_in_file;
96
97 // The number of history lines we've saved so far.
98 int lines_this_session;
99
100 // The default history file.
101 string xfile;
102
103 // The number of lines of history to save.
104 int xsize;
105
106 void error (int);
107
108 void error (const string&);
109
110 command_history (const command_history&);
111
112 command_history& operator = (const command_history&);
113 };
114
115 #endif
116
117 /*
118 ;;; Local Variables: ***
119 ;;; mode: C++ ***
120 ;;; page-delimiter: "^/\\*" ***
121 ;;; End: ***
122 */