index cd10f80c058adf9b8e2fafa1c0ef82c597e27fb3..9c6651259bdd288991ba7cf1f719f788dfd999dc 100644 (file)
* Authors:
* Bob Jamison
*
- * Copyright (C) 2005 Bob Jamison
+ * Copyright (C) 2005-2006 Bob Jamison
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
namespace Pedro
{
+
typedef std::string DOMString;
typedef unsigned int XMLCh;
Namespace(const Namespace &other)
{
- prefix = other.prefix;
- namespaceURI = other.namespaceURI;
+ assign(other);
+ }
+
+ Namespace &operator=(const Namespace &other)
+ {
+ assign(other);
+ return *this;
}
virtual ~Namespace()
protected:
+ void assign(const Namespace &other)
+ {
+ prefix = other.prefix;
+ namespaceURI = other.namespaceURI;
+ }
+
DOMString prefix;
DOMString namespaceURI;
Attribute(const Attribute &other)
{
- name = other.name;
- value = other.value;
+ assign(other);
+ }
+
+ Attribute &operator=(const Attribute &other)
+ {
+ assign(other);
+ return *this;
}
virtual ~Attribute()
protected:
+ void assign(const Attribute &other)
+ {
+ name = other.name;
+ value = other.value;
+ }
+
DOMString name;
DOMString value;
Element(const DOMString &nameArg, const DOMString &valueArg)
{
parent = NULL;
- name = nameArg;
- value = valueArg;
+ name = nameArg;
+ value = valueArg;
}
Element(const Element &other)
{
- parent = other.parent;
- children = other.children;
- attributes = other.attributes;
- namespaces = other.namespaces;
- name = other.name;
- value = other.value;
+ assign(other);
+ }
+
+ Element &operator=(const Element &other)
+ {
+ assign(other);
+ return *this;
}
virtual Element *clone();
protected:
+ void assign(const Element &other)
+ {
+ parent = other.parent;
+ children = other.children;
+ attributes = other.attributes;
+ namespaces = other.namespaces;
+ name = other.name;
+ value = other.value;
+ }
void findElementsRecursive(std::vector<Element *>&res, const DOMString &name);
class Parser
{
public:
+ /**
+ * Constructor
+ */
Parser()
{ init(); }
Element *parse(XMLCh *buf,int pos,int len);
- bool keepGoing;
- Element *currentNode;
- long parselen;
- XMLCh *parsebuf;
- DOMString cdatabuf;
- long currentPosition;
- int colNr;
-
+ bool keepGoing;
+ Element *currentNode;
+ long parselen;
+ XMLCh *parsebuf;
+ DOMString cdatabuf;
+ long currentPosition;
+ int colNr;
};