Loading...
Searching...
No Matches
Like.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/dataaccess/query/Like.h
22
23 \brief It is intended to encode a character string comparison operator with pattern matching.
24*/
25
26#ifndef __TERRALIB_DATAACCESS_INTERNAL_LIKE_H
27#define __TERRALIB_DATAACCESS_INTERNAL_LIKE_H
28
29// TerraLib
30#include "Function.h"
31
32namespace te
33{
34 namespace da
35 {
36 /*!
37 \class Like
38
39 \brief It is intended to encode a character string comparison operator with pattern matching.
40
41 \sa Function
42 */
44 {
45 public:
46
48
49 /*!
50 \brief Constructor.
51
52 \param str The operator will take the expression ownership.
53 */
55 const std::string& pattern,
56 const std::string& wildCard = "%",
57 const std::string& singleChar = "_",
58 const std::string& escapeChar = "\\");
59
60 /*! \brief Constructor. */
61 Like(const Expression& str,
62 const std::string& pattern,
63 const std::string& wildCard = "%",
64 const std::string& singleChar = "_",
65 const std::string& escapeChar = "\\");
66
67 /*! \brief Destructor. */
69
70 /*! \brief Copy constructor. */
71 Like(const Like& rhs);
72
73 /*! Assignment operator. */
74 Like& operator=(const Like& rhs);
75
76 /*! \brief It creates a new copy of this expression. */
77 Expression* clone() const;
78
79 /*!
80 \brief It returns the string expression to be compared with the like operator.
81
82 \return The string expression to be compared with the like operator.
83 */
85
86 /*!
87 \brief It sets the string expression to be compared with the like operator.
88
89 \param str The string expression to be compared with the like operator.
90 */
92
93 /*!
94 \brief It returns the pattern used in the comparison.
95
96 \return The pattern used in the comparison.
97 */
99
100 /*!
101 \brief It sets the pattern to be used in the comparison.
102
103 \param p The pattern to be used in the comparison.
104 */
105 void setPattern(const std::string& p);
106
107 /*!
108 \brief It sets the wild character.
109
110 \param w The wild character.
111 */
112 void setWildCard(const std::string& w);
113
114 /*!
115 \brief It returns the wild character.
116
117 \return The wild character.
118 */
119 const std::string& getWildCard() const;
120
121 /*!
122 \brief It sets the wild single character.
123
124 \param s The wild single character.
125 */
126 void setSingleChar(const std::string& s);
127
128 /*!
129 \brief It returns the single wild character.
130
131 \return The single wild character.
132 */
133 const std::string& getSingleChar() const;
134
135 /*!
136 \brief It sets the escape character.
137
138 \param e The escape character.
139 */
140 void setEscapeChar(const std::string& e);
141
142 /*!
143 \brief It returns the escape character.
144
145 \return The escape character.
146 */
147 const std::string& getEscapeChar() const;
148
149 private:
150
151 std::string m_wildCard; //!< The wild card character matches zero or more characters.
152 std::string m_singleChar; //!< The single char character matches exactly one character.
153 std::string m_escapeChar; //!< The escape char character is used to escape the meaning of the wild card, single char and escape char itself.
154 };
155
156 } // end namespace da
157} // end namespace te
158
159#endif // __TERRALIB_DATAACCESS_INTERNAL_LIKE_H
160
#define TE_DEFINE_VISITABLE
This is an abstract class that models a query expression.
Definition Expression.h:48
A class that models a Function expression.
Definition Function.h:48
It is intended to encode a character string comparison operator with pattern matching.
Definition Like.h:44
TE_DEFINE_VISITABLE Like(Expression *str, const std::string &pattern, const std::string &wildCard="%", const std::string &singleChar="_", const std::string &escapeChar="\\")
Constructor.
const std::string & getEscapeChar() const
It returns the escape character.
Like & operator=(const Like &rhs)
std::string m_escapeChar
The escape char character is used to escape the meaning of the wild card, single char and escape char...
Definition Like.h:153
te::da::LiteralString * getPattern() const
It returns the pattern used in the comparison.
std::string m_singleChar
The single char character matches exactly one character.
Definition Like.h:152
Like(const Like &rhs)
Copy constructor.
~Like()
Destructor.
void setPattern(const std::string &p)
It sets the pattern to be used in the comparison.
std::string m_wildCard
The wild card character matches zero or more characters.
Definition Like.h:151
void setSingleChar(const std::string &s)
It sets the wild single character.
const std::string & getWildCard() const
It returns the wild character.
void setEscapeChar(const std::string &e)
It sets the escape character.
void setString(Expression *str)
It sets the string expression to be compared with the like operator.
Like(const Expression &str, const std::string &pattern, const std::string &wildCard="%", const std::string &singleChar="_", const std::string &escapeChar="\\")
Constructor.
void setWildCard(const std::string &w)
It sets the wild character.
Expression * getString() const
It returns the string expression to be compared with the like operator.
const std::string & getSingleChar() const
It returns the single wild character.
Expression * clone() const
It creates a new copy of this expression.
This class models a string Literal value.
TerraLib.
Symbology Encoding functions.
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:97