diff options
Diffstat (limited to 'project2/xslRows.cpp')
-rw-r--r-- | project2/xslRows.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/project2/xslRows.cpp b/project2/xslRows.cpp index 696edb9..aa53540 100644 --- a/project2/xslRows.cpp +++ b/project2/xslRows.cpp @@ -3,6 +3,7 @@ #include "xml.h" #include "exceptions.h" #include "xmlObjectLoader.h" +#include "genericVisitor.h" #include <boost/lexical_cast.hpp> #include <libxml/HTMLparser.h> #include <libxml/xpath.h> @@ -101,7 +102,7 @@ XslRows::getDocument(const Glib::ustring & url) const void XslRows::execute(const RowProcessor * rp) const { - xmlDocPtr doc = getDocument(url()); + xmlDocPtr doc = LexicalCall<Glib::ustring, xmlDocPtr>(boost::bind(&XslRows::getDocument, this, _1), url()); xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc); if (!xpathCtx) { throw XpathInitError(); @@ -109,7 +110,7 @@ XslRows::execute(const RowProcessor * rp) const BOOST_FOREACH(const Namespaces::value_type & ns, namespaces) { xmlXPathRegisterNs(xpathCtx, BAD_CAST ns.first.c_str(), BAD_CAST ns.second.c_str()); } - xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression(BAD_CAST fv->root().c_str(), xpathCtx); + xmlXPathObjectPtr xpathObj = LexicalCall<const xmlChar *, xmlXPathObjectPtr>(boost::bind(&xmlXPathEvalExpression, _1, xpathCtx), fv->root()); if (!xpathObj || !xpathObj->nodesetval) { xmlXPathFreeContext(xpathCtx); throw XpathEvalError(); @@ -120,14 +121,14 @@ XslRows::execute(const RowProcessor * rp) const xpathCtx->node = rowRoot; values.clear(); BOOST_FOREACH(const FilterView::XPaths::value_type & xp, fv->xpaths) { - xmlXPathObjectPtr xpathObjI = xmlXPathEvalExpression(BAD_CAST xp.second().c_str(), xpathCtx); + xmlXPathObjectPtr xpathObjI = LexicalCall<const xmlChar *, xmlXPathObjectPtr>(boost::bind(&xmlXPathEvalExpression, _1, xpathCtx), xp.second()); if (!xpathObjI) { xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); throw XpathEvalError(); } if (xpathObjI->floatval) { - values[xp.first] = boost::shared_ptr<const Glib::ustring>(new Glib::ustring(boost::lexical_cast<Glib::ustring>(xpathObjI->floatval))); + values[xp.first] = xpathObjI->floatval; } else if (xpathObjI->stringval) { values[xp.first] = boost::shared_ptr<const Glib::ustring>(new Glib::ustring((const char *)xpathObjI->stringval)); @@ -159,13 +160,13 @@ XslRows::FilterView::FilterView(const xmlpp::Element * p) : } } -const Glib::ustring & +VariableType XslRows::getCurrentValue(const Glib::ustring & id) const { - return *values.find(id)->second; + return values.find(id)->second; } -const Glib::ustring & +VariableType XslRows::getCurrentValue(unsigned int col) const { return getCurrentValue(getColumnName(col)); |