It is intended to encode a character string comparison operator with pattern matching. More...
#include <Like.h>
Public Types | |
| typedef void | ReturnType |
| typedef QueryVisitor | VisitorType |
Public Member Functions | |
| virtual ReturnType | accept (VisitorType &guest) const =0 |
| It call the visit method from the guest object. More... | |
| void | add (Expression *arg) |
| It adds the argument to the function list of arguments. More... | |
| Expression * | clone () const |
| It creates a new copy of this expression. More... | |
| Expression * | getArg (std::size_t i) const |
| It returns the i-th function argument. More... | |
| const std::string & | getEscapeChar () const |
| It returns the escape character. More... | |
| const std::string & | getName () const |
| It returns the function name. More... | |
| std::size_t | getNumArgs () const |
| It returns the number of arguments informed to the function. More... | |
| const std::string & | getPattern () |
| It returns the pattern used in the comparison. More... | |
| const std::string & | getSingleChar () const |
| It returns the single wild character. More... | |
| Expression * | getString () const |
| It returns the string expression to be compared with the like operator. More... | |
| const std::string & | getWildCard () const |
| It returns the wild character. More... | |
| TE_DEFINE_VISITABLE | Like (Expression *str, const std::string &pattern, const std::string &wildCard="%", const std::string &singleChar="_", const std::string &escapeChar="\\") |
| Constructor. More... | |
| Like (const Expression &str, const std::string &pattern, const std::string &wildCard="%", const std::string &singleChar="_", const std::string &escapeChar="\\") | |
| Constructor. More... | |
| Like (const Like &rhs) | |
| Copy constructor. More... | |
| Like & | operator= (const Like &rhs) |
| Expression * | operator[] (std::size_t i) const |
| It returns the i-th function argument. More... | |
| void | setEscapeChar (const std::string &e) |
| It sets the escape character. More... | |
| void | setPattern (const std::string &p) |
| It sets the pattern to be used in the comparison. More... | |
| void | setSingleChar (const std::string &s) |
| It sets the wild single character. More... | |
| void | setString (Expression *str) |
| It sets the string expression to be compared with the like operator. More... | |
| void | setWildCard (const std::string &w) |
| It sets the wild character. More... | |
| ~Like () | |
| Destructor. More... | |
Protected Attributes | |
| std::vector< Expression * > | m_args |
| The list of arguments. More... | |
| std::string | m_name |
| The function name. May be an operator symbol or just a regular name like ST_Intersects. More... | |
Private Attributes | |
| std::string | m_escapeChar |
| The escape char character is used to escape the meaning of the wild card, single char and escape char itself. More... | |
| std::string | m_pattern |
| The literal string pattern. More... | |
| std::string | m_singleChar |
| The single char character matches exactly one character. More... | |
| std::string | m_wildCard |
| The wild card character matches zero or more characters. More... | |
It is intended to encode a character string comparison operator with pattern matching.
|
inherited |
Definition at line 58 of file BaseVisitable.h.
|
inherited |
Definition at line 57 of file BaseVisitable.h.
| te::da::Like::Like | ( | Expression * | str, |
| const std::string & | pattern, | ||
| const std::string & | wildCard = "%", |
||
| const std::string & | singleChar = "_", |
||
| const std::string & | escapeChar = "\\" |
||
| ) |
Constructor.
| str | The operator will take the expression ownership. |
Definition at line 35 of file Like.cpp.
References te::da::Function::m_args.
| te::da::Like::Like | ( | const Expression & | str, |
| const std::string & | pattern, | ||
| const std::string & | wildCard = "%", |
||
| const std::string & | singleChar = "_", |
||
| const std::string & | escapeChar = "\\" |
||
| ) |
Constructor.
Definition at line 49 of file Like.cpp.
References te::da::Expression::clone(), Like(), te::da::Function::m_args, and ~Like().
|
default |
Destructor.
Referenced by Like().
|
default |
Copy constructor.
|
pure virtualinherited |
It call the visit method from the guest object.
| guest | The guest or visitor. |
|
inherited |
It adds the argument to the function list of arguments.
| arg | The argument to be added. |
Definition at line 79 of file dataaccess/query/Function.cpp.
References te::da::Function::m_args.
Referenced by te::map::QueryEncoder::getExpression(), te::da::ObjectIdSet::getExpressionByInClause(), te::da::ObjectIdSet::setExpressionByInClause(), and te::map::QueryEncoder::visit().
|
virtual |
It creates a new copy of this expression.
Reimplemented from te::da::Function.
Definition at line 83 of file Like.cpp.
References Like().
|
inherited |
It returns the i-th function argument.
| i | The argument position. |
Definition at line 67 of file dataaccess/query/Function.cpp.
References te::da::Function::m_args.
Referenced by te::qt::widgets::DataSetTableView::changeColumnData(), te::da::SpatialRestrictionVisitor::getGeometryRestriction(), te::da::SpatialRestrictionVisitor::getPropertyName(), te::da::SpatialRestrictionVisitor::isFromEnvelope(), and te::serialize::xml::Save().
| const std::string & te::da::Like::getEscapeChar | ( | ) | const |
It returns the escape character.
Definition at line 134 of file Like.cpp.
References m_escapeChar.
|
inlineinherited |
It returns the function name.
Definition at line 79 of file dataaccess/query/Function.h.
Referenced by te::da::AttributeRestrictionVisitor::getOperator(), te::da::SpatialRestrictionVisitor::getSpatialRelation(), te::da::AttributeRestrictionVisitor::isAttributeRestrictionFunction(), te::da::SpatialRestrictionVisitor::isSpatialRestrictionFunction(), te::serialize::xml::Save(), te::da::SpatialQueryProcessor::supportsSpatialTopologicOperatos(), te::ogr::SQLVisitor::visit(), te::gpkg::SQLVisitor::visit(), te::da::SQLVisitor::visit(), and te::ado::SQLVisitor::visit().
|
inherited |
It returns the number of arguments informed to the function.
Definition at line 62 of file dataaccess/query/Function.cpp.
References te::da::Function::m_args.
Referenced by te::qt::widgets::DataSetTableView::changeColumnData(), te::da::ObjectIdSet::getExpressionByInClause(), te::da::SpatialRestrictionVisitor::getGeometryRestriction(), te::da::SpatialRestrictionVisitor::getPropertyName(), te::da::SpatialRestrictionVisitor::isFromEnvelope(), te::serialize::xml::Save(), te::da::ObjectIdSet::setExpressionByInClause(), te::da::FunctionNoArgsEncoder::toSQL(), te::da::UnaryOpEncoder::toSQL(), te::da::BinaryOpEncoder::toSQL(), te::da::FunctionEncoder::toSQL(), te::da::TemplateEncoder::toSQL(), te::ogr::SQLVisitor::visit(), te::gpkg::SQLVisitor::visit(), te::da::AttributeRestrictionVisitor::visit(), te::da::SpatialRestrictionVisitor::visit(), and te::da::SQLVisitor::visit().
| const std::string & te::da::Like::getPattern | ( | ) |
| const std::string & te::da::Like::getSingleChar | ( | ) | const |
It returns the single wild character.
Definition at line 124 of file Like.cpp.
References m_singleChar.
| te::da::Expression * te::da::Like::getString | ( | ) | const |
It returns the string expression to be compared with the like operator.
Definition at line 88 of file Like.cpp.
References te::da::Function::m_args.
| const std::string & te::da::Like::getWildCard | ( | ) | const |
It returns the wild character.
Definition at line 114 of file Like.cpp.
References m_wildCard.
| te::da::Like & te::da::Like::operator= | ( | const Like & | rhs | ) |
Assignment operator.
Definition at line 69 of file Like.cpp.
References m_escapeChar, m_pattern, m_singleChar, m_wildCard, and te::da::Function::operator=().
|
inherited |
It returns the i-th function argument.
| i | The argument position. |
Definition at line 73 of file dataaccess/query/Function.cpp.
References te::da::Function::m_args.
| void te::da::Like::setEscapeChar | ( | const std::string & | e | ) |
It sets the escape character.
| e | The escape character. |
Definition at line 129 of file Like.cpp.
References m_escapeChar.
| void te::da::Like::setPattern | ( | const std::string & | p | ) |
| void te::da::Like::setSingleChar | ( | const std::string & | s | ) |
It sets the wild single character.
| s | The wild single character. |
Definition at line 119 of file Like.cpp.
References m_singleChar.
| void te::da::Like::setString | ( | Expression * | str | ) |
It sets the string expression to be compared with the like operator.
| str | The string expression to be compared with the like operator. |
Definition at line 93 of file Like.cpp.
References te::da::Function::m_args.
| void te::da::Like::setWildCard | ( | const std::string & | w | ) |
It sets the wild character.
| w | The wild character. |
Definition at line 109 of file Like.cpp.
References m_wildCard.
|
protectedinherited |
The list of arguments.
Definition at line 118 of file dataaccess/query/Function.h.
Referenced by te::da::Function::add(), te::da::BinaryFunction::BinaryFunction(), te::da::Function::Function(), te::da::GeometryType::GeometryType(), te::da::Function::getArg(), te::da::UnaryFunction::getArgument(), te::da::BinaryFunction::getFirst(), te::da::Substring::getLength(), te::da::Function::getNumArgs(), te::da::BinaryFunction::getSecond(), te::da::Substring::getStartPosition(), te::da::Substring::getString(), getString(), Like(), te::da::Function::operator=(), te::da::Function::operator[](), te::da::UnaryFunction::setArgument(), te::da::BinaryFunction::setFirst(), te::da::Substring::setLength(), te::da::BinaryFunction::setSecond(), te::da::Substring::setStartPosition(), te::da::Substring::setString(), setString(), te::da::ST_Area::ST_Area(), te::da::ST_Buffer::ST_Buffer(), te::da::ST_Centroid::ST_Centroid(), te::da::ST_ConvexHull::ST_ConvexHull(), te::da::ST_DistanceBuffer::ST_DistanceBuffer(), te::da::ST_Envelope::ST_Envelope(), te::da::ST_Extent::ST_Extent(), te::da::ST_IsClosed::ST_IsClosed(), te::da::ST_IsEmpty::ST_IsEmpty(), te::da::ST_IsValid::ST_IsValid(), te::da::ST_Length::ST_Length(), te::da::ST_MakeValid::ST_MakeValid(), te::da::ST_Multi::ST_Multi(), te::da::ST_NPoints::ST_NPoints(), te::da::ST_Perimeter::ST_Perimeter(), te::da::ST_Relate::ST_Relate(), te::da::ST_StartPoint::ST_StartPoint(), te::da::ST_Transform::ST_Transform(), te::da::Substring::Substring(), te::da::UnaryFunction::UnaryFunction(), and te::da::Function::~Function().
|
private |
The escape char character is used to escape the meaning of the wild card, single char and escape char itself.
Definition at line 154 of file Like.h.
Referenced by getEscapeChar(), operator=(), and setEscapeChar().
|
protectedinherited |
The function name. May be an operator symbol or just a regular name like ST_Intersects.
Definition at line 117 of file dataaccess/query/Function.h.
Referenced by te::da::Function::operator=().
|
private |
The literal string pattern.
Definition at line 151 of file Like.h.
Referenced by getPattern(), operator=(), and setPattern().
|
private |
The single char character matches exactly one character.
Definition at line 153 of file Like.h.
Referenced by getSingleChar(), operator=(), and setSingleChar().
|
private |
The wild card character matches zero or more characters.
Definition at line 152 of file Like.h.
Referenced by getWildCard(), operator=(), and setWildCard().