mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 17:15:07 +03:00
cam: options: Add empty() function to OptionValue class
Add a convenience helper to check if an option value is empty, based on the value type. This is useful as a shortcut syntax to check if an option has been set. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
668c87732a
commit
812e5a946f
2 changed files with 8 additions and 0 deletions
|
@ -583,6 +583,13 @@ void OptionValue::addValue(const OptionValue &value)
|
|||
* \return The value type
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn OptionValue::empty()
|
||||
* \brief Check if the value is empty
|
||||
* \return True if the value is empty (type set to ValueType::ValueNone), or
|
||||
* false otherwise
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Cast the value to an int
|
||||
* \return The option value as an int, or 0 if the value type isn't
|
||||
|
|
|
@ -135,6 +135,7 @@ public:
|
|||
void addValue(const OptionValue &value);
|
||||
|
||||
ValueType type() const { return type_; }
|
||||
bool empty() const { return type_ == ValueType::ValueNone; }
|
||||
|
||||
operator int() const;
|
||||
operator std::string() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue