JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
EqualizePredicate.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 11/13/17.
3 //
4 
5 #ifndef JODA_EQUALIZEPREDICATE_H
6 #define JODA_EQUALIZEPREDICATE_H
7 
8 #include "../../../../../values/include/joda/query/values/IValueProvider.h"
9 #include "Predicate.h"
10 
11 namespace joda::query {
16 class NotEqualizableException : public std::exception {
17  virtual const char *what() const throw() {
18  return "The given values are not comparable by '==' or '!='";
19  }
20 };
21 
26  public:
27  EqualizePredicate(std::unique_ptr<IValueProvider> &&lhs,
28  std::unique_ptr<IValueProvider> &&rhs, bool equal);
29  bool check(const RapidJsonDocument &val) override;
30  bool isCompatible(Predicate *other) override;
31  std::string getType() override;
32  void accept(class PredicateVisitor &v) override;
33  std::string toString();
34  std::vector<std::string> getAttributes() const;
35  std::unique_ptr<Predicate> duplicate();
36 
37  std::unique_ptr<IValueProvider> &getLhs();
38  std::unique_ptr<IValueProvider> &getRhs();
39  bool isEqual() const;
40 
41  protected:
42  std::unique_ptr<IValueProvider> lhs;
43  std::unique_ptr<IValueProvider> rhs;
44  bool equal = true;
45 };
46 } // namespace joda::query
47 
48 #endif // JODA_EQUALIZEPREDICATE_H
Definition: RapidJsonDocument.h:22
Definition: EqualizePredicate.h:25
bool check(const RapidJsonDocument &val) override
Definition: EqualizePredicate.cpp:8
std::unique_ptr< IValueProvider > rhs
Definition: EqualizePredicate.h:43
std::unique_ptr< Predicate > duplicate()
Definition: EqualizePredicate.cpp:50
bool equal
Definition: EqualizePredicate.h:44
std::vector< std::string > getAttributes() const
Definition: EqualizePredicate.cpp:43
std::unique_ptr< IValueProvider > & getLhs()
Definition: EqualizePredicate.cpp:55
EqualizePredicate(std::unique_ptr< IValueProvider > &&lhs, std::unique_ptr< IValueProvider > &&rhs, bool equal)
Definition: EqualizePredicate.cpp:26
std::unique_ptr< IValueProvider > lhs
Definition: EqualizePredicate.h:42
bool isEqual() const
Definition: EqualizePredicate.cpp:62
bool isCompatible(Predicate *other) override
Definition: EqualizePredicate.cpp:12
std::string getType() override
Definition: EqualizePredicate.cpp:17
std::string toString()
Definition: EqualizePredicate.cpp:34
void accept(class PredicateVisitor &v) override
Definition: EqualizePredicate.cpp:21
std::unique_ptr< IValueProvider > & getRhs()
Definition: EqualizePredicate.cpp:59
Definition: EqualizePredicate.h:16
Definition: PredicateVisitor.h:29
Definition: Predicate.h:20
Definition: AttributeStatAggregator.h:12