# HG changeset patch # User John W. Eaton # Date 1347462294 14400 # Node ID d6ea3c0f80d8845eb0a6413d26b328854dd27289 # Parent b135f013679ef6ae7b6b22629f3a5d3a5eff8e69 pass std::string objects by const reference, not value * octave-event-listener.h, octave-event.cc, octave-event.h, octave-qt-event-listener.cc, octave-qt-event-listener.h: In all functions that pass std::string objects around, pass them by const reference instead of by value. diff --git a/libgui/src/octave-adapter/octave-event-listener.h b/libgui/src/octave-adapter/octave-event-listener.h --- a/libgui/src/octave-adapter/octave-event-listener.h +++ b/libgui/src/octave-adapter/octave-event-listener.h @@ -31,7 +31,9 @@ octave_event_listener () { } virtual ~octave_event_listener () { } - virtual void current_directory_has_changed (std::string directory) = 0; + virtual void + current_directory_has_changed (const std::string& directory) = 0; + virtual void about_to_exit () = 0; virtual void entered_debug_mode () = 0; diff --git a/libgui/src/octave-adapter/octave-event.cc b/libgui/src/octave-adapter/octave-event.cc --- a/libgui/src/octave-adapter/octave-event.cc +++ b/libgui/src/octave-adapter/octave-event.cc @@ -41,13 +41,13 @@ #include void -octave_event::call_octave_function (std::string name) +octave_event::call_octave_function (const std::string& name) { call_octave_function (name, octave_value_list ()); } void -octave_event::call_octave_function (std::string name, +octave_event::call_octave_function (const std::string& name, const octave_value_list& args, int nargout) { diff --git a/libgui/src/octave-adapter/octave-event.h b/libgui/src/octave-adapter/octave-event.h --- a/libgui/src/octave-adapter/octave-event.h +++ b/libgui/src/octave-adapter/octave-event.h @@ -73,9 +73,9 @@ { _octave_event_observer.event_reject (this); } protected: - void call_octave_function (std::string name); + void call_octave_function (const std::string& name); - void call_octave_function (std::string name, + void call_octave_function (const std::string& name, const octave_value_list& args, int nargout = 0); @@ -127,7 +127,7 @@ public: /** Creates a new octave_run_file_event. */ octave_run_file_event (octave_event_observer& o, - std::string file) + const std::string& file) : octave_event (o) { _file = file; } @@ -143,7 +143,7 @@ public: /** Creates a new octave_change_directory_event. */ octave_change_directory_event (octave_event_observer& o, - std::string directory) + const std::string& directory) : octave_event (o) { _directory = directory; } @@ -175,7 +175,7 @@ public: /** Creates a new octave_change_directory_event. */ octave_load_workspace_event (octave_event_observer& o, - std::string file) + const std::string& file) : octave_event (o) { _file = file; } @@ -191,7 +191,7 @@ public: /** Creates a new octave_change_directory_event. */ octave_save_workspace_event (octave_event_observer& o, - std::string file) + const std::string& file) : octave_event (o) { _file = file; } @@ -216,8 +216,8 @@ { public: octave_add_breakpoint_event (octave_event_observer& o, - std::string path, - std::string function_name, + const std::string& path, + const std::string& function_name, int line) : octave_event (o) { @@ -253,8 +253,8 @@ { public: octave_remove_breakpoint_event (octave_event_observer& o, - std::string path, - std::string function_name, + const std::string& path, + const std::string& function_name, int line) : octave_event (o) { @@ -290,8 +290,8 @@ { public: octave_remove_all_breakpoints_event (octave_event_observer& o, - std::string path, - std::string function_name) + const std::string& path, + const std::string& function_name) : octave_event (o) { _path = path; diff --git a/libgui/src/octave-qt-event-listener.cc b/libgui/src/octave-qt-event-listener.cc --- a/libgui/src/octave-qt-event-listener.cc +++ b/libgui/src/octave-qt-event-listener.cc @@ -33,7 +33,7 @@ } void -octave_qt_event_listener::current_directory_has_changed (std::string directory) +octave_qt_event_listener::current_directory_has_changed (const std::string& directory) { emit current_directory_has_changed_signal (QString::fromStdString (directory)); diff --git a/libgui/src/octave-qt-event-listener.h b/libgui/src/octave-qt-event-listener.h --- a/libgui/src/octave-qt-event-listener.h +++ b/libgui/src/octave-qt-event-listener.h @@ -34,7 +34,7 @@ public: octave_qt_event_listener (QObject *parent = 0); - void current_directory_has_changed (std::string directory); + void current_directory_has_changed (const std::string& directory); void about_to_exit (); void entered_debug_mode ();