Alex Romosan: Pass strings by reference not value
This commit is contained in:
parent
1de61c8afd
commit
24e9bb6ce8
15 changed files with 20 additions and 20 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -110,7 +110,7 @@ void KLN89Page::Update(double dt) {
|
|||
}
|
||||
}
|
||||
|
||||
void KLN89Page::ShowScratchpadMessage(string line1, string line2) {
|
||||
void KLN89Page::ShowScratchpadMessage(const string& line1, const string& line2) {
|
||||
_scratchpadLine1 = line1;
|
||||
_scratchpadLine2 = line2;
|
||||
_scratchpadTimer = 0.0;
|
||||
|
@ -195,10 +195,10 @@ void KLN89Page::LooseFocus() {
|
|||
_entInvert = false;
|
||||
}
|
||||
|
||||
void KLN89Page::SetId(string s) {
|
||||
void KLN89Page::SetId(const string& s) {
|
||||
_id = s;
|
||||
}
|
||||
|
||||
string KLN89Page::GetId() {
|
||||
const string& KLN89Page::GetId() {
|
||||
return(_id);
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ public:
|
|||
inline void SetEntInvert(bool b) { _entInvert = b; }
|
||||
|
||||
// Get / Set a waypoint id, NOT the page name!
|
||||
virtual void SetId(string s);
|
||||
virtual string GetId();
|
||||
virtual void SetId(const string& s);
|
||||
virtual const string& GetId();
|
||||
|
||||
protected:
|
||||
KLN89* _kln89;
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
string _id; // The ID of the waypoint that the page is displaying.
|
||||
// Doesn't make sense for all pages, but does for all the data pages.
|
||||
|
||||
void ShowScratchpadMessage(string line1, string line2);
|
||||
void ShowScratchpadMessage(const string& line1, const string& line2);
|
||||
|
||||
bool _scratchpadMsg; // Set true when there is a scratchpad message to display
|
||||
double _scratchpadTimer; // Used for displaying the scratchpad messages for the right amount of time.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
void Knob2Left1();
|
||||
void Knob2Right1();
|
||||
|
||||
void SetId(string s);
|
||||
void SetId(const string& s);
|
||||
|
||||
private:
|
||||
// Update the cached airport details
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
void Update(double dt);
|
||||
|
||||
void SetId(string s);
|
||||
void SetId(const string& s);
|
||||
|
||||
void ClrPressed();
|
||||
void EntPressed();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
void Knob2Left1();
|
||||
void Knob2Right1();
|
||||
|
||||
void SetId(string s);
|
||||
void SetId(const string& s);
|
||||
|
||||
private:
|
||||
string _int_id;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
void Knob2Left1();
|
||||
void Knob2Right1();
|
||||
|
||||
void SetId(string s);
|
||||
void SetId(const string& s);
|
||||
|
||||
private:
|
||||
string _ndb_id;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
void Knob2Left1();
|
||||
void Knob2Right1();
|
||||
|
||||
void SetId(string s);
|
||||
void SetId(const string& s);
|
||||
|
||||
private:
|
||||
string _vor_id;
|
||||
|
|
Loading…
Add table
Reference in a new issue