//! Initializes the name and default values for an option.
explicit AbstractOption(const char *name)
: minValueCount_(1), maxValueCount_(1),
- name_(name), descr_(NULL)
+ name_(name), descr_(NULL), storeIsSet_(NULL)
{ }
/*! \brief
//! Sets the description for the option.
void setDescription(const char *descr) { descr_ = descr; }
+ //! Sets the storage location for whether the option is set.
+ void setStoreIsSet(bool *store) { storeIsSet_ = store; }
//! Sets a flag for the option.
void setFlag(OptionFlag flag) { flags_.set(flag); }
//! Clears a flag for the option.
//! Pointer to description of the option.
const char *descr_;
OptionFlags flags_;
+ bool *storeIsSet_;
/*! \brief
* Needed to initialize an AbstractOptionStorage object from this class
*/
MyClass &storeVector(std::vector<T> *store)
{ storeVector_ = store; return me(); }
+ /*! \brief
+ * Stores whether the option was explicitly set.
+ *
+ * \param[in] store Variable to store the flag in.
+ *
+ * The value is set to `false` on creation of the option, and to `true`
+ * as soon as a value is assigned to the option. A default value does
+ * not set the flag to `true`, but assignment that uses
+ * defaultValueIfSet() does.
+ *
+ * The pointer provided should remain valid as long as the associated
+ * Options object exists.
+ */
+ MyClass &storeIsSet(bool *store)
+ { setStoreIsSet(store); return me(); }
protected:
/*! \cond libapi */