libyui-ncurses
Loading...
Searching...
No Matches
NCTableSortDefault::Compare Class Reference

#include <NCTableSort.h>

Public Member Functions

 Compare (int sortCol, bool reverse)
 
bool operator() (YItem *item1, YItem *item2) const
 

Protected Member Functions

std::wstring smartSortKey (YItem *item) const
 
long long toNumber (const std::wstring &str, bool *ok) const
 

Protected Attributes

const int _sortCol
 
const bool _reverse
 

Detailed Description

Comparison functor.

This uses the sort key of the cell if it has one, the label if not.

It also tries to convert strings to numbers to do a numeric comparison if possible.

Member Function Documentation

◆ operator()()

bool NCTableSortDefault::Compare::operator() ( YItem * item1,
YItem * item2 ) const

The comparison itself: Return the result of item1 < item2

◆ smartSortKey()

std::wstring NCTableSortDefault::Compare::smartSortKey ( YItem * item) const
protected

Return the sort key of column no. _sortCol for an item or, if it doesn't have one, its label in that column.

◆ toNumber()

long long NCTableSortDefault::Compare::toNumber ( const std::wstring & str,
bool * ok ) const
protected

Try to convert a string to a number. Return the number and set the 'ok' flag to 'true' on success, to 'false' on failure.


The documentation for this class was generated from the following files: