4#ifndef _Stroika_Foundation_Memory_VariantValue_h_
5#define _Stroika_Foundation_Memory_VariantValue_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
14#if qStroika_HasComponent_boost
15#include <boost/json/value.hpp>
19#include "Stroika/Foundation/Common/Common.h"
21#include "Stroika/Foundation/Containers/Mapping.h"
22#include "Stroika/Foundation/Containers/Sequence.h"
35 using Characters::String;
36 using Containers::Mapping;
37 using Containers::Sequence;
45 concept IVariantValueAsBasic_ =
46 Common::IAnyOf<T, bool, BLOB, Date, DateTime, wstring, String, Mapping<String, VariantValue>, map<wstring, VariantValue>, Sequence<VariantValue>, vector<VariantValue>>
47#if qStroika_HasComponent_boost
48 or same_as<T, boost::json::value>
50 or integral<T> or floating_point<T>;
178 using FloatType_ =
long double;
184 using IntegerType_ =
long long int;
190 using UnsignedIntegerType_ =
unsigned long long int;
234 using Type::eBoolean;
236 using Type::eDateTime;
238 using Type::eInteger;
240#if qCompilerAndStdLib_InternalCompilerErrorTSubCopy_Buggy
241 static constexpr Type eNull = Type::eNull;
246 using Type::eUnsignedInteger;
265 template <same_as<
bool> BOOL_T>
283 template <Characters::IConvertibleToString STRINGISH_T>
296 template <
typename T>
299#if qStroika_HasComponent_boost
309 template <
typename T>
316 nonvirtual
Type GetType ()
const;
327 nonvirtual
bool empty ()
const;
382 template <
typename RETURNTYPE>
440 nonvirtual
bool AsBool_ ()
const;
441 nonvirtual Date AsDate_ ()
const;
442 nonvirtual DateTime AsDateTime_ ()
const;
443 nonvirtual BLOB AsBLOB_ ()
const;
444 nonvirtual IntegerType_ AsInteger_ ()
const;
445 nonvirtual UnsignedIntegerType_ AsUnsignedInteger_ ()
const;
446 nonvirtual FloatType_ AsFloatType_ ()
const;
447 nonvirtual String AsString_ ()
const;
450#if qStroika_HasComponent_boost
467 struct EqualsComparer;
470 struct ThreeWayComparer;
476 shared_ptr<IRep_> fVal_;
479 template <
typename T>
483 static const shared_ptr<IRep_> kFalseRep_;
484 static const shared_ptr<IRep_> kTrueRep_;
486 static_assert (totally_ordered<VariantValue>);
533#include "VariantValue.inl"
#define Stroika_Define_Enum_Bounds(FIRST_ITEM, LAST_ITEM)
String is like std::u32string, except it is much easier to use, often much more space efficient,...
A Mapping uniquely associates two elements: a key and a value (use Assocation to allow multiple value...
A generalization of a vector: a container whose elements are keyed by the natural numbers.
Simple variant-value (case variant union) object, with (variant) basic types analogous to a value in ...
nonvirtual VariantValue ConvertTo(Type to) const
Return this VariantValue converted to the given type (as if by As<T> for the T appropriate to 'Type t...
nonvirtual bool operator==(const VariantValue &rhs) const
compares as if first normalized with Normalize()
VariantValue()=default
construct a VariantValue from most any 'basic type' you would expect to find in a weakly typed langua...
nonvirtual bool empty() const
nonvirtual String ToString() const
Type
Enumeration of variant types.
nonvirtual VariantValue & operator=(VariantValue &&rhs) noexcept=default
nonvirtual bool IsConvertibleTo(Type to) const
nonvirtual RETURNTYPE As() const
nonvirtual VariantValue Normalize() const
nonvirtual strong_ordering operator<=>(const VariantValue &rhs) const
compares as if first normalized with Normalize()
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
Compares values as if first normalized with Normalize () method.
Compares values as if first normalized with Normalize () method.