11 #ifndef JODA_VALUEACCEPTER_H
12 #define JODA_VALUEACCEPTER_H
19 const std::unique_ptr<joda::query::IValueProvider> &ival) {
21 if (pProvider !=
nullptr) {
26 DCHECK(pp !=
nullptr || def !=
nullptr);
31 template <
class Handler>
35 return pp->
Accept(json, alloc, h);
37 return DefaultAccept(json, alloc, h);
44 this->alloc_ = alloc_;
47 template <
typename Handler>
49 return Accept(*json_, *alloc_, handler);
52 template <
class Handler>
53 static bool Accept(
const std::unique_ptr<IValueProvider> &ival,
58 return pp->
Accept(json, alloc, h);
60 return DefaultAccept<Handler>(ival, json, alloc, h);
71 std::variant<const RJValue, std::optional<const RJValue *>,
79 return std::move(val);
81 auto *val = def->
getValue(json, alloc);
82 if (val ==
nullptr)
return (std::nullptr_t)
nullptr;
89 return std::optional<const RJValue *>(
nullptr);
98 template <
class Handler>
99 static bool DefaultAccept(
const std::unique_ptr<IValueProvider> &ival,
102 if (ival->isAtom()) {
103 auto val = ival->getAtomValue(json, alloc);
106 auto *val = ival->getValue(json, alloc);
107 return val->Accept(h);
111 template <
class Handler>
116 return val.Accept(h);
118 auto *val = def->
getValue(json, alloc);
119 return val->Accept(h);
129 if (def !=
nullptr)
return def->
getValue(json, alloc);
138 return pp->
getVO(json);
rapidjson::MemoryPoolAllocator< RJBaseAlloc > RJMemoryPoolAlloc
Definition: RJFwd.h:26
rapidjson::GenericValue< RJChar, RJMemoryPoolAlloc > RJValue
Definition: RJFwd.h:29
Definition: RapidJsonDocument.h:22
bool Accept(Handler &handler) const
Definition: RapidJsonDocument.h:121
Definition: VirtualObject.h:13
Definition: IValueProvider.h:143
virtual bool isAtom() const
Definition: IValueProvider.h:215
virtual RJValue getAtomValue(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const =0
virtual RJValue const * getValue(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const =0
virtual std::vector< std::string > getAttributes() const
Definition: IValueProvider.h:222
Definition: PointerProvider.h:17
const RJValue * getValue(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const override
Definition: PointerProvider.cpp:31
bool objIsPointerEvaluatable(const RapidJsonDocument &json) const
Definition: PointerProvider.cpp:60
const VirtualObject * getVO(const RapidJsonDocument &json) const
Definition: PointerProvider.cpp:65
bool Accept(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc, Handler &h) const
Definition: PointerProvider.h:59
std::variant< const RJValue, std::optional< const RJValue * >, const VirtualObject * > getPointerIfExists(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const
Definition: PointerProvider.cpp:75
Definition: ValueAccepter.h:16
const RJValue * getPointer(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const
Definition: ValueAccepter.h:127
void prepareGenerator(const RapidJsonDocument *json_, RJMemoryPoolAlloc *alloc_)
Definition: ValueAccepter.h:41
std::vector< std::string > getMaterializeAttributes() const
Definition: ValueAccepter.h:147
bool Accept(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc, Handler &h) const
Definition: ValueAccepter.h:32
static bool Accept(const std::unique_ptr< IValueProvider > &ival, const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc, Handler &h)
Definition: ValueAccepter.h:53
ValueAccepter(const std::unique_ptr< joda::query::IValueProvider > &ival)
Definition: ValueAccepter.h:18
const VirtualObject * getObjVO(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const
Definition: ValueAccepter.h:135
ValueAccepter()
Definition: ValueAccepter.h:29
std::variant< const RJValue, std::optional< const RJValue * >, const VirtualObject * > getPointerIfExists(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const
Definition: ValueAccepter.h:73
bool operator()(Handler &handler)
Definition: ValueAccepter.h:48
Definition: AttributeStatAggregator.h:12