GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
command_history Class Reference

#include "cmd-hist.h"

Public Member Functions

virtual ~command_history ()=default
 

Static Public Member Functions

static bool add (const std::string &)
 
static void append (const std::string &="")
 
static int base ()
 
static void clean_up_and_save (const std::string &="", int=-1)
 
static void clear ()
 
static int current_number ()
 
static std::string file ()
 
static std::string get_entry (int)
 
static int goto_mark ()
 
static std::string histcontrol ()
 
static void ignore_entries (bool=true)
 
static bool ignoring_entries ()
 
static void initialize (bool, const std::string &, int, const std::string &)
 
static bool is_initialized ()
 
static int is_stifled ()
 
static int length ()
 
static string_vector list (int=-1, bool=false)
 
static int max_input_history ()
 
static void process_histcontrol (const std::string &)
 
static void read (bool=true)
 
static void read (const std::string &, bool=true)
 
static void read_range (const std::string &, int=-1, int=-1, bool=true)
 
static void read_range (int=-1, int=-1, bool=true)
 
static void remove (int)
 
static void replace_entry (int, const std::string &)
 
static void set_file (const std::string &)
 
static void set_mark (int n)
 
static void set_size (int)
 
static int size ()
 
static void stifle (int)
 
static void truncate_file (const std::string &="", int=-1)
 
static int unstifle ()
 
static int where ()
 
static void write (const std::string &="")
 

Protected Member Functions

 command_history ()
 
virtual bool do_add (const std::string &)
 
virtual void do_append (const std::string &)
 
virtual int do_base () const
 
virtual void do_clean_up_and_save (const std::string &, int)
 
virtual void do_clear ()
 
virtual int do_current_number () const
 
virtual std::string do_file ()
 
virtual std::string do_get_entry (int) const
 
virtual int do_goto_mark ()
 
virtual std::string do_histcontrol () const
 
virtual void do_ignore_entries (bool)
 
virtual bool do_ignoring_entries () const
 
virtual void do_initialize (bool, const std::string &, int, const std::string &)
 
virtual bool do_is_initialized () const
 
virtual int do_is_stifled () const
 
virtual int do_length () const
 
virtual string_vector do_list (int, bool) const
 
virtual int do_max_input_history () const
 
virtual void do_process_histcontrol (const std::string &)
 
virtual void do_read (const std::string &, bool)
 
virtual void do_read_range (const std::string &, int, int, bool)
 
virtual void do_remove (int)
 
virtual void do_replace_entry (int, const std::string &)
 
virtual void do_set_file (const std::string &)
 
virtual void do_set_mark (int)
 
virtual void do_set_size (int)
 
virtual int do_size () const
 
virtual void do_stifle (int)
 
virtual void do_truncate_file (const std::string &, int) const
 
virtual int do_unstifle ()
 
virtual int do_where () const
 
virtual void do_write (const std::string &) const
 
void error (const std::string &) const
 
void error (int, const std::string &msg="") const
 

Protected Attributes

std::string m_file
 
int m_history_control
 
bool m_ignoring_additions
 
bool m_initialized
 
int m_lines_in_file
 
int m_lines_this_session
 
int m_size
 

Detailed Description

Definition at line 37 of file cmd-hist.h.

Constructor & Destructor Documentation

◆ command_history()

command_history::command_history ( )
inlineprotected

Definition at line 43 of file cmd-hist.h.

◆ ~command_history()

virtual command_history::~command_history ( )
virtualdefault

Member Function Documentation

◆ add()

bool command_history::add ( const std::string &  s)
static

Definition at line 617 of file cmd-hist.cc.

References do_add().

Referenced by history_system::write_timestamp().

◆ append()

void command_history::append ( const std::string &  f = "")
static

Definition at line 735 of file cmd-hist.cc.

References do_append(), and f.

Referenced by history_system::do_history().

◆ base()

int command_history::base ( )
static

Definition at line 657 of file cmd-hist.cc.

References do_base().

◆ clean_up_and_save()

void command_history::clean_up_and_save ( const std::string &  f = "",
int  n = -1 
)
static

Definition at line 769 of file cmd-hist.cc.

References do_clean_up_and_save(), f, and n.

Referenced by octave::Fexec().

◆ clear()

void command_history::clear ( )
static

Definition at line 632 of file cmd-hist.cc.

References do_clear().

Referenced by history_system::do_history().

◆ current_number()

int command_history::current_number ( )
static

Definition at line 663 of file cmd-hist.cc.

References do_current_number().

Referenced by command_editor::do_decode_prompt_string().

◆ do_add()

bool command_history::do_add ( const std::string &  )
protectedvirtual

Definition at line 837 of file cmd-hist.cc.

Referenced by add().

◆ do_append()

void command_history::do_append ( const std::string &  f_arg)
protectedvirtual

Definition at line 936 of file cmd-hist.cc.

References do_where(), error(), f, m_file, m_initialized, and m_lines_this_session.

Referenced by append().

◆ do_base()

int command_history::do_base ( ) const
protectedvirtual

Definition at line 869 of file cmd-hist.cc.

Referenced by base(), and do_current_number().

◆ do_clean_up_and_save()

void command_history::do_clean_up_and_save ( const std::string &  f_arg,
int   
)
protectedvirtual

Definition at line 990 of file cmd-hist.cc.

References error(), f, m_file, and m_initialized.

Referenced by clean_up_and_save().

◆ do_clear()

void command_history::do_clear ( )
protectedvirtual

Definition at line 847 of file cmd-hist.cc.

Referenced by clear().

◆ do_current_number()

int command_history::do_current_number ( ) const
protectedvirtual

Definition at line 875 of file cmd-hist.cc.

References do_base(), do_where(), and m_size.

Referenced by current_number().

◆ do_file()

std::string command_history::do_file ( )
protectedvirtual

Definition at line 807 of file cmd-hist.cc.

References m_file.

Referenced by file().

◆ do_get_entry()

std::string command_history::do_get_entry ( int  ) const
protectedvirtual

Definition at line 980 of file cmd-hist.cc.

Referenced by get_entry().

◆ do_goto_mark()

int command_history::do_goto_mark ( )
protectedvirtual

Definition at line 901 of file cmd-hist.cc.

Referenced by goto_mark().

◆ do_histcontrol()

virtual std::string command_history::do_histcontrol ( ) const
inlineprotectedvirtual

Definition at line 154 of file cmd-hist.h.

Referenced by histcontrol().

◆ do_ignore_entries()

void command_history::do_ignore_entries ( bool  flag)
protectedvirtual

Definition at line 825 of file cmd-hist.cc.

References m_ignoring_additions.

Referenced by ignore_entries().

◆ do_ignoring_entries()

bool command_history::do_ignoring_entries ( ) const
protectedvirtual

Definition at line 831 of file cmd-hist.cc.

References m_ignoring_additions.

Referenced by ignoring_entries().

◆ do_initialize()

void command_history::do_initialize ( bool  read_history_file,
const std::string &  f_arg,
int  sz,
const std::string &  control_arg 
)
protectedvirtual

Definition at line 780 of file cmd-hist.cc.

References m_initialized, process_histcontrol(), read(), set_file(), and set_size().

Referenced by initialize().

◆ do_is_initialized()

bool command_history::do_is_initialized ( ) const
protectedvirtual

Definition at line 795 of file cmd-hist.cc.

References m_initialized.

Referenced by is_initialized().

◆ do_is_stifled()

int command_history::do_is_stifled ( ) const
protectedvirtual

Definition at line 891 of file cmd-hist.cc.

Referenced by is_stifled().

◆ do_length()

int command_history::do_length ( ) const
protectedvirtual

Definition at line 857 of file cmd-hist.cc.

Referenced by length().

◆ do_list()

string_vector command_history::do_list ( int  ,
bool   
) const
protectedvirtual

Definition at line 974 of file cmd-hist.cc.

Referenced by list().

◆ do_max_input_history()

int command_history::do_max_input_history ( ) const
protectedvirtual

Definition at line 863 of file cmd-hist.cc.

Referenced by max_input_history().

◆ do_process_histcontrol()

void command_history::do_process_histcontrol ( const std::string &  )
protectedvirtual

Definition at line 776 of file cmd-hist.cc.

