mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-20 22:45:44 +08:00
get() goes const, add clear()
This commit is contained in:
@@ -44,7 +44,7 @@ void CUserDBentry::set(const std::string key, const std::string value)
|
|||||||
m_db[key] = value;
|
m_db[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CUserDBentry::get(const std::string key)
|
const std::string CUserDBentry::get(const std::string key) const
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return m_db.at(key);
|
return m_db.at(key);
|
||||||
@@ -52,3 +52,8 @@ std::string CUserDBentry::get(const std::string key)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CUserDBentry::clear(void)
|
||||||
|
{
|
||||||
|
m_db.clear();
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ public:
|
|||||||
static bool isValidKey(const std::string key);
|
static bool isValidKey(const std::string key);
|
||||||
|
|
||||||
void set(const std::string key, const std::string value);
|
void set(const std::string key, const std::string value);
|
||||||
std::string get(const std::string key);
|
const std::string get(const std::string key) const;
|
||||||
|
void clear(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<std::string, std::string> m_db;
|
std::unordered_map<std::string, std::string> m_db;
|
||||||
|
|||||||
Reference in New Issue
Block a user