Freeciv21
Develop your civilization from humble roots to a global empire
datum Struct Reference

The following several functions allow intelligent sorting city report fields by column. More...

Public Attributes

union {
   float   numeric_value
 
   char *   string_value
 
val
 
bool is_numeric
 

Detailed Description

The following several functions allow intelligent sorting city report fields by column.

This doesn't necessarily do the right thing, but it's better than sorting alphabetically.

The GUI gives us two values to compare (as strings). We try to split them into an array of numeric and string fields, then we compare lexicographically. Two numeric fields are compared in the obvious way, two character fields are compared alphabetically. Arbitrarily, a numeric field is sorted before a character field (for "justification" note that numbers are before letters in the ASCII table).

Definition at line 958 of file view_cities_data.cpp.

Member Data Documentation

◆ is_numeric

bool datum::is_numeric

◆ numeric_value

float datum::numeric_value

Definition at line 960 of file view_cities_data.cpp.

Referenced by datum_compare(), and init_datum_number().

◆ string_value

char* datum::string_value

Definition at line 961 of file view_cities_data.cpp.

Referenced by datum_compare(), free_datum(), and init_datum_string().

◆ 

union { ... } datum::val