te::da::Like Class Referenceabstract

It is intended to encode a character string comparison operator with pattern matching. More...

#include <Like.h>

Inheritance diagram for te::da::Like:
te::da::Function te::da::Expression te::common::BaseVisitable< QueryVisitor >

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...
 
Expressionclone () const
 It creates a new copy of this expression. More...
 
ExpressiongetArg (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...
 
ExpressiongetString () 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...
 
Likeoperator= (const Like &rhs)
 
Expressionoperator[] (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...
 

Detailed Description

It is intended to encode a character string comparison operator with pattern matching.

See also
Function

Definition at line 43 of file Like.h.

Member Typedef Documentation

typedef void te::common::BaseVisitable< QueryVisitor , void >::ReturnType
inherited

Definition at line 58 of file BaseVisitable.h.

Definition at line 57 of file BaseVisitable.h.

Constructor & Destructor Documentation

te::da::Like::Like ( Expression str,
const std::string &  pattern,
const std::string &  wildCard = "%",
const std::string &  singleChar = "_",
const std::string &  escapeChar = "\\" 
)

Constructor.

Parameters
strThe operator will take the expression ownership.

Definition at line 35 of file Like.cpp.

References te::da::Function::m_args.

Referenced by clone(), and Like().

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().

te::da::Like::~Like ( )
default

Destructor.

Referenced by Like().

te::da::Like::Like ( const Like rhs)
default

Copy constructor.

Member Function Documentation

virtual ReturnType te::common::BaseVisitable< QueryVisitor , void >::accept ( VisitorType guest) const
pure virtualinherited

It call the visit method from the guest object.

Parameters
guestThe guest or visitor.
Returns
Any valid value define by the template type R.
void te::da::Function::add ( Expression arg)
inherited

It adds the argument to the function list of arguments.

Parameters
argThe argument to be added.
Note
The Function will take the ownership of the given argument.

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().

te::da::Expression * te::da::Like::clone ( ) const
virtual

It creates a new copy of this expression.

Reimplemented from te::da::Function.

Definition at line 83 of file Like.cpp.

References Like().

te::da::Expression * te::da::Function::getArg ( std::size_t  i) const
inherited
const std::string & te::da::Like::getEscapeChar ( ) const

It returns the escape character.

Returns
The escape character.

Definition at line 134 of file Like.cpp.

References m_escapeChar.

const std::string & te::da::Like::getPattern ( )

It returns the pattern used in the comparison.

Returns
The pattern used in the comparison.

Definition at line 99 of file Like.cpp.

References m_pattern.

const std::string & te::da::Like::getSingleChar ( ) const

It returns the single wild character.

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.

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.

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=().

te::da::Expression * te::da::Function::operator[] ( std::size_t  i) const
inherited

It returns the i-th function argument.

Parameters
iThe argument position.
Returns
The it-th function argument.

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.

Parameters
eThe escape character.

Definition at line 129 of file Like.cpp.

References m_escapeChar.

void te::da::Like::setPattern ( const std::string &  p)

It sets the pattern to be used in the comparison.

Parameters
pThe pattern to be used in the comparison.

Definition at line 104 of file Like.cpp.

References m_pattern, and p.

void te::da::Like::setSingleChar ( const std::string &  s)

It sets the wild single character.

Parameters
sThe 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.

Parameters
strThe 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.

Parameters
wThe wild character.

Definition at line 109 of file Like.cpp.

References m_wildCard.

Member Data Documentation

std::vector<Expression*> te::da::Function::m_args
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().

std::string te::da::Like::m_escapeChar
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().

std::string te::da::Function::m_name
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=().

std::string te::da::Like::m_pattern
private

The literal string pattern.

Definition at line 151 of file Like.h.

Referenced by getPattern(), operator=(), and setPattern().

std::string te::da::Like::m_singleChar
private

The single char character matches exactly one character.

Definition at line 153 of file Like.h.

Referenced by getSingleChar(), operator=(), and setSingleChar().

std::string te::da::Like::m_wildCard
private

The wild card character matches zero or more characters.

Definition at line 152 of file Like.h.

Referenced by getWildCard(), operator=(), and setWildCard().


The documentation for this class was generated from the following files: