From effac436c84214e2dd8556e7a17c217e3282bda5 Mon Sep 17 00:00:00 2001
From: deva <deva>
Date: Tue, 13 May 2008 09:51:33 +0000
Subject: Filename cleanups...

---
 server/src/Makefile.am                 |  12 ++--
 server/src/externaldataqueryhandler.cc |  31 --------
 server/src/externaldataqueryhandler.h  |  46 ------------
 server/src/externaldataqueryparser.cc  | 112 -----------------------------
 server/src/externaldataqueryparser.h   |  58 ---------------
 server/src/macro_parser.h              |   2 +-
 server/src/queryhandler.cc             |  31 ++++++++
 server/src/queryhandler.h              |  46 ++++++++++++
 server/src/queryparser.cc              | 112 +++++++++++++++++++++++++++++
 server/src/queryparser.h               |  58 +++++++++++++++
 server/src/sax_parser.cc               | 125 ---------------------------------
 server/src/sax_parser.h                |  50 -------------
 server/src/saxparser.cc                | 125 +++++++++++++++++++++++++++++++++
 server/src/saxparser.h                 |  50 +++++++++++++
 server/src/templateparser.h            |   2 +-
 server/src/xmlparser.h                 |   2 +-
 16 files changed, 431 insertions(+), 431 deletions(-)
 delete mode 100644 server/src/externaldataqueryhandler.cc
 delete mode 100644 server/src/externaldataqueryhandler.h
 delete mode 100644 server/src/externaldataqueryparser.cc
 delete mode 100644 server/src/externaldataqueryparser.h
 create mode 100644 server/src/queryhandler.cc
 create mode 100644 server/src/queryhandler.h
 create mode 100644 server/src/queryparser.cc
 create mode 100644 server/src/queryparser.h
 delete mode 100644 server/src/sax_parser.cc
 delete mode 100644 server/src/sax_parser.h
 create mode 100644 server/src/saxparser.cc
 create mode 100644 server/src/saxparser.h

diff --git a/server/src/Makefile.am b/server/src/Makefile.am
index 4d64067..621e8dd 100644
--- a/server/src/Makefile.am
+++ b/server/src/Makefile.am
@@ -11,14 +11,14 @@ pracrod_SOURCES = \
 	database.cc \
 	configuration.cc \
 	exception.cc \
-	externaldataqueryhandler.cc \
-	externaldataqueryparser.cc \
+	queryhandler.cc \
+	queryparser.cc \
 	journal_commit.cc \
 	log.cc \
 	luaquerymapper.cc \
 	macro_parser.cc \
 	resumeparser.cc \
-	sax_parser.cc \
+	saxparser.cc \
 	server.cc \
 	templateparser.cc \
 	tcpsocket.cc \
@@ -32,15 +32,15 @@ EXTRA_DIST = \
 	database.h \
 	debug.h \
 	exception.h \
-	externaldataqueryhandler.h \
-	externaldataqueryparser.h \
+	queryhandler.h \
+	queryparser.h \
 	journal_commit.h \
 	log.h \
 	luaquerymapper.h \
 	macro.h \
 	macro_parser.h \
 	resumeparser.h \
-	sax_parser.h \
+	saxparser.h \
 	server.h \
 	templateparser.h \
 	tcpsocket.h \
diff --git a/server/src/externaldataqueryhandler.cc b/server/src/externaldataqueryhandler.cc
deleted file mode 100644
index c6aed15..0000000
--- a/server/src/externaldataqueryhandler.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- *            externaldataqueryhandler.cc
- *
- *  Tue May  6 14:50:56 CEST 2008
- *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
- *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
- ****************************************************************************/
-
-/*
- *  This file is part of Pracro.
- *
- *  Pracro 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 of the License, or
- *  (at your option) any later version.
- *
- *  Pracro 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 Pracro; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#include "externaldataqueryhandler.h"
-
-ExternalDataQueryHandler::ExternalDataQueryHandler()
-{
-}
diff --git a/server/src/externaldataqueryhandler.h b/server/src/externaldataqueryhandler.h
deleted file mode 100644
index 375ffa2..0000000
--- a/server/src/externaldataqueryhandler.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- *            externaldataqueryhandler.h
- *
- *  Tue May  6 14:50:55 CEST 2008
- *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
- *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
- ****************************************************************************/
-
-/*
- *  This file is part of Pracro.
- *
- *  Pracro 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 of the License, or
- *  (at your option) any later version.
- *
- *  Pracro 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 Pracro; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef __PRACRO_EXTERNALDATAQUERYHANDLER_H__
-#define __PRACRO_EXTERNALDATAQUERYHANDLER_H__
-
-class ExternalDataQuery {};
-
-/**
- * This class handles the query of external data.
- */
-class ExternalDataQueryHandler {
-public:
-  ExternalDataQueryHandler();
-
-  // Add a query to the query queue
-  void addQuery(ExternalDataQuery &query) {}
-
-  // Execute all queries in parallel, for speed improv.
-  void exec() {}
-};
-
-#endif/*__PRACRO_EXTERNALDATAQUERYHANDLER_H__*/
diff --git a/server/src/externaldataqueryparser.cc b/server/src/externaldataqueryparser.cc
deleted file mode 100644
index 2de7fba..0000000
--- a/server/src/externaldataqueryparser.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- *            externaldataqueryparser.cc
- *
- *  Tue May  6 17:02:37 CEST 2008
- *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
- *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
- ****************************************************************************/
-
-/*
- *  This file is part of Pracro.
- *
- *  Pracro 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 of the License, or
- *  (at your option) any later version.
- *
- *  Pracro 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 Pracro; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#include "externaldataqueryparser.h"
-
-ExternalDataQueryParser::ExternalDataQueryParser(std::string document)
-{
-  this->document = document;
-  p = 0;
-  stack.push_back(&result);
-}
-
-void ExternalDataQueryParser::startTag(std::string name, std::map< std::string, std::string> attributes)
-{
-
-  if(name == "group") {
-    QueryResult q;
-    stack.back()->groups[attributes["name"]] = q;
-    stack.push_back(&stack.back()->groups[attributes["name"]]);
-  }
-
-  if(name == "value") {
-    stack.back()->values[attributes["name"]] = attributes["value"];
-  }
-
-}
-
-void ExternalDataQueryParser::endTag(std::string name)
-{
-  if(name == "group") stack.pop_back();
-}
-
-// FIXME: This is *not* the optimal way to do this.
-int ExternalDataQueryParser::readData(char *data, size_t size)
-{
-  size_t len = document.size() - p < size ? document.size() - p : size;
-  strncpy(data, document.c_str() + p, len);
-  p += len;
-  return len;
-}
-
-#ifdef TEST_EXTERNALDATAQUERYPARSER
-
-static std::string loadresultstring(QueryResult &res, std::string group = "")
-{
-  std::string s;
-
-  std::map< std::string, std::string >::iterator v = res.values.begin();
-  while(v != res.values.end()) {
-    s += group + (*v).first + " = \"" + (*v).second + "\"\n";
-    v++;
-  }
-
-  std::map< std::string, QueryResult >::iterator g = res.groups.begin();
-  while(g != res.groups.end()) {
-    s += group + (*g).first + " = {}\n";
-    s += loadresultstring((*g).second, group + (*g).first + ".");
-    g++;
-  }
-
-  return s;
-}
-
-char xml[] =
-  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
-  "<group name=\"dims\">\n"
-  "  <value name=\"fisk\" value=\"42\"/>"
-  "  <value name=\"futte\" value=\"bamse\"/>"
-  "  <group name=\"dims2\">\n"
-  "    <value name=\"fisk2\" value=\"42\"/>"
-  "    <value name=\"futte2\" value=\"bamse\"/>"
-  "  </group>\n"
-  "  <group name=\"dims3\">\n"
-  "    <value name=\"fisk3\" value=\"42\"/>"
-  "    <value name=\"futte3\" value=\"bamse\"/>"
-  "  </group>\n"
-  "</group>\n";
-
-int main()
-{
-  ExternalDataQueryParser e(xml);
-  e.parse();
-
-  printf("%s\n", loadresultstring(e.result).c_str());
-
-  return 0;
-}
-
-#endif
diff --git a/server/src/externaldataqueryparser.h b/server/src/externaldataqueryparser.h
deleted file mode 100644
index 1b760de..0000000
--- a/server/src/externaldataqueryparser.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- *            externaldataqueryparser.h
- *
- *  Tue May  6 17:02:36 CEST 2008
- *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
- *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
- ****************************************************************************/
-
-/*
- *  This file is part of Pracro.
- *
- *  Pracro 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 of the License, or
- *  (at your option) any later version.
- *
- *  Pracro 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 Pracro; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef __PRACRO_EXTERNALDATAQUERYPARSER_H__
-#define __PRACRO_EXTERNALDATAQUERYPARSER_H__
-
-#include "queryresult.h"
-#include "sax_parser.h"
-
-#include <vector>
-
-/**
- * This class parses xml entyties into a QueryResult structure.
- */
-class ExternalDataQueryParser : public SAXParser {
-public:
-  ExternalDataQueryParser(std::string document);
-
-  void startTag(std::string name, std::map< std::string, std::string> attributes);
-  void endTag(std::string name);
-
-  QueryResult result;
-
-protected:
-  int readData(char *data, size_t size);
-
-private:
-  // For read
-  int p;
-  std::string document;
-
-  std::vector< QueryResult * > stack;
-};
-
-#endif/*__PRACRO_EXTERNALDATAQUERYPARSER_H__*/
diff --git a/server/src/macro_parser.h b/server/src/macro_parser.h
index 248e586..7200551 100644
--- a/server/src/macro_parser.h
+++ b/server/src/macro_parser.h
@@ -29,7 +29,7 @@
 
 #include <string>
 
