メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

cmd-hist.h

解説を見る。
00001 /*
00002 
00003 Copyright (C) 1996, 1997 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 2, or (at your option) any
00010 later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 */
00022 
00023 #if !defined (octave_cmd_hist_h)
00024 #define octave_cmd_hist_h 1
00025 
00026 #include <string>
00027 
00028 #include "str-vec.h"
00029 
00030 class
00031 command_history
00032 {
00033 protected:
00034 
00035   command_history (void)
00036     : ignoring_additions (false), lines_in_file (0),
00037       lines_this_session (0), xfile (), xsize (-1) { }
00038 
00039 public:
00040 
00041   virtual ~command_history (void) { }
00042 
00043   static void set_file (const std::string&);
00044 
00045   static std::string file (void);
00046 
00047   static void set_size (int);
00048 
00049   static int size (void);
00050 
00051   static void ignore_entries (bool = true);
00052 
00053   static bool ignoring_entries (void);
00054 
00055   static void add (const std::string&);
00056 
00057   static void remove (int);
00058 
00059   static int where (void);
00060 
00061   static int length (void);
00062 
00063   static int max_input_history (void);
00064 
00065   static int base (void);
00066 
00067   static int current_number (void);
00068 
00069   static void stifle (int);
00070 
00071   static int unstifle (void);
00072 
00073   static int is_stifled (void);
00074 
00075   static void set_mark (int n);
00076 
00077   // Gag.  This declaration has to match the Function typedef in
00078   // readline.h.
00079 
00080   static int goto_mark (void);
00081 
00082   static void read (bool = true);
00083 
00084   static void read (const std::string&, bool = true);
00085 
00086   static void read_range (int = -1, int = -1, bool = true);
00087 
00088   static void read_range (const std::string&, int = -1, int = -1,
00089                           bool = true);
00090 
00091   static void write (const std::string& = std::string ());
00092 
00093   static void append (const std::string& = std::string ());
00094 
00095   static void truncate_file (const std::string& = std::string (), int = -1);
00096 
00097   static string_vector list (int = -1, bool = false);
00098 
00099   static std::string get_entry (int);
00100 
00101   static void replace_entry (int, const std::string&);
00102 
00103   static void clean_up_and_save (const std::string& = std::string (), int = -1);
00104 
00105 private:
00106 
00107   // No copying!
00108 
00109   command_history (const command_history&);
00110 
00111   command_history& operator = (const command_history&);
00112 
00113   static bool instance_ok (void);
00114 
00115   static void make_command_history (void);
00116 
00117   // The real thing.
00118   static command_history *instance;
00119 
00120 protected:
00121 
00122   // To use something other than the GNU history library, derive a new
00123   // class from command_history, overload these functions as
00124   // necessary, and make instance point to the new class.
00125 
00126   virtual void do_set_file (const std::string&);
00127 
00128   virtual std::string do_file (void);
00129 
00130   virtual void do_set_size (int);
00131 
00132   virtual int do_size (void);
00133 
00134   virtual void do_ignore_entries (bool);
00135 
00136   virtual bool do_ignoring_entries (void);
00137 
00138   virtual void do_add (const std::string&);
00139 
00140   virtual void do_remove (int);
00141 
00142   virtual int do_where (void);
00143 
00144   virtual int do_length (void);
00145 
00146   virtual int do_max_input_history (void);
00147 
00148   virtual int do_base (void);
00149 
00150   virtual int do_current_number (void);
00151 
00152   virtual void do_stifle (int);
00153 
00154   virtual int do_unstifle (void);
00155 
00156   virtual int do_is_stifled (void);
00157 
00158   virtual void do_set_mark (int);
00159 
00160   virtual int do_goto_mark (void);
00161 
00162   virtual void do_read (const std::string&, bool);
00163 
00164   virtual void do_read_range (const std::string&, int, int, bool);
00165 
00166   virtual void do_write (const std::string&);
00167 
00168   virtual void do_append (const std::string&);
00169 
00170   virtual void do_truncate_file (const std::string&, int);
00171 
00172   virtual string_vector do_list (int, bool);
00173 
00174   virtual std::string do_get_entry (int);
00175 
00176   virtual void do_replace_entry (int, const std::string&);
00177 
00178   virtual void do_clean_up_and_save (const std::string&, int);
00179 
00180   void error (int);
00181 
00182   void error (const std::string&);
00183 
00184   // TRUE means we are ignoring new additions.
00185   bool ignoring_additions;
00186 
00187   // The number of hisory lines we read from the history file.
00188   int lines_in_file;
00189 
00190   // The number of history lines we've saved so far.
00191   int lines_this_session;
00192 
00193   // The default history file.
00194   std::string xfile;
00195 
00196   // The number of lines of history to save.
00197   int xsize;
00198 };
00199 
00200 #endif
00201 
00202 /*
00203 ;;; Local Variables: ***
00204 ;;; mode: C++ ***
00205 ;;; End: ***
00206 */

Wed Dec 29 11:51:02 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送