Predicate to sort CargoDataEntries with stl algorithms. More...
Public Member Functions | |
CargoSorter (CargoSortType t=ST_STATION_ID, SortOrder o=SO_ASCENDING) | |
CargoSortType | GetSortType () |
bool | operator() (const CargoDataEntry *cd1, const CargoDataEntry *cd2) const |
Sorting operator. | |
Private Member Functions | |
template<class Tid > | |
bool | SortId (Tid st1, Tid st2) const |
Helper for sorting by ID. | |
bool | SortCount (const CargoDataEntry *cd1, const CargoDataEntry *cd2) const |
Helper for sorting by cargo count. | |
bool | SortStation (StationID st1, StationID st2) const |
Helper for sorting by station name. | |
Private Attributes | |
CargoSortType | type |
SortOrder | order |
Predicate to sort CargoDataEntries with stl algorithms.
Can sort by different CargoSortTypes.
Definition at line 817 of file station_gui.cpp.
bool CargoSorter::operator() | ( | const CargoDataEntry * | cd1, | |
const CargoDataEntry * | cd2 | |||
) | const |
Sorting operator.
cd1 | First entry to be compared. | |
cd2 | Second entry to be compared. |
Definition at line 1146 of file station_gui.cpp.
References CargoDataEntry::GetCargo(), CargoDataEntry::GetStation(), SortCount(), SortStation(), ST_CARGO_ID, ST_COUNT, ST_STATION_ID, and ST_STATION_STRING.
bool CargoSorter::SortCount | ( | const CargoDataEntry * | cd1, | |
const CargoDataEntry * | cd2 | |||
) | const [private] |
Helper for sorting by cargo count.
cd1 | First CargoDataEntry to compare. | |
cd2 | Second CargoDataEntry to compare. |
Definition at line 1181 of file station_gui.cpp.
References CargoDataEntry::GetCount(), CargoDataEntry::GetStation(), and SortStation().
Referenced by operator()().
bool CargoSorter::SortId | ( | Tid | id1, | |
Tid | id2 | |||
) | const [private] |
Helper for sorting by ID.
Tid | ID class; typically StationID or CargoID. |
id1 | First ID to compare. | |
id2 | Second ID to compare. |
Definition at line 1170 of file station_gui.cpp.
Referenced by SortStation().
bool CargoSorter::SortStation | ( | StationID | st1, | |
StationID | st2 | |||
) | const [private] |
Helper for sorting by station name.
st1 | ID of first station to compare. | |
st2 | ID of second station to compare. |
Definition at line 1200 of file station_gui.cpp.
References SpecializedStation< Station, false >::IsValidID(), lastof, MAX_LENGTH_STATION_NAME_CHARS, SetDParam(), and SortId().
Referenced by operator()(), and SortCount().