Skip to content

Commit 93bab66

Browse files
committed
IO/config: return constant references whenever possible
1 parent 99f3771 commit 93bab66

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/IO/configuration_config.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const Config::Option & Config::getOption(const std::string &key) const
162162
\param key is the name of the option
163163
\result The value of the specified option.
164164
*/
165-
std::string Config::get(const std::string &key) const
165+
const std::string & Config::get(const std::string &key) const
166166
{
167167
return getOption(key).value;
168168
}
@@ -213,7 +213,7 @@ void Config::set(const std::string &key, const std::string &value)
213213
\param name is the name of the attribute
214214
\result The value of the specified attribute.
215215
*/
216-
std::string Config::getAttribute(const std::string &key, const std::string &name) const
216+
const std::string & Config::getAttribute(const std::string &key, const std::string &name) const
217217
{
218218
return getOption(key).attributes.at(name);
219219
}

src/IO/configuration_config.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ class Config
6363

6464
bool isMultiSectionsEnabled() const;
6565

66-
std::string get(const std::string &key) const;
66+
const std::string & get(const std::string &key) const;
6767
std::string get(const std::string &key, const std::string &fallback) const;
6868
void set(const std::string &key, const std::string &value);
6969

70-
std::string getAttribute(const std::string &key, const std::string &name) const;
70+
const std::string & getAttribute(const std::string &key, const std::string &name) const;
7171
std::string getAttribute(const std::string &key, const std::string &name, const std::string &fallback) const;
7272
void setAttribute(const std::string &key, const std::string &name, const std::string &value);
7373

0 commit comments

Comments
 (0)