changeset 15360:d6ea3c0f80d8

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.
author John W. Eaton <jwe@octave.org>
date Wed, 12 Sep 2012 11:04:54 -0400
parents b135f013679e
children 4b82664f526b 7366bedaeac1
files libgui/src/octave-adapter/octave-event-listener.h libgui/src/octave-adapter/octave-event.cc libgui/src/octave-adapter/octave-event.h libgui/src/octave-qt-event-listener.cc libgui/src/octave-qt-event-listener.h
diffstat 5 files changed, 19 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- a/libgui/src/octave-adapter/octave-event.cc
+++ b/libgui/src/octave-adapter/octave-event.cc
@@ -41,13 +41,13 @@
 #include <readline/readline.h>
 
 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)
 {
--- 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;
--- 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));
--- 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 ();