summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-07-03 19:34:28 +0000
committeralberth <alberth@openttd.org>2009-07-03 19:34:28 +0000
commitf5d976082495fef56c7ab64548238c4e3110d03c (patch)
treec8c5bf740f0b22c4f8c5183c202acfa66e22886a /src
parentff402e7ea0b10029760f8ee7dee1b47dac166b73 (diff)
downloadopenttd-f5d976082495fef56c7ab64548238c4e3110d03c.tar.xz
(svn r16730) -Doc: Added some missing docs (most notably the class/struct docs) to GUIList template.
Diffstat (limited to 'src')
-rw-r--r--src/sortlist_type.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sortlist_type.h b/src/sortlist_type.h
index 101d11152..9d89c9e56 100644
--- a/src/sortlist_type.h
+++ b/src/sortlist_type.h
@@ -12,6 +12,7 @@
#include "core/smallvec_type.hpp"
#include "date_type.h"
+/** Flags of the sort list. */
enum SortListFlags {
VL_NONE = 0, ///< no sort
VL_DESC = 1 << 0, ///< sort descending or ascending
@@ -23,20 +24,27 @@ enum SortListFlags {
};
DECLARE_ENUM_AS_BIT_SET(SortListFlags);
+/** Data structure describing how to show the list (what sort direction and criterium). */
struct Listing {
bool order; ///< Ascending/descending
byte criteria; ///< Sorting criteria
};
+/** Data structure describing what to show in the list (filter criteria). */
struct Filtering {
bool state; ///< Filter on/off
byte criteria; ///< Filtering criteria
};
+/**
+ * List template of 'things' \p T to sort in a GUI.
+ * @tparam T Type of data stored in the list to represent each item.
+ * @tparam F Type of data fed as additional value to the filter function. @see FilterFunction
+ */
template <typename T, typename F = const char*>
class GUIList : public SmallVector<T, 32> {
public:
- typedef int CDECL SortFunction(const T*, const T*);
- typedef bool CDECL FilterFunction(const T*, F);
+ typedef int CDECL SortFunction(const T*, const T*); ///< Signature of sort function.
+ typedef bool CDECL FilterFunction(const T*, F); ///< Signature of filter function.
protected:
SortFunction * const *sort_func_list; ///< the sort criteria functions
@@ -274,7 +282,7 @@ public:
}
/**
- * Overload of Sort()
+ * Overload of #Sort(SortFunction *compare)
* Overloaded to reduce external code
*
* @return true if the list sequence has been altered