27 #include "../../common/Translator.h"
28 #include "../../fe/BinaryOperator.h"
29 #include "../../fe/Expression.h"
30 #include "../../fe/Globals.h"
31 #include "../../fe/Literal.h"
32 #include "../../fe/PropertyName.h"
33 #include "../../xml/Reader.h"
34 #include "../../xml/Writer.h"
35 #include "../Exception.h"
42 #include <boost/format.hpp>
63 ExpressionFnctIdxType::const_iterator it = m_fncts.find(name);
65 if(it == m_fncts.end())
66 throw Exception((boost::format(
TR_SERIALIZATION(
"Could not find a reader for the following expression type: %1%.")) % name).str());
70 return it->second(reader);
78 if(m_writer != &writer)
86 std::string name =
"ogc:";
89 m_writer->writeStartElement(name);
99 m_writer->writeEndElement(name);
109 m_writer->writeElement(
"ogc:Literal", visited.
getValue());
115 m_writer->writeElement(
"ogc:PropertyName", visited.
getName());
157 std::auto_ptr<te::fe::BinaryOperator> exp(op);
168 return exp.release();
188 exp->setValue(value);
195 return exp.release();
200 exp->setValue(value);
205 return exp.release();
224 return exp.release();
static const char * sm_sub
This class is used to encode the name of any property of an object.
void write(const te::fe::Expression *exp, te::xml::Writer &writer)
A function is a named procedure that performs a distinct computation.
void visit(const te::fe::BinaryOperator &visited)
static const char * sm_div
This class models a XML reader object.
Expression * getSecond() const
It returns the second operand.
virtual bool next()=0
It gets the next event to be read.
#define TR_SERIALIZATION(message)
It marks a string in order to get translated. This is a special mark used in the XML module of TerraL...
const std::string & getValue() const
It returns the literal value.
boost::function< te::fe::Expression *(te::xml::Reader &)> ExpressionReadFnctType
te::fe::Expression * read(te::xml::Reader &reader) const
ExpressionFnctIdxType m_fncts
This is an abstract class that models a Filter Encoding expression.
te::fe::Expression * PropertyNameReader(te::xml::Reader &reader)
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node.
This class can be used to represent literal values.
Expression * getFirst() const
It returns the first operand.
This is an abstract class that models a Filter Encoding expression.
static const char * sm_add
te::fe::Expression * BinaryOperatorReader(te::xml::Reader &reader)
const char * getName() const
It returns the operator name.
This class can be used to represent binary operation expressions.
static const char * sm_mul
void reg(const std::string &expName, const ExpressionReadFnctType &fnct)
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object.
static Expression & getInstance()
It returns a reference to the singleton instance.
virtual NodeType getNodeType() const =0
It return the type of node read.
te::fe::Expression * LiteralReader(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.
const std::string & getName() const
It returns the property name.
This class models a XML writer object.