Changeset View
Changeset View
Standalone View
Standalone View
src/lib/definition.cpp
Show First 20 Lines • Show All 228 Lines • ▼ Show 20 Line(s) | |||||
229 | 229 | | |||
230 | QStringList Definition::keywordList(const QString& name) const | 230 | QStringList Definition::keywordList(const QString& name) const | ||
231 | { | 231 | { | ||
232 | d->load(DefinitionData::OnlyKeywords(true)); | 232 | d->load(DefinitionData::OnlyKeywords(true)); | ||
233 | const auto list = d->keywordList(name); | 233 | const auto list = d->keywordList(name); | ||
234 | return list ? list->keywords() : QStringList(); | 234 | return list ? list->keywords() : QStringList(); | ||
235 | } | 235 | } | ||
236 | 236 | | |||
237 | bool Definition::setKeywordList(const QString& name, const QStringList& content) | ||||
238 | { | ||||
239 | d->load(DefinitionData::OnlyKeywords(true)); | ||||
240 | KeywordList* list = d->keywordList(name); | ||||
241 | if (list) | ||||
242 | { | ||||
243 | list->setKeywordList(content); | ||||
244 | return true; | ||||
245 | } | ||||
246 | else | ||||
247 | return false; | ||||
248 | } | ||||
249 | | ||||
237 | QVector<Format> Definition::formats() const | 250 | QVector<Format> Definition::formats() const | ||
238 | { | 251 | { | ||
239 | d->load(); | 252 | d->load(); | ||
240 | 253 | | |||
241 | // sort formats so that the order matches the order of the itemDatas in the xml files. | 254 | // sort formats so that the order matches the order of the itemDatas in the xml files. | ||
242 | auto formatList = QVector<Format>::fromList(d->formats.values()); | 255 | auto formatList = QVector<Format>::fromList(d->formats.values()); | ||
243 | std::sort(formatList.begin(), formatList.end(), [](const KSyntaxHighlighting::Format & lhs, const KSyntaxHighlighting::Format & rhs){ | 256 | std::sort(formatList.begin(), formatList.end(), [](const KSyntaxHighlighting::Format & lhs, const KSyntaxHighlighting::Format & rhs){ | ||
244 | return lhs.id() < rhs.id(); | 257 | return lhs.id() < rhs.id(); | ||
▲ Show 20 Lines • Show All 589 Lines • Show Last 20 Lines |