# HG changeset patch # User Rik # Date 1631245868 25200 # Node ID f6fe2dcaffaff0399b16a844eb97268ea8a67e86 # Parent b7727b8533d82e1a9c5e782d07d91ad8529a50b7 maint: use "m_" prefix for member variables in class command_editor. * cmd-edit.cc, cmd-edit.h: Use "m_" prefix for member variables in class command_editor. Shorten lines > 80 characters. Re-order private access block to have member variables last. diff -r b7727b8533d8 -r f6fe2dcaffaf liboctave/util/cmd-edit.cc --- a/liboctave/util/cmd-edit.cc Thu Sep 09 20:38:03 2021 -0700 +++ b/liboctave/util/cmd-edit.cc Thu Sep 09 20:51:08 2021 -0700 @@ -58,11 +58,11 @@ command_editor *command_editor::s_instance = nullptr; - std::set command_editor::startup_hook_set; + std::set command_editor::m_startup_hook_set; - std::set command_editor::pre_input_hook_set; + std::set command_editor::m_pre_input_hook_set; - std::set command_editor::event_hook_set; + std::set command_editor::m_event_hook_set; static mutex event_hook_lock; @@ -1119,7 +1119,7 @@ // Iterate over a copy of the set to avoid problems if a hook // function attempts to remove itself from the startup_hook_set. - std::set hook_set = startup_hook_set; + std::set hook_set = m_startup_hook_set; for (startup_hook_fcn f : hook_set) { @@ -1136,7 +1136,7 @@ // Iterate over copy of the set to avoid problems if a hook function // attempts to remove itself from the pre_input_hook_set. - std::set hook_set = pre_input_hook_set; + std::set hook_set = m_pre_input_hook_set; for (pre_input_hook_fcn f : hook_set) { @@ -1155,7 +1155,7 @@ event_hook_lock.lock (); - std::set hook_set (event_hook_set); + std::set hook_set (m_event_hook_set); event_hook_lock.unlock (); @@ -1501,7 +1501,7 @@ { if (instance_ok ()) { - startup_hook_set.insert (f); + m_startup_hook_set.insert (f); s_instance->set_startup_hook (startup_handler); } @@ -1512,12 +1512,12 @@ { if (instance_ok ()) { - auto p = startup_hook_set.find (f); + auto p = m_startup_hook_set.find (f); - if (p != startup_hook_set.end ()) - startup_hook_set.erase (p); + if (p != m_startup_hook_set.end ()) + m_startup_hook_set.erase (p); - if (startup_hook_set.empty ()) + if (m_startup_hook_set.empty ()) s_instance->restore_startup_hook (); } } @@ -1527,7 +1527,7 @@ { if (instance_ok ()) { - pre_input_hook_set.insert (f); + m_pre_input_hook_set.insert (f); s_instance->set_pre_input_hook (pre_input_handler); } @@ -1538,12 +1538,12 @@ { if (instance_ok ()) { - auto p = pre_input_hook_set.find (f); + auto p = m_pre_input_hook_set.find (f); - if (p != pre_input_hook_set.end ()) - pre_input_hook_set.erase (p); + if (p != m_pre_input_hook_set.end ()) + m_pre_input_hook_set.erase (p); - if (pre_input_hook_set.empty ()) + if (m_pre_input_hook_set.empty ()) s_instance->restore_pre_input_hook (); } } @@ -1553,7 +1553,7 @@ { autolock guard (event_hook_lock); - event_hook_set.insert (f); + m_event_hook_set.insert (f); } void @@ -1561,10 +1561,10 @@ { autolock guard (event_hook_lock); - auto p = event_hook_set.find (f); + auto p = m_event_hook_set.find (f); - if (p != event_hook_set.end ()) - event_hook_set.erase (p); + if (p != m_event_hook_set.end ()) + m_event_hook_set.erase (p); } diff -r b7727b8533d8 -r f6fe2dcaffaf liboctave/util/cmd-edit.h --- a/liboctave/util/cmd-edit.h Thu Sep 09 20:38:03 2021 -0700 +++ b/liboctave/util/cmd-edit.h Thu Sep 09 20:51:08 2021 -0700 @@ -142,7 +142,8 @@ static user_accept_line_fcn get_user_accept_line_function (void); - static string_vector generate_filename_completions (const std::string& text); + static string_vector + generate_filename_completions (const std::string& text); static std::string get_line_buffer (void); @@ -218,15 +219,6 @@ static int event_handler (void); - static std::set startup_hook_set; - - static std::set pre_input_hook_set; - - static std::set event_hook_set; - - // The real thing. - static command_editor *s_instance; - static void cleanup_instance (void) { delete s_instance; @@ -235,6 +227,14 @@ static void handle_interrupt_signal (void); + //-------- + + static command_editor *s_instance; // the real thing. + + static std::set m_startup_hook_set; + static std::set m_pre_input_hook_set; + static std::set m_event_hook_set; + protected: // To use something other than the GNU readline library, derive a new @@ -310,11 +310,14 @@ virtual void do_set_user_accept_line_function (user_accept_line_fcn) { } - virtual completion_fcn do_get_completion_function (void) const { return nullptr; } + virtual completion_fcn do_get_completion_function (void) const + { return nullptr; } - virtual quoting_fcn do_get_quoting_function (void) const { return nullptr; } + virtual quoting_fcn do_get_quoting_function (void) const + { return nullptr; } - virtual dequoting_fcn do_get_dequoting_function (void) const { return nullptr; } + virtual dequoting_fcn do_get_dequoting_function (void) const + { return nullptr; } virtual char_is_quoted_fcn do_get_char_is_quoted_function (void) const { return nullptr; } @@ -331,7 +334,8 @@ virtual char do_get_prev_char (int) const = 0; - virtual void do_replace_line (const std::string& text, bool clear_undo) = 0; + virtual void + do_replace_line (const std::string& text, bool clear_undo) = 0; virtual void do_kill_full_line (void) = 0; @@ -374,9 +378,7 @@ void do_interrupt_event_loop (bool arg) { m_interrupt_event_loop = arg; } bool do_event_loop_interrupted (void) const - { - return m_interrupt_event_loop; - } + { return m_interrupt_event_loop; } int do_insert_initial_input (void);