Referenced by process_histcontrol().

◆ do_read()

void command_history::do_read ( const std::string &  f,
bool   
)
protectedvirtual

Definition at line 907 of file cmd-hist.cc.

References error(), and f.

Referenced by read().

◆ do_read_range()

void command_history::do_read_range ( const std::string &  f,
int  ,
int  ,
bool   
)
protectedvirtual

Definition at line 914 of file cmd-hist.cc.

References error(), and f.

Referenced by read_range().

◆ do_remove()

void command_history::do_remove ( int  )
protectedvirtual

Definition at line 843 of file cmd-hist.cc.

Referenced by remove().

◆ do_replace_entry()

void command_history::do_replace_entry ( int  ,
const std::string &   
)
protectedvirtual

Definition at line 986 of file cmd-hist.cc.

Referenced by replace_entry().

◆ do_set_file()

void command_history::do_set_file ( const std::string &  f)
protectedvirtual

Definition at line 801 of file cmd-hist.cc.

References f, and m_file.

Referenced by set_file().

◆ do_set_mark()

void command_history::do_set_mark ( int  )
protectedvirtual

Definition at line 897 of file cmd-hist.cc.

Referenced by set_mark().

◆ do_set_size()

void command_history::do_set_size ( int  n)
protectedvirtual

Definition at line 813 of file cmd-hist.cc.

References m_size, and n.

Referenced by set_size().

◆ do_size()

int command_history::do_size ( ) const
protectedvirtual

Definition at line 819 of file cmd-hist.cc.

References m_size.

Referenced by size().

◆ do_stifle()

void command_history::do_stifle ( int  )
protectedvirtual

Definition at line 881 of file cmd-hist.cc.

Referenced by stifle().

◆ do_truncate_file()

void command_history::do_truncate_file ( const std::string &  f_arg,
int   
) const
protectedvirtual

Definition at line 959 of file cmd-hist.cc.

References error(), f, m_file, and m_initialized.

Referenced by truncate_file().

◆ do_unstifle()

int command_history::do_unstifle ( )
protectedvirtual

Definition at line 885 of file cmd-hist.cc.

Referenced by unstifle().

◆ do_where()

int command_history::do_where ( ) const
protectedvirtual

Definition at line 851 of file cmd-hist.cc.

Referenced by do_append(), do_current_number(), and where().

◆ do_write()

void command_history::do_write ( const std::string &  f_arg) const
protectedvirtual

Definition at line 921 of file cmd-hist.cc.

References error(), f, m_file, and m_initialized.

Referenced by write().

◆ error() [1/2]

void command_history::error ( const std::string &  s) const
protected

Definition at line 1015 of file cmd-hist.cc.

◆ error() [2/2]

void command_history::error ( int  err_num,
const std::string &  msg = "" 
) const
protected

◆ file()

std::string command_history::file ( )
static

Definition at line 572 of file cmd-hist.cc.

References do_file().

Referenced by history_system::do_history(), octave::Fhistory_file(), read(), and read_range().

◆ get_entry()

std::string command_history::get_entry ( int  n)
static

Definition at line 756 of file cmd-hist.cc.

References do_get_entry(), and n.

◆ goto_mark()

int command_history::goto_mark ( )
static

Definition at line 695 of file cmd-hist.cc.

References do_goto_mark().

◆ histcontrol()

std::string command_history::histcontrol ( )
static

Definition at line 585 of file cmd-hist.cc.

References do_histcontrol().

Referenced by octave::Fhistory_control().

◆ ignore_entries()

void command_history::ignore_entries ( bool  flag = true)
static

◆ ignoring_entries()

bool command_history::ignoring_entries ( )
static

◆ initialize()

void command_history::initialize ( bool  read_history_file,
const std::string &  f_arg,
int  sz,
const std::string &  control_arg 
)
static

Definition at line 544 of file cmd-hist.cc.

References do_initialize().

Referenced by history_system::initialize().

◆ is_initialized()

bool command_history::is_initialized ( )
static

Definition at line 553 of file cmd-hist.cc.

References do_is_initialized().

◆ is_stifled()

int command_history::is_stifled ( )
static

