mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
implemented most of DataEditor; fixed some bugs in Settings
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@78 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -20,14 +20,19 @@
|
||||
template <typename T>
|
||||
class Defaultable {
|
||||
public:
|
||||
inline Defaultable() : is_default(true) {}
|
||||
inline Defaultable(const T& v) : value(v), is_default(false) {}
|
||||
inline Defaultable() : is_default(true) {}
|
||||
inline Defaultable(const T& v, bool def = false) : value(v), is_default(def) {}
|
||||
|
||||
/// Assigning a value takes this object out of the default state
|
||||
inline void assign(const T& new_value) {
|
||||
value = new_value;
|
||||
is_default = false;
|
||||
}
|
||||
/// Assigning a value keep this object in the default state
|
||||
inline void assignDefault(const T& new_value) {
|
||||
assert(is_default);
|
||||
value = new_value;
|
||||
}
|
||||
|
||||
/// Get access to the value
|
||||
inline const T& operator () () const { return value; }
|
||||
|
||||
Reference in New Issue
Block a user