summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/general/gr_prefs.cc13
-rw-r--r--gnuradio-core/src/lib/general/gr_prefs.h22
-rw-r--r--gnuradio-core/src/lib/general/gr_prefs.i22
-rw-r--r--gr-utils/src/python/modtool/modtool_newmod.py2
4 files changed, 30 insertions, 29 deletions
diff --git a/gnuradio-core/src/lib/general/gr_prefs.cc b/gnuradio-core/src/lib/general/gr_prefs.cc
index 953143bc5..7e48e3486 100644
--- a/gnuradio-core/src/lib/general/gr_prefs.cc
+++ b/gnuradio-core/src/lib/general/gr_prefs.cc
@@ -119,14 +119,14 @@ gr_prefs::_read_files()
}
bool
-gr_prefs::has_section(const std::string section)
+gr_prefs::has_section(const std::string &section)
{
size_t t = d_configs.find("[" + section + "]#");
return t != std::string::npos;
}
bool
-gr_prefs::has_option(const std::string section, const std::string option)
+gr_prefs::has_option(const std::string &section, const std::string &option)
{
if(has_section(section)) {
size_t sec = d_configs.find("[" + section + "]#");
@@ -139,7 +139,8 @@ gr_prefs::has_option(const std::string section, const std::string option)
}
const std::string
-gr_prefs::get_string(const std::string section, const std::string option, const std::string default_val)
+gr_prefs::get_string(const std::string &section, const std::string &option,
+ const std::string &default_val)
{
std::stringstream envname;
std::string secname=section, optname=option;
@@ -170,7 +171,7 @@ gr_prefs::get_string(const std::string section, const std::string option, const
}
bool
-gr_prefs::get_bool(const std::string section, const std::string option, bool default_val)
+gr_prefs::get_bool(const std::string &section, const std::string &option, bool default_val)
{
if(has_option(section, option)) {
std::string str = get_string(section, option, "");
@@ -191,7 +192,7 @@ gr_prefs::get_bool(const std::string section, const std::string option, bool def
}
long
-gr_prefs::get_long(const std::string section, const std::string option, long default_val)
+gr_prefs::get_long(const std::string &section, const std::string &option, long default_val)
{
if(has_option(section, option)) {
std::string str = get_string(section, option, "");
@@ -209,7 +210,7 @@ gr_prefs::get_long(const std::string section, const std::string option, long def
}
double
-gr_prefs::get_double(const std::string section, const std::string option, double default_val)
+gr_prefs::get_double(const std::string &section, const std::string &option, double default_val)
{
if(has_option(section, option)) {
std::string str = get_string(section, option, "");
diff --git a/gnuradio-core/src/lib/general/gr_prefs.h b/gnuradio-core/src/lib/general/gr_prefs.h
index 90d602741..dc2745d16 100644
--- a/gnuradio-core/src/lib/general/gr_prefs.h
+++ b/gnuradio-core/src/lib/general/gr_prefs.h
@@ -46,39 +46,39 @@ public:
/*!
* \brief Does \p section exist?
*/
- virtual bool has_section(const std::string section);
+ virtual bool has_section(const std::string &section);
/*!
* \brief Does \p option exist?
*/
- virtual bool has_option(const std::string section, const std::string option);
+ virtual bool has_option(const std::string &section, const std::string &option);
/*!
* \brief If option exists return associated value; else default_val.
*/
- virtual const std::string get_string(const std::string section,
- const std::string option,
- const std::string default_val);
+ virtual const std::string get_string(const std::string &section,
+ const std::string &option,
+ const std::string &default_val);
/*!
* \brief If option exists and value can be converted to bool, return it; else default_val.
*/
- virtual bool get_bool(const std::string section,
- const std::string option,
+ virtual bool get_bool(const std::string &section,
+ const std::string &option,
bool default_val);
/*!
* \brief If option exists and value can be converted to long, return it; else default_val.
*/
- virtual long get_long(const std::string section,
- const std::string option,
+ virtual long get_long(const std::string &section,
+ const std::string &option,
long default_val);
/*!
* \brief If option exists and value can be converted to double, return it; else default_val.
*/
- virtual double get_double(const std::string section,
- const std::string option,
+ virtual double get_double(const std::string &section,
+ const std::string &option,
double default_val);
protected:
diff --git a/gnuradio-core/src/lib/general/gr_prefs.i b/gnuradio-core/src/lib/general/gr_prefs.i
index cfb4cdb4e..b21d47f3b 100644
--- a/gnuradio-core/src/lib/general/gr_prefs.i
+++ b/gnuradio-core/src/lib/general/gr_prefs.i
@@ -31,39 +31,39 @@ public:
/*!
* \brief Does \p section exist?
*/
- virtual bool has_section(const std::string section);
+ virtual bool has_section(const std::string &section);
/*!
* \brief Does \p option exist?
*/
- virtual bool has_option(const std::string section, const std::string option);
+ virtual bool has_option(const std::string &section, const std::string &option);
/*!
* \brief If option exists return associated value; else default_val.
*/
- virtual const std::string get_string(const std::string section,
- const std::string option,
- const std::string default_val);
+ virtual const std::string get_string(const std::string &section,
+ const std::string &option,
+ const std::string &default_val);
/*!
* \brief If option exists and value can be converted to bool, return it; else default_val.
*/
- virtual bool get_bool(const std::string section,
- const std::string option,
+ virtual bool get_bool(const std::string &section,
+ const std::string &option,
bool default_val);
/*!
* \brief If option exists and value can be converted to long, return it; else default_val.
*/
- virtual long get_long(const std::string section,
- const std::string option,
+ virtual long get_long(const std::string &section,
+ const std::string &option,
long default_val);
/*!
* \brief If option exists and value can be converted to double, return it; else default_val.
*/
- virtual double get_double(const std::string section,
- const std::string option,
+ virtual double get_double(const std::string &section,
+ const std::string &option,
double default_val);
};
diff --git a/gr-utils/src/python/modtool/modtool_newmod.py b/gr-utils/src/python/modtool/modtool_newmod.py
index 102d83d8d..0613d5fbe 100644
--- a/gr-utils/src/python/modtool/modtool_newmod.py
+++ b/gr-utils/src/python/modtool/modtool_newmod.py
@@ -66,7 +66,7 @@ class ModToolNewModule(ModTool):
print 'The given directory exists.'
exit(2)
if options.srcdir is None:
- options.srcdir = '/usr/local/share/gnuradio/modtool/gr-newmod',
+ options.srcdir = '/usr/local/share/gnuradio/modtool/gr-newmod'
self._srcdir = gr.prefs().get_string('modtool', 'newmod_path', options.srcdir)
if not os.path.isdir(self._srcdir):
print 'Error: Could not find gr-newmod source dir.'