MCPcopy Create free account
hub / github.com/KDE/kdevelop / operator()

Method operator()

plugins/quickopen/projectitemquickopen.cpp:85–100  ·  view source on GitHub ↗

@brief Calculates the distance to two pre-filtered match items * * @param a The CodeModelView witch represents the first item to be tested * @param b The CodeModelView witch represents the second item to be tested * * @b */

Source from the content-addressed store, hash-verified

83 * @b
84 */
85 inline bool operator()(const CodeModelViewItem& a, const CodeModelViewItem& b) const
86 {
87 const int height_a = cache.value(a.m_id.index(), -1);
88 const int height_b = cache.value(b.m_id.index(), -1);
89
90 Q_ASSERT(height_a != -1);
91 Q_ASSERT(height_b != -1);
92
93 if (height_a == height_b) {
94 // stable sorting for equal items based on index
95 // TODO: fast string-based sorting in such cases?
96 return a.m_id.index() < b.m_id.index();
97 }
98
99 return height_a < height_b;
100 }
101private:
102 const QHash<int, int>& cache;
103};

Callers

nothing calls this directly

Calls 2

valueMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected