MCPcopy Create free account
hub / github.com/KDE/kdevelop / words

Function words

kdevplatform/template/filters/kdevfilters.cpp:27–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27QStringList words(const QVariant& input)
28{
29 QString string = safeString(input);
30 if (string == string.toLower() && !string.contains(QLatin1Char('_'))) {
31 return QStringList(string);
32 }
33
34 if (string.contains(QLatin1Char('_'))) {
35 return string.toLower().split(QLatin1Char('_'));
36 }
37
38 int n = string.size();
39 QStringList ret;
40 int last = 0;
41 for (int i = 1; i < n; ++i)
42 {
43 if (string[i].isUpper())
44 {
45 ret << string.mid(last, i-last).toLower();
46 last = i;
47 }
48 }
49 ret << string.mid(last).toLower();
50 return ret;
51}
52
53QVariant CamelCaseFilter::doFilter(const QVariant& input, const QVariant& /*argument*/,
54 bool /*autoescape*/) const

Callers 1

doFilterMethod · 0.85

Calls 6

safeStringFunction · 0.85
QStringListClass · 0.85
midMethod · 0.80
containsMethod · 0.45
splitMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected