mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-16 17:05:08 +03:00
libcamera: controls: Reorder ControlValue methods
Reorder functions in ControlValue class to group const methods together. Cosmetic change only. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
8c051160e7
commit
dd09239600
2 changed files with 52 additions and 52 deletions
|
@ -33,11 +33,6 @@ public:
|
||||||
ControlType type() const { return type_; }
|
ControlType type() const { return type_; }
|
||||||
bool isNone() const { return type_ == ControlTypeNone; }
|
bool isNone() const { return type_ == ControlTypeNone; }
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
const T &get() const;
|
|
||||||
template<typename T>
|
|
||||||
void set(const T &value);
|
|
||||||
|
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
|
|
||||||
bool operator==(const ControlValue &other) const;
|
bool operator==(const ControlValue &other) const;
|
||||||
|
@ -46,6 +41,11 @@ public:
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
const T &get() const;
|
||||||
|
template<typename T>
|
||||||
|
void set(const T &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ControlType type_;
|
ControlType type_;
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,53 @@ ControlValue::ControlValue(int64_t value)
|
||||||
* \return True if the value type is ControlTypeNone, false otherwise
|
* \return True if the value type is ControlTypeNone, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Assemble and return a string describing the value
|
||||||
|
* \return A string describing the ControlValue
|
||||||
|
*/
|
||||||
|
std::string ControlValue::toString() const
|
||||||
|
{
|
||||||
|
switch (type_) {
|
||||||
|
case ControlTypeNone:
|
||||||
|
return "<None>";
|
||||||
|
case ControlTypeBool:
|
||||||
|
return bool_ ? "True" : "False";
|
||||||
|
case ControlTypeInteger32:
|
||||||
|
return std::to_string(integer32_);
|
||||||
|
case ControlTypeInteger64:
|
||||||
|
return std::to_string(integer64_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<ValueType Error>";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Compare ControlValue instances for equality
|
||||||
|
* \return True if the values have identical types and values, false otherwise
|
||||||
|
*/
|
||||||
|
bool ControlValue::operator==(const ControlValue &other) const
|
||||||
|
{
|
||||||
|
if (type_ != other.type_)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (type_) {
|
||||||
|
case ControlTypeBool:
|
||||||
|
return bool_ == other.bool_;
|
||||||
|
case ControlTypeInteger32:
|
||||||
|
return integer32_ == other.integer32_;
|
||||||
|
case ControlTypeInteger64:
|
||||||
|
return integer64_ == other.integer64_;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn bool ControlValue::operator!=()
|
||||||
|
* \brief Compare ControlValue instances for non equality
|
||||||
|
* \return False if the values have identical types and values, true otherwise
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn template<typename T> const T &ControlValue::get() const
|
* \fn template<typename T> const T &ControlValue::get() const
|
||||||
* \brief Get the control value
|
* \brief Get the control value
|
||||||
|
@ -175,53 +222,6 @@ void ControlValue::set<int64_t>(const int64_t &value)
|
||||||
}
|
}
|
||||||
#endif /* __DOXYGEN__ */
|
#endif /* __DOXYGEN__ */
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Assemble and return a string describing the value
|
|
||||||
* \return A string describing the ControlValue
|
|
||||||
*/
|
|
||||||
std::string ControlValue::toString() const
|
|
||||||
{
|
|
||||||
switch (type_) {
|
|
||||||
case ControlTypeNone:
|
|
||||||
return "<None>";
|
|
||||||
case ControlTypeBool:
|
|
||||||
return bool_ ? "True" : "False";
|
|
||||||
case ControlTypeInteger32:
|
|
||||||
return std::to_string(integer32_);
|
|
||||||
case ControlTypeInteger64:
|
|
||||||
return std::to_string(integer64_);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "<ValueType Error>";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Compare ControlValue instances for equality
|
|
||||||
* \return True if the values have identical types and values, false otherwise
|
|
||||||
*/
|
|
||||||
bool ControlValue::operator==(const ControlValue &other) const
|
|
||||||
{
|
|
||||||
if (type_ != other.type_)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (type_) {
|
|
||||||
case ControlTypeBool:
|
|
||||||
return bool_ == other.bool_;
|
|
||||||
case ControlTypeInteger32:
|
|
||||||
return integer32_ == other.integer32_;
|
|
||||||
case ControlTypeInteger64:
|
|
||||||
return integer64_ == other.integer64_;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \fn bool ControlValue::operator!=()
|
|
||||||
* \brief Compare ControlValue instances for non equality
|
|
||||||
* \return False if the values have identical types and values, true otherwise
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class ControlId
|
* \class ControlId
|
||||||
* \brief Control static metadata
|
* \brief Control static metadata
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue