#ifndef _CHINESE_ENGLISH_BULLET_BOX_H #define _CHINESE_ENGLISH_BULLET_BOX_H #include "UtilityGlobal.h" #include #include #include "nlohmann/json.hpp" using json = nlohmann::json; #include #include #include #include #include using json = nlohmann::json; using std::unordered_map; using std::string; class UTILITY_API Chinese_English_bullet_box { public: // 获取单例实例的公共静态方法 static Chinese_English_bullet_box& getInstance(); // 禁止复制构造函数和赋值运算符 Chinese_English_bullet_box(const Chinese_English_bullet_box&) = delete; Chinese_English_bullet_box& operator=(const Chinese_English_bullet_box&) = delete; string get_Bullet_box(string ch_key); string get_Bullet_box(string ch_key,int iLange); //ch_str 是以/隔开的string string get_Bullet_box_array(string ch_str,int iLange); private: int loadFile(QString strFilePath); int writeFile(QString strFilePath); void setLoadFile(bool b) { m_isLoadFile = b; } bool isLoadFile() { return m_isLoadFile; } // 私有构造函数 Chinese_English_bullet_box() { m_isLoadFile = false; } std::vector split(const std::string& str, char delimiter) ; bool m_isLoadFile; QString m_filePath; // 数据存储 std::unordered_map m_data_; }; #endif