* @brief ConfigParser::GetConfigFilters - Parse filters from the config. * @return Parsed filter info. */
| 132 | * @return Parsed filter info. |
| 133 | */ |
| 134 | std::vector<FILTER_INFO> ConfigParser::GetConfigFilters() |
| 135 | { |
| 136 | std::vector<std::string> filterNames; |
| 137 | std::vector<FILTER_INFO> filters; |
| 138 | FILTER_INFO currentFilter; |
| 139 | std::string currentFilterName; |
| 140 | std::string currentFilterType; |
| 141 | std::wstring currentFilterContent; |
| 142 | ULONG currentFilterFlags; |
| 143 | std::stringstream filterStream; |
| 144 | std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter; |
| 145 | |
| 146 | // |
| 147 | // Check if there is anything for us to parse. |
| 148 | // |
| 149 | if(configMap.count("filters") == 0) |
| 150 | { |
| 151 | printf("ConfigParser!GetConfigFilters: No filters to parse.\n"); |
| 152 | return filters; |
| 153 | } |
| 154 | |
| 155 | filterStream = std::stringstream(configMap["filters"]); |
| 156 | // |
| 157 | // Enumerate the filters. |
| 158 | // |
| 159 | while(filterStream.good()) |
| 160 | { |
| 161 | std::getline(filterStream, currentFilterName, ','); |
| 162 | filterNames.push_back(currentFilterName); |
| 163 | } |
| 164 | |
| 165 | for(std::string filterName : filterNames) |
| 166 | { |
| 167 | // |
| 168 | // Check for the content of the filter. |
| 169 | // |
| 170 | if(configMap.count(filterName + ".content") == 0) |
| 171 | { |
| 172 | printf("ConfigParser!GetConfigFilters: Failed to find content of filter %s.\n", filterName.c_str()); |
| 173 | continue; |
| 174 | } |
| 175 | // |
| 176 | // Check for the type of the filter. |
| 177 | // |
| 178 | if(configMap.count(filterName + ".type") == 0) |
| 179 | { |
| 180 | printf("ConfigParser!GetConfigFilters: Failed to find type of filter %s.\n", filterName.c_str()); |
| 181 | continue; |
| 182 | } |
| 183 | // |
| 184 | // Check for the flags of the filter. |
| 185 | // |
| 186 | if(configMap.count(filterName + ".flags") == 0) |
| 187 | { |
| 188 | printf("ConfigParser!GetConfigFilters: Failed to find flags of filter %s.\n", filterName.c_str()); |
| 189 | continue; |
| 190 | } |
| 191 |