Mercurial > octave
changeset 29562:7513a6aa14ef
use m_ prefix for data members in hook_function classes
* hook-fcn.h, hook-fcn.cc (class hook_function, class
name_hook_function, class fcn_handle_hook_function, class
hook_function_list): Use m_ prefix for data members.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 27 Apr 2021 13:23:06 -0400 |
parents | ed90a4d75f6d |
children | 8a296f1351a4 |
files | libinterp/corefcn/hook-fcn.cc libinterp/corefcn/hook-fcn.h |
diffstat | 2 files changed, 40 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/hook-fcn.cc Tue Apr 27 13:16:01 2021 -0400 +++ b/libinterp/corefcn/hook-fcn.cc Tue Apr 27 13:23:06 2021 -0400 @@ -36,11 +36,11 @@ { std::string name = f.string_value (); - rep = std::shared_ptr<base_hook_function> (new named_hook_function (name, d)); + m_rep = std::shared_ptr<base_hook_function> (new named_hook_function (name, d)); } else if (f.is_function_handle ()) { - rep = std::shared_ptr<base_hook_function> (new fcn_handle_hook_function (f, d)); + m_rep = std::shared_ptr<base_hook_function> (new fcn_handle_hook_function (f, d)); } else error ("invalid hook function"); @@ -50,19 +50,19 @@ { octave_value_list args = initial_args; - if (data.is_defined ()) - args.append (data); + if (m_data.is_defined ()) + args.append (m_data); - octave::feval (name, args, 0); + octave::feval (m_name, args, 0); } void fcn_handle_hook_function::eval (const octave_value_list& initial_args) { octave_value_list args = initial_args; - if (data.is_defined ()) - args.append (data); + if (m_data.is_defined ()) + args.append (m_data); - octave::feval (fcn_handle, args, 0); + octave::feval (m_fcn_handle, args, 0); }
--- a/libinterp/corefcn/hook-fcn.h Tue Apr 27 13:16:01 2021 -0400 +++ b/libinterp/corefcn/hook-fcn.h Tue Apr 27 13:23:06 2021 -0400 @@ -64,7 +64,7 @@ static std::shared_ptr<base_hook_function> nil_rep (new base_hook_function ()); - rep = nil_rep; + m_rep = nil_rep; } hook_function (const octave_value& f, @@ -76,18 +76,18 @@ hook_function& operator = (const hook_function& hf) = default; - std::string id (void) const { return rep->id (); } + std::string id (void) const { return m_rep->id (); } - bool is_valid (void) const { return rep->is_valid (); } + bool is_valid (void) const { return m_rep->is_valid (); } void eval (const octave_value_list& initial_args) { - rep->eval (initial_args); + m_rep->eval (initial_args); } private: - std::shared_ptr<base_hook_function> rep; + std::shared_ptr<base_hook_function> m_rep; }; class @@ -96,20 +96,20 @@ public: named_hook_function (const std::string& n, const octave_value& d) - : name (n), data (d) + : m_name (n), m_data (d) { } void eval (const octave_value_list& initial_args); - std::string id (void) const { return name; } + std::string id (void) const { return m_name; } - bool is_valid (void) const { return is_valid_function (name); } + bool is_valid (void) const { return is_valid_function (m_name); } private: - std::string name; + std::string m_name; - octave_value data; + octave_value m_data; }; class @@ -118,35 +118,35 @@ public: fcn_handle_hook_function (const octave_value& fh_arg, const octave_value& d) - : ident (), valid (false), fcn_handle (fh_arg), data (d) + : m_ident (), m_valid (false), m_fcn_handle (fh_arg), m_data (d) { - octave_fcn_handle *fh = fcn_handle.fcn_handle_value (true); + octave_fcn_handle *fh = m_fcn_handle.fcn_handle_value (true); if (fh) { - valid = true; + m_valid = true; std::ostringstream buf; buf << fh; - ident = fh->fcn_name () + ':' + buf.str (); + m_ident = fh->fcn_name () + ':' + buf.str (); } } void eval (const octave_value_list& initial_args); - std::string id (void) const { return ident; } + std::string id (void) const { return m_ident; } - bool is_valid (void) const { return valid; } + bool is_valid (void) const { return m_valid; } private: - std::string ident; + std::string m_ident; - bool valid; + bool m_valid; - octave_value fcn_handle; + octave_value m_fcn_handle; - octave_value data; + octave_value m_data; }; class @@ -167,36 +167,36 @@ hook_function_list& operator = (const hook_function_list& lst) = default; - bool empty (void) const { return fcn_map.empty (); } + bool empty (void) const { return m_fcn_map.empty (); } - void clear (void) { fcn_map.clear (); } + void clear (void) { m_fcn_map.clear (); } void insert (const std::string& id, const hook_function& f) { - fcn_map[id] = f; + m_fcn_map[id] = f; } iterator find (const std::string& id) { - return fcn_map.find (id); + return m_fcn_map.find (id); } const_iterator find (const std::string& id) const { - return fcn_map.find (id); + return m_fcn_map.find (id); } - iterator end (void) { return fcn_map.end (); } + iterator end (void) { return m_fcn_map.end (); } - const_iterator end (void) const { return fcn_map.end (); } + const_iterator end (void) const { return m_fcn_map.end (); } - void erase (iterator p) { fcn_map.erase (p); } + void erase (iterator p) { m_fcn_map.erase (p); } void run (const octave_value_list& initial_args = octave_value_list ()) { - auto p = fcn_map.begin (); + auto p = m_fcn_map.begin (); - while (p != fcn_map.end ()) + while (p != m_fcn_map.end ()) { std::string hook_fcn_id = p->first; hook_function hook_fcn = p->second; @@ -206,13 +206,13 @@ if (hook_fcn.is_valid ()) hook_fcn.eval (initial_args); else - fcn_map.erase (q); + m_fcn_map.erase (q); } } private: - map_type fcn_map; + map_type m_fcn_map; }; #endif