summaryrefslogtreecommitdiff
path: root/cpp/src/IceXML
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-05-03 19:26:09 +0200
committerBenoit Foucher <benoit@zeroc.com>2016-05-03 19:26:09 +0200
commitee3b7be185f7d887a33b9c242a7ccd08a09d2614 (patch)
tree1974211a0cbd5e3df95b6deed0b2b42f7854aca9 /cpp/src/IceXML
parentRename files for consistency (diff)
downloadice-ee3b7be185f7d887a33b9c242a7ccd08a09d2614.tar.bz2
ice-ee3b7be185f7d887a33b9c242a7ccd08a09d2614.tar.xz
ice-ee3b7be185f7d887a33b9c242a7ccd08a09d2614.zip
Re-factored gmake build system
Diffstat (limited to 'cpp/src/IceXML')
-rw-r--r--cpp/src/IceXML/.gitignore5
-rw-r--r--cpp/src/IceXML/Makefile41
-rw-r--r--cpp/src/IceXML/Makefile.mk17
-rw-r--r--cpp/src/IceXML/Parser.h187
4 files changed, 204 insertions, 46 deletions
diff --git a/cpp/src/IceXML/.gitignore b/cpp/src/IceXML/.gitignore
deleted file mode 100644
index 720f44c7047..00000000000
--- a/cpp/src/IceXML/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-.depend
-.depend
diff --git a/cpp/src/IceXML/Makefile b/cpp/src/IceXML/Makefile
deleted file mode 100644
index 6378e47c360..00000000000
--- a/cpp/src/IceXML/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-LIBFILENAME = $(call mklibfilename,IceXML,$(VERSION))
-SONAME = $(call mksoname,IceXML,$(SOVERSION))
-LIBNAME = $(call mklibname,IceXML)
-
-TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)$(cpp11libdirsuffix)/$(LIBNAME))
-
-OBJS = Parser.o
-
-include $(top_srcdir)/config/Make.rules
-
-CPPFLAGS := -I.. $(CPPFLAGS) -DICE_XML_API_EXPORTS $(EXPAT_FLAGS)
-
-LINKWITH := -lIceUtil $(EXPAT_LIBS)
-
-$(libdir)/$(LIBFILENAME): $(OBJS)
- @mkdir -p $(dir $@)
- rm -f $@
- $(call mkshlib,$@,$(SONAME),$(OBJS),$(LINKWITH))
-
-$(libdir)/$(SONAME): $(libdir)/$(LIBFILENAME)
- rm -f $@
- ln -s $(LIBFILENAME) $@
-
-$(libdir)$(cpp11libdirsuffix)/$(LIBNAME): $(libdir)/$(SONAME)
- @mkdir -p $(libdir)$(cpp11libdirsuffix)
- rm -f $@
- ln -s $(cpp11sonamedir)$(SONAME) $@
-
-install:: all
- $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))
diff --git a/cpp/src/IceXML/Makefile.mk b/cpp/src/IceXML/Makefile.mk
new file mode 100644
index 00000000000..00ecc121121
--- /dev/null
+++ b/cpp/src/IceXML/Makefile.mk
@@ -0,0 +1,17 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+$(project)_libraries := IceXML
+
+IceXML_targetdir := $(libdir)
+IceXML_dependencies := IceUtil
+IceXML_cppflags := -DICE_XML_API_EXPORTS
+IceXML_libs := expat
+
+projects += $(project)
diff --git a/cpp/src/IceXML/Parser.h b/cpp/src/IceXML/Parser.h
new file mode 100644
index 00000000000..dd391156cf4
--- /dev/null
+++ b/cpp/src/IceXML/Parser.h
@@ -0,0 +1,187 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_XML_PARSER_H
+#define ICE_XML_PARSER_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Handle.h>
+#include <IceUtil/Exception.h>
+
+#include <vector>
+#include <map>
+
+#ifndef ICE_XML_API
+# ifdef ICE_XML_API_EXPORTS
+# define ICE_XML_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define ICE_XML_API /**/
+# else
+# define ICE_XML_API ICE_DECLSPEC_IMPORT
+# endif
+#endif
+
+//
+// Automatically link IceXML[D|++11|++11D].lib with Visual C++
+//
+
+#if !defined(ICE_BUILDING_ICE_XML) && defined(ICE_XML_API_EXPORTS)
+# define ICE_BUILDING_ICE_XML
+#endif
+
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICE_XML)
+# pragma comment(lib, ICE_LIBNAME("IceXML"))
+#endif
+
+namespace IceXML
+{
+
+class ICE_XML_API ParserException : public IceUtil::Exception
+{
+public:
+
+ ParserException(const std::string&);
+ ParserException(const char*, int, const std::string&);
+ virtual ~ParserException() ICE_NOEXCEPT;
+
+ virtual std::string ice_id() const;
+ virtual void ice_print(std::ostream&) const;
+#ifndef ICE_CPP11_MAPPING
+ virtual ParserException* ice_clone() const;
+#endif
+ virtual void ice_throw() const;
+
+ std::string reason() const;
+
+private:
+
+ std::string _reason;
+ static const char* _name;
+};
+
+class Node;
+typedef IceUtil::Handle< Node > NodePtr;
+
+typedef std::vector<NodePtr> NodeList;
+
+class Element;
+typedef IceUtil::Handle< Element > ElementPtr;
+
+class Text;
+typedef IceUtil::Handle< Text > TextPtr;
+
+class Document;
+typedef IceUtil::Handle< Document > DocumentPtr;
+
+typedef std::map<std::string, std::string> Attributes;
+
+class ICE_XML_API Node : public IceUtil::Shared
+{
+public:
+
+ virtual ~Node();
+
+ virtual NodePtr getParent() const;
+ virtual std::string getName() const;
+ virtual std::string getValue() const;
+ virtual NodeList getChildren() const;
+ virtual Attributes getAttributes() const;
+ virtual std::string getAttribute(const std::string&) const;
+
+ virtual bool addChild(const NodePtr&);
+
+ virtual void destroy();
+
+ int getLine() const;
+ int getColumn() const;
+
+protected:
+
+ Node(const NodePtr&, const std::string&, const std::string&, int, int);
+
+ NodePtr _parent;
+ std::string _name;
+ std::string _value;
+ int _line;
+ int _column;
+};
+
+class ICE_XML_API Element : public Node
+{
+public:
+
+ Element(const NodePtr&, const std::string&, const Attributes&, int, int);
+ virtual ~Element();
+
+ virtual NodeList getChildren() const;
+ virtual Attributes getAttributes() const;
+ virtual std::string getAttribute(const std::string&) const;
+
+ virtual bool addChild(const NodePtr&);
+
+ virtual void destroy();
+
+private:
+
+ NodeList _children;
+ Attributes _attributes;
+};
+
+class ICE_XML_API Text : public Node
+{
+public:
+
+ Text(const NodePtr&, const std::string&, int, int);
+ virtual ~Text();
+};
+
+class ICE_XML_API Document : public Node
+{
+public:
+
+ Document();
+ virtual ~Document();
+
+ virtual NodeList getChildren() const;
+
+ virtual bool addChild(const NodePtr&);
+
+ virtual void destroy();
+
+private:
+
+ NodeList _children;
+};
+
+class ICE_XML_API Handler
+{
+public:
+
+ virtual ~Handler();
+
+ virtual void startElement(const std::string&, const Attributes&, int, int) = 0;
+ virtual void endElement(const std::string&, int, int) = 0;
+ virtual void characters(const std::string&, int, int) = 0;
+ virtual void error(const std::string&, int, int);
+};
+
+class ICE_XML_API Parser
+{
+public:
+
+ static DocumentPtr parse(const std::string&); // The given filename must be UTF-8 encoded
+ static DocumentPtr parse(std::istream&);
+
+ static void parse(const std::string&, Handler&);
+ static void parse(std::istream&, Handler&);
+};
+
+}
+
+#endif