]> git.mxchange.org Git - flightgear.git/commitdiff
Alex Romosan: Pass strings by reference not value
authordaveluff <daveluff>
Fri, 2 Dec 2005 22:52:09 +0000 (22:52 +0000)
committerdaveluff <daveluff>
Fri, 2 Dec 2005 22:52:09 +0000 (22:52 +0000)
15 files changed:
src/Instrumentation/KLN89/kln89.cxx
src/Instrumentation/KLN89/kln89.hxx
src/Instrumentation/KLN89/kln89_page.cxx
src/Instrumentation/KLN89/kln89_page.hxx
src/Instrumentation/KLN89/kln89_page_apt.cxx
src/Instrumentation/KLN89/kln89_page_apt.hxx
src/Instrumentation/KLN89/kln89_page_dir.cxx
src/Instrumentation/KLN89/kln89_page_dir.hxx
src/Instrumentation/KLN89/kln89_page_fpl.hxx
src/Instrumentation/KLN89/kln89_page_int.cxx
src/Instrumentation/KLN89/kln89_page_int.hxx
src/Instrumentation/KLN89/kln89_page_ndb.cxx
src/Instrumentation/KLN89/kln89_page_ndb.hxx
src/Instrumentation/KLN89/kln89_page_vor.cxx
src/Instrumentation/KLN89/kln89_page_vor.hxx

