| 54 | } |
| 55 | |
| 56 | bool EventsConfiguration::Load(PCWSTR path, bool clean) { |
| 57 | IniFile file(path); |
| 58 | if (clean) |
| 59 | _categories.clear(); |
| 60 | |
| 61 | auto data = file.ReadSection(L"Events"); |
| 62 | for (auto& cat : data) { |
| 63 | auto equal = cat.Find(L'='); |
| 64 | ATLASSERT(equal >= 0); |
| 65 | if (equal < 0) |
| 66 | return false; |
| 67 | EventConfigCategory category; |
| 68 | category.Name = cat.Left(equal); |
| 69 | auto events = cat.Mid(equal + 1); |
| 70 | if (!events.IsEmpty()) { |
| 71 | int start = 0; |
| 72 | for (;;) { |
| 73 | auto id = events.Tokenize(L",", start); |
| 74 | if (id.IsEmpty()) |
| 75 | break; |
| 76 | category.Opcodes.push_back(_wtoi(id)); |
| 77 | } |
| 78 | } |
| 79 | _categories.push_back(category); |
| 80 | } |
| 81 | return true; |
| 82 | } |
| 83 | |
| 84 | bool EventConfigCategory::Contains(int opcode) const { |
| 85 | return std::find(Opcodes.begin(), Opcodes.end(), opcode) != Opcodes.end(); |
nothing calls this directly
no test coverage detected