From: Adam Dickmeiss Date: Tue, 27 May 2014 13:54:23 +0000 (+0200) Subject: Add skeleton MP module X-Git-Tag: v0.1~13 X-Git-Url: http://git.indexdata.com/?p=mp-xquery-moved-to-github.git;a=commitdiff_plain;h=2f8add7d38665b398a719f1d485577db377be76b Add skeleton MP module --- diff --git a/src/Makefile b/src/Makefile index dc991bf..31d2ba1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,17 +1,28 @@ +ROOT=.. +ZORBA := $(ROOT)/../zorba/zorba-3.0/build/dist -O=tst.o +ifeq "${MP_CONFIG}" "" +MP_CONFIG := $(shell if test -x $(ROOT)/../metaproxy/metaproxy-config; then echo $(ROOT)/../metaproxy/metaproxy-config; else echo metaproxy-config; fi) +endif -ZORBA := ../../zorba/zorba-3.0/build/dist +MP_CFLAGS := $(shell $(MP_CONFIG) --cflags) +MP_LIBS := $(shell $(MP_CONFIG) --libs) +MP_SO := metaproxy_filter_xquery.so -CXXFLAGS=-I$(ZORBA)/include +ZORBA_LIBS := -L $(ZORBA)/lib -lzorba_simplestore +ZORBA_CFLAGS := -I$(ZORBA)/include $(MP_CFLAGS) +CXXFLAGS := $(ZORBA_CFLAGS) $(MP_CFLAGS) -fPIC -LIB=-L $(ZORBA)/lib -lzorba_simplestore +all: tst $(MP_SO) -tst: $(O) - $(CXX) $^ -o $@ $(LIB) +tst: tst.o + $(CXX) $^ -o $@ $(ZORBA_LIBS) + +$(MP_SO): metaproxy_filter_xquery.o + $(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(MP_LIBS) $(ZORBA_LIBS) clean: - rm -f *.o tst + rm -f *.o tst $(MP_SO) run: tst LD_LIBRARY_PATH=$(ZORBA)/lib ./tst diff --git a/src/metaproxy_filter_xquery.cpp b/src/metaproxy_filter_xquery.cpp new file mode 100644 index 0000000..c7fe809 --- /dev/null +++ b/src/metaproxy_filter_xquery.cpp @@ -0,0 +1,82 @@ +/* This file is part of mp-xquery + Copyright (C) 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 +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +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 this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include + +namespace mp = metaproxy_1; +namespace yf = mp::filter; +using namespace mp; + +namespace metaproxy_1 { + namespace filter { + class XQuery : public Base { + public: + ~XQuery(); + XQuery(); + void process(metaproxy_1::Package & package) const; + void configure(const xmlNode * ptr, bool test_only, + const char *path); + void start() const; + void stop(int signo) const; + private: + }; + } +} + +void yf::XQuery::start() const +{ +} + +void yf::XQuery::stop(int signo) const +{ +} + +void yf::XQuery::process(Package &package) const +{ + package.move(); +} + +void yf::XQuery::configure(const xmlNode * ptr, bool test_only, + const char *path) +{ +} + +static yf::Base* filter_creator() +{ + return new mp::filter::XQuery; +} + +extern "C" { + struct metaproxy_1_filter_struct metaproxy_1_filter_xquery = { + 0, + "xquery", + filter_creator + }; +} + + +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +