103 template<
typename DataModel>
104 void invokeSetWithEachArgument(DataModel && )
109 template<
typename DataModel,
typename Arg,
typename... Args>
110 void invokeSetWithEachArgument(DataModel &&dm, Arg &&arg, Args &&...args)
112 dm.set(std::forward<Arg>(arg));
113 invokeSetWithEachArgument(std::forward<DataModel>(dm), std::forward<Args>(args)...);
122 static_assert(std::is_default_constructible<T>::value,
"T needs to be default_constructible");
126 : m_hasValue{
false }
130 explicit constexpr Optional(
const T &value)
135 explicit constexpr Optional(T &&value)
137 , m_value{ std::move(value) }
140 const T &value()
const
144 throw std::runtime_error(
"value() called on unset optional");
149 bool hasValue()
const
160 bool operator==(
const Optional<T> &other)
const
162 if(hasValue() != other.hasValue())
170 return value() == other.value();
173 bool operator!=(
const Optional<T> &other)
const
175 return !operator==(other);
178 bool operator<(
const Optional<T> &other)
const
180 if(!hasValue() && !other.hasValue())
184 if(hasValue() && !other.hasValue())
188 if(!hasValue() && other.hasValue())
192 return m_value < other.m_value;
195 bool operator>(
const Optional<T> &other)
const
197 if(!hasValue() && !other.hasValue())
201 if(hasValue() && !other.hasValue())
205 if(!hasValue() && other.hasValue())
209 return m_value > other.m_value;
212 bool operator<=(
const Optional<T> &other)
const
214 return (
operator==(other) ||
operator<(other));
217 bool operator>=(
const Optional<T> &other)
const
219 return (
operator==(other) ||
operator>(other));
230 static void setFromString(T &target,
const std::string &value)
232 target.setFromString(value);
235 static void setFromString(T &target,
const std::string &path,
const std::string &value)
237 target.setFromString(path, value);
240 static std::string getString(
const T &target,
const std::string &path)
242 return target.getString(path);
247 void setFromString(T &target,
const std::string &value)
249 Befriend<T>::setFromString(target, value);
253 void setFromString(T &target,
const std::string &path,
const std::string &value)
255 Befriend<T>::setFromString(target, path, value);
259 std::string getString(
const T &target,
const std::string &path)
261 return Befriend<T>::getString(target, path);
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:99