ComparisonOperators.cpp
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 ComparisonOperators.cpp
22 
23  \brief It is used to indicate what types of comparison operators are supported by a service.
24  */
25 
26 // TerraLib
27 #include "ComparisonOperators.h"
28 #include "Globals.h"
29 
30 // STL
31 #include <cassert>
32 
33 std::set<const char*, te::common::LessCmp<const char*> > te::fe::ComparisonOperators::sm_validComparisonOperators;
34 
36 
38 {
39 // we will not clear the vector items beacuse they are just reference to an internal list of operators.
40 }
41 
43 {
44  assert(c);
45  m_comparisonOperators.push_back(c);
46 }
47 
48 const char* te::fe::ComparisonOperators::operator[](size_t i) const
49 {
50  assert(i < m_comparisonOperators.size());
51  return m_comparisonOperators[i];
52 }
53 
55 {
56  assert(o);
57 
58  std::set<const char*, te::common::LessCmp<const char*> >::const_iterator it = sm_validComparisonOperators.find(o);
59 
60  if(it != sm_validComparisonOperators.end())
61  return *it;
62 
63  return nullptr;
64 }
65 
67 {
77 }
78 
80 {
82 }
83 
It is used to indicate what types of comparison operators are supported by a service.
static const char * sm_lessThan
static const char * sm_like
const char * operator[](size_t i) const
It returns a specified comparison operator.
void push_back(const char *c)
It adds the comparison operator to the supported list of operators.
static const char * sm_nullCheck
An static class with global definitions.
static void clearValidOperatorList()
It clears the valid comparison operator list.
ComparisonOperators()
It initializes a new ComparisonOperators.
static const char * sm_greaterThanEqualTo
static void loadValidOperatorList()
It loads the valid comparison operator list.
static const char * sm_between
static const char * findOperator(const char *o)
It checks if operator &#39;o&#39; is a valid operator. It returns a pointer to the found operator or NULL oth...
static const char * sm_lessThanEqualTo
static const char * sm_greaterThan
static std::set< const char *, te::common::LessCmp< const char * > > sm_validComparisonOperators
The list of valid comparison operators.
static const char * sm_equalTo
std::vector< const char * > m_comparisonOperators
Optional.
static const char * sm_notEqualTo