Definition at line 682 of file cmd-hist.cc.

References do_is_stifled().

◆ length()

int command_history::length ( )
static

Definition at line 645 of file cmd-hist.cc.

References do_length().

◆ list()

string_vector command_history::list ( int  limit = -1,
bool  number_lines = false 
)
static

◆ max_input_history()

int command_history::max_input_history ( )
static

Definition at line 651 of file cmd-hist.cc.

References do_max_input_history().

◆ process_histcontrol()

void command_history::process_histcontrol ( const std::string &  control_arg)
static

Definition at line 578 of file cmd-hist.cc.

References do_process_histcontrol().

Referenced by do_initialize(), and octave::Fhistory_control().

◆ read() [1/2]

void command_history::read ( bool  must_exist = true)
static

Definition at line 701 of file cmd-hist.cc.

References file().

Referenced by history_system::do_history(), and do_initialize().

◆ read() [2/2]

void command_history::read ( const std::string &  f,
bool  must_exist = true 
)
static

Definition at line 707 of file cmd-hist.cc.

References do_read(), and f.

◆ read_range() [1/2]

void command_history::read_range ( const std::string &  f,
int  from = -1,
int  to = -1,
bool  must_exist = true 
)
static

Definition at line 720 of file cmd-hist.cc.

References do_read_range(), and f.

◆ read_range() [2/2]

void command_history::read_range ( int  from = -1,
int  to = -1,
bool  must_exist = true 
)
static

Definition at line 714 of file cmd-hist.cc.

References file().

Referenced by history_system::do_history().

◆ remove()

void command_history::remove ( int  n)
static

Definition at line 625 of file cmd-hist.cc.

References do_remove(), and n.

◆ replace_entry()

void command_history::replace_entry ( int  which,
const std::string &  line 
)
static

Definition at line 762 of file cmd-hist.cc.

References do_replace_entry().

◆ set_file()

void command_history::set_file ( const std::string &  f_arg)
static

◆ set_mark()

void command_history::set_mark ( int  n)
static

Definition at line 688 of file cmd-hist.cc.

References do_set_mark(), and n.

◆ set_size()

void command_history::set_size ( int  n)
static

Definition at line 591 of file cmd-hist.cc.

References do_set_size(), and n.

Referenced by do_initialize(), and octave::Fhistory_size().

◆ size()

int command_history::size ( )
static

Definition at line 598 of file cmd-hist.cc.

References do_size().

Referenced by octave::Fhistory_size().

◆ stifle()

void command_history::stifle ( int  n)
static

Definition at line 669 of file cmd-hist.cc.

References do_stifle(), and n.

◆ truncate_file()

void command_history::truncate_file ( const std::string &  f = "",
int  n = -1 
)
static

Definition at line 742 of file cmd-hist.cc.

References do_truncate_file(), f, and n.

◆ unstifle()

int command_history::unstifle ( )
static

Definition at line 676 of file cmd-hist.cc.

References do_unstifle().

◆ where()

int command_history::where ( )
static

Definition at line 639 of file cmd-hist.cc.

References do_where().

◆ write()

void command_history::write ( const std::string &  f = "")
static

Definition at line 728 of file cmd-hist.cc.

References do_write(), and f.

Referenced by history_system::do_history().

Member Data Documentation

◆ m_file

std::string command_history::m_file
protected

◆ m_history_control

int command_history::m_history_control
protected

Definition at line 225 of file cmd-hist.h.

◆ m_ignoring_additions

bool command_history::m_ignoring_additions
protected

Definition at line 222 of file cmd-hist.h.

Referenced by do_ignore_entries(), and do_ignoring_entries().

◆ m_initialized

bool command_history::m_initialized
protected

◆ m_lines_in_file

int command_history::m_lines_in_file
protected

Definition at line 228 of file cmd-hist.h.

◆ m_lines_this_session

int command_history::m_lines_this_session
protected

Definition at line 231 of file cmd-hist.h.

Referenced by do_append().

◆ m_size

int command_history::m_size
protected

Definition at line 237 of file cmd-hist.h.

Referenced by do_current_number(), do_set_size(), and do_size().


The documentation for this class was generated from the following files: