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

#include "cmd-hist.h"

Collaboration diagram for octave::command_history:

Public Member Functions

 command_history (const command_history &)=delete
 
virtual ~command_history (void)=default
 
command_historyoperator= (const command_history &)=delete
 

Static Public Member Functions

static bool add (const std::string &)
 
static void append (const std::string &="")
 
static int base (void)
 
static void clean_up_and_save (const std::string &="", int=-1)
 
static void clear (void)
 
static int current_number (void)
 
static std::string file (void)
 
static std::string get_entry (int)
 
static int goto_mark (void)
 
static std::string histcontrol (void)
 
static void ignore_entries (bool=true)
 
static bool ignoring_entries (void)
 
static void initialize (bool, const std::string &, int, const std::string &)
 
static bool is_initialized (void)
 
static int is_stifled (void)
 
static int length (void)
 
static string_vector list (int=-1, bool=false)
 
static int max_input_history (void)
 
static void process_histcontrol (const std::string &)
 
static void read (bool=true)
 
static void read (const std::string &, bool=true)
 
static void read_range (int=-1, int=-1, bool=true)
 
static void read_range (const std::string &, 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 (void)
 
static void stifle (int)
 
static void truncate_file (const std::string &="", int=-1)
 
static int unstifle (void)
 
static int where (void)
 
static void write (const std::string &="")
 

Protected Member Functions

 command_history (void)
 
virtual bool do_add (const std::string &)
 
virtual void do_append (const std::string &)
 
virtual int do_base (void) const
 
virtual void do_clean_up_and_save (const std::string &, int)
 
virtual void do_clear (void)
 
virtual int do_current_number (void) const
 
virtual std::string do_file (void)
 
virtual std::string do_get_entry (int) const
 
virtual int do_goto_mark (void)
 
virtual std::string do_histcontrol (void) const
 
virtual void do_ignore_entries (bool)
 
virtual bool do_ignoring_entries (void) const
 
virtual void do_initialize (bool, const std::string &, int, const std::string &)
 
virtual bool do_is_initialized (void) const
 
virtual int do_is_stifled (void) const
 
virtual int do_length (void) const
 
virtual string_vector do_list (int, bool) const
 
virtual int do_max_input_history (void) 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 (void) const
 
virtual void do_stifle (int)
 
virtual void do_truncate_file (const std::string &, int) const
 
virtual int do_unstifle (void)
 
virtual int do_where (void) const
 
virtual void do_write (const std::string &) const
 
void error (int, const std::string &msg="") const
 
void error (const std::string &) const
 

Protected Attributes

int history_control
 
bool ignoring_additions
 
bool initialized
 
int lines_in_file
 
int lines_this_session
 
std::string xfile
 
int xsize
 

Static Private Member Functions

static void cleanup_instance (void)
 
static bool instance_ok (void)
 
static void make_command_history (void)
 

Static Private Attributes

static command_historyinstance = nullptr
 

Detailed Description

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

Constructor & Destructor Documentation

◆ command_history() [1/2]

octave::command_history::command_history ( void  )
inlineprotected

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

Referenced by make_command_history().

◆ command_history() [2/2]

octave::command_history::command_history ( const command_history )
delete

◆ ~command_history()

virtual octave::command_history::~command_history ( void  )
virtualdefault

Member Function Documentation

◆ add()

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

◆ append()

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

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

References do_append(), f, instance, and instance_ok().

Referenced by do_history().

◆ base()

int octave::command_history::base ( void  )
static

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

References do_base(), instance, and instance_ok().

◆ clean_up_and_save()

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

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

References do_clean_up_and_save(), f, instance, and instance_ok().

◆ cleanup_instance()

static void octave::command_history::cleanup_instance ( void  )
inlinestaticprivate

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

Referenced by instance_ok().

◆ clear()

void octave::command_history::clear ( void  )
static

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

References do_clear(), instance, and instance_ok().

Referenced by do_history().

◆ current_number()

int octave::command_history::current_number ( void  )
static

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

References do_current_number(), instance, and instance_ok().

◆ do_add()

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

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

Referenced by add().

◆ do_append()

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

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

References do_where(), error(), f, initialized, lines_this_session, string, and xfile.

Referenced by append().

◆ do_base()

int octave::command_history::do_base ( void  ) const
protectedvirtual

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

Referenced by base(), and do_current_number().

◆ do_clean_up_and_save()

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

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

References error(), f, initialized, string, and xfile.

Referenced by clean_up_and_save().

◆ do_clear()

void octave::command_history::do_clear ( void  )
protectedvirtual

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

Referenced by clear().

◆ do_current_number()

int octave::command_history::do_current_number ( void  ) const
protectedvirtual

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

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

Referenced by current_number().

◆ do_file()

std::string octave::command_history::do_file ( void  )
protectedvirtual

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

References xfile.

Referenced by file().

◆ do_get_entry()

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

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

Referenced by get_entry().

◆ do_goto_mark()

int octave::command_history::do_goto_mark ( void  )
protectedvirtual

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

Referenced by goto_mark().

◆ do_histcontrol()

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

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

Referenced by histcontrol().

◆ do_ignore_entries()

void octave::command_history::do_ignore_entries ( bool  flag)
protectedvirtual

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

References ignoring_additions.

Referenced by ignore_entries().

◆ do_ignoring_entries()

bool octave::command_history::do_ignoring_entries ( void  ) const
protectedvirtual

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

References ignoring_additions.

Referenced by ignoring_entries().

◆ do_initialize()

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

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

References initialized, process_histcontrol(), read(), set_file(), set_size(), and sz.

Referenced by initialize().

◆ do_is_initialized()

bool octave::command_history::do_is_initialized ( void  ) const
protectedvirtual

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

References initialized.

Referenced by is_initialized().

◆ do_is_stifled()

int octave::command_history::do_is_stifled ( void  ) const
protectedvirtual

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

Referenced by is_stifled().

◆ do_length()

int octave::command_history::do_length ( void  ) const
protectedvirtual

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

Referenced by length().

◆ do_list()

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

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

Referenced by list().

◆ do_max_input_history()

int octave::command_history::do_max_input_history ( void  ) const
protectedvirtual

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

Referenced by max_input_history().

◆ do_process_histcontrol()

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

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

Referenced by process_histcontrol().

◆ do_read()

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

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

References error(), and f.

Referenced by read().

◆ do_read_range()

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

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

References error(), and f.

Referenced by read_range().

◆ do_remove()

void octave::command_history::do_remove ( int  )
protectedvirtual

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

Referenced by remove().

◆ do_replace_entry()

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

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

Referenced by replace_entry().

◆ do_set_file()

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

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

References f, and xfile.

Referenced by set_file().

◆ do_set_mark()

void octave::command_history::do_set_mark ( int  )
protectedvirtual

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

Referenced by set_mark().

◆ do_set_size()

void octave::command_history::do_set_size ( int  n)
protectedvirtual

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

References xsize.

Referenced by set_size().

◆ do_size()

int octave::command_history::do_size ( void  ) const
protectedvirtual

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

References xsize.

Referenced by size().

◆ do_stifle()

void octave::command_history::do_stifle ( int  )
protectedvirtual

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

Referenced by stifle().

◆ do_truncate_file()

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

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

References error(), f, initialized, string, and xfile.

Referenced by truncate_file().

◆ do_unstifle()

int octave::command_history::do_unstifle ( void  )
protectedvirtual

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

Referenced by unstifle().

◆ do_where()

int octave::command_history::do_where ( void  ) const
protectedvirtual

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

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

◆ do_write()

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

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

References error(), f, initialized, string, and xfile.

Referenced by write().

◆ error() [1/2]

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

◆ error() [2/2]

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

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

References s.

◆ file()

std::string octave::command_history::file ( void  )
static

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

References do_file(), instance, and instance_ok().

Referenced by do_history(), read(), and read_range().

◆ get_entry()

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

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

References do_get_entry(), instance, and instance_ok().

◆ goto_mark()

int octave::command_history::goto_mark ( void  )
static

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

References do_goto_mark(), instance, and instance_ok().

◆ histcontrol()

std::string octave::command_history::histcontrol ( void  )
static

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

References do_histcontrol(), instance, and instance_ok().

◆ ignore_entries()

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

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

References do_ignore_entries(), instance, and instance_ok().

◆ ignoring_entries()

bool octave::command_history::ignoring_entries ( void  )
static

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

References do_ignoring_entries(), instance, and instance_ok().

◆ initialize()

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

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

References do_initialize(), instance, instance_ok(), and sz.

Referenced by initialize_history().

◆ instance_ok()

◆ is_initialized()

bool octave::command_history::is_initialized ( void  )
static

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

References do_is_initialized(), and instance.

◆ is_stifled()

int octave::command_history::is_stifled ( void  )
static

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

References do_is_stifled(), instance, and instance_ok().

◆ length()

int octave::command_history::length ( void  )
static

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

References do_length(), instance, and instance_ok().

◆ list()

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

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

References do_list(), instance, and instance_ok().

Referenced by do_history(), initialize_history(), and mk_tmp_hist_file().

◆ make_command_history()

void octave::command_history::make_command_history ( void  )
staticprivate

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

References command_history(), and instance.

Referenced by instance_ok().

◆ max_input_history()

int octave::command_history::max_input_history ( void  )
static

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

References do_max_input_history(), instance, and instance_ok().

◆ operator=()

command_history& octave::command_history::operator= ( const command_history )
delete

◆ process_histcontrol()

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

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

References do_process_histcontrol(), instance, and instance_ok().

Referenced by do_initialize().

◆ read() [1/2]

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

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

References file().

Referenced by do_history(), and do_initialize().

◆ read() [2/2]

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

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

References do_read(), f, instance, and instance_ok().

◆ read_range() [1/2]

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

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

References file().

Referenced by do_history().

◆ read_range() [2/2]

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

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

References do_read_range(), f, instance, and instance_ok().

◆ remove()

void octave::command_history::remove ( int  n)
static

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

References do_remove(), instance, and instance_ok().

Referenced by mk_tmp_hist_file().

◆ replace_entry()

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

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

References do_replace_entry(), instance, and instance_ok().

◆ set_file()

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

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

References do_set_file(), f, instance, instance_ok(), string, and octave::sys::file_ops::tilde_expand().

Referenced by do_history(), and do_initialize().

◆ set_mark()

void octave::command_history::set_mark ( int  n)
static

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

References do_set_mark(), instance, and instance_ok().

◆ set_size()

void octave::command_history::set_size ( int  n)
static

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

References do_set_size(), instance, and instance_ok().

Referenced by do_initialize().

◆ size()

int octave::command_history::size ( void  )
static

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

References do_size(), instance, and instance_ok().

◆ stifle()

void octave::command_history::stifle ( int  n)
static

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

References do_stifle(), instance, and instance_ok().

◆ truncate_file()

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

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

References do_truncate_file(), f, instance, and instance_ok().

◆ unstifle()

int octave::command_history::unstifle ( void  )
static

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

References do_unstifle(), instance, and instance_ok().

◆ where()

int octave::command_history::where ( void  )
static

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

References do_where(), instance, and instance_ok().

◆ write()

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

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

References do_write(), f, instance, and instance_ok().

Referenced by do_history().

Member Data Documentation

◆ history_control

int octave::command_history::history_control
protected

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

◆ ignoring_additions

bool octave::command_history::ignoring_additions
protected

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

Referenced by do_ignore_entries(), and do_ignoring_entries().

◆ initialized

bool octave::command_history::initialized
protected

◆ instance

◆ lines_in_file

int octave::command_history::lines_in_file
protected

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

◆ lines_this_session

int octave::command_history::lines_this_session
protected

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

Referenced by do_append().

◆ xfile

std::string octave::command_history::xfile
protected

◆ xsize

int octave::command_history::xsize
protected

Definition at line 232 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: