mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
use var passed by reference
This commit is contained in:
@@ -394,7 +394,7 @@ void CConfigFile::setString(const std::string & key, const std::string & val)
|
||||
unknownKeyQueryedFlag = tmpUnknownKeyQueryedFlag;
|
||||
}
|
||||
|
||||
void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int32_t> vec)
|
||||
void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int32_t> &vec)
|
||||
{
|
||||
bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag;
|
||||
unknownKeyQueryedFlag = false;
|
||||
@@ -419,7 +419,7 @@ void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int3
|
||||
unknownKeyQueryedFlag = tmpUnknownKeyQueryedFlag;
|
||||
}
|
||||
|
||||
void CConfigFile::setStringVector(const std::string & key, const std::vector<std::string> vec)
|
||||
void CConfigFile::setStringVector(const std::string & key, const std::vector<std::string> &vec)
|
||||
{
|
||||
bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag;
|
||||
unknownKeyQueryedFlag = false;
|
||||
|
@@ -91,10 +91,10 @@ class CConfigFile
|
||||
// vectors
|
||||
//
|
||||
std::vector <std::string> getStringVector(const std::string & key);
|
||||
void setStringVector(const std::string & key, const std::vector<std::string> vec);
|
||||
void setStringVector(const std::string & key, const std::vector<std::string> &vec);
|
||||
|
||||
std::vector <int32_t> getInt32Vector(const std::string & key);
|
||||
void setInt32Vector(const std::string & key, const std::vector<int32_t> vec);
|
||||
void setInt32Vector(const std::string & key, const std::vector<int32_t> &vec);
|
||||
|
||||
//
|
||||
// flags
|
||||
|
@@ -34,7 +34,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
bool read_file(const std::string filename, std::list<std::string> &line)
|
||||
bool read_file(const std::string &filename, std::list<std::string> &line)
|
||||
{
|
||||
std::string s;
|
||||
std::ifstream in(filename.c_str());
|
||||
@@ -50,7 +50,7 @@ bool read_file(const std::string filename, std::list<std::string> &line)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool write_file(const std::string filename, const std::list<std::string> line)
|
||||
bool write_file(const std::string &filename, const std::list<std::string> &line)
|
||||
{
|
||||
std::ofstream out(filename.c_str());
|
||||
|
||||
@@ -63,7 +63,7 @@ bool write_file(const std::string filename, const std::list<std::string> line)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::list<std::string>::iterator add_attributes(const std::map<std::string, std::string> attribute, std::list<std::string> &line, std::list<std::string>::iterator here)
|
||||
std::list<std::string>::iterator add_attributes(const std::map<std::string, std::string> &attribute, std::list<std::string> &line, std::list<std::string>::iterator here)
|
||||
{
|
||||
for (std::map<std::string, std::string>::const_iterator it = attribute.begin(); it != attribute.end(); ++it)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ std::list<std::string>::iterator add_attributes(const std::map<std::string, std:
|
||||
return here;
|
||||
}
|
||||
|
||||
std::string remove_interface_from_line(const std::string interface, const std::string line)
|
||||
std::string remove_interface_from_line(const std::string &interface, const std::string &line)
|
||||
{
|
||||
std::string s;
|
||||
std::istringstream in(line.c_str());
|
||||
@@ -98,7 +98,7 @@ std::string remove_interface_from_line(const std::string interface, const std::s
|
||||
return (contains_at_least_one_interface ? out.str() : "");
|
||||
}
|
||||
|
||||
bool write_interface(const std::string filename, const std::string name, const bool automatic_start, const std::string family, const std::string method, const std::map<std::string, std::string> attribute)
|
||||
bool write_interface(const std::string &filename, const std::string &name, const bool automatic_start, const std::string &family, const std::string &method, const std::map<std::string, std::string> &attribute)
|
||||
{
|
||||
std::string s;
|
||||
std::list<std::string> line;
|
||||
@@ -215,7 +215,7 @@ bool write_interface(const std::string filename, const std::string name, const b
|
||||
return write_file(filename, line);
|
||||
}
|
||||
|
||||
bool read_interface(const std::string filename, const std::string name, bool &automatic_start, std::string &family, std::string &method, std::map<std::string, std::string> &attribute)
|
||||
bool read_interface(const std::string &filename, const std::string &name, bool &automatic_start, std::string &family, std::string &method, std::map<std::string, std::string> &attribute)
|
||||
{
|
||||
std::string s;
|
||||
std::string t;
|
||||
@@ -309,7 +309,7 @@ bool read_interface(const std::string filename, const std::string name, bool &au
|
||||
return true;
|
||||
}
|
||||
|
||||
bool getInetAttributes(const std::string name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway)
|
||||
bool getInetAttributes(const std::string &name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway)
|
||||
{
|
||||
std::string family;
|
||||
std::string method;
|
||||
@@ -343,14 +343,14 @@ bool getInetAttributes(const std::string name, bool &automatic_start, std::strin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool addLoopbackDevice(const std::string name, const bool automatic_start)
|
||||
bool addLoopbackDevice(const std::string &name, const bool automatic_start)
|
||||
{
|
||||
std::map<std::string, std::string> attribute;
|
||||
|
||||
return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "loopback", attribute);
|
||||
}
|
||||
|
||||
bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway, bool wireless)
|
||||
bool setStaticAttributes(const std::string &name, const bool automatic_start, const std::string &address, const std::string &netmask, const std::string &broadcast, const std::string &gateway, bool wireless)
|
||||
{
|
||||
std::map<std::string, std::string> attribute;
|
||||
|
||||
@@ -371,7 +371,7 @@ bool setStaticAttributes(const std::string name, const bool automatic_start, con
|
||||
return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "static", attribute);
|
||||
}
|
||||
|
||||
bool setDhcpAttributes(const std::string name, const bool automatic_start, bool wireless)
|
||||
bool setDhcpAttributes(const std::string &name, const bool automatic_start, bool wireless)
|
||||
{
|
||||
std::map<std::string, std::string> attribute;
|
||||
char hostname[100];
|
||||
|
@@ -24,12 +24,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
bool getInetAttributes(const std::string name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway);
|
||||
bool getInetAttributes(const std::string &name, bool &automatic_start, std::string &address, std::string &netmask, std::string &broadcast, std::string &gateway);
|
||||
|
||||
bool addLoopbackDevice(const std::string name, const bool automatic_start);
|
||||
bool addLoopbackDevice(const std::string &name, const bool automatic_start);
|
||||
|
||||
bool setStaticAttributes(const std::string name, const bool automatic_start, const std::string address, const std::string netmask, const std::string broadcast, const std::string gateway, bool wireless = false);
|
||||
bool setStaticAttributes(const std::string &name, const bool automatic_start, const std::string &address, const std::string &netmask, const std::string &broadcast, const std::string &gateway, bool wireless = false);
|
||||
|
||||
bool setDhcpAttributes(const std::string name, const bool automatic_start, bool wireless = false);
|
||||
bool setDhcpAttributes(const std::string &name, const bool automatic_start, bool wireless = false);
|
||||
|
||||
#endif /* __network_interfaces_h__ */
|
||||
|
@@ -72,7 +72,7 @@ class CComponentsIconForm : public CComponentsForm
|
||||
|
||||
public:
|
||||
CComponentsIconForm();
|
||||
CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> v_icon_names, bool has_shadow = CC_SHADOW_OFF,
|
||||
CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> &v_icon_names, bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
// ~CComponentsIconForm(); //inherited from CComponentsForm
|
||||
|
||||
|
@@ -41,7 +41,7 @@ CComponentsIconForm::CComponentsIconForm()
|
||||
}
|
||||
|
||||
|
||||
CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> v_icon_names, bool has_shadow,
|
||||
CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> &v_icon_names, bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
initVarIconForm();
|
||||
|
@@ -87,7 +87,7 @@
|
||||
/* percent */
|
||||
#define MIN_BROWSER_FRAME_HEIGHT 10
|
||||
#define MAX_BROWSER_FRAME_HEIGHT 80
|
||||
void strReplace(std::string& orig, const char* fstr, const std::string rstr);
|
||||
void strReplace(std::string& orig, const char* fstr, const std::string &rstr);
|
||||
|
||||
/* !!!! Do NOT change the order of the enum, just add items at the end !!!! */
|
||||
typedef enum
|
||||
|
@@ -614,7 +614,7 @@ int find_next_char(char to_find, char *text, int start_pos, int end_pos)
|
||||
}
|
||||
|
||||
//void CMovieInfo::strReplace(std::string& orig, const char* fstr, const std::string rstr)
|
||||
void strReplace(std::string & orig, const char *fstr, const std::string rstr)
|
||||
void strReplace(std::string & orig, const char *fstr, const std::string &rstr)
|
||||
{
|
||||
// replace all occurrence of fstr with rstr and, and returns a reference to itself
|
||||
size_t index = 0;
|
||||
|
@@ -40,17 +40,17 @@
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
|
||||
CMessageBox::CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width, const char * const Icon, const CMessageBox::result_ Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Text, Width, Icon)
|
||||
CMessageBox::CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width, const char * const Icon, const CMessageBox::result_ &Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Text, Width, Icon)
|
||||
{
|
||||
Init(Default, ShowButtons);
|
||||
}
|
||||
|
||||
CMessageBox::CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width, const char * const Icon, const CMessageBox::result_ Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Lines, Width, Icon)
|
||||
CMessageBox::CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width, const char * const Icon, const CMessageBox::result_ &Default, const uint32_t ShowButtons) : CHintBoxExt(Caption, Lines, Width, Icon)
|
||||
{
|
||||
Init(Default, ShowButtons);
|
||||
}
|
||||
|
||||
void CMessageBox::Init(const CMessageBox::result_ Default, const uint32_t ShowButtons)
|
||||
void CMessageBox::Init(const CMessageBox::result_ &Default, const uint32_t ShowButtons)
|
||||
{
|
||||
#define BtnCount 3
|
||||
returnDefaultOnTimeout = false;
|
||||
@@ -274,7 +274,7 @@ int CMessageBox::exec(int timeout)
|
||||
return res;
|
||||
}
|
||||
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
|
||||
{
|
||||
CMessageBox* messageBox = new CMessageBox(Caption, Text, Width, Icon, Default, ShowButtons);
|
||||
messageBox->returnDefaultValueOnTimeout(returnDefaultOnTimeout);
|
||||
@@ -285,12 +285,12 @@ int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const C
|
||||
return res;
|
||||
}
|
||||
|
||||
int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
|
||||
int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
|
||||
{
|
||||
return ShowMsgUTF(Caption, g_Locale->getText(Text), Default, ShowButtons, Icon, Width, timeout,returnDefaultOnTimeout);
|
||||
}
|
||||
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
|
||||
{
|
||||
return ShowMsgUTF(Caption, Text.c_str(), Default, ShowButtons, Icon, Width, timeout,returnDefaultOnTimeout);
|
||||
}
|
||||
|
@@ -87,21 +87,21 @@ class CMessageBox : public CHintBoxExt
|
||||
} buttons;
|
||||
|
||||
// Text & Caption are always UTF-8 encoded
|
||||
CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ Default = mbrYes, const uint32_t ShowButtons = mbAll);
|
||||
CMessageBox(const neutrino_locale_t Caption, const char * const Text, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ &Default = mbrYes, const uint32_t ShowButtons = mbAll);
|
||||
|
||||
CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ Default = mbrYes, const uint32_t ShowButtons = mbAll);
|
||||
CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, const int Width = 500, const char * const Icon = NULL, const CMessageBox::result_ &Default = mbrYes, const uint32_t ShowButtons = mbAll);
|
||||
|
||||
int exec(int timeout = -1);
|
||||
void returnDefaultValueOnTimeout(bool returnDefault);
|
||||
|
||||
private:
|
||||
void Init(const CMessageBox::result_ Default, const uint32_t ShowButtons);
|
||||
void Init(const CMessageBox::result_ &Default, const uint32_t ShowButtons);
|
||||
};
|
||||
|
||||
// Text is always UTF-8 encoded
|
||||
int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false);
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8
|
||||
int ShowLocalizedMessage(const neutrino_locale_t Caption, const neutrino_locale_t Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false);
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8
|
||||
int ShowMsgUTF(const neutrino_locale_t Caption, const std::string & Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8
|
||||
|
||||
void DisplayErrorMessage(const char * const ErrorMsg); // UTF-8
|
||||
void DisplayInfoMessage(const char * const InfoMsg); // UTF-8
|
||||
|
@@ -1103,7 +1103,7 @@ CTimerEvent_Record::CTimerEvent_Record(time_t announce_Time, time_t alarm_Time,
|
||||
event_id_t epgID,
|
||||
time_t epg_starttime, unsigned char apids,
|
||||
CTimerd::CTimerEventRepeat evrepeat,
|
||||
uint32_t repeatcount, const std::string recDir) :
|
||||
uint32_t repeatcount, const std::string &recDir) :
|
||||
CTimerEvent(getEventType(), announce_Time, alarm_Time, stop_Time, evrepeat, repeatcount)
|
||||
{
|
||||
eventInfo.epgID = epgID;
|
||||
|
@@ -123,7 +123,7 @@ class CTimerEvent_Record : public CTimerEvent
|
||||
time_t epg_starttime = 0,
|
||||
unsigned char apids = TIMERD_APIDS_STD,
|
||||
CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE,
|
||||
uint32_t repeatcount = 1, const std::string recDir = "");
|
||||
uint32_t repeatcount = 1, const std::string &recDir = "");
|
||||
CTimerEvent_Record(CConfigFile *config, int iId);
|
||||
virtual ~CTimerEvent_Record(){};
|
||||
virtual CTimerd::CTimerEventTypes getEventType(void) const { return CTimerd::TIMER_RECORD; };
|
||||
|
Reference in New Issue
Block a user