27 #include "../../../core/translator/Translator.h" 28 #include "../../../fe/BBOXOp.h" 29 #include "../../../fe/BinaryComparisonOp.h" 30 #include "../../../fe/BinaryLogicOp.h" 31 #include "../../../fe/BinarySpatialOp.h" 32 #include "../../../fe/DistanceBuffer.h" 33 #include "../../../fe/Globals.h" 34 #include "../../../fe/Literal.h" 35 #include "../../../fe/PropertyIsBetween.h" 36 #include "../../../fe/PropertyIsLike.h" 37 #include "../../../fe/PropertyIsNull.h" 38 #include "../../../fe/PropertyName.h" 39 #include "../../../fe/UnaryLogicOp.h" 40 #include "../../../xml/AbstractWriter.h" 41 #include "../../../xml/Reader.h" 42 #include "../../Exception.h" 50 #include <boost/format.hpp> 91 std::string name =
"ogc:";
105 AbstractOpFnctIdxType::const_iterator it =
m_fncts.find(opName);
108 throw Exception((boost::format(
TE_TR(
"Could not find a reader for the following operator type: %1%.")) % opName).str());
110 assert(it->second.second);
112 return it->second.first(
m_names.find(opName)->second, reader);
119 AbstractOpFnctIdxType::const_iterator it =
m_fncts.find(op->
getName());
122 throw Exception((boost::format(
TE_TR(
"Could not find a writer for the following operator type: %1%.")) % op->
getName()).str());
124 assert(it->second.second);
126 return it->second.second(op, writer);
249 std::string wildCard = reader.
getAttr(
"wildCard");
250 assert(!wildCard.empty());
251 op->setWildCard(wildCard);
253 std::string singleChar = reader.
getAttr(
"singleChar");
254 assert(!singleChar.empty());
255 op->setSingleChar(singleChar);
257 std::string escapeChar = reader.
getAttr(
"escapeChar");
258 assert(!escapeChar.empty());
259 op->setEscapeChar(escapeChar);
414 if(binaryOp ==
nullptr)
430 if(between ==
nullptr)
455 assert(!wildCard.empty());
458 assert(!singleChar.empty());
461 assert(!escapeChar.empty());
478 if(isNull ==
nullptr)
492 if(binaryLogicOp ==
nullptr)
497 assert(binaryLogicOp->
size() >= 2);
499 for(std::size_t i = 0; i < binaryLogicOp->
size(); ++i)
509 if(unaryLogicOp ==
nullptr)
523 if(binarySpatialOp ==
nullptr)
void BinaryLogicOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
static const char * sm_propertyIsLessThan
static const char * sm_touches
void UnaryLogicOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
const char * getName() const
It returns the operator name.
te::fe::AbstractOp * DistanceBufferReader(const char *opName, te::xml::Reader &reader)
static const char * sm_dWithin
PropertyName * getPropertyName() const
It returns the property name.
Distance buffer operator.
static const char * sm_contains
This class models a XML reader object.
void write(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer) const
boost::function< te::fe::AbstractOp *(const char *opName, te::xml::Reader &)> AbstractOpReadFnctType
te::fe::AbstractOp * BinaryLogicOpReader(const char *opName, te::xml::Reader &reader)
virtual void writeStartElement(const std::string &qName)=0
virtual bool hasAttrs() const =0
It tells if the element has attributes in the case of an element node.
static const char * sm_propertyIsGreaterThanOrEqualTo
static const char * sm_propertyIsGreaterThan
static const char * sm_crosses
Base exception class for plugin module.
static const char * sm_or
boost::function< void(const te::fe::AbstractOp *, te::xml::AbstractWriter &)> AbstractOpWriteFnctType
A convenient and more compact way of encoding the very common bounding box constraint based on an env...
PropertyName * getPropertyName() const
It returns the property name.
const std::string & getWildCard() const
It returns the wild character.
static const char * sm_intersects
A class for binary spatial operators.
te::fe::AbstractOp * BetweenReader(const char *opName, te::xml::Reader &reader)
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
static const char * sm_disjoint
The PropertyIsBetween element is defined as a compact way of encoding a range check.
static const char * sm_within
This class models a XML writer object.
#define TE_TR(message)
It marks a string in order to get translated.
PropertyName * getProperty() const
It returns the property name.
std::size_t size() const
It returns the number of operands.
static const char * sm_propertyIsEqualTo
A logical operator that can be used to combine one conditional expressions.
The PropertyIsNull class encodes an operator that checks to see if the value of its content is NULL...
AbstractOpFnctIdxType m_fncts
Literal * getLiteral() const
It returns the literal value.
static const char * sm_propertyIsLike
const std::string & getSingleChar() const
It returns the single wild character.
te::fe::AbstractOp * UnaryLogicOpReader(const char *opName, te::xml::Reader &reader)
void BinarySpatialOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
Expression * getUpperBoundary() const
It returns the upper boundary expression.
static const char * sm_propertyIsNotEqualTo
virtual std::string getAttr(const std::string &name) const =0
It returns the attribute value in the case of an element node with valid attributes.
It is intended to encode a character string comparison operator with pattern matching.
std::map< std::string, const char * > m_names
Auxiliary map of string to te::fe::Global names pointers.
static T & getInstance()
It returns a reference to the singleton instance.
PropertyName * getProperty() const
It returns the property name.
static const char * sm_beyond
AbstractOp * getOp(std::size_t i) const
It returns a specified operand.
void BetweenWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
Expression * getSecond() const
It returns the second operand.
const std::string & getEscapeChar() const
It returns the escape character.
te::fe::AbstractOp * NullReader(const char *opName, te::xml::Reader &reader)
std::string GetQualifiedName(const te::fe::AbstractOp *op)
AbstractOp * getOp() const
It returns the operand.
void BBOXWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
std::pair< AbstractOpReadFnctType, AbstractOpWriteFnctType > AbstractOpFnctSerializeType
static const char * sm_propertyIsNull
An abstract interface for operators.
Auxiliary classes and functions to serialize filter operations from a XML document.
PropertyName * getProperty() const
It returns the property name.
A class for binary comparison operators.
static const char * sm_and
te::fe::AbstractOp * BinaryComparsionOpReader(const char *opName, te::xml::Reader &reader)
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
te::fe::AbstractOp * LikeReader(const char *opName, te::xml::Reader &reader)
static const char * sm_equals
virtual void writeEndElement(const std::string &qName)=0
A logical operator can be used to combine two or more conditional expressions.
void LikeWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
virtual NodeType getNodeType() const =0
It return the type of node read.
void BinaryComparsionOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
void reg(const std::string &opName, const AbstractOpFnctSerializeType &fncts)
static const char * sm_overlaps
Auxiliary classes and functions to serialize filter expressions from a XML document.
static const char * sm_not
Expression * getFirst() const
It returns the first operand.
te::fe::AbstractOp * BinarySpatialOpReader(const char *opName, te::xml::Reader &reader)
void NullWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
static const char * sm_propertyIsBetween
static const char * sm_bbox
virtual bool next()=0
It gets the next event to be read.
Expression * getLowerBoundary() const
It returns the lower boundary expression.
void DistanceBufferOpWriter(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer)
static const char * sm_propertyIsLessThanOrEqualTo
te::fe::AbstractOp * read(te::xml::Reader &reader) const
Expression * getExpression() const
It returns the between expression.
te::fe::AbstractOp * BBOXReader(const char *opName, te::xml::Reader &reader)