-#include "sax_parser.h"
+#include "saxparser.h"
 #include "macro.h"
 
 class MacroParser : public SAXParser {
diff --git a/server/src/queryhandler.cc b/server/src/queryhandler.cc
new file mode 100644
index 0000000..16db038
--- /dev/null
+++ b/server/src/queryhandler.cc
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ *            queryhandler.cc
+ *
+ *  Tue May  6 14:50:56 CEST 2008
+ *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
+ *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
+ ****************************************************************************/
+
+/*
+ *  This file is part of Pracro.
+ *
+ *  Pracro 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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Pracro 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 Pracro; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#include "queryhandler.h"
+
+QueryHandler::QueryHandler()
+{
+}
diff --git a/server/src/queryhandler.h b/server/src/queryhandler.h
new file mode 100644
index 0000000..2de62ae
--- /dev/null
+++ b/server/src/queryhandler.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ *            queryhandler.h
+ *
+ *  Tue May  6 14:50:55 CEST 2008
+ *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
+ *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
+ ****************************************************************************/
+
+/*
+ *  This file is part of Pracro.
+ *
+ *  Pracro 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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Pracro 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 Pracro; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#ifndef __PRACRO_QUERYHANDLER_H__
+#define __PRACRO_QUERYHANDLER_H__
+
+class Query {};
+
+/**
+ * This class handles the query of external data.
+ */
+class QueryHandler {
+public:
+  QueryHandler();
+
+  // Add a query to the query queue
+  void addQuery(Query &query) {}
+
+  // Execute all queries in parallel, for speed improv.
+  void exec() {}
+};
+
+#endif/*__PRACRO_QUERYHANDLER_H__*/
diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc
new file mode 100644
index 0000000..38e3037
--- /dev/null
+++ b/server/src/queryparser.cc
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ *            queryparser.cc
+ *
+ *  Tue May  6 17:02:37 CEST 2008
+ *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
+ *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
+ ****************************************************************************/
+
+/*
+ *  This file is part of Pracro.
+ *
+ *  Pracro 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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Pracro 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 Pracro; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#include "queryparser.h"
+
+QueryParser::QueryParser(std::string document)
+{
+  this->document = document;
+  p = 0;
+  stack.push_back(&result);
+}
+
+void QueryParser::startTag(std::string name, std::map< std::string, std::string> attributes)
+{
+
+  if(name == "group") {
+    QueryResult q;
+    stack.back()->groups[attributes["name"]] = q;
+    stack.push_back(&stack.back()->groups[attributes["name"]]);
+  }
+
+  if(name == "value") {
+    stack.back()->values[attributes["name"]] = attributes["value"];
+  }
+
+}
+
+void QueryParser::endTag(std::string name)
+{
+  if(name == "group") stack.pop_back();
+}
+
+// FIXME: This is *not* the optimal way to do this.
+int QueryParser::readData(char *data, size_t size)
+{
+  size_t len = document.size() - p < size ? document.size() - p : size;
+  strncpy(data, document.c_str() + p, len);
+  p += len;
+  return len;
+}
+
+#ifdef TEST_EXTERNALDATAQUERYPARSER
+
+static std::string loadresultstring(QueryResult &res, std::string group = "")
+{
+  std::string s;
+
+  std::map< std::string, std::string >::iterator v = res.values.begin();
+  while(v != res.values.end()) {
+    s += group + (*v).first + " = \"" + (*v).second + "\"\n";
+    v++;
+  }
+
+  std::map< std::string, QueryResult >::iterator g = res.groups.begin();
+  while(g != res.groups.end()) {
+    s += group + (*g).first + " = {}\n";
+    s += loadresultstring((*g).second, group + (*g).first + ".");
+    g++;
+  }
+
+  return s;
+}
+
+char xml[] =
+  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+  "<group name=\"dims\">\n"
+  "  <value name=\"fisk\" value=\"42\"/>"
+  "  <value name=\"futte\" value=\"bamse\"/>"
+  "  <group name=\"dims2\">\n"
+  "    <value name=\"fisk2\" value=\"42\"/>"
+  "    <value name=\"futte2\" value=\"bamse\"/>"
+  "  </group>\n"
+  "  <group name=\"dims3\">\n"
+  "    <value name=\"fisk3\" value=\"42\"/>"
+  "    <value name=\"futte3\" value=\"bamse\"/>"
+  "  </group>\n"
+  "</group>\n";
+
+int main()
+{
+  QueryParser e(xml);
+  e.parse();
+
+  printf("%s\n", loadresultstring(e.result).c_str());
+
+  return 0;
+}
+
+#endif
diff --git a/server/src/queryparser.h b/server/src/queryparser.h
new file mode 100644
index 0000000..58f7f37
--- /dev/null
+++ b/server/src/queryparser.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ *            queryparser.h
+ *
+ *  Tue May  6 17:02:36 CEST 2008
+ *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
+ *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
+ ****************************************************************************/
+
+/*
+ *  This file is part of Pracro.
+ *
+ *  Pracro 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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Pracro 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 Pracro; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#ifndef __PRACRO_QUERYPARSER_H__
+#define __PRACRO_QUERYPARSER_H__
+
+#include "queryresult.h"
+#include "saxparser.h"
+
+#include <vector>
+
+/**
+ * This class parses xml entyties into a QueryResult structure.
+ */
+class QueryParser : public SAXParser {
+public:
+  QueryParser(std::string document);
+
+  void startTag(std::string name, std::map< std::string, std::string> attributes);
+  void endTag(std::string name);
+
+  QueryResult result;
+
+protected:
+  int readData(char *data, size_t size);
+
+private:
+  // For read
+  int p;
+  std::string document;
+
+  std::vector< QueryResult * > stack;
+};
+
+#endif/*__PRACRO_QUERYPARSER_H__*/
diff --git a/server/src/sax_parser.cc b/server/src/sax_parser.cc
deleted file mode 100644
index dd0a7a3..0000000
--- a/server/src/sax_parser.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- *            sax_parser.cc
- *
- *  Mon Mar 24 14:40:15 CET 2008
- *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
- *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
- ****************************************************************************/
-
-/*
- *  This file is part of Pracro.
- *
- *  Pracro 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 of the License, or
- *  (at your option) any later version.
- *
- *  Pracro 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 Pracro; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#include "sax_parser.h"
-
-static void start_hndl(void *p, const char *el, const char **attr)
-{
-  SAXParser *parser = (SAXParser*)XML_GetUserData(p);
-
-  // Convert to comfy C++ values...
-  std::string name = el;
-  std::map< std::string, std::string > attributes;
-
-  while(*attr) {
-    std::string at_name = *attr;
-    attr++;
-    std::string at_value = *attr;
-    attr++;
-
-    attributes.insert(make_pair(at_name, at_value));
-  }
-
-  parser->startTag(name, attributes);
-}
-
-static void end_hndl(void *p, const char *el)
-{
-  SAXParser *parser = (SAXParser*)XML_GetUserData(p);
-  std::string name = el;
-  parser->endTag(name);
-}
-
-
-SAXParser::SAXParser()
-{
-  p = XML_ParserCreate(NULL);
-  if(!p) {
-    fprintf(stderr, "Couldn't allocate memory for parser\n");
-    // throw Exception(...);
-    return;
-  }
-
-  XML_SetUserData(p, this);
-  XML_UseParserAsHandlerArg(p);
-  XML_SetElementHandler(p, start_hndl, end_hndl);
-}
-
-int SAXParser::parse()
-{
-  char buf[32];
-  int len;
-  
-  do {
-    len = readData(buf, sizeof(buf) - 1);
-    if (! XML_Parse(p, buf, len, len == 0)) {
-      fprintf(stderr, "Parse error at line %d:\n%s\n",
-              XML_GetCurrentLineNumber(p),
-              XML_ErrorString(XML_GetErrorCode(p)));
-      return -1;
-    }
-
-    memset(buf, 0, sizeof(buf));
-  } while(len);
-
-  return 0;
-}
-
-#ifdef TEST_SAXPARSER
-/**
- * Compile with: g++ -DTEST_SAXPARSER sax_parser.cc -lexpat -otext_saxparser
- * Run with: ./test_saxparser [xmlfile]
- */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-class MyParser :public SAXParser {
-public:
-  MyParser(char *file) {
-    fd = open(file, O_RDONLY);
-  }
-
-  int readData(char *data, size_t size) {
-    return read(fd, data, size);
-  }
-
-  void startTag(std::string name, std::map< std::string, std::string> attributes)
-  {
-    printf("<%s>\n", name.c_str());
-  }
-
-private:
-  int fd;
-};
-
-int main(int argc, char *argv[]) {
-  if(argc < 2) return 1;
-  MyParser parser(argv[1]);
-  parser.parse();
-}
-
-#endif/*TEST_SAXPARSER*/
diff --git a/server/src/sax_parser.h b/server/src/sax_parser.h
deleted file mode 100644
index b6b48ba..0000000
--- a/server/src/sax_parser.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- *            sax_parser.h
- *
- *  Mon Mar 24 14:40:15 CET 2008
- *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
- *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
- ****************************************************************************/
-
-/*
- *  This file is part of Pracro.
- *
- *  Pracro 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 of the License, or
- *  (at your option) any later version.
- *
- *  Pracro 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 Pracro; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef __PRACRO_SAX_PARSER_H__
-#define __PRACRO_SAX_PARSER_H__
-
-#include <string>
-#include <map>
-#include <expat.h>
-
-class SAXParser {
-public:
-  SAXParser();
-
-  int parse();
-
-  virtual void startTag(std::string name, std::map< std::string, std::string> attributes) {}
-  virtual void endTag(std::string name) {}
-
-protected:
-  virtual int readData(char *data, size_t size) { return 0; }
-
-private:
-  XML_Parser p;
-};
-
-#endif/*__PRACRO_SAX_PARSER_H__*/
diff --git a/server/src/saxparser.cc b/server/src/saxparser.cc
new file mode 100644
index 0000000..e0d849a
--- /dev/null
+++ b/server/src/saxparser.cc
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ *            saxparser.cc
+ *
+ *  Mon Mar 24 14:40:15 CET 2008
+ *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
+ *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
+ ****************************************************************************/
+
+/*
+ *  This file is part of Pracro.
+ *
+ *  Pracro 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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Pracro 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 Pracro; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#include "saxparser.h"
+
+static void start_hndl(void *p, const char *el, const char **attr)
+{
+  SAXParser *parser = (SAXParser*)XML_GetUserData(p);
+
+  // Convert to comfy C++ values...
+  std::string name = el;
+  std::map< std::string, std::string > attributes;
+
+  while(*attr) {
+    std::string at_name = *attr;
+    attr++;
+    std::string at_value = *attr;
+    attr++;
+
+    attributes.insert(make_pair(at_name, at_value));
+  }
+
+  parser->startTag(name, attributes);
+}
+
+static void end_hndl(void *p, const char *el)
+{
+  SAXParser *parser = (SAXParser*)XML_GetUserData(p);
+  std::string name = el;
+  parser->endTag(name);
+}
+
+
+SAXParser::SAXParser()
+{
+  p = XML_ParserCreate(NULL);
+  if(!p) {
+    fprintf(stderr, "Couldn't allocate memory for parser\n");
+    // throw Exception(...);
+    return;
+  }
+
+  XML_SetUserData(p, this);
+  XML_UseParserAsHandlerArg(p);
+  XML_SetElementHandler(p, start_hndl, end_hndl);
+}
+
+int SAXParser::parse()
+{
+  char buf[32];
+  int len;
+  
+  do {
+    len = readData(buf, sizeof(buf) - 1);
+    if (! XML_Parse(p, buf, len, len == 0)) {
+      fprintf(stderr, "Parse error at line %d:\n%s\n",
+              XML_GetCurrentLineNumber(p),
+              XML_ErrorString(XML_GetErrorCode(p)));
+      return -1;
+    }
+
+    memset(buf, 0, sizeof(buf));
+  } while(len);
+
+  return 0;
+}
+
+#ifdef TEST_SAXPARSER
+/**
+ * Compile with: g++ -DTEST_SAXPARSER sax_parser.cc -lexpat -otext_saxparser
+ * Run with: ./test_saxparser [xmlfile]
+ */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+class MyParser :public SAXParser {
+public:
+  MyParser(char *file) {
+    fd = open(file, O_RDONLY);
+  }
+
+  int readData(char *data, size_t size) {
+    return read(fd, data, size);
+  }
+
+  void startTag(std::string name, std::map< std::string, std::string> attributes)
+  {
+    printf("<%s>\n", name.c_str());
+  }
+
+private:
+  int fd;
+};
+
+int main(int argc, char *argv[]) {
+  if(argc < 2) return 1;
+  MyParser parser(argv[1]);
+  parser.parse();
+}
+
+#endif/*TEST_SAXPARSER*/
diff --git a/server/src/saxparser.h b/server/src/saxparser.h
new file mode 100644
index 0000000..c03b281
--- /dev/null
+++ b/server/src/saxparser.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ *            saxparser.h
+ *
+ *  Mon Mar 24 14:40:15 CET 2008
+ *  Copyright 2008 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup
+ *  deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk
+ ****************************************************************************/
+
+/*
+ *  This file is part of Pracro.
+ *
+ *  Pracro 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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Pracro 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 Pracro; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+#ifndef __PRACRO_SAXPARSER_H__
+#define __PRACRO_SAXPARSER_H__
+
+#include <string>
+#include <map>
+#include <expat.h>
+
+class SAXParser {
+public:
+  SAXParser();
+
+  int parse();
+
+  virtual void startTag(std::string name, std::map< std::string, std::string> attributes) {}
+  virtual void endTag(std::string name) {}
+
+protected:
+  virtual int readData(char *data, size_t size) { return 0; }
+
+private:
+  XML_Parser p;
+};
+
+#endif/*__PRACRO_SAXPARSER_H__*/
diff --git a/server/src/templateparser.h b/server/src/templateparser.h
index c53b04d..d5c09b1 100644
--- a/server/src/templateparser.h
+++ b/server/src/templateparser.h
@@ -27,7 +27,7 @@
 #ifndef __PRACRO_TEMPLATEPARSER_H__
 #define __PRACRO_TEMPLATEPARSER_H__
 
-#include "sax_parser.h"
+#include "saxparser.h"
 #include "template.h"
 
 typedef enum {
diff --git a/server/src/xmlparser.h b/server/src/xmlparser.h
index 30e6767..1a37e26 100644
--- a/server/src/xmlparser.h
+++ b/server/src/xmlparser.h
@@ -27,7 +27,7 @@
 #ifndef __PRACRO_XMLPARSER_H__
 #define __PRACRO_XMLPARSER_H__
 
-#include "sax_parser.h"
+#include "saxparser.h"
 #include "tcpsocket.h"
 #include "transaction.h"
 
-- 
cgit v1.2.3