|
wex
v21.04.0
|
Offers base statistics. More...
#include <wex/statistics.h>
Public Member Functions | |
| statistics (const std::vector< std::pair< const std::string, T >> &v={}) | |
| Default constructor. More... | |
| statistics & | operator+= (const statistics &s) |
| Adds other statistics. | |
| void | clear () |
| Clears the items. More... | |
| const T | dec (const std::string &key, T dec_value=1) |
| Decrements key with value. | |
| const std::string | get () const |
| Returns all items as a string. More... | |
| const T | get (const std::string &key) const |
| Returns value for specified key. | |
| const auto & | get_items () const |
| Returns the items. | |
| const T | inc (const std::string &key, T inc_value=1) |
| Increments key with value. | |
| const T | set (const std::string &key, T value) |
| Sets key to value. More... | |
| grid * | show (wxWindow *parent, bool hide_row_labels=true, bool hide_col_labels=true, wxWindowID id=wxID_ANY) |
| Shows the statistics as a grid window on the parent, and specify whether to show row labels and col labels. More... | |
| const grid * | get_grid () const |
| Access to the grid, returns nullptr if the grid has not been shown yet. | |
Offers base statistics.
All statistics involve a key value pair, where the key is a string, and the value a template. The statistics can be shown on a grid, that is automatically updated whenever statistics change.
|
inline |
Default constructor.
You can specify a vector of values to initialize the statistics.
|
inline |
Clears the items.
If you have shown the statistics the window is updated as well.
|
inline |
Returns all items as a string.
All items are returned as a string, with comma's separating items, and a : separating key and value.
|
inline |
Sets key to value.
If you have shown the statistics the window is updated as well.
|
inline |
Shows the statistics as a grid window on the parent, and specify whether to show row labels and col labels.
Returns the window that is created, or is activated, if it already was created.
| parent | the parent for the grid |
| hide_row_labels | show row labels (i.e. row numbers) |
| hide_col_labels | show col labels (Item, Value) |
| id | the id of the grid component |