MCPcopy Create free account
hub / github.com/TeXworks/texworks / BibTeXEntryLessThan

Function BibTeXEntryLessThan

src/CitationSelectDialog.cpp:92–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92bool BibTeXEntryLessThan(const BibTeXFile::Entry * a, const BibTeXFile::Entry * b)
93{
94 Q_ASSERT(a);
95 Q_ASSERT(b);
96
97 // Sort by year first
98 if (a->year() != b->year()) {
99 if (a->year().isEmpty() && !b->year().isEmpty()) return false;
100 if (!a->year().isEmpty() && b->year().isEmpty()) return true;
101 return a->year() < b->year();
102 }
103 // If the years are equal, sort by authors
104 if (a->author() != b->author())
105 return a->author() < b->author();
106// if (a->title() != b->title())
107// return a->title() < b->title();
108
109 // If all else fails, sort by BibTeX key
110 return a->key() < b->key();
111}
112
113QStringList CitationSelectDialog::getSelectedKeys(const bool ordered /* = true */) const
114{

Callers

nothing calls this directly

Calls 3

yearMethod · 0.80
keyMethod · 0.80
authorMethod · 0.45

Tested by

no test coverage detected