index e66115bcb22c5fcc80de6e77be93d01060d0135e..78a817f9e09d5c79c0c871464507d7cf2be3caa5 100644 (file)
@@ -908,7 +908,7 @@ void KLN89::DrawMapQuad(int x1, int y1, int x2, int y2, bool invert) {
 // Draw an airport or waypoint label on the moving map
 // Specify position by the map pixel co-ordinate of the left or right, bottom, of the *visible* portion of the label.
 // The black background quad will automatically overlap this by 1 pixel.
-void KLN89::DrawLabel(string s, int x1, int y1, bool right_align) {
+void KLN89::DrawLabel(const string& s, int x1, int y1, bool right_align) {
        MapToInstrument(x1, y1);
        if(!right_align) {
                for(unsigned int i=0; i<s.size(); ++i) {
index 992063e242859e14b15a87d0f22617cb79ec0eba..b116dde5d54aaf342e0248bc8eaae497d201e815 100644 (file)
@@ -240,7 +240,7 @@ private:
        // Draw an airport or waypoint label on the moving map
        // Specify position by the map pixel co-ordinate of the left or right, bottom, of the *visible* portion of the label.
        // The black background quad will automatically overlap this by 1 pixel.
-       void DrawLabel(string s, int x1, int y1, bool right_align = false);
+       void DrawLabel(const string& s, int x1, int y1, bool right_align = false);
        
        int GetLabelQuadrant(double h);
        int GetLabelQuadrant(double h1, double h2);
index 153164839594e5b88d4e40d1012763785dbeb414..6924208d0389fd90e79a3bdeea3dd32bd97741be 100644 (file)
@@ -110,7 +110,7 @@ void KLN89Page::Update(double dt) {
        }\r
 }\r
 \r
-void KLN89Page::ShowScratchpadMessage(string line1, string line2) {\r
+void KLN89Page::ShowScratchpadMessage(const string& line1, const string& line2) {\r
        _scratchpadLine1 = line1;\r
        _scratchpadLine2 = line2;\r
        _scratchpadTimer = 0.0;\r
@@ -195,10 +195,10 @@ void KLN89Page::LooseFocus() {
        _entInvert = false;\r
 }\r
 \r
-void KLN89Page::SetId(string s) {\r
+void KLN89Page::SetId(const string& s) {\r
        _id = s;\r
 }\r
 \r
-string KLN89Page::GetId() {\r
+const string& KLN89Page::GetId() {\r
        return(_id);\r
 }\r
index 251436b5d5e21d78e08104bba5cba14766da01b5..9794c4e012c654141aaa485bede57e1aa68e1942 100644 (file)
@@ -60,8 +60,8 @@ public:
        inline void SetEntInvert(bool b) { _entInvert = b; }\r
        \r
        // Get / Set a waypoint id, NOT the page name!\r
-       virtual void SetId(string s);\r
-       virtual string GetId();\r
+       virtual void SetId(const string& s);\r
+       virtual const string& GetId();\r
        \r
 protected:\r
        KLN89* _kln89;\r
@@ -82,7 +82,7 @@ protected:
        string _id;             // The ID of the waypoint that the page is displaying.\r
                                        // Doesn't make sense for all pages, but does for all the data pages.\r
                                        \r
-       void ShowScratchpadMessage(string line1, string line2);\r
+       void ShowScratchpadMessage(const string& line1, const string& line2);\r
                                        \r
        bool _scratchpadMsg;            // Set true when there is a scratchpad message to display\r
        double _scratchpadTimer;        // Used for displaying the scratchpad messages for the right amount of time.\r
index d1272e6cd013afd7d64ac7965540111c81b4915a..db283003e77082a5e8d34a9055b285dd0970cd66 100644 (file)
@@ -462,7 +462,7 @@ void KLN89AptPage::Update(double dt) {
        KLN89Page::Update(dt);
 }
 
-void KLN89AptPage::SetId(string s) {
+void KLN89AptPage::SetId(const string& s) {
        _last_apt_id = _apt_id;
        _save_apt_id = _apt_id;
        _apt_id = s;
index d5814fda8d98a663a12b3bc972889a0c7a2c14aa..62e250cd6f8b5abd4460fd57a6215b55a93f7d45 100644 (file)
@@ -49,7 +49,7 @@ public:
        void Knob2Left1();
        void Knob2Right1();
        
-       void SetId(string s);
+       void SetId(const string& s);
        
 private:
        // Update the cached airport details
index 63c75abe8168b0eac171e3df60cc77a117c153ab..8ac43e5ac329daf908995eab481397cb5eabda81 100644 (file)
@@ -63,7 +63,7 @@ void KLN89DirPage::Update(double dt) {
        KLN89Page::Update(dt);
 }
 
-void KLN89DirPage::SetId(string s) {
+void KLN89DirPage::SetId(const string& s) {
        if(s.size()) {
                _id = s;
                // TODO - fill in lat, lon, type
@@ -100,4 +100,4 @@ void KLN89DirPage::EntPressed() {
        } else {
                _kln89->DtoInitiate(_id);
        }
-}
\ No newline at end of file
+}
index ec31df4aac0404bfe3a3d7d908e8e865544c82a2..cee3b3f62717df914fa772b23380750b06bbb619 100644 (file)
@@ -34,7 +34,7 @@ public:
        
        void Update(double dt);
        
-       void SetId(string s);
+       void SetId(const string& s);
        
        void ClrPressed();
        void EntPressed();
index a571e16d66fa56fd0bd7bc0d93363ca7cfe78321..f4c8a7804d89e6410e50fab4ad4e3af9c9ed7864 100644 (file)
@@ -48,7 +48,7 @@ public:
        // Override the base class GetId function to return the waypoint ID under the cursor
        // on FPL0 page, if there is one and the cursor is on.
        // Otherwise return an empty string.
-       inline string GetId() { return(_fp0SelWpId); } 
+       inline const string& GetId() { return(_fp0SelWpId); } 
        
 private:
        int _fpMode;    // 0 = Dis, 1 = Dtk
index e765cffc7ebda86a1a3267029db3a2552db062cb..cf46bf142c0f5ff38d962294983f6df32a848599 100644 (file)
@@ -159,7 +159,7 @@ void KLN89IntPage::Update(double dt) {
        KLN89Page::Update(dt);
 }
 
-void KLN89IntPage::SetId(string s) {
+void KLN89IntPage::SetId(const string& s) {
        _last_int_id = _int_id;
        _save_int_id = _int_id;
        _int_id = s;
index f8b8dc7a28eb3dd466a619347270500f058607ba..df0ee52d3b8730dbad172fc85a2fca7a27556e31 100644 (file)
@@ -40,7 +40,7 @@ public:
        void Knob2Left1();
        void Knob2Right1();
        
-       void SetId(string s);
+       void SetId(const string& s);
        
 private:
        string _int_id;
index 44698954b0dda4678ed11c9f7998ef1025e20162..9d460bf0eef2f7c8ba1d1ef035872e1ec7f7da84 100644 (file)
@@ -123,7 +123,7 @@ void KLN89NDBPage::Update(double dt) {
        KLN89Page::Update(dt);
 }
 
-void KLN89NDBPage::SetId(string s) {
+void KLN89NDBPage::SetId(const string& s) {
        _last_ndb_id = _ndb_id;
        _save_ndb_id = _ndb_id;
        _ndb_id = s;
index 373844dd829d32d7524900c049cf600c590998e2..ca21353cd767a9f8930496025b71599d348bec52 100644 (file)
@@ -40,7 +40,7 @@ public:
        void Knob2Left1();
        void Knob2Right1();
        
-       void SetId(string s);
+       void SetId(const string& s);
        
 private:
        string _ndb_id; 
index 3456c6e80a41f178f9d1c313ece26fed9a3f3428..3a1c5938ad820bc93472a5614439dbc8f975bc1b 100644 (file)
@@ -135,7 +135,7 @@ void KLN89VorPage::Update(double dt) {
        KLN89Page::Update(dt);
 }
 
-void KLN89VorPage::SetId(string s) {
+void KLN89VorPage::SetId(const string& s) {
        _last_vor_id = _vor_id;
        _save_vor_id = _vor_id;
        _vor_id = s;
index a9fc412f2aa4165e2ca2448f4b213bd722c8f023..c73ded848fe14c47f1e496d76e6e46644a04d6ea 100644 (file)
@@ -40,7 +40,7 @@ public:
        void Knob2Left1();
        void Knob2Right1();
        
-       void SetId(string s);
+       void SetId(const string& s);
        
 private:
        string _vor_id;