58 template<
typename DataModel>
59 void invokeSetWithEachArgument(DataModel & )
64 template<
typename DataModel,
typename Arg,
typename... Args>
65 void invokeSetWithEachArgument(DataModel &dm, Arg &&arg, Args &&...args)
67 dm.set(std::forward<Arg>(arg));
68 invokeSetWithEachArgument(dm, std::forward<Args>(args)...);
77 static_assert(std::is_default_constructible<T>::value,
"T needs to be default_constructible");
85 explicit constexpr Optional(
const T &value)
90 explicit constexpr Optional(T &&value)
92 , m_value{ std::move(value) }
95 const T &value()
const
99 throw std::runtime_error(
"value() called on unset optional");
104 bool hasValue()
const
115 bool operator==(
const Optional<T> &other)
const
117 if(hasValue() != other.hasValue())
125 return value() == other.value();
128 bool operator!=(
const Optional<T> &other)
const
130 return !operator==(other);
133 bool operator<(
const Optional<T> &other)
const
135 if(!hasValue() && !other.hasValue())
139 if(hasValue() && !other.hasValue())
143 if(!hasValue() && other.hasValue())
147 return m_value < other.m_value;
150 bool operator>(
const Optional<T> &other)
const
152 if(!hasValue() && !other.hasValue())
156 if(hasValue() && !other.hasValue())
160 if(!hasValue() && other.hasValue())
164 return m_value > other.m_value;
167 bool operator<=(
const Optional<T> &other)
const
169 return (
operator==(other) ||
operator<(other));
172 bool operator>=(
const Optional<T> &other)
const
174 return (
operator==(other) ||
operator>(other));
185 static void setFromString(T &target,
const std::string &value)
187 target.setFromString(value);
190 static void setFromString(T &target,
const std::string &path,
const std::string &value)
192 target.setFromString(path, value);
195 static std::string getString(
const T &target,
const std::string &path)
197 return target.getString(path);
202 void setFromString(T &target,
const std::string &value)
204 Befriend<T>::setFromString(target, value);
208 void setFromString(T &target,
const std::string &path,
const std::string &value)
210 Befriend<T>::setFromString(target, path, value);
214 std::string getString(
const T &target,
const std::string &path)
216 return Befriend<T>::getString(target, path);
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:56