5 #ifndef JODA_LISTATTRIBUTESPROVIDER_H
6 #define JODA_LISTATTRIBUTESPROVIDER_H
18 if (!firstObject)
return false;
22 constexpr
bool Bool(
bool b) {
23 if (!firstObject)
return false;
27 constexpr
bool Int(
int i) {
28 if (!firstObject)
return false;
32 constexpr
bool Uint(
unsigned i) {
33 if (!firstObject)
return false;
37 constexpr
bool Int64(int64_t i) {
38 if (!firstObject)
return false;
43 if (!firstObject)
return false;
48 if (!firstObject)
return false;
52 constexpr
bool RawNumber(
const Ch *str, rapidjson::SizeType length,
54 if (!firstObject)
return false;
58 constexpr
bool String(
const Ch *str, rapidjson::SizeType length,
bool copy) {
59 if (!firstObject)
return false;
64 if (stack == 0) firstObject =
true;
69 bool Key(
const Ch *str, rapidjson::SizeType length,
bool copy) {
70 if (!firstObject)
return false;
71 if (stack == 1) attributes.emplace_back(str, length);
81 if (!firstObject)
return false;
86 constexpr
bool EndArray(rapidjson::SizeType elementCount) {
99 std::vector<std::string> attributes;
101 bool firstObject =
false;
119 static constexpr
auto name =
"LISTATTRIBUTES";
127 const std::vector<std::unique_ptr<IValueProvider>> ¶meters){
133 const std::vector<std::unique_ptr<IValueProvider>> ¶meters,
136 RJValue ret(rapidjson::kArrayType);
138 auto ptr = accepter.getPointer(json, alloc);
139 if (ptr !=
nullptr) {
140 if (!ptr->IsObject())
return RJValue();
141 ret.Reserve(ptr->MemberCount(), alloc);
142 for (
typename RJDocument::ConstMemberIterator m = ptr->MemberBegin();
143 m != ptr->MemberEnd(); ++m) {
144 ret.PushBack(
RJValue(m->name, alloc), alloc);
149 auto vo = accepter.getObjVO(json, alloc);
151 ret.Reserve(vo->size(), alloc);
152 for (
const auto &mem : vo->attributes()) {
153 ret.PushBack(
RJValue(mem, alloc), alloc);
159 auto res = accepter.Accept(json, alloc, handler);
163 ret.Reserve(atts.size(), alloc);
164 for (
auto &&att : atts) {
165 ret.PushBack(
RJValue(att, alloc), alloc);
rapidjson::MemoryPoolAllocator< RJBaseAlloc > RJMemoryPoolAlloc
Definition: RJFwd.h:26
rapidjson::GenericValue< RJChar, RJMemoryPoolAlloc > RJValue
Definition: RJFwd.h:29
Definition: RapidJsonDocument.h:22
Definition: TemplateProvider.h:44
Definition: ListAttributesProvider.h:104
values::NoParameter< 3 > P3
Definition: ListAttributesProvider.h:110
static void checkParameters(State &state, const std::vector< std::unique_ptr< IValueProvider >> ¶meters)
Definition: ListAttributesProvider.h:125
bool State
Definition: ListAttributesProvider.h:114
values::NoParameter< 1 > P1
Definition: ListAttributesProvider.h:108
values::ObjectParameter< 0 > P0
Definition: ListAttributesProvider.h:107
static RJValue calculate(const State &state, const std::vector< std::unique_ptr< IValueProvider >> ¶meters, const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc)
Definition: ListAttributesProvider.h:131
values::NoParameter< 2 > P2
Definition: ListAttributesProvider.h:109
static constexpr IValueType retType
Definition: ListAttributesProvider.h:117
values::NoParameter< 4 > P4
Definition: ListAttributesProvider.h:111
static constexpr auto name
Definition: ListAttributesProvider.h:119
Definition: ListAttributesProvider.h:13
constexpr bool StartArray()
Definition: ListAttributesProvider.h:80
constexpr bool Null()
Definition: ListAttributesProvider.h:17
constexpr bool Double(double d)
Definition: ListAttributesProvider.h:47
constexpr bool Int64(int64_t i)
Definition: ListAttributesProvider.h:37
constexpr bool String(const Ch *str, rapidjson::SizeType length, bool copy)
Definition: ListAttributesProvider.h:58
constexpr bool RawNumber(const Ch *str, rapidjson::SizeType length, bool copy)
Definition: ListAttributesProvider.h:52
constexpr bool Int(int i)
Definition: ListAttributesProvider.h:27
bool StartObject()
Definition: ListAttributesProvider.h:63
std::vector< std::string > getAttributes() const
Definition: ListAttributesProvider.h:91
constexpr bool EndArray(rapidjson::SizeType elementCount)
Definition: ListAttributesProvider.h:86
constexpr bool Bool(bool b)
Definition: ListAttributesProvider.h:22
constexpr bool Uint64(uint64_t i)
Definition: ListAttributesProvider.h:42
bool Key(const Ch *str, rapidjson::SizeType length, bool copy)
Definition: ListAttributesProvider.h:69
bool EndObject(rapidjson::SizeType memberCount)
Definition: ListAttributesProvider.h:75
constexpr bool Uint(unsigned i)
Definition: ListAttributesProvider.h:32
char Ch
Definition: ListAttributesProvider.h:15
void reset()
Definition: ListAttributesProvider.h:93
Definition: ListAttributesProvider.h:11
Definition: AttributeStatAggregator.h:12
IValueType
Definition: IValueProvider.h:33
@ IV_Array
Definition: IValueProvider.h:38
TemplateProvider< joda::query::providers::listattributes::ListAttributesCalculator > ListAttributesProvider
Definition: ListAttributesProvider.h:178
Definition: ParameterPack.h:18
Definition: ParameterPack.h:199
static ReturnT extractValue(const std::vector< std::unique_ptr< IValueProvider >> ¶meters, const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc)
Definition: ParameterPack.h:211