summaryrefslogtreecommitdiff
path: root/cpp/src/IceXML/Parser.h
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2021-01-28 14:18:08 -0500
committerJoe George <joe@zeroc.com>2021-02-01 16:50:22 -0500
commit3dd23049d2424404255585228ffc5e0314fed7ce (patch)
tree5dd38567c461ab08f0c402f54551b42e23de29cb /cpp/src/IceXML/Parser.h
parentRemove checksum support (#607) (diff)
downloadice-3dd23049d2424404255585228ffc5e0314fed7ce.tar.bz2
ice-3dd23049d2424404255585228ffc5e0314fed7ce.tar.xz
ice-3dd23049d2424404255585228ffc5e0314fed7ce.zip
Port Glacier2, IceBox, IceBridge, IceDB, IceXML, icegriddb
Diffstat (limited to 'cpp/src/IceXML/Parser.h')
-rw-r--r--cpp/src/IceXML/Parser.h73
1 files changed, 27 insertions, 46 deletions
diff --git a/cpp/src/IceXML/Parser.h b/cpp/src/IceXML/Parser.h
index 71101b7a55a..ddade14a93a 100644
--- a/cpp/src/IceXML/Parser.h
+++ b/cpp/src/IceXML/Parser.h
@@ -5,8 +5,6 @@
#ifndef ICE_XML_PARSER_H
#define ICE_XML_PARSER_H
-#include <IceUtil/Shared.h>
-#include <IceUtil/Handle.h>
#include <IceUtil/Exception.h>
#include <vector>
@@ -37,21 +35,15 @@
namespace IceXML
{
-class ICE_XML_API ParserException : public IceUtil::ExceptionHelper<ParserException>
+class ICE_XML_API ParserException final : public IceUtil::ExceptionHelper<ParserException>
{
public:
ParserException(const std::string&);
ParserException(const char*, int, const std::string&);
-#ifndef ICE_CPP11_COMPILER
- virtual ~ParserException() throw();
-#endif
- virtual std::string ice_id() const;
- virtual void ice_print(std::ostream&) const;
-#ifndef ICE_CPP11_MAPPING
- virtual ParserException* ice_clone() const;
-#endif
+ std::string ice_id() const override;
+ void ice_print(std::ostream&) const override;
std::string reason() const;
@@ -61,36 +53,28 @@ private:
static const char* _name;
};
-class Node;
-typedef IceUtil::Handle< Node > NodePtr;
-
-typedef std::vector<NodePtr> NodeList;
-
+class Document;
class Element;
-typedef IceUtil::Handle< Element > ElementPtr;
-
+class Node;
class Text;
-typedef IceUtil::Handle< Text > TextPtr;
-class Document;
-typedef IceUtil::Handle< Document > DocumentPtr;
-
-typedef std::map<std::string, std::string> Attributes;
+using NodeList = std::vector<std::shared_ptr<Node>>;
+using Attributes = std::map<std::string, std::string>;
-class ICE_XML_API Node : public IceUtil::Shared
+class ICE_XML_API Node
{
public:
- virtual ~Node();
+ virtual ~Node() = default;
- virtual NodePtr getParent() const;
+ virtual std::shared_ptr<Node> 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 bool addChild(const std::shared_ptr<Node>&);
virtual void destroy();
@@ -99,29 +83,28 @@ public:
protected:
- Node(const NodePtr&, const std::string&, const std::string&, int, int);
+ Node(const std::shared_ptr<Node>&, const std::string&, const std::string&, int, int);
- NodePtr _parent;
+ std::shared_ptr<Node> _parent;
std::string _name;
std::string _value;
int _line;
int _column;
};
-class ICE_XML_API Element : public Node
+class ICE_XML_API Element final : public Node
{
public:
- Element(const NodePtr&, const std::string&, const Attributes&, int, int);
- virtual ~Element();
+ Element(const std::shared_ptr<Node>&, const std::string&, const Attributes&, int, int);
- virtual NodeList getChildren() const;
- virtual Attributes getAttributes() const;
- virtual std::string getAttribute(const std::string&) const;
+ NodeList getChildren() const override;
+ Attributes getAttributes() const override;
+ std::string getAttribute(const std::string&) const override;
- virtual bool addChild(const NodePtr&);
+ bool addChild(const std::shared_ptr<Node>&) override;
- virtual void destroy();
+ void destroy() override;
private:
@@ -129,12 +112,11 @@ private:
Attributes _attributes;
};
-class ICE_XML_API Text : public Node
+class ICE_XML_API Text final : public Node
{
public:
- Text(const NodePtr&, const std::string&, int, int);
- virtual ~Text();
+ Text(const std::shared_ptr<Node>&, const std::string&, int, int);
};
class ICE_XML_API Document : public Node
@@ -142,13 +124,12 @@ class ICE_XML_API Document : public Node
public:
Document();
- virtual ~Document();
- virtual NodeList getChildren() const;
+ NodeList getChildren() const override;
- virtual bool addChild(const NodePtr&);
+ bool addChild(const std::shared_ptr<Node>&) override;
- virtual void destroy();
+ void destroy() override;
private:
@@ -171,8 +152,8 @@ 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 std::shared_ptr<Document> parse(const std::string&); // The given filename must be UTF-8 encoded
+ static std::shared_ptr<Document> parse(std::istream&);
static void parse(const std::string&, Handler&);
static void parse(std::istream&, Handler&);