5 #ifndef JODA_UNARYSTRINGPROVIDER_H
6 #define JODA_UNARYSTRINGPROVIDER_H
29 std::vector<std::unique_ptr<IValueProvider>> &¶meters)
33 DCHECK(
isAtom()) <<
"Only atom ReturnTypes allowed";
40 std::string
getName()
const override {
return Calc::name; };
44 std::unique_ptr<IValueProvider>
duplicate()
const override {
50 for (
const auto ¶m :
params) {
51 c &= param->isConst();
60 return Calc::calculate(std::move(str), alloc);
65 DCHECK(!
isAtom()) <<
"Did not check for atom first";
73 for (
unsigned int i = 0; i <
params.size(); ++i) {
83 static constexpr
auto name =
"LEN";
97 static constexpr
auto name =
"UPPER";
101 transform(val.begin(), val.end(), val.begin(), ::toupper);
102 return RJValue(val.c_str(), alloc);
112 static constexpr
auto name =
"LOWER";
116 transform(val.begin(), val.end(), val.begin(), ::tolower);
117 return RJValue(val.c_str(), alloc);
127 static constexpr
auto name =
"LTRIM";
131 val.erase(val.begin(), std::find_if(val.begin(), val.end(), [](
int ch) {
132 return !std::isspace(ch);
134 return RJValue(val.c_str(), alloc);
144 static constexpr
auto name =
"RTRIM";
148 val.erase(std::find_if(val.rbegin(), val.rend(),
149 [](
int ch) { return !std::isspace(ch); })
152 return RJValue(val.c_str(), alloc);
#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: 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: UnaryStringProvider.h:26
RJValue getAtomValue(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const override
Definition: UnaryStringProvider.h:56
const RJValue * getValue(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) const override
Definition: UnaryStringProvider.h:63
void checkAllParamTypes()
Definition: UnaryStringProvider.h:72
std::string getName() const override
Definition: UnaryStringProvider.h:40
std::string toString() const override
Definition: UnaryStringProvider.h:42
UnaryStringProvider(std::vector< std::unique_ptr< IValueProvider >> &¶meters)
Definition: UnaryStringProvider.h:28
std::unique_ptr< IValueProvider > duplicate() const override
Definition: UnaryStringProvider.h:44
joda::query::IValueType getReturnType() const override
Definition: UnaryStringProvider.h:36
bool isConst() const override
Definition: UnaryStringProvider.h:48
Definition: AttributeStatAggregator.h:12
UnaryStringProvider< UnaryRtrimCalculationFunction > RtrimProvider
Definition: UnaryStringProvider.h:156
UnaryStringProvider< UnaryUpperCalculationFunction > UpperProvider
Definition: UnaryStringProvider.h:106
UnaryStringProvider< UnaryLenCalculationFunction > LenProvider
Definition: UnaryStringProvider.h:91
UnaryStringProvider< UnaryLowerCalculationFunction > LowerProvider
Definition: UnaryStringProvider.h:121
UnaryStringProvider< UnaryLtrimCalculationFunction > LtrimProvider
Definition: UnaryStringProvider.h:138
IValueType
Definition: IValueProvider.h:33
@ IV_Number
Definition: IValueProvider.h:35
@ IV_String
Definition: IValueProvider.h:34
Definition: UnaryStringProvider.h:82
static constexpr auto name
Definition: UnaryStringProvider.h:83
static RJValue calculate(std::string &&val, RJMemoryPoolAlloc &alloc)
Definition: UnaryStringProvider.h:86
static constexpr joda::query::IValueType retType
Definition: UnaryStringProvider.h:84
Definition: UnaryStringProvider.h:111
static constexpr auto name
Definition: UnaryStringProvider.h:112
static RJValue calculate(std::string &&val, RJMemoryPoolAlloc &alloc)
Definition: UnaryStringProvider.h:115
static constexpr joda::query::IValueType retType
Definition: UnaryStringProvider.h:113
Definition: UnaryStringProvider.h:126
static constexpr auto name
Definition: UnaryStringProvider.h:127
static RJValue calculate(std::string &&val, RJMemoryPoolAlloc &alloc)
Definition: UnaryStringProvider.h:130
static constexpr joda::query::IValueType retType
Definition: UnaryStringProvider.h:128
Definition: UnaryStringProvider.h:143
static RJValue calculate(std::string &&val, RJMemoryPoolAlloc &alloc)
Definition: UnaryStringProvider.h:147
static constexpr auto name
Definition: UnaryStringProvider.h:144
static constexpr joda::query::IValueType retType
Definition: UnaryStringProvider.h:145
Definition: UnaryStringProvider.h:96
static RJValue calculate(std::string &&val, RJMemoryPoolAlloc &alloc)
Definition: UnaryStringProvider.h:100
static constexpr joda::query::IValueType retType
Definition: UnaryStringProvider.h:98
static constexpr auto name
Definition: UnaryStringProvider.h:97