Browse Source

update

disinfection_machine
zhaohe 2 years ago
parent
commit
99f14adcb3
  1. 5
      core/basic/enum_converter.hpp

5
core/basic/enum_converter.hpp

@ -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;
};
};

Loading…
Cancel
Save