60 Value(
const Value&) =
default;
61 Value(
Value&&)
noexcept =
default;
63 Value& operator=(
Value&&) &
noexcept =
default;
66 Value& operator=(T&&) && {
69 "You're assigning to a temporary formats::bson::Value! Use "
70 "formats::bson::ValueBuilder for data modifications."
77 explicit Value(impl::ValueImplPtr);
105 const_iterator
end()
const;
113 const_reverse_iterator
rend()
const;
129 bool operator==(
const Value&)
const;
137 bool IsArray()
const;
138 bool IsDocument()
const;
142 bool IsInt32()
const;
143 bool IsInt64()
const;
144 bool IsUInt64()
const;
145 bool IsDouble()
const;
146 bool IsString()
const;
147 bool IsDateTime()
const;
149 bool IsBinary()
const;
150 bool IsDecimal128()
const;
151 bool IsMinKey()
const;
152 bool IsMaxKey()
const;
153 bool IsTimestamp()
const;
155 bool IsObject()
const {
return IsDocument(); }
165 template <
typename T>
169 "There is no `Parse(const Value&, formats::parse::To<T>)` in namespace "
170 "of `T` or `formats::parse`. "
171 "Probably you have not provided a `Parse` function overload."
174 return Parse(*
this, formats::
parse::To<T>{});
179 template <
typename T,
typename First,
typename... Rest>
180 auto As(First&& default_arg, Rest&&... more_default_args)
const {
184 return decltype(As<T>())(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
192 template <
typename T>
194 return (
IsMissing() || IsNull()) ?
decltype(As<T>())() : As<T>();
199 template <
typename T>
201 if constexpr (formats::
common::impl::HasConvert<
Value, T>) {
202 return Convert(*
this, formats::
parse::To<T>{});
203 }
else if constexpr (formats::
common::impl::HasParse<
Value, T>) {
204 return Parse(*
this, formats::
parse::To<T>{});
208 "There is no `Convert(const Value&, formats::parse::To<T>)` or "
209 "`Parse(const Value&, formats::parse::To<T>)` in namespace of `T` or `formats::parse`. "
210 "Probably you have not provided a `Convert` function overload."
217 template <
typename T,
typename First,
typename... Rest>
218 T
ConvertTo(First&& default_arg, Rest&&... more_default_args)
const {
221 return T(std::forward<First>(default_arg), std::forward<Rest>(more_default_args)...);
223 return ConvertTo<T>();
252 Document GetInternalArrayDocument()
const;
256 const impl::BsonHolder& GetBson()
const;
260 friend class impl::BsonBuilder;
262 friend bool Parse(
const Value& value,
parse::To<
bool>);
263 friend int64_t Parse(
const Value& value,
parse::To<int64_t>);
264 friend uint64_t Parse(
const Value& value,
parse::To<uint64_t>);
265 friend double Parse(
const Value& value,
parse::To<
double>);
266 friend std::string Parse(
const Value& value,
parse::To<std::string>);
267 friend std::chrono::system_clock::time_point
268 Parse(
const Value& value,
parse::To<std::chrono::system_clock::time_point>);
275 impl::ValueImplPtr impl_;