eis/eqpalg/utility/item2chinese.hpp
Huamonarch 224c2c45c4 Remove irrelevant comments from eqpalg source files
Cleaned 66 files across all eqpalg subdirectories:
- Removed commented-out dead code
- Removed redundant Chinese inline comments that restate variable/function names
- Removed trailing ///< annotations on self-explanatory fields
- Removed namespace closing comments
- Preserved all file headers, Doxygen documentation, and logic explanations
- No code changes — only comment removal
2026-05-09 13:30:09 +08:00

53 lines
1.2 KiB
C++

#pragma once
/**
* @file item2chinese.hpp
* @brief
* @author your name (you@domain.com)
* @version 0.1
* @date 2026-01-15
*
* Copyright: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#include <glob/BinaryTele.h>
#include <string>
#include <unordered_map>
#include <zlib/MemVar.h>
#include <zlib/zoneDef.h>
class Item2Chines {
private:
std::unordered_map<std::string, std::string> data_;
BinaryTele binary_tele{CMemVar::Const()->event_eis_start, "T_LOV_FDAAITEM"};
private:
void select_fdaaitem() {
const auto prefix = string(CMemVar::Const()->UnitNo) + "_";
for (int i = CMemVar::Const()->event_eis_start;
i <= CMemVar::Const()->event_eis_end; i++) {
binary_tele.ReBuild(i);
auto size = binary_tele.size();
for (int j = 0; j < size; j++) {
std::string item = binary_tele[j].item;
std::string chinese = binary_tele[j].chinese;
auto item_name = prefix + item;
data_[item_name] = chinese;
}
}
}
public:
std::string operator()(const std::string &item) const {
auto it = data_.find(item);
if (it != data_.end()) {
return it->second;
}
return item;
}
Item2Chines() { select_fdaaitem(); }
~Item2Chines() {}
};