|
Open Model Railroad Network (OpenMRN)
|
Specialization of EntryModel with upper and lower bounds. More...
#include <EntryModel.hxx>
Public Member Functions | |
| EntryModelBounded () | |
| Constructor. | |
| void | init (unsigned max_size, int base, T value, T min, T max, T default_val, bool automatic_clamp=true) |
| Initialize with a value. | |
| void | set_default () |
| Set the value to the default. | |
Public Member Functions inherited from EntryModel< T > | |
| EntryModel () | |
| Constructor. | |
| void | clear () |
| Clear the entry string. | |
| void | init (unsigned max_size, int base) |
| Initialize empty. | |
| void | init (unsigned max_size, int base, T value, bool automatic_clamp=true) |
| Initialize with a value. | |
| void | push_back (uint8_t val) |
| Append a value to the "back". | |
| void | push_back_char (char c) |
| Append a character to the "back". | |
| EntryModel & | append (uint8_t val) |
| Append a value to the "back". | |
| EntryModel & | append_char (char c) |
| Append a character to the "back". | |
| void | pop_back () |
| Removes (deletes) a character off the end. | |
| void | set_base (int base) |
| Set the radix base. | |
| void | set_base (int base, bool convert) |
| Set the radix base. | |
| void | set_value (T value) |
| Set the value, keep the max number of digits and base the same. | |
| size_t | size () |
| Get the size (actual number of digits). | |
| size_t | max_size () |
| Get the max size (in digits). | |
| bool | empty () |
| Test if the entry is "empty". | |
| bool | cursor_visible () |
| Test if cursor is visible. | |
| bool | is_at_initial_value () |
| Determine if this object is holding an initial or modified value. | |
| bool | has_leading_zeros () |
| It is not always possible with get_string() to return the leading zeros. | |
| void | set_leading_zeros (unsigned num) |
| Sets the number of leading zeros without changing the value. | |
| T | get_value (bool force_clamp=false) |
| Get the entry as an unsigned integer value. | |
| string | get_string (bool right_justify=false) |
| Get the value as a string. | |
| void | set_min () |
| Set the value to the minimum. | |
| void | set_max () |
| Set the value to the maximum. | |
| void | change_sign () |
| Change the sign of the data. | |
| T | operator++ () |
| Pre-increment value. | |
| T | operator-- () |
| Pre-decrement value. | |
Private Member Functions | |
| void | clamp (bool force=false) override |
| Clamp the value at the min or max. | |
| void | set_boundaries () override |
| Override base class to do nothing. | |
| DISALLOW_COPY_AND_ASSIGN (EntryModelBounded) | |
Private Attributes | |
| T | valueDefault_ |
| default value | |
Additional Inherited Members | |
Protected Member Functions inherited from EntryModel< T > | |
| void | auto_clamp (bool force=false) |
| Calls clamp() only if automatic clamping is enabled (autoClamp_ = true). | |
| void | calculate_size () |
| Calculate the size in digits. | |
| DISALLOW_COPY_AND_ASSIGN (EntryModel) | |
Protected Attributes inherited from EntryModel< T > | |
| T | value_ |
| present value held | |
| T | valueMin_ |
| minimum value representable by maxSize_ | |
| T | valueMax_ |
| maximum value representable by maxSize_ | |
| unsigned | numLeadingZeros_: 5 |
| number of leading zeros | |
| unsigned | maxSize_: 5 |
| maximum number of digits | |
| unsigned | size_: 5 |
| actual number of digits | |
| unsigned | isAtInitialValue_: 1 |
| true if still has the initial value | |
| unsigned | empty_: 1 |
| true if the value_ is "empty" | |
| unsigned | base_: 6 |
| radix base | |
| unsigned | autoClamp_: 1 |
| true to auto clamp the values | |
Specialization of EntryModel with upper and lower bounds.
| T | the data type up to 64-bits in size |
| N | the size of the entry in max number of visible digits. |
Definition at line 511 of file EntryModel.hxx.
|
inline |
Constructor.
Definition at line 515 of file EntryModel.hxx.
|
inlineoverrideprivatevirtual |
Clamp the value at the min or max.
Clamping will not occur if the value is zero and there is space for more leading zeros.
| force | Normally, clamping doesn't occur if the entry is "empty". However, if force is set to true, we will clamp anyways. |
Reimplemented from EntryModel< T >.
Definition at line 550 of file EntryModel.hxx.
|
inline |
Initialize with a value.
| max_size | max number of digits in the base type |
| base | base type, 10 or 16 |
| value | value to initialize with |
| min | minumum value |
| max | maximum value |
| default_val | default value |
| automatic_clamp |
Definition at line 528 of file EntryModel.hxx.
|
inlineoverrideprivatevirtual |
Override base class to do nothing.
The boundaries come from EntryModelBounded::init().
Reimplemented from EntryModel< T >.
Definition at line 564 of file EntryModel.hxx.
|
inline |
Set the value to the default.
Definition at line 540 of file EntryModel.hxx.
|
private |
default value
Definition at line 568 of file EntryModel.hxx.