All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 R 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 R te::common::BaseVisitable< QueryVisitor , R >::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.

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(), and te::da::Function::m_args.

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

Destructor.

Definition at line 63 of file Like.cpp.

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

Copy constructor.

Definition at line 67 of file Like.cpp.

Member Function Documentation

virtual ReturnType te::common::BaseVisitable< QueryVisitor , R >::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 Function.cpp.

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 90 of file Like.cpp.

te::da::Expression * te::da::Function::getArg ( 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 67 of file Function.cpp.

Referenced by 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.

Returns
The escape character.

Definition at line 141 of file Like.cpp.

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 106 of file Like.cpp.

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

It returns the single wild character.

Returns
The single wild character.

Definition at line 131 of file Like.cpp.

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 95 of file Like.cpp.

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

It returns the wild character.

Returns
The wild character.

Definition at line 121 of file Like.cpp.

te::da::Like & te::da::Like::operator= ( const Like rhs)

Assignment operator.

Definition at line 76 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 Function.cpp.

void te::da::Like::setEscapeChar ( const std::string &  e)

It sets the escape character.

Parameters
eThe escape character.

Definition at line 136 of file Like.cpp.

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 111 of file Like.cpp.

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

It sets the wild single character.

Parameters
sThe wild single character.

Definition at line 126 of file Like.cpp.

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 100 of file Like.cpp.

void te::da::Like::setWildCard ( const std::string &  w)

It sets the wild character.

Parameters
wThe wild character.

Definition at line 116 of file Like.cpp.

Member Data Documentation

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

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

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

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


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