MCPcopy Create free account
hub / github.com/KDE/labplot / initDictionary

Method initDictionary

src/backend/core/column/ColumnPrivate.cpp:2881–2902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2879}
2880
2881void ColumnPrivate::initDictionary() {
2882 m_dictionary.clear();
2883 m_dictionaryFrequencies.clear();
2884 if (!m_data || columnMode() != AbstractColumn::ColumnMode::Text)
2885 return;
2886
2887 auto data = static_cast<QVector<QString>*>(m_data);
2888 for (auto& value : *data) {
2889 if (value.isEmpty())
2890 continue;
2891
2892 if (!m_dictionary.contains(value))
2893 m_dictionary << value;
2894
2895 if (m_dictionaryFrequencies.constFind(value) == m_dictionaryFrequencies.constEnd())
2896 m_dictionaryFrequencies[value] = 1;
2897 else
2898 m_dictionaryFrequencies[value]++;
2899 }
2900
2901 available.dictionary = true;
2902}
2903
2904/**
2905 * \brief Set the content of row 'row'

Callers 2

dictionaryIndexMethod · 0.80
ColumnPrivate.cppFile · 0.80

Calls 3

clearMethod · 0.45
isEmptyMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected