X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_cql_to_rpn.cpp;h=996af5851152c7559f7ccb77debef16129d5a4ad;hb=4f5fe9b621891d0d4eabbd7dbcba65f96f11f528;hp=fe54450a17ac5872cabf735b75c31e6a7fb482ad;hpb=637a685d61a9ff0e3f398a59da426979815c4d68;p=metaproxy-moved-to-github.git diff --git a/src/filter_cql_to_rpn.cpp b/src/filter_cql_to_rpn.cpp index fe54450..996af58 100644 --- a/src/filter_cql_to_rpn.cpp +++ b/src/filter_cql_to_rpn.cpp @@ -1,7 +1,5 @@ -/* $Id: filter_cql_to_rpn.cpp,v 1.7 2007-05-09 21:23:09 adam Exp $ - Copyright (c) 2005-2007, Index Data. - -This file is part of Metaproxy. +/* This file is part of Metaproxy. + Copyright (C) 2005-2013 Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -14,21 +12,15 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Metaproxy; see the file LICENSE. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - */ -/* $Id: filter_cql_to_rpn.cpp,v 1.7 2007-05-09 21:23:09 adam Exp $ - Copyright (c) 2005-2007, Index Data. - - See the LICENSE file for details - */ +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "config.hpp" -#include "util.hpp" +#include -#include "filter.hpp" -#include "package.hpp" +#include +#include #include "filter_cql_to_rpn.hpp" @@ -59,7 +51,7 @@ namespace metaproxy_1 { // define Pimpl wrapper forwarding to Impl - + yf::CQLtoRPN::CQLtoRPN() : m_p(new Impl) { } @@ -68,7 +60,8 @@ yf::CQLtoRPN::~CQLtoRPN() { // must have a destructor because of boost::scoped_ptr } -void yf::CQLtoRPN::configure(const xmlNode *xmlnode) +void yf::CQLtoRPN::configure(const xmlNode *xmlnode, bool test_only, + const char *path) { m_p->configure(xmlnode); } @@ -86,7 +79,7 @@ yf::CQLtoRPN::Impl::Impl() } yf::CQLtoRPN::Impl::~Impl() -{ +{ } void yf::CQLtoRPN::Impl::configure(const xmlNode *xmlnode) @@ -97,7 +90,7 @@ void yf::CQLtoRPN::Impl::configure(const xmlNode *xmlnode) */ - + std::string fname; for (xmlnode = xmlnode->children; xmlnode; xmlnode = xmlnode->next) { @@ -118,7 +111,7 @@ void yf::CQLtoRPN::Impl::configure(const xmlNode *xmlnode) } else { - throw mp::filter::FilterException("Bad element " + throw mp::filter::FilterException("Bad element " + std::string((const char *) xmlnode->name)); } @@ -153,17 +146,17 @@ void yf::CQLtoRPN::Impl::process(mp::Package &package) char *addinfo = 0; Z_RPNQuery *rpnquery = 0; mp::odr odr; - + int r = m_cql2rpn.query_transform(sr->query->u.type_104->u.cql, &rpnquery, odr, &addinfo); if (r == -3) { - Z_APDU *f_apdu = + Z_APDU *f_apdu = odr.create_searchResponse( - apdu_req, - YAZ_BIB1_TEMPORARY_SYSTEM_ERROR, - "Missing CQL to RPN configuration"); + apdu_req, + YAZ_BIB1_PERMANENT_SYSTEM_ERROR, + "cql_rpn: missing CQL to RPN configuration"); package.response() = f_apdu; return; } @@ -171,14 +164,14 @@ void yf::CQLtoRPN::Impl::process(mp::Package &package) { int error_code = yaz_diag_srw_to_bib1(r); - Z_APDU *f_apdu = + Z_APDU *f_apdu = odr.create_searchResponse(apdu_req, error_code, addinfo); package.response() = f_apdu; return; } else { // conversion OK - + sr->query->which = Z_Query_type_1; sr->query->u.type_1 = rpnquery; package.request() = gdu; @@ -195,7 +188,7 @@ static mp::filter::Base* filter_creator() } extern "C" { - struct metaproxy_1_filter_struct metaproxy_1_filter_cql_to_rpn = { + struct metaproxy_1_filter_struct metaproxy_1_filter_cql_rpn = { 0, "cql_rpn", filter_creator @@ -205,8 +198,9 @@ extern "C" { /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil - * c-file-style: "stroustrup" * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +