|
|
@ -16,6 +16,8 @@ |
|
|
|
#include <typeinfo>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "iflytopcpp/core/spdlogfactory/logger.hpp"
|
|
|
|
|
|
|
|
namespace iflytop { |
|
|
|
namespace core { |
|
|
|
using namespace std; |
|
|
@ -34,13 +36,14 @@ class EnumConverter { |
|
|
|
if (it != _str2e.end()) { |
|
|
|
return it->second; |
|
|
|
} |
|
|
|
return "unkown"; |
|
|
|
return fmt::format("unkown({})", (int)e); |
|
|
|
}; |
|
|
|
T str2e(string s) { |
|
|
|
auto it = _e2str.find(s); |
|
|
|
if (it != _e2str.end()) { |
|
|
|
return it->second; |
|
|
|
} |
|
|
|
throw std::invalid_argument(fmt::format("EnumConverter unkown convert ({})", s)); |
|
|
|
return (T)-1; |
|
|
|
}; |
|
|
|
}; |
|
|
|