| 136 | }; |
| 137 | |
| 138 | FormatterData readFormatterData(const KConfigGroup& sourceFormatterConfig, const QString& mimeTypeName, |
| 139 | const QVector<ISourceFormatter*>& formatters) |
| 140 | { |
| 141 | FormatterData result{}; |
| 142 | |
| 143 | SourceFormatter::ConfigForMimeType parser(sourceFormatterConfig, mimeTypeName); |
| 144 | if (!parser.isValid()) { |
| 145 | return result; |
| 146 | } |
| 147 | |
| 148 | const auto it = std::find_if(formatters.cbegin(), formatters.cend(), |
| 149 | [formatterName = parser.formatterName()](const ISourceFormatter* f) { |
| 150 | return f->name() == formatterName; |
| 151 | }); |
| 152 | if (it != formatters.cend()) { |
| 153 | result.formatter = *it; |
| 154 | result.styleName = std::move(parser).takeStyleName(); |
| 155 | } |
| 156 | |
| 157 | return result; |
| 158 | } |
| 159 | |
| 160 | } // namespace Config |
| 161 | } // unnamed namespace |
no test coverage detected