5 #ifndef JODA_BINARYSTRINGPROVIDER_H
6 #define JODA_BINARYSTRINGPROVIDER_H
30 std::vector<std::unique_ptr<IValueProvider>> &¶meters)
34 DCHECK(
isAtom()) <<
"Only atom ReturnTypes allowed";
41 std::string
getName()
const override {
return Calc::name; };
45 std::unique_ptr<IValueProvider>
duplicate()
const override {
51 for (
const auto ¶m :
params) {
52 c &= param->isConst();
64 return Calc::calculate(std::move(lhsStr), std::move(rhsStr), alloc);
69 DCHECK(!
isAtom()) <<
"Did not check for atom first";
77 for (
unsigned int i = 0; i <
params.size(); ++i) {
87 static constexpr
auto name =
"SCONTAINS";
92 return RJValue(lhs.find(rhs) != std::string::npos);
96 typedef BinaryStringProvider<BinarySCONTAINSCalculationFunction>
103 static constexpr
auto name =
"STARTSWITH";
108 if (rhs.size() > lhs.size())
return RJValue(
false);
109 return RJValue(lhs.substr(0, rhs.size()) == rhs);
113 typedef BinaryStringProvider<BinarySTARTSWITHCalculationFunction>
120 static constexpr
auto name =
"CONCAT";
125 return RJValue((lhs + rhs).c_str(), alloc);
135 static constexpr
auto name =
"FINDSTR";
140 return RJValue((int64_t)lhs.find(rhs));
#define CREATE_FACTORY(FCLASS)
Definition: IValueProvider.h:20
rapidjson::MemoryPoolAllocator< RJBaseAlloc > RJMemoryPoolAlloc
Definition: RJFwd.h:26
rapidjson::GenericValue< RJChar, RJMemoryPoolAlloc > RJValue
Definition: RJFwd.h:29
Definition: RapidJsonDocument.h:22
Definition: BinaryStringProvider.h:27
bool isConst() const override
Definition: BinaryStringProvider.h:49
const RJValue * getValue(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const override
Definition: BinaryStringProvider.h:67
joda::query::IValueType getReturnType() const override
Definition: BinaryStringProvider.h:37
std::unique_ptr< IValueProvider > duplicate() const override
Definition: BinaryStringProvider.h:45
void checkAllParamTypes()
Definition: BinaryStringProvider.h:76
RJValue getAtomValue(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const override
Definition: BinaryStringProvider.h:57
std::string getName() const override
Definition: BinaryStringProvider.h:41
BinaryStringProvider(std::vector< std::unique_ptr< IValueProvider >> &¶meters)
Definition: BinaryStringProvider.h:29
std::string toString() const override
Definition: BinaryStringProvider.h:43
Definition: IValueProvider.h:143
std::vector< std::unique_ptr< IValueProvider > > params
Definition: IValueProvider.h:373
void checkParamSize(unsigned int expected)
Definition: IValueProvider.cpp:112
virtual bool isAtom() const
Definition: IValueProvider.h:215
std::vector< std::unique_ptr< IValueProvider > > duplicateParameters() const
Definition: IValueProvider.cpp:104
bool getParamString(std::string &ret, const std::unique_ptr< IValueProvider > &val, const RapidJsonDocument &json) const
Definition: IValueProvider.h:319
void checkParamType(unsigned int i, IValueType expected)
Definition: IValueProvider.cpp:125
virtual std::string toString() const
Definition: IValueProvider.cpp:99
Definition: AttributeStatAggregator.h:12
BinaryStringProvider< BinarySCONTAINSCalculationFunction > SCONTAINSProvider
Definition: BinaryStringProvider.h:97
BinaryStringProvider< BinaryFINDSTRCalculationFunction > FINDSTRProvider
Definition: BinaryStringProvider.h:144
BinaryStringProvider< BinaryConcatCalculationFunction > ConcatProvider
Definition: BinaryStringProvider.h:129
IValueType
Definition: IValueProvider.h:33
@ IV_Number
Definition: IValueProvider.h:35
@ IV_Bool
Definition: IValueProvider.h:36
@ IV_String
Definition: IValueProvider.h:34
BinaryStringProvider< BinarySTARTSWITHCalculationFunction > STARTSWITHProvider
Definition: BinaryStringProvider.h:114
Definition: BinaryStringProvider.h:119
static constexpr auto name
Definition: BinaryStringProvider.h:120
static RJValue calculate(std::string &&lhs, std::string &&rhs, RJMemoryPoolAlloc &alloc)
Definition: BinaryStringProvider.h:123
static constexpr joda::query::IValueType retType
Definition: BinaryStringProvider.h:121
Definition: BinaryStringProvider.h:134
static RJValue calculate(std::string &&lhs, std::string &&rhs, RJMemoryPoolAlloc &alloc)
Definition: BinaryStringProvider.h:138
static constexpr auto name
Definition: BinaryStringProvider.h:135
static constexpr joda::query::IValueType retType
Definition: BinaryStringProvider.h:136
Definition: BinaryStringProvider.h:86
static RJValue calculate(std::string &&lhs, std::string &&rhs, RJMemoryPoolAlloc &alloc)
Definition: BinaryStringProvider.h:90
static constexpr joda::query::IValueType retType
Definition: BinaryStringProvider.h:88
static constexpr auto name
Definition: BinaryStringProvider.h:87
Definition: BinaryStringProvider.h:102
static constexpr auto name
Definition: BinaryStringProvider.h:103
static RJValue calculate(std::string &&lhs, std::string &&rhs, RJMemoryPoolAlloc &alloc)
Definition: BinaryStringProvider.h:106
static constexpr joda::query::IValueType retType
Definition: BinaryStringProvider.h:104