| 75 | } |
| 76 | |
| 77 | void ConfigurationParser::Load(istream& inputStream) |
| 78 | { |
| 79 | string buffer{}; |
| 80 | stringstream ss{}; |
| 81 | size_t lineNumber = 0; |
| 82 | while (getline(inputStream, buffer)) |
| 83 | { |
| 84 | lineNumber++; |
| 85 | ss.clear(); |
| 86 | ss.str(buffer); |
| 87 | string key{}; |
| 88 | char ch; |
| 89 | if (!(ss >> key)) continue; |
| 90 | if (key[0] == '#') continue; |
| 91 | if (!(ss >> ch) || ch != '=') |
| 92 | throw Exception("������������������=������" + to_string(lineNumber) + "��"); |
| 93 | string value{}; |
| 94 | if (!(ss >> value)) |
| 95 | throw Exception("��Ч�������С�����������ֵ���У�" + to_string(lineNumber) + "��"); |
| 96 | // ISSUE Ŀǰ����ֵ�в��ܰ����ո�����ڿոضϡ� |
| 97 | entries[key] = value; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | std::string ConfigurationParser::GetString(const std::string& key, const std::string& defaultValue) const |
| 102 | { |