mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-04 10:42:04 +00:00
Optimize codes
Move node renaming after removing Emojis.
This commit is contained in:
6 files changed
+34
-52
No files matched your search
+4
-9
@@ -69,7 +69,7 @@ public:
|
||||
template <typename T> void define(const T &value)
|
||||
{
|
||||
if(_M_VALUE == -1)
|
||||
set(value);
|
||||
*this = value;
|
||||
}
|
||||
|
||||
bool get(const bool &def_value = false)
|
||||
@@ -85,12 +85,6 @@ public:
|
||||
return _M_VALUE;
|
||||
}
|
||||
|
||||
bool set(const tribool &value)
|
||||
{
|
||||
_M_VALUE = value._M_VALUE;
|
||||
return _M_VALUE;
|
||||
}
|
||||
|
||||
bool set(const std::string &str)
|
||||
{
|
||||
switch(hash_(str))
|
||||
@@ -185,11 +179,12 @@ template <typename T> static inline void eraseElements(T &target)
|
||||
T().swap(target);
|
||||
}
|
||||
|
||||
template <typename T> static inline T to_number(const std::string &str, T def_value)
|
||||
template <typename T, typename U> static inline T to_number(const U &value, T def_value = T())
|
||||
{
|
||||
T retval = 0.0;
|
||||
char c;
|
||||
std::stringstream ss(str);
|
||||
std::stringstream ss;
|
||||
ss << value;
|
||||
if(!(ss >> retval))
|
||||
return def_value;
|
||||
else if(ss >> c)
|
||||
|
||||
Reference in new issue
Block a user