Update template filter to avoid Pimpl MP-579
[metaproxy-moved-to-github.git] / src / filter_template.cpp
index 07c0d2a..3b26044 100644 (file)
@@ -1,55 +1,75 @@
-/* $Id: filter_template.cpp,v 1.3 2006-01-04 11:19:04 adam Exp $
-   Copyright (c) 2005, Index Data.
+/* This file is part of Metaproxy.
+   Copyright (C) Index Data
 
-%LICENSE%
- */
-
-#include "config.hpp"
+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.
 
-#include "filter.hpp"
-#include "router.hpp"
-#include "package.hpp"
+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.
 
-#include <boost/thread/mutex.hpp>
+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 "util.hpp"
+#include "config.hpp"
 #include "filter_template.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/thread/mutex.hpp>
 
 #include <yaz/zgdu.h>
 
-namespace yf = yp2::filter;
+namespace mp = metaproxy_1;
+namespace yf = mp::filter;
 
-namespace yp2 {
+namespace metaproxy_1 {
     namespace filter {
-        class Template::Rep {
-            friend class Template;
-            int dummy;
+        class Template : public Base {
+        public:
+            Template();
+            ~Template();
+            void process(metaproxy_1::Package & package) const;
+            void configure(const xmlNode * ptr, bool test_only,
+                           const char *path);
+        private:
+            int m_dummy;
         };
     }
 }
 
-yf::Template::Template() : m_p(new Rep)
+yf::Template::Template()
 {
-    m_p->dummy = 1;
 }
 
 yf::Template::~Template()
-{  // must have a destructor because of boost::scoped_ptr
+{
+}
+
+void yf::Template::configure(const xmlNode *xmlnode, bool test_only,
+                             const char *path)
+{
 }
 
-void yf::Template::process(Package &package) const
+void yf::Template::process(mp::Package &package) const
 {
-    // Z_GDU *gdu = package.request().get();
     package.move();
 }
 
-static yp2::filter::Base* filter_creator()
+
+static mp::filter::Base* filter_creator()
 {
-    return new yp2::filter::Template;
+    return new mp::filter::Template;
 }
 
 extern "C" {
-    const struct yp2_filter_struct yp2_filter_template = {
+    struct metaproxy_1_filter_struct metaproxy_1_filter_template = {
         0,
         "template",
         filter_creator
@@ -60,8 +80,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
  */
+