mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-08-06 16:11:46 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
78
vendor/POCO/XML/include/Poco/DOM/AbstractContainerNode.h
vendored
Normal file
78
vendor/POCO/XML/include/Poco/DOM/AbstractContainerNode.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// AbstractContainerNode.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AbstractContainerNode class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_AbstractContainerNode_INCLUDED
|
||||
#define DOM_AbstractContainerNode_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractNode.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API AbstractContainerNode: public AbstractNode
|
||||
/// AbstractContainerNode is an implementation of Node
|
||||
/// that stores and manages child nodes.
|
||||
///
|
||||
/// Child nodes are organized in a single linked list.
|
||||
{
|
||||
public:
|
||||
// Node
|
||||
Node* firstChild() const;
|
||||
Node* lastChild() const;
|
||||
Node* insertBefore(Node* newChild, Node* refChild);
|
||||
Node* replaceChild(Node* newChild, Node* oldChild);
|
||||
Node* removeChild(Node* oldChild);
|
||||
Node* appendChild(Node* newChild);
|
||||
bool hasChildNodes() const;
|
||||
bool hasAttributes() const;
|
||||
Node* getNodeByPath(const XMLString& path) const;
|
||||
Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const;
|
||||
|
||||
protected:
|
||||
AbstractContainerNode(Document* pOwnerDocument);
|
||||
AbstractContainerNode(Document* pOwnerDocument, const AbstractContainerNode& node);
|
||||
~AbstractContainerNode();
|
||||
|
||||
void dispatchNodeRemovedFromDocument();
|
||||
void dispatchNodeInsertedIntoDocument();
|
||||
|
||||
static const Node* findNode(XMLString::const_iterator& it, const XMLString::const_iterator& end, const Node* pNode, const NSMap* pNSMap);
|
||||
static const Node* findElement(const XMLString& name, const Node* pNode, const NSMap* pNSMap);
|
||||
static const Node* findElement(int index, const Node* pNode, const NSMap* pNSMap);
|
||||
static const Node* findElement(const XMLString& attr, const XMLString& value, const Node* pNode, const NSMap* pNSMap);
|
||||
static const Attr* findAttribute(const XMLString& name, const Node* pNode, const NSMap* pNSMap);
|
||||
bool hasAttributeValue(const XMLString& name, const XMLString& value, const NSMap* pNSMap) const;
|
||||
static bool namesAreEqual(const Node* pNode1, const Node* pNode2, const NSMap* pNSMap);
|
||||
static bool namesAreEqual(const Node* pNode, const XMLString& name, const NSMap* pNSMap);
|
||||
|
||||
static const XMLString WILDCARD;
|
||||
|
||||
private:
|
||||
AbstractNode* _pFirstChild;
|
||||
|
||||
friend class AbstractNode;
|
||||
friend class NodeAppender;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_AbstractContainerNode_INCLUDED
|
125
vendor/POCO/XML/include/Poco/DOM/AbstractNode.h
vendored
Normal file
125
vendor/POCO/XML/include/Poco/DOM/AbstractNode.h
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// AbstractNode.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AbstractNode class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_AbstractNode_INCLUDED
|
||||
#define DOM_AbstractNode_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/Node.h"
|
||||
#include "Poco/DOM/MutationEvent.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class AbstractContainerNode;
|
||||
class Attr;
|
||||
class EventDispatcher;
|
||||
|
||||
|
||||
class XML_API AbstractNode: public Node
|
||||
/// AbstractNode provides a basic implementation
|
||||
/// of the Node interface for all types of nodes
|
||||
/// that do not contain other nodes.
|
||||
{
|
||||
public:
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
const XMLString& getNodeValue() const;
|
||||
void setNodeValue(const XMLString& value);
|
||||
Node* parentNode() const;
|
||||
NodeList* childNodes() const;
|
||||
Node* firstChild() const;
|
||||
Node* lastChild() const;
|
||||
Node* previousSibling() const;
|
||||
Node* nextSibling() const;
|
||||
NamedNodeMap* attributes() const;
|
||||
Document* ownerDocument() const;
|
||||
Node* insertBefore(Node* newChild, Node* refChild);
|
||||
Node* replaceChild(Node* newChild, Node* oldChild);
|
||||
Node* removeChild(Node* oldChild);
|
||||
Node* appendChild(Node* newChild);
|
||||
bool hasChildNodes() const;
|
||||
Node* cloneNode(bool deep) const;
|
||||
void normalize();
|
||||
bool isSupported(const XMLString& feature, const XMLString& version) const;
|
||||
const XMLString& namespaceURI() const;
|
||||
XMLString prefix() const;
|
||||
const XMLString& localName() const;
|
||||
bool hasAttributes() const;
|
||||
|
||||
// EventTarget
|
||||
void addEventListener(const XMLString& type, EventListener* listener, bool useCapture);
|
||||
void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture);
|
||||
bool dispatchEvent(Event* evt);
|
||||
|
||||
// Extensions
|
||||
XMLString innerText() const;
|
||||
Node* getNodeByPath(const XMLString& path) const;
|
||||
Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const;
|
||||
|
||||
virtual void autoRelease();
|
||||
|
||||
protected:
|
||||
AbstractNode(Document* pOwnerDocument);
|
||||
AbstractNode(Document* pOwnerDocument, const AbstractNode& node);
|
||||
~AbstractNode();
|
||||
|
||||
virtual Node* copyNode(bool deep, Document* pOwnerDocument) const = 0;
|
||||
|
||||
virtual bool events() const;
|
||||
virtual bool eventsSuspended() const;
|
||||
void captureEvent(Event* evt);
|
||||
void bubbleEvent(Event* evt);
|
||||
void dispatchSubtreeModified();
|
||||
void dispatchNodeInserted();
|
||||
void dispatchNodeRemoved();
|
||||
virtual void dispatchNodeRemovedFromDocument();
|
||||
virtual void dispatchNodeInsertedIntoDocument();
|
||||
void dispatchAttrModified(Attr* pAttr, MutationEvent::AttrChangeType changeType, const XMLString& prevValue, const XMLString& newValue);
|
||||
void dispatchCharacterDataModified(const XMLString& prevValue, const XMLString& newValue);
|
||||
void setOwnerDocument(Document* pOwnerDocument);
|
||||
|
||||
static const XMLString EMPTY_STRING;
|
||||
|
||||
private:
|
||||
AbstractNode();
|
||||
|
||||
AbstractContainerNode* _pParent;
|
||||
AbstractNode* _pNext;
|
||||
Document* _pOwner;
|
||||
EventDispatcher* _pEventDispatcher;
|
||||
|
||||
static const XMLString NODE_NAME;
|
||||
|
||||
friend class AbstractContainerNode;
|
||||
friend class Document;
|
||||
friend class DocumentFragment;
|
||||
friend class Element;
|
||||
friend class Attr;
|
||||
friend class CharacterData;
|
||||
friend class DOMBuilder;
|
||||
friend class NodeAppender;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_AbstractNode_INCLUDED
|
180
vendor/POCO/XML/include/Poco/DOM/Attr.h
vendored
Normal file
180
vendor/POCO/XML/include/Poco/DOM/Attr.h
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
//
|
||||
// Attr.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Attr class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Attr_INCLUDED
|
||||
#define DOM_Attr_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractNode.h"
|
||||
#include "Poco/DOM/Element.h"
|
||||
#include "Poco/XML/Name.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API Attr: public AbstractNode
|
||||
/// The Attr interface represents an attribute in an Element object. Typically
|
||||
/// the allowable values for the attribute are defined in a document type definition.
|
||||
///
|
||||
/// Attr objects inherit the Node interface, but since they are not actually
|
||||
/// child nodes of the element they describe, the DOM does not consider them
|
||||
/// part of the document tree. Thus, the Node attributes parentNode, previousSibling,
|
||||
/// and nextSibling have a null value for Attr objects. The DOM takes the view
|
||||
/// that attributes are properties of elements rather than having a separate
|
||||
/// identity from the elements they are associated with; this should make it
|
||||
/// more efficient to implement such features as default attributes associated
|
||||
/// with all elements of a given type. Furthermore, Attr nodes may not be immediate
|
||||
/// children of a DocumentFragment. However, they can be associated with Element
|
||||
/// nodes contained within a DocumentFragment. In short, users and implementors
|
||||
/// of the DOM need to be aware that Attr nodes have some things in common with
|
||||
/// other objects inheriting the Node interface, but they also are quite distinct.
|
||||
///
|
||||
/// The attribute's effective value is determined as follows: if this attribute
|
||||
/// has been explicitly assigned any value, that value is the attribute's effective
|
||||
/// value; otherwise, if there is a declaration for this attribute, and that
|
||||
/// declaration includes a default value, then that default value is the attribute's
|
||||
/// effective value; otherwise, the attribute does not exist on this element
|
||||
/// in the structure model until it has been explicitly added. Note that the
|
||||
/// nodeValue attribute on the Attr instance can also be used to retrieve the
|
||||
/// string version of the attribute's value(s).
|
||||
///
|
||||
/// In XML, where the value of an attribute can contain entity references, the
|
||||
/// child nodes of the Attr node provide a representation in which entity references
|
||||
/// are not expanded. These child nodes may be either Text or EntityReference
|
||||
/// nodes. Because the attribute type may be unknown, there are no tokenized
|
||||
/// attribute values.
|
||||
{
|
||||
public:
|
||||
const XMLString& name() const;
|
||||
/// Returns the name of this attribute.
|
||||
|
||||
bool specified() const;
|
||||
/// If this attribute was explicitly given a value in the original document,
|
||||
/// this is true; otherwise, it is false. Note that the implementation is in
|
||||
/// charge of this attribute, not the user. If the user changes the value of
|
||||
/// the attribute (even if it ends up having the same value as the default value)
|
||||
/// then the specified flag is automatically flipped to true. To re-specify
|
||||
/// the attribute as the default value from the DTD, the user must delete the
|
||||
/// attribute. The implementation will then make a new attribute available with
|
||||
/// specified set to false and the default value (if one exists).
|
||||
/// In summary:
|
||||
///
|
||||
/// * If the attribute has an assigned value in the document then specified
|
||||
/// is true, and the value is the assigned value.
|
||||
/// * If the attribute has no assigned value in the document and has a default
|
||||
/// value in the DTD, then specified is false, and the value is the default
|
||||
/// value in the DTD.
|
||||
/// * If the attribute has no assigned value in the document and has a value
|
||||
/// of #IMPLIED in the DTD, then the attribute does not appear in the structure
|
||||
/// model of the document.
|
||||
/// * If the attribute is not associated to any element (i.e. because it
|
||||
/// was just created or was obtained from some removal or cloning operation)
|
||||
/// specified is true.
|
||||
|
||||
const XMLString& value() const;
|
||||
/// Returns the value of the attribute as a string. Character
|
||||
/// and general entity references are replaced with their values. See also the
|
||||
/// method getAttribute on the Element interface.
|
||||
|
||||
const XMLString& getValue() const;
|
||||
/// Returns the value of the attribute as a string. Character
|
||||
/// and general entity references are replaced with their values. See also the
|
||||
/// method getAttribute on the Element interface.
|
||||
|
||||
void setValue(const XMLString& value);
|
||||
/// Sets the value of the attribute as a string.
|
||||
/// This creates a Text node with the unparsed contents of the string.
|
||||
/// I.e. any characters that an XML processor would recognize as markup are
|
||||
/// instead treated as literal text. See also the method setAttribute on the
|
||||
/// Element interface.
|
||||
|
||||
// DOM Level 2
|
||||
Element* ownerElement() const;
|
||||
/// The Element node this attribute is attached to or null
|
||||
/// if this attribute is not in use.
|
||||
|
||||
// Node
|
||||
Node* parentNode() const;
|
||||
const XMLString& nodeName() const;
|
||||
const XMLString& getNodeValue() const;
|
||||
void setNodeValue(const XMLString& value);
|
||||
unsigned short nodeType() const;
|
||||
Node* previousSibling() const;
|
||||
const XMLString& namespaceURI() const;
|
||||
XMLString prefix() const;
|
||||
const XMLString& localName() const;
|
||||
|
||||
// Non-standard extensions
|
||||
XMLString innerText() const;
|
||||
|
||||
protected:
|
||||
Attr(Document* pOwnerDocument, Element* pOwnerElement, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const XMLString& value, bool specified = true);
|
||||
Attr(Document* pOwnerDocument, const Attr& attr);
|
||||
~Attr();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
const Name& _name;
|
||||
XMLString _value;
|
||||
bool _specified;
|
||||
|
||||
friend class Document;
|
||||
friend class Element;
|
||||
friend class DOMBuilder;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Attr::name() const
|
||||
{
|
||||
return _name.qname();
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& Attr::value() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& Attr::getValue() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
||||
inline bool Attr::specified() const
|
||||
{
|
||||
return _specified;
|
||||
}
|
||||
|
||||
|
||||
inline Element* Attr::ownerElement() const
|
||||
{
|
||||
return static_cast<Element*>(_pParent);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Attr_INCLUDED
|
65
vendor/POCO/XML/include/Poco/DOM/AttrMap.h
vendored
Normal file
65
vendor/POCO/XML/include/Poco/DOM/AttrMap.h
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// AttrMap.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the AttrMap class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_AttrMap_INCLUDED
|
||||
#define DOM_AttrMap_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/NamedNodeMap.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Element;
|
||||
|
||||
|
||||
class XML_API AttrMap: public NamedNodeMap
|
||||
// This implementation of NamedNodeMap is
|
||||
// returned by Element::attributes()
|
||||
{
|
||||
public:
|
||||
Node* getNamedItem(const XMLString& name) const;
|
||||
Node* setNamedItem(Node* arg);
|
||||
Node* removeNamedItem(const XMLString& name);
|
||||
Node* item(unsigned long index) const;
|
||||
unsigned long length() const;
|
||||
|
||||
Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
Node* setNamedItemNS(Node* arg);
|
||||
Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName);
|
||||
|
||||
void autoRelease();
|
||||
|
||||
protected:
|
||||
AttrMap(Element* pElement);
|
||||
~AttrMap();
|
||||
|
||||
private:
|
||||
AttrMap();
|
||||
|
||||
Element* _pElement;
|
||||
|
||||
friend class Element;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_AttrMap_INCLUDED
|
35
vendor/POCO/XML/include/Poco/DOM/AutoPtr.h
vendored
Normal file
35
vendor/POCO/XML/include/Poco/DOM/AutoPtr.h
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// AutoPtr.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Import Poco::AutoPtr into the XML namespace.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMAutoPtr_INCLUDED
|
||||
#define DOM_DOMAutoPtr_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
using Poco::AutoPtr;
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMAutoPtr_INCLUDED
|
84
vendor/POCO/XML/include/Poco/DOM/CDATASection.h
vendored
Normal file
84
vendor/POCO/XML/include/Poco/DOM/CDATASection.h
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// CDATASection.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM CDATASection class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_CDATASection_INCLUDED
|
||||
#define DOM_CDATASection_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/Text.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API CDATASection: public Text
|
||||
/// CDATA sections are used to escape blocks of text containing characters that
|
||||
/// would otherwise be regarded as markup. The only delimiter that is recognized
|
||||
/// in a CDATA section is the "]]>" string that ends the CDATA section. CDATA
|
||||
/// sections cannot be nested. Their primary purpose is for including material
|
||||
/// such as XML fragments, without needing to escape all the delimiters.
|
||||
///
|
||||
/// The DOMString attribute of the Text node holds the text that is contained
|
||||
/// by the CDATA section. Note that this may contain characters that need to
|
||||
/// be escaped outside of CDATA sections and that, depending on the character
|
||||
/// encoding ("charset") chosen for serialization, it may be impossible to write
|
||||
/// out some characters as part of a CDATA section.
|
||||
///
|
||||
/// The CDATASection interface inherits from the CharacterData interface through
|
||||
/// the Text interface. Adjacent CDATASection nodes are not merged by use of
|
||||
/// the normalize method on the Element interface.
|
||||
///
|
||||
/// Note: Because no markup is recognized within a CDATASection, character numeric
|
||||
/// references cannot be used as an escape mechanism when serializing. Therefore,
|
||||
/// action needs to be taken when serializing a CDATASection with a character
|
||||
/// encoding where some of the contained characters cannot be represented. Failure
|
||||
/// to do so would not produce well-formed XML.
|
||||
/// One potential solution in the serialization process is to end the CDATA
|
||||
/// section before the character, output the character using a character reference
|
||||
/// or entity reference, and open a new CDATA section for any further characters
|
||||
/// in the text node. Note, however, that some code conversion libraries at
|
||||
/// the time of writing do not return an error or exception when a character
|
||||
/// is missing from the encoding, making the task of ensuring that data is not
|
||||
/// corrupted on serialization more difficult.
|
||||
{
|
||||
public:
|
||||
// Text
|
||||
Text* splitText(unsigned long offset);
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
CDATASection(Document* pOwnerDocument, const XMLString& data);
|
||||
CDATASection(Document* pOwnerDocument, const CDATASection& sec);
|
||||
~CDATASection();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
static const XMLString NODE_NAME;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_CDATASection_INCLUDED
|
123
vendor/POCO/XML/include/Poco/DOM/CharacterData.h
vendored
Normal file
123
vendor/POCO/XML/include/Poco/DOM/CharacterData.h
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
//
|
||||
// CharacterData.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM CharacterData class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_CharacterData_INCLUDED
|
||||
#define DOM_CharacterData_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractNode.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API CharacterData: public AbstractNode
|
||||
/// The CharacterData interface extends Node with a set of attributes and methods
|
||||
/// for accessing character data in the DOM. For clarity this set is defined
|
||||
/// here rather than on each object that uses these attributes and methods.
|
||||
/// No DOM objects correspond directly to CharacterData, though Text and others
|
||||
/// do inherit the interface from it. All offsets in this interface start from 0.
|
||||
///
|
||||
/// Text strings in the DOM are represented in either UTF-8 (if XML_UNICODE_WCHAR_T is
|
||||
/// not defined) or in UTF-16 (if XML_UNICODE_WCHAR_T is defined).
|
||||
/// Indexing on character data is done in XMLChar units.
|
||||
{
|
||||
public:
|
||||
const XMLString& data() const;
|
||||
/// Returns the character data of the node that
|
||||
/// implements the interface.
|
||||
|
||||
const XMLString& getData() const;
|
||||
/// Returns the character data of the node that
|
||||
/// implements the interface.
|
||||
|
||||
void setData(const XMLString& data);
|
||||
/// Sets the character data of the node that
|
||||
/// implements the interface.
|
||||
|
||||
unsigned long length() const;
|
||||
/// Returns the number of XMLChars that are available
|
||||
/// through getData and substringData. This may have the
|
||||
/// value zero.
|
||||
|
||||
XMLString substringData(unsigned long offset, unsigned long count) const;
|
||||
/// Extracts a range of data from the node.
|
||||
/// If offset and count exceeds the length, then all
|
||||
/// the characters to the end of the data are returned.
|
||||
|
||||
void appendData(const XMLString& arg);
|
||||
/// Append the string to the end of the character data
|
||||
/// of the node.
|
||||
|
||||
void insertData(unsigned long offset, const XMLString& arg);
|
||||
/// Insert a string at the specified character offset.
|
||||
|
||||
void deleteData(unsigned long offset, unsigned long count);
|
||||
/// Remove a range of characters from the node.
|
||||
|
||||
void replaceData(unsigned long offset, unsigned long count, const XMLString& arg);
|
||||
/// Replace the characters starting at the specified character
|
||||
/// offset with the specified string.
|
||||
|
||||
// Non-standard extensions
|
||||
XMLString trimmedData() const;
|
||||
/// Returns the character data of that node with
|
||||
/// all surrounding whitespace removed.
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
// Node
|
||||
const XMLString& getNodeValue() const;
|
||||
void setNodeValue(const XMLString& value);
|
||||
|
||||
protected:
|
||||
CharacterData(Document* pOwnerDocument, const XMLString& data);
|
||||
CharacterData(Document* pOwnerDocument, const CharacterData& data);
|
||||
~CharacterData();
|
||||
|
||||
private:
|
||||
XMLString _data;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& CharacterData::data() const
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& CharacterData::getData() const
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long CharacterData::length() const
|
||||
{
|
||||
return (unsigned long) _data.length();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_CharacterData_INCLUDED
|
55
vendor/POCO/XML/include/Poco/DOM/ChildNodesList.h
vendored
Normal file
55
vendor/POCO/XML/include/Poco/DOM/ChildNodesList.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ChildNodesList.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the ChildNodesList class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_ChildNodesList_INCLUDED
|
||||
#define DOM_ChildNodesList_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/NodeList.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API ChildNodesList: public NodeList
|
||||
// This implementation of NodeList is returned
|
||||
// by Node::getChildNodes().
|
||||
{
|
||||
public:
|
||||
Node* item(unsigned long index) const;
|
||||
unsigned long length() const;
|
||||
|
||||
void autoRelease();
|
||||
|
||||
protected:
|
||||
ChildNodesList(const Node* pParent);
|
||||
~ChildNodesList();
|
||||
|
||||
private:
|
||||
ChildNodesList();
|
||||
|
||||
const Node* _pParent;
|
||||
|
||||
friend class AbstractNode;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_ChildNodesList_INCLUDED
|
58
vendor/POCO/XML/include/Poco/DOM/Comment.h
vendored
Normal file
58
vendor/POCO/XML/include/Poco/DOM/Comment.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// Comment.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Comment class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Comment_INCLUDED
|
||||
#define DOM_Comment_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/CharacterData.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API Comment: public CharacterData
|
||||
/// This interface inherits from CharacterData and represents the content of
|
||||
/// a comment, i.e., all the characters between the starting '<!--' and ending
|
||||
/// '-->'. Note that this is the definition of a comment in XML, and, in practice,
|
||||
/// HTML, although some HTML tools may implement the full SGML comment structure.
|
||||
{
|
||||
public:
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
Comment(Document* pOwnerDocument, const XMLString& data);
|
||||
Comment(Document* pOwnerDocument, const Comment& comment);
|
||||
~Comment();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
static const XMLString NODE_NAME;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Comment_INCLUDED
|
112
vendor/POCO/XML/include/Poco/DOM/DOMBuilder.h
vendored
Normal file
112
vendor/POCO/XML/include/Poco/DOM/DOMBuilder.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// DOMBuilder.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMBuilder
|
||||
//
|
||||
// Definition of the DOMBuilder class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMBuilder_INCLUDED
|
||||
#define DOM_DOMBuilder_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/SAX/ContentHandler.h"
|
||||
#include "Poco/SAX/LexicalHandler.h"
|
||||
#include "Poco/SAX/DTDHandler.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XMLReader;
|
||||
class Document;
|
||||
class InputSource;
|
||||
class AbstractNode;
|
||||
class AbstractContainerNode;
|
||||
class NamePool;
|
||||
|
||||
|
||||
class XML_API DOMBuilder: protected DTDHandler, protected ContentHandler, protected LexicalHandler
|
||||
/// This class builds a tree representation of an
|
||||
/// XML document, according to the W3C Document Object Model, Level 1 and 2
|
||||
/// specifications.
|
||||
///
|
||||
/// The actual XML parsing is done by an XMLReader, which
|
||||
/// must be supplied to the DOMBuilder.
|
||||
{
|
||||
public:
|
||||
DOMBuilder(XMLReader& xmlReader, NamePool* pNamePool = 0);
|
||||
/// Creates a DOMBuilder using the given XMLReader.
|
||||
/// If a NamePool is given, it becomes the Document's NamePool.
|
||||
|
||||
virtual ~DOMBuilder();
|
||||
/// Destroys the DOMBuilder.
|
||||
|
||||
virtual Document* parse(const XMLString& uri);
|
||||
/// Parse an XML document from a location identified by an URI.
|
||||
|
||||
virtual Document* parse(InputSource* pInputSource);
|
||||
/// Parse an XML document from a location identified by an InputSource.
|
||||
|
||||
virtual Document* parseMemoryNP(const char* xml, std::size_t size);
|
||||
/// Parses an XML document from memory.
|
||||
|
||||
protected:
|
||||
// DTDHandler
|
||||
void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId);
|
||||
void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName);
|
||||
|
||||
// ContentHandler
|
||||
void setDocumentLocator(const Locator* loc);
|
||||
void startDocument();
|
||||
void endDocument();
|
||||
void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes);
|
||||
void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname);
|
||||
void characters(const XMLChar ch[], int start, int length);
|
||||
void ignorableWhitespace(const XMLChar ch[], int start, int length);
|
||||
void processingInstruction(const XMLString& target, const XMLString& data);
|
||||
void startPrefixMapping(const XMLString& prefix, const XMLString& uri);
|
||||
void endPrefixMapping(const XMLString& prefix);
|
||||
void skippedEntity(const XMLString& name);
|
||||
|
||||
// LexicalHandler
|
||||
void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId);
|
||||
void endDTD();
|
||||
void startEntity(const XMLString& name);
|
||||
void endEntity(const XMLString& name);
|
||||
void startCDATA();
|
||||
void endCDATA();
|
||||
void comment(const XMLChar ch[], int start, int length);
|
||||
|
||||
void appendNode(AbstractNode* pNode);
|
||||
|
||||
void setupParse();
|
||||
|
||||
private:
|
||||
static const XMLString EMPTY_STRING;
|
||||
|
||||
XMLReader& _xmlReader;
|
||||
NamePool* _pNamePool;
|
||||
Document* _pDocument;
|
||||
AbstractContainerNode* _pParent;
|
||||
AbstractNode* _pPrevious;
|
||||
bool _inCDATA;
|
||||
bool _namespaces;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMBuilder_INCLUDED
|
112
vendor/POCO/XML/include/Poco/DOM/DOMException.h
vendored
Normal file
112
vendor/POCO/XML/include/Poco/DOM/DOMException.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// DOMException.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DOMException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMException_INCLUDED
|
||||
#define DOM_DOMException_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API DOMException: public XMLException
|
||||
/// DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
|
||||
/// when an operation is impossible to perform (either for logical reasons,
|
||||
/// because data is lost, or because the implementation has become unstable).
|
||||
/// In general, DOM methods return specific error values in ordinary processing
|
||||
/// situations, such as out-of-bound errors when using NodeList.
|
||||
///
|
||||
/// Implementations should raise other exceptions under other circumstances.
|
||||
/// For example, implementations should raise an implementation-dependent exception
|
||||
/// if a null argument is passed when null was not expected.
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
INDEX_SIZE_ERR = 1, /// index or size is negative or greater than allowed value
|
||||
DOMSTRING_SIZE_ERR, /// the specified range of text does not fit into a DOMString (not used)
|
||||
HIERARCHY_REQUEST_ERR, /// a node is inserted somewhere it doesn't belong
|
||||
WRONG_DOCUMENT_ERR, /// a node is used in a different document than the one that created it
|
||||
INVALID_CHARACTER_ERR, /// an invalid character is specified (not used)
|
||||
NO_DATA_ALLOWED_ERR, /// data is specified for a node which does not support data
|
||||
NO_MODIFICATION_ALLOWED_ERR, /// an attempt is made to modify an object where modifications are not allowed
|
||||
NOT_FOUND_ERR, /// an attempt was made to reference a node in a context where it does not exist
|
||||
NOT_SUPPORTED_ERR, /// the implementation does not support the type of object requested
|
||||
INUSE_ATTRIBUTE_ERR, /// an attempt is made to add an attribute that is already in use elsewhere
|
||||
INVALID_STATE_ERR, /// a parameter or an operation is not supported by the underlying object
|
||||
SYNTAX_ERR, /// an invalid or illegal string is specified
|
||||
INVALID_MODIFICATION_ERR, /// an attempt is made to modify the type of the underlying object
|
||||
NAMESPACE_ERR, /// an attempt is made to create or change an object in a way which is incorrect with regard to namespaces
|
||||
INVALID_ACCESS_ERR, /// an attempt is made to use an object that is not, or is no longer, usable
|
||||
|
||||
_NUMBER_OF_MESSAGES
|
||||
};
|
||||
|
||||
DOMException(unsigned short code);
|
||||
/// Creates a DOMException with the given error code.
|
||||
|
||||
DOMException(const DOMException& exc);
|
||||
/// Creates a DOMException by copying another one.
|
||||
|
||||
~DOMException() noexcept;
|
||||
/// Destroys the DOMException.
|
||||
|
||||
DOMException& operator = (const DOMException& exc);
|
||||
|
||||
const char* name() const noexcept;
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const noexcept;
|
||||
/// Returns the name of the exception class.
|
||||
|
||||
Poco::Exception* clone() const;
|
||||
/// Creates an exact copy of the exception.
|
||||
|
||||
void rethrow() const;
|
||||
/// (Re)Throws the exception.
|
||||
|
||||
unsigned short code() const;
|
||||
/// Returns the DOM exception code.
|
||||
|
||||
protected:
|
||||
static const std::string& message(unsigned short code);
|
||||
|
||||
private:
|
||||
DOMException();
|
||||
|
||||
unsigned short _code;
|
||||
|
||||
static const std::string MESSAGES[_NUMBER_OF_MESSAGES];
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline unsigned short DOMException::code() const
|
||||
{
|
||||
return _code;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMException_INCLUDED
|
82
vendor/POCO/XML/include/Poco/DOM/DOMImplementation.h
vendored
Normal file
82
vendor/POCO/XML/include/Poco/DOM/DOMImplementation.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// DOMImplementation.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DOMImplementation class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMImplementation_INCLUDED
|
||||
#define DOM_DOMImplementation_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class DocumentType;
|
||||
class Document;
|
||||
class NamePool;
|
||||
|
||||
|
||||
class XML_API DOMImplementation
|
||||
/// The DOMImplementation interface provides a number of methods for
|
||||
/// performing operations that are independent of any particular instance
|
||||
/// of the document object model.
|
||||
/// In this implementation, DOMImplementation is implemented as a singleton.
|
||||
{
|
||||
public:
|
||||
DOMImplementation();
|
||||
/// Creates the DOMImplementation.
|
||||
|
||||
~DOMImplementation();
|
||||
/// Destroys the DOMImplementation.
|
||||
|
||||
bool hasFeature(const XMLString& feature, const XMLString& version) const;
|
||||
/// Tests if the DOM implementation implements a specific feature.
|
||||
///
|
||||
/// The only supported features are "XML", version "1.0" and "Core",
|
||||
/// "Events", "MutationEvents" and "Traversal", version "2.0".
|
||||
|
||||
// DOM Level 2
|
||||
DocumentType* createDocumentType(const XMLString& name, const XMLString& publicId, const XMLString& systemId) const;
|
||||
/// Creates an empty DocumentType node. Entity declarations and notations
|
||||
/// are not made available. Entity reference expansions and default attribute
|
||||
/// additions do not occur.
|
||||
|
||||
Document* createDocument(const XMLString& namespaceURI, const XMLString& qualifiedName, DocumentType* doctype) const;
|
||||
/// Creates an XML Document object of the specified type with its document element.
|
||||
///
|
||||
/// Note: You can also create a Document directly using the new operator.
|
||||
|
||||
static const DOMImplementation& instance();
|
||||
/// Returns a reference to the default DOMImplementation
|
||||
/// object.
|
||||
|
||||
private:
|
||||
static const XMLString FEATURE_XML;
|
||||
static const XMLString FEATURE_CORE;
|
||||
static const XMLString FEATURE_EVENTS;
|
||||
static const XMLString FEATURE_MUTATIONEVENTS;
|
||||
static const XMLString FEATURE_TRAVERSAL;
|
||||
static const XMLString VERSION_1_0;
|
||||
static const XMLString VERSION_2_0;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMImplementation_INCLUDED
|
103
vendor/POCO/XML/include/Poco/DOM/DOMObject.h
vendored
Normal file
103
vendor/POCO/XML/include/Poco/DOM/DOMObject.h
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// DOMObject.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOMObject class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMObject_INCLUDED
|
||||
#define DOM_DOMObject_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API DOMObject
|
||||
/// The base class for all objects in the Document Object Model.
|
||||
///
|
||||
/// DOMObject defines the rules for memory management
|
||||
/// in this implementation of the DOM. Violation of these
|
||||
/// rules, which are outlined in the following, results
|
||||
/// in memory leaks or dangling pointers.
|
||||
///
|
||||
/// Every object created by new or by a factory
|
||||
/// method (for example, Document::create*) must be released
|
||||
/// with a call to release() or autoRelease() when it
|
||||
/// is no longer needed.
|
||||
///
|
||||
/// Every object created by cloning or importing another
|
||||
/// object must be released.
|
||||
/// For every call to duplicate() there must be a matching
|
||||
/// call to release().
|
||||
/// An object obtained via any other way must not be
|
||||
/// released, except ownership of it has been explicitly
|
||||
/// taken with a call to duplicate().
|
||||
///
|
||||
/// While DOMObjects are safe for use in multithreaded programs,
|
||||
/// a DOMObject or one of its subclasses must not be accessed
|
||||
/// from multiple threads simultaneously.
|
||||
{
|
||||
public:
|
||||
DOMObject();
|
||||
/// Creates the DOMObject.
|
||||
/// The object's reference count is initialized to one.
|
||||
|
||||
void duplicate() const;
|
||||
/// Increases the object's reference count.
|
||||
|
||||
void release() const;
|
||||
/// Decreases the object's reference count.
|
||||
/// If the reference count reaches zero,
|
||||
/// the object is deleted.
|
||||
|
||||
virtual void autoRelease() = 0;
|
||||
/// Adds the object to an appropriate
|
||||
/// AutoReleasePool, which is usually the
|
||||
/// AutoReleasePool managed by the Document
|
||||
/// to which this object belongs.
|
||||
|
||||
protected:
|
||||
virtual ~DOMObject();
|
||||
/// Destroys the DOMObject.
|
||||
|
||||
private:
|
||||
DOMObject(const DOMObject&);
|
||||
DOMObject& operator = (const DOMObject&);
|
||||
|
||||
mutable int _rc;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline void DOMObject::duplicate() const
|
||||
{
|
||||
++_rc;
|
||||
}
|
||||
|
||||
|
||||
inline void DOMObject::release() const
|
||||
{
|
||||
if (--_rc == 0)
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMObject_INCLUDED
|
114
vendor/POCO/XML/include/Poco/DOM/DOMParser.h
vendored
Normal file
114
vendor/POCO/XML/include/Poco/DOM/DOMParser.h
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// DOMParser.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMParser
|
||||
//
|
||||
// Definition of the DOMParser class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMParser_INCLUDED
|
||||
#define DOM_DOMParser_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/SAX/SAXParser.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class NamePool;
|
||||
class Document;
|
||||
class InputSource;
|
||||
class EntityResolver;
|
||||
|
||||
|
||||
class XML_API DOMParser
|
||||
/// This is a convenience class that combines a
|
||||
/// DOMBuilder with a SAXParser, with the optional
|
||||
/// support of a WhitespaceFilter.
|
||||
{
|
||||
public:
|
||||
explicit DOMParser(NamePool* pNamePool = 0);
|
||||
/// Creates a new DOMParser.
|
||||
/// If a NamePool is given, it becomes the Document's NamePool.
|
||||
|
||||
explicit DOMParser(unsigned long namePoolSize);
|
||||
/// Creates a new DOMParser, using the given NamePool size.
|
||||
///
|
||||
/// The given namePoolSize should be a suitable prime number,
|
||||
/// e.g. 251, 509, 1021 or 4093, depending on the expected
|
||||
/// size of the document.
|
||||
|
||||
~DOMParser();
|
||||
/// Destroys the DOMParser.
|
||||
|
||||
void setEncoding(const XMLString& encoding);
|
||||
/// Sets the encoding used by the parser if no
|
||||
/// encoding is specified in the XML document.
|
||||
|
||||
const XMLString& getEncoding() const;
|
||||
/// Returns the name of the encoding used by
|
||||
/// the parser if no encoding is specified in
|
||||
/// the XML document.
|
||||
|
||||
void addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding);
|
||||
/// Adds an encoding to the parser.
|
||||
|
||||
void setFeature(const XMLString& name, bool state);
|
||||
/// Set the state of a feature.
|
||||
///
|
||||
/// If a feature is not recognized by the DOMParser, it is
|
||||
/// passed on to the underlying XMLReader.
|
||||
///
|
||||
/// The only currently supported feature is
|
||||
/// http://www.appinf.com/features/no-whitespace-in-element-content
|
||||
/// which, when activated, causes the WhitespaceFilter to
|
||||
/// be used.
|
||||
|
||||
bool getFeature(const XMLString& name) const;
|
||||
/// Look up the value of a feature.
|
||||
///
|
||||
/// If a feature is not recognized by the DOMParser, the
|
||||
/// DOMParser queries the underlying SAXParser for the feature.
|
||||
|
||||
Document* parse(const XMLString& uri);
|
||||
/// Parse an XML document from a location identified by an URI.
|
||||
|
||||
Document* parse(InputSource* pInputSource);
|
||||
/// Parse an XML document from a location identified by an InputSource.
|
||||
|
||||
Document* parseString(const std::string& xml);
|
||||
/// Parse an XML document from a string.
|
||||
|
||||
Document* parseMemory(const char* xml, std::size_t size);
|
||||
/// Parse an XML document from memory.
|
||||
|
||||
EntityResolver* getEntityResolver() const;
|
||||
/// Returns the entity resolver used by the underlying SAXParser.
|
||||
|
||||
void setEntityResolver(EntityResolver* pEntityResolver);
|
||||
/// Sets the entity resolver on the underlying SAXParser.
|
||||
|
||||
static const XMLString FEATURE_FILTER_WHITESPACE;
|
||||
|
||||
private:
|
||||
SAXParser _saxParser;
|
||||
NamePool* _pNamePool;
|
||||
bool _filterWhitespace;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMParser_INCLUDED
|
122
vendor/POCO/XML/include/Poco/DOM/DOMSerializer.h
vendored
Normal file
122
vendor/POCO/XML/include/Poco/DOM/DOMSerializer.h
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// DOMSerializer.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMSerializer
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMSerializer_INCLUDED
|
||||
#define DOM_DOMSerializer_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/SAX/XMLReader.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
class Element;
|
||||
class Text;
|
||||
class Comment;
|
||||
class ProcessingInstruction;
|
||||
class Entity;
|
||||
class CDATASection;
|
||||
class Notation;
|
||||
class Document;
|
||||
class DocumentType;
|
||||
class DocumentFragment;
|
||||
class DeclHandler;
|
||||
class LexicalHandler;
|
||||
|
||||
|
||||
class XML_API DOMSerializer: public XMLReader
|
||||
/// The DOMSerializer serializes a DOM document
|
||||
/// into a sequence of SAX events which are
|
||||
/// reported to the registered SAX event
|
||||
/// handlers.
|
||||
///
|
||||
/// The DOMWriter uses a DOMSerializer with an
|
||||
/// XMLWriter to serialize a DOM document into
|
||||
/// textual XML.
|
||||
{
|
||||
public:
|
||||
DOMSerializer();
|
||||
/// Creates the DOMSerializer.
|
||||
|
||||
~DOMSerializer();
|
||||
/// Destroys the DOMSerializer.
|
||||
|
||||
void serialize(const Node* pNode);
|
||||
/// Serializes a DOM node and its children
|
||||
/// into a sequence of SAX events, which are
|
||||
/// reported to the registered SAX event
|
||||
/// handlers.
|
||||
|
||||
// XMLReader
|
||||
void setEntityResolver(EntityResolver* pResolver);
|
||||
EntityResolver* getEntityResolver() const;
|
||||
void setDTDHandler(DTDHandler* pDTDHandler);
|
||||
DTDHandler* getDTDHandler() const;
|
||||
void setContentHandler(ContentHandler* pContentHandler);
|
||||
ContentHandler* getContentHandler() const;
|
||||
void setErrorHandler(ErrorHandler* pErrorHandler);
|
||||
ErrorHandler* getErrorHandler() const;
|
||||
|
||||
void setFeature(const XMLString& featureId, bool state);
|
||||
bool getFeature(const XMLString& featureId) const;
|
||||
void setProperty(const XMLString& propertyId, const XMLString& value);
|
||||
void setProperty(const XMLString& propertyId, void* value);
|
||||
void* getProperty(const XMLString& propertyId) const;
|
||||
|
||||
protected:
|
||||
void parse(InputSource* pSource);
|
||||
/// The DOMSerializer cannot parse an InputSource,
|
||||
/// so this method simply throws an XMLException when invoked.
|
||||
|
||||
void parse(const XMLString& systemId);
|
||||
/// The DOMSerializer cannot parse from a system identifier,
|
||||
/// so this method simply throws an XMLException when invoked.
|
||||
|
||||
void parseMemoryNP(const char* xml, std::size_t size);
|
||||
/// The DOMSerializer cannot parse from a system identifier,
|
||||
/// so this method simply throws an XMLException when invoked.
|
||||
|
||||
void iterate(const Node* pNode) const;
|
||||
void handleNode(const Node* pNode) const;
|
||||
void handleElement(const Element* pElement) const;
|
||||
void handleCharacterData(const Text* pText) const;
|
||||
void handleComment(const Comment* pComment) const;
|
||||
void handlePI(const ProcessingInstruction* pPI) const;
|
||||
void handleCDATASection(const CDATASection* pCDATA) const;
|
||||
void handleDocument(const Document* pDocument) const;
|
||||
void handleDocumentType(const DocumentType* pDocumentType) const;
|
||||
void handleFragment(const DocumentFragment* pFragment) const;
|
||||
void handleNotation(const Notation* pNotation) const;
|
||||
void handleEntity(const Entity* pEntity) const;
|
||||
|
||||
private:
|
||||
EntityResolver* _pEntityResolver;
|
||||
DTDHandler* _pDTDHandler;
|
||||
ContentHandler* _pContentHandler;
|
||||
ErrorHandler* _pErrorHandler;
|
||||
DeclHandler* _pDeclHandler;
|
||||
LexicalHandler* _pLexicalHandler;
|
||||
|
||||
static const XMLString CDATA;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMSerializer_INCLUDED
|
127
vendor/POCO/XML/include/Poco/DOM/DOMWriter.h
vendored
Normal file
127
vendor/POCO/XML/include/Poco/DOM/DOMWriter.h
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// DOMWriter.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMWriter
|
||||
//
|
||||
// Definition of class DOMWriter.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DOMWriter_INCLUDED
|
||||
#define DOM_DOMWriter_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/XML/XMLStream.h"
|
||||
#include "Poco/TextEncoding.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
class Document;
|
||||
|
||||
|
||||
class XML_API DOMWriter
|
||||
/// The DOMWriter uses a DOMSerializer with an
|
||||
/// XMLWriter to serialize a DOM document into
|
||||
/// textual XML.
|
||||
{
|
||||
public:
|
||||
DOMWriter();
|
||||
/// Creates a DOMWriter.
|
||||
|
||||
~DOMWriter();
|
||||
/// Destroys a DOMWriter.
|
||||
|
||||
void setEncoding(const std::string& encodingName, Poco::TextEncoding& textEncoding);
|
||||
/// Sets the encoding, which will be reflected in the written XML declaration.
|
||||
|
||||
const std::string& getEncoding() const;
|
||||
/// Returns the encoding name set with setEncoding.
|
||||
|
||||
void setOptions(int options);
|
||||
/// Sets options for the internal XMLWriter.
|
||||
///
|
||||
/// See class XMLWriter for available options.
|
||||
|
||||
int getOptions() const;
|
||||
/// Returns the options for the internal XMLWriter.
|
||||
|
||||
void setNewLine(const std::string& newLine);
|
||||
/// Sets the line ending characters for the internal
|
||||
/// XMLWriter. See XMLWriter::setNewLine() for a list
|
||||
/// of supported values.
|
||||
|
||||
const std::string& getNewLine() const;
|
||||
/// Returns the line ending characters used by the
|
||||
/// internal XMLWriter.
|
||||
|
||||
void setIndent(const std::string& indent);
|
||||
/// Sets the string used for one indentation step.
|
||||
///
|
||||
/// The default is a single TAB character.
|
||||
/// The given string should only contain TAB or SPACE
|
||||
/// characters (e.g., a single TAB character, or
|
||||
/// two to four SPACE characters).
|
||||
|
||||
const std::string& getIndent() const;
|
||||
/// Returns the string used for one indentation step.
|
||||
|
||||
void writeNode(XMLByteOutputStream& ostr, const Node* pNode);
|
||||
/// Writes the XML for the given node to the specified stream.
|
||||
|
||||
void writeNode(const std::string& systemId, const Node* pNode);
|
||||
/// Writes the XML for the given node to the file specified in systemId,
|
||||
/// using a standard file output stream (Poco::FileOutputStream).
|
||||
|
||||
private:
|
||||
std::string _encodingName;
|
||||
Poco::TextEncoding* _pTextEncoding;
|
||||
int _options;
|
||||
std::string _newLine;
|
||||
std::string _indent;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const std::string& DOMWriter::getEncoding() const
|
||||
{
|
||||
return _encodingName;
|
||||
}
|
||||
|
||||
|
||||
inline int DOMWriter::getOptions() const
|
||||
{
|
||||
return _options;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& DOMWriter::getNewLine() const
|
||||
{
|
||||
return _newLine;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& DOMWriter::getIndent() const
|
||||
{
|
||||
return _indent;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DOMWriter_INCLUDED
|
67
vendor/POCO/XML/include/Poco/DOM/DTDMap.h
vendored
Normal file
67
vendor/POCO/XML/include/Poco/DOM/DTDMap.h
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// DTDMap.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DTDMap class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DTDMap_INCLUDED
|
||||
#define DOM_DTDMap_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/NamedNodeMap.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class DocumentType;
|
||||
|
||||
|
||||
class XML_API DTDMap: public NamedNodeMap
|
||||
/// This implementation of NamedNodeMap
|
||||
/// is returned by DocumentType::entities()
|
||||
/// and DocumentType::notations().
|
||||
{
|
||||
public:
|
||||
Node* getNamedItem(const XMLString& name) const;
|
||||
Node* setNamedItem(Node* arg);
|
||||
Node* removeNamedItem(const XMLString& name);
|
||||
Node* item(unsigned long index) const;
|
||||
unsigned long length() const;
|
||||
|
||||
Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
Node* setNamedItemNS(Node* arg);
|
||||
Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName);
|
||||
|
||||
void autoRelease();
|
||||
|
||||
protected:
|
||||
DTDMap(const DocumentType* pDocumentType, unsigned short type);
|
||||
~DTDMap();
|
||||
|
||||
private:
|
||||
DTDMap();
|
||||
|
||||
const DocumentType* _pDocumentType;
|
||||
unsigned short _type;
|
||||
|
||||
friend class DocumentType;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DTDMap_INCLUDED
|
285
vendor/POCO/XML/include/Poco/DOM/Document.h
vendored
Normal file
285
vendor/POCO/XML/include/Poco/DOM/Document.h
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// Document.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Document class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Document_INCLUDED
|
||||
#define DOM_Document_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractContainerNode.h"
|
||||
#include "Poco/DOM/DocumentEvent.h"
|
||||
#include "Poco/DOM/Element.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/XML/NamePool.h"
|
||||
#include "Poco/AutoReleasePool.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class NamePool;
|
||||
class DocumentType;
|
||||
class DOMImplementation;
|
||||
class DocumentFragment;
|
||||
class Text;
|
||||
class Comment;
|
||||
class CDATASection;
|
||||
class ProcessingInstruction;
|
||||
class Attr;
|
||||
class EntityReference;
|
||||
class NodeList;
|
||||
class Entity;
|
||||
class Notation;
|
||||
|
||||
|
||||
class XML_API Document: public AbstractContainerNode, public DocumentEvent
|
||||
/// The Document interface represents the entire HTML or XML document. Conceptually,
|
||||
/// it is the root of the document tree, and provides the primary access to the
|
||||
/// document's data.
|
||||
///
|
||||
/// Since elements, text nodes, comments, processing instructions, etc. cannot exist
|
||||
/// outside the context of a Document, the Document interface also contains the
|
||||
/// factory methods needed to create these objects. The Node objects created have a
|
||||
/// ownerDocument attribute which associates them with the Document within whose
|
||||
/// context they were created.
|
||||
{
|
||||
public:
|
||||
using AutoReleasePool = Poco::AutoReleasePool<DOMObject>;
|
||||
|
||||
explicit Document(NamePool* pNamePool = 0);
|
||||
/// Creates a new document. If pNamePool == 0, the document
|
||||
/// creates its own name pool, otherwise it uses the given name pool.
|
||||
/// Sharing a name pool makes sense for documents containing instances
|
||||
/// of the same schema, thus reducing memory usage.
|
||||
|
||||
explicit Document(unsigned long namePoolSize);
|
||||
/// Creates a new document using a name pool with the given size, which
|
||||
/// should be a prime number (e.g., 251, 509, 1021, 4093).
|
||||
|
||||
Document(DocumentType* pDocumentType, NamePool* pNamePool = 0);
|
||||
/// Creates a new document. If pNamePool == 0, the document
|
||||
/// creates its own name pool, otherwise it uses the given name pool.
|
||||
/// Sharing a name pool makes sense for documents containing instances
|
||||
/// of the same schema, thus reducing memory usage.
|
||||
|
||||
Document(DocumentType* pDocumentType, unsigned long namePoolSize);
|
||||
/// Creates a new document using a name pool with the given size, which
|
||||
/// should be a prime number (e.g., 251, 509, 1021, 4093).
|
||||
|
||||
NamePool& namePool();
|
||||
/// Returns a pointer to the documents Name Pool.
|
||||
|
||||
AutoReleasePool& autoReleasePool();
|
||||
/// Returns a pointer to the documents Auto Release Pool.
|
||||
|
||||
void collectGarbage();
|
||||
/// Releases all objects in the Auto Release Pool.
|
||||
|
||||
void suspendEvents();
|
||||
/// Suspends all events until resumeEvents() is called.
|
||||
|
||||
void resumeEvents();
|
||||
/// Resumes all events suspended with suspendEvent();
|
||||
|
||||
bool eventsSuspended() const;
|
||||
/// Returns true if events are suspended.
|
||||
|
||||
bool events() const;
|
||||
/// Returns true if events are not suspended.
|
||||
|
||||
const DocumentType* doctype() const;
|
||||
/// The Document Type Declaration (see DocumentType) associated with this document.
|
||||
/// For HTML documents as well as XML documents without a document type declaration
|
||||
/// this returns null. The DOM Level 1 does not support editing the Document
|
||||
/// Type Declaration. docType cannot be altered in any way, including through
|
||||
/// the use of methods inherited from the Node interface, such as insertNode
|
||||
/// or removeNode.
|
||||
|
||||
const DOMImplementation& implementation() const;
|
||||
/// The DOMImplementation object that handles this document. A DOM application
|
||||
/// may use objects from multiple implementations.
|
||||
|
||||
Element* documentElement() const;
|
||||
/// This is a convenience attribute that allows direct access to the child node
|
||||
/// that is the root element of the document. For HTML documents, this is the
|
||||
/// element with the tagName "HTML".
|
||||
|
||||
Element* createElement(const XMLString& tagName) const;
|
||||
/// Creates an element of the type specified. Note that the instance returned
|
||||
/// implements the Element interface, so attributes can be specified directly
|
||||
/// on the returned object.
|
||||
///
|
||||
/// In addition, if there are known attributes with default values, Attr nodes
|
||||
/// representing them are automatically created and attached to the element.
|
||||
|
||||
DocumentFragment* createDocumentFragment() const;
|
||||
/// Creates an empty DocumentFragment object.
|
||||
|
||||
Text* createTextNode(const XMLString& data) const;
|
||||
/// Creates a text node given the specified string.
|
||||
|
||||
Comment* createComment(const XMLString& data) const;
|
||||
/// Creates a comment node given the specified string.
|
||||
|
||||
CDATASection* createCDATASection(const XMLString& data) const;
|
||||
/// Creates a CDATASection node whose value is the specified string.
|
||||
|
||||
ProcessingInstruction* createProcessingInstruction(const XMLString& target, const XMLString& data) const;
|
||||
/// Creates a ProcessingInstruction node given the specified target and data strings.
|
||||
|
||||
Attr* createAttribute(const XMLString& name) const;
|
||||
/// Creates an Attr of the given name. Note that the Attr instance can then
|
||||
/// be set on an Element using the setAttributeNode method.
|
||||
|
||||
EntityReference* createEntityReference(const XMLString& name) const;
|
||||
/// Creates an EntityReference object. In addition, if the referenced entity
|
||||
/// is known, the child list of the EntityReference node is made the same as
|
||||
/// that of the corresponding Entity node.
|
||||
|
||||
NodeList* getElementsByTagName(const XMLString& name) const;
|
||||
/// Returns a NodeList of all Elements with a given tag name in the order
|
||||
/// in which they would be encountered in a preorder traversal of the
|
||||
/// document tree.
|
||||
///
|
||||
/// The returned NodeList must be released with a call to release()
|
||||
/// when no longer needed.
|
||||
|
||||
// DOM Level 2
|
||||
Node* importNode(Node* importedNode, bool deep);
|
||||
/// Imports a node from another document to this document. The returned node
|
||||
/// has no parent; (parentNode is null). The source node is not altered or removed
|
||||
/// from the original document; this method creates a new copy of the source
|
||||
/// node.
|
||||
/// For all nodes, importing a node creates a node object owned by the importing
|
||||
/// document, with attribute values identical to the source node's nodeName
|
||||
/// and nodeType, plus the attributes related to namespaces (prefix, localName,
|
||||
/// and namespaceURI). As in the cloneNode operation on a Node, the source node
|
||||
/// is not altered.
|
||||
/// Additional information is copied as appropriate to the nodeType, attempting
|
||||
/// to mirror the behavior expected if a fragment of XML or HTML source was
|
||||
/// copied from one document to another, recognizing that the two documents
|
||||
/// may have different DTDs in the XML case.
|
||||
|
||||
Element* createElementNS(const XMLString& namespaceURI, const XMLString& qualifiedName) const;
|
||||
/// Creates an element of the given qualified name and namespace URI.
|
||||
|
||||
Attr* createAttributeNS(const XMLString& namespaceURI, const XMLString& qualifiedName) const;
|
||||
/// Creates an attribute of the given qualified name and namespace URI.
|
||||
|
||||
NodeList* getElementsByTagNameNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
/// Returns a NodeList of all the Elements with a given local name and
|
||||
/// namespace URI in the order in which they are encountered in a
|
||||
/// preorder traversal of the Document tree.
|
||||
|
||||
Element* getElementById(const XMLString& elementId) const;
|
||||
/// Returns the Element whose ID is given by elementId. If no such
|
||||
/// element exists, returns null. Behavior is not defined if more
|
||||
/// than one element has this ID.
|
||||
///
|
||||
/// Note: The DOM implementation must have information that says
|
||||
/// which attributes are of type ID. Attributes with the name "ID"
|
||||
/// are not of type ID unless so defined. Implementations that do
|
||||
/// not know whether attributes are of type ID or not are expected to
|
||||
/// return null. This implementation therefore returns null.
|
||||
///
|
||||
/// See also the non-standard two argument variant of getElementById()
|
||||
/// and getElementByIdNS().
|
||||
|
||||
// DocumentEvent
|
||||
Event* createEvent(const XMLString& eventType) const;
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
// EventTarget
|
||||
bool dispatchEvent(Event* evt);
|
||||
|
||||
// Extensions
|
||||
Entity* createEntity(const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName) const;
|
||||
/// Creates an Entity with the given name, publicId, systemId and notationName.
|
||||
///
|
||||
/// This method is not part of the W3C Document Object Model.
|
||||
|
||||
Notation* createNotation(const XMLString& name, const XMLString& publicId, const XMLString& systemId) const;
|
||||
/// Creates a Notation with the given name, publicId and systemId.
|
||||
///
|
||||
/// This method is not part of the W3C Document Object Model.
|
||||
|
||||
Element* getElementById(const XMLString& elementId, const XMLString& idAttribute) const;
|
||||
/// Returns the first Element whose ID attribute (given in idAttribute)
|
||||
/// has the given elementId. If no such element exists, returns null.
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
Element* getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const;
|
||||
/// Returns the first Element whose ID attribute (given in idAttributeURI and idAttributeLocalName)
|
||||
/// has the given elementId. If no such element exists, returns null.
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
protected:
|
||||
~Document();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
DocumentType* getDoctype();
|
||||
void setDoctype(DocumentType* pDoctype);
|
||||
|
||||
private:
|
||||
DocumentType* _pDocumentType;
|
||||
NamePool* _pNamePool;
|
||||
AutoReleasePool _autoReleasePool;
|
||||
int _eventSuspendLevel;
|
||||
|
||||
static const XMLString NODE_NAME;
|
||||
|
||||
friend class DOMBuilder;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline NamePool& Document::namePool()
|
||||
{
|
||||
return *_pNamePool;
|
||||
}
|
||||
|
||||
|
||||
inline Document::AutoReleasePool& Document::autoReleasePool()
|
||||
{
|
||||
return _autoReleasePool;
|
||||
}
|
||||
|
||||
|
||||
inline const DocumentType* Document::doctype() const
|
||||
{
|
||||
return _pDocumentType;
|
||||
}
|
||||
|
||||
|
||||
inline DocumentType* Document::getDoctype()
|
||||
{
|
||||
return _pDocumentType;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Document_INCLUDED
|
65
vendor/POCO/XML/include/Poco/DOM/DocumentEvent.h
vendored
Normal file
65
vendor/POCO/XML/include/Poco/DOM/DocumentEvent.h
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// DocumentEvent.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentEvent interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DocumentEvent_INCLUDED
|
||||
#define DOM_DocumentEvent_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Event;
|
||||
|
||||
|
||||
class XML_API DocumentEvent
|
||||
/// The DocumentEvent interface provides a mechanism by which the user can create
|
||||
/// an Event of a type supported by the implementation. It is expected that
|
||||
/// the DocumentEvent interface will be implemented on the same object which
|
||||
/// implements the Document interface in an implementation which supports the
|
||||
/// Event model.
|
||||
{
|
||||
public:
|
||||
virtual Event* createEvent(const XMLString& eventType) const = 0;
|
||||
/// Creates an event of the specified type.
|
||||
///
|
||||
/// The eventType parameter specifies the type of Event interface to be created.
|
||||
/// If the Event interface specified is supported by the implementation this
|
||||
/// method will return a new Event of the interface type requested. If the Event
|
||||
/// is to be dispatched via the dispatchEvent method the appropriate event init
|
||||
/// method must be called after creation in order to initialize the Event's
|
||||
/// values. As an example, a user wishing to synthesize some kind of UIEvent
|
||||
/// would call createEvent with the parameter "UIEvents". The initUIEvent method
|
||||
/// could then be called on the newly created UIEvent to set the specific type
|
||||
/// of UIEvent to be dispatched and set its context information.
|
||||
/// The createEvent method is used in creating Events when it is either inconvenient
|
||||
/// or unnecessary for the user to create an Event themselves. In cases where
|
||||
/// the implementation provided Event is insufficient, users may supply their
|
||||
/// own Event implementations for use with the dispatchEvent method.
|
||||
|
||||
protected:
|
||||
virtual ~DocumentEvent();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DocumentEvent_INCLUDED
|
84
vendor/POCO/XML/include/Poco/DOM/DocumentFragment.h
vendored
Normal file
84
vendor/POCO/XML/include/Poco/DOM/DocumentFragment.h
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// DocumentFragment.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentFragment class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DocumentFragment_INCLUDED
|
||||
#define DOM_DocumentFragment_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractContainerNode.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API DocumentFragment: public AbstractContainerNode
|
||||
/// DocumentFragment is a "lightweight" or "minimal" Document object. It is
|
||||
/// very common to want to be able to extract a portion of a document's tree
|
||||
/// or to create a new fragment of a document. Imagine implementing a user command
|
||||
/// like cut or rearranging a document by moving fragments around. It is desirable
|
||||
/// to have an object which can hold such fragments and it is quite natural
|
||||
/// to use a Node for this purpose. While it is true that a Document object
|
||||
/// could fulfill this role, a Document object can potentially be a heavyweight
|
||||
/// object, depending on the underlying implementation. What is really needed
|
||||
/// for this is a very lightweight object. DocumentFragment is such an object.
|
||||
///
|
||||
/// Furthermore, various operations -- such as inserting nodes as children of
|
||||
/// another Node -- may take DocumentFragment objects as arguments; this results
|
||||
/// in all the child nodes of the DocumentFragment being moved to the child
|
||||
/// list of this node.
|
||||
///
|
||||
/// The children of a DocumentFragment node are zero or more nodes representing
|
||||
/// the tops of any sub-trees defining the structure of the document. DocumentFragment
|
||||
/// nodes do not need to be well-formed XML documents (although they do need
|
||||
/// to follow the rules imposed upon well-formed XML parsed entities, which
|
||||
/// can have multiple top nodes). For example, a DocumentFragment might have
|
||||
/// only one child and that child node could be a Text node. Such a structure
|
||||
/// model represents neither an HTML document nor a well-formed XML document.
|
||||
///
|
||||
/// When a DocumentFragment is inserted into a Document (or indeed any other
|
||||
/// Node that may take children) the children of the DocumentFragment and not
|
||||
/// the DocumentFragment itself are inserted into the Node. This makes the DocumentFragment
|
||||
/// very useful when the user wishes to create nodes that are siblings; the
|
||||
/// DocumentFragment acts as the parent of these nodes so that the user can
|
||||
/// use the standard methods from the Node interface, such as insertBefore and
|
||||
/// appendChild.
|
||||
{
|
||||
public:
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
DocumentFragment(Document* pOwnerDocument);
|
||||
DocumentFragment(Document* pOwnerDocument, const DocumentFragment& fragment);
|
||||
~DocumentFragment();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
static const XMLString NODE_NAME;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DocumentFragment_INCLUDED
|
125
vendor/POCO/XML/include/Poco/DOM/DocumentType.h
vendored
Normal file
125
vendor/POCO/XML/include/Poco/DOM/DocumentType.h
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// DocumentType.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM DocumentType class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_DocumentType_INCLUDED
|
||||
#define DOM_DocumentType_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractContainerNode.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class NamedNodeMap;
|
||||
|
||||
|
||||
class XML_API DocumentType: public AbstractContainerNode
|
||||
/// Each Document has a doctype attribute whose value is either null or a DocumentType
|
||||
/// object. The DocumentType interface in the DOM Level 1 Core provides an
|
||||
/// interface to the list of entities that are defined for the document, and
|
||||
/// little else because the effect of namespaces and the various XML scheme
|
||||
/// efforts on DTD representation are not clearly understood as of this writing.
|
||||
///
|
||||
/// The DOM Level 1 doesn't support editing DocumentType nodes.
|
||||
{
|
||||
public:
|
||||
const XMLString& name() const;
|
||||
/// The name of the DTD; i.e., the name immediately following the
|
||||
/// DOCTYPE keyword.
|
||||
|
||||
NamedNodeMap* entities() const;
|
||||
/// A NamedNodeMap containing the general entities,
|
||||
/// both external and internal, declared in the DTD.
|
||||
/// Duplicates are discarded.
|
||||
///
|
||||
/// Note: In this implementation, only the
|
||||
/// external entities are reported.
|
||||
/// Every node in this map also implements the
|
||||
/// Entity interface.
|
||||
///
|
||||
/// The returned NamedNodeMap must be released with a call
|
||||
/// to release() when no longer needed.
|
||||
|
||||
NamedNodeMap* notations() const;
|
||||
/// A NamedNodeMap containing the notations declared in the DTD. Duplicates
|
||||
/// are discarded. Every node in this map also implements the Notation interface.
|
||||
/// The DOM Level 1 does not support editing notations, therefore notations
|
||||
/// cannot be altered in any way.
|
||||
///
|
||||
/// The returned NamedNodeMap must be released with a call
|
||||
/// to release() when no longer needed.
|
||||
|
||||
// DOM Level 2
|
||||
const XMLString& publicId() const;
|
||||
/// Returns the public identifier of the external DTD subset.
|
||||
|
||||
const XMLString& systemId() const;
|
||||
/// Returns the system identifier of the external DTD subset.
|
||||
|
||||
const XMLString& internalSubset() const;
|
||||
/// Returns the internal DTD subset. This implementation
|
||||
/// returns an empty string.
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
DocumentType(Document* pOwner, const XMLString& name, const XMLString& publicId, const XMLString& systemId);
|
||||
DocumentType(Document* pOwner, const DocumentType& dt);
|
||||
~DocumentType();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
XMLString _name;
|
||||
XMLString _publicId;
|
||||
XMLString _systemId;
|
||||
|
||||
friend class DOMImplementation;
|
||||
friend class Document;
|
||||
friend class DOMBuilder;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& DocumentType::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& DocumentType::publicId() const
|
||||
{
|
||||
return _publicId;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& DocumentType::systemId() const
|
||||
{
|
||||
return _systemId;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_DocumentType_INCLUDED
|
219
vendor/POCO/XML/include/Poco/DOM/Element.h
vendored
Normal file
219
vendor/POCO/XML/include/Poco/DOM/Element.h
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
//
|
||||
// Element.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Element class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Element_INCLUDED
|
||||
#define DOM_Element_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractContainerNode.h"
|
||||
#include "Poco/XML/Name.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Attr;
|
||||
class NodeList;
|
||||
class Document;
|
||||
|
||||
|
||||
class XML_API Element: public AbstractContainerNode
|
||||
/// The Element interface represents an element in an XML document.
|
||||
/// Elements may have attributes associated with them; since the Element interface
|
||||
/// inherits from Node, the generic Node interface attribute attributes may
|
||||
/// be used to retrieve the set of all attributes for an element. There are
|
||||
/// methods on the Element interface to retrieve either an Attr object by name
|
||||
/// or an attribute value by name. In XML, where an attribute value may contain
|
||||
/// entity references, an Attr object should be retrieved to examine the possibly
|
||||
/// fairly complex sub-tree representing the attribute value.
|
||||
{
|
||||
public:
|
||||
const XMLString& tagName() const;
|
||||
/// Returns the name of the element.
|
||||
///
|
||||
/// For example, in
|
||||
///
|
||||
/// <elementExample id="demo">
|
||||
/// ...
|
||||
/// </elementExample>
|
||||
///
|
||||
/// tagName has the value "elementExample". Note that this is case-preserving in XML,
|
||||
/// as are all of the operations of the DOM.
|
||||
|
||||
const XMLString& getAttribute(const XMLString& name) const;
|
||||
/// Retrieves an attribute value by name.
|
||||
///
|
||||
/// Returns the attribute's value, if the attribute
|
||||
/// exists, or an empty string otherwise.
|
||||
|
||||
void setAttribute(const XMLString& name, const XMLString& value);
|
||||
/// Adds a new attribute. If an attribute with that name is already present
|
||||
/// in the element, its value is changed to be that of the value parameter.
|
||||
/// This value is a simple string; it is not parsed as it is being set. So any
|
||||
/// markup (such as syntax to be recognized as an entity reference) is treated
|
||||
/// as literal text, and needs to be appropriately escaped by the implementation
|
||||
/// when it is written out.
|
||||
|
||||
void removeAttribute(const XMLString& name);
|
||||
/// Removes an attribute by name.
|
||||
|
||||
Attr* getAttributeNode(const XMLString& name) const;
|
||||
/// Retrieves an Attr node by name.
|
||||
|
||||
Attr* setAttributeNode(Attr* newAttr);
|
||||
/// Adds a new attribute. If an attribute with that name is already
|
||||
/// present in the element, it is replaced by the new one.
|
||||
|
||||
Attr* addAttributeNodeNP(Attr* oldAttr, Attr* newAttr);
|
||||
/// For internal use only.
|
||||
/// Adds a new attribute after oldAttr.
|
||||
/// If oldAttr is 0, newAttr is set as first attribute.
|
||||
/// Returns newAttr.
|
||||
/// Does not fire any events.
|
||||
|
||||
Attr* removeAttributeNode(Attr* oldAttr);
|
||||
/// Removes the specified attribute.
|
||||
|
||||
NodeList* getElementsByTagName(const XMLString& name) const;
|
||||
/// Returns a NodeList of all descendant elements with a given tag
|
||||
/// name, in the order in which they would be encountered in a
|
||||
/// preorder traversal of the Element tree.
|
||||
///
|
||||
/// The special name "*" matches all tags.
|
||||
///
|
||||
/// The returned NodeList must be released with a call
|
||||
/// to release() when no longer needed.
|
||||
|
||||
void normalize();
|
||||
/// Puts all Text nodes in the full depth of the sub-tree underneath this Element,
|
||||
/// including attribute nodes, into a "normal" form where only markup (e.g.,
|
||||
/// tags, comments, processing instructions, CDATA sections, and entity references)
|
||||
/// separates Text nodes, i.e., there are no adjacent Text nodes. This can be
|
||||
/// used to ensure that the DOM view of a document is the same as if it were
|
||||
/// saved and re-loaded, and is useful when operations (such as XPointer
|
||||
/// lookups) that depend on a particular document tree structure are to be used.
|
||||
///
|
||||
/// Note: In cases where the document contains CDATASections, the normalize
|
||||
/// operation alone may not be sufficient, since XPointers do not differentiate
|
||||
/// between Text nodes and CDATASection nodes.
|
||||
|
||||
// DOM Level 2
|
||||
const XMLString& getAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
/// Retrieves an attribute value by name.
|
||||
///
|
||||
/// Returns the attribute's value, if the attribute
|
||||
/// exists, or an empty string otherwise.
|
||||
|
||||
void setAttributeNS(const XMLString& namespaceURI, const XMLString& qualifiedName, const XMLString& value);
|
||||
/// Adds a new attribute. If an attribute with that name
|
||||
/// is already present in the element, its value is changed
|
||||
/// to be that of the value parameter.
|
||||
|
||||
void removeAttributeNS(const XMLString& namespaceURI, const XMLString& localName);
|
||||
/// Removes an attribute by name.
|
||||
|
||||
Attr* getAttributeNodeNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
/// Retrieves an Attr node by name.
|
||||
|
||||
Attr* setAttributeNodeNS(Attr* newAttr);
|
||||
/// Adds a new attribute. If an attribute with that name is already
|
||||
/// present in the element, it is replaced by the new one.
|
||||
|
||||
bool hasAttribute(const XMLString& name) const;
|
||||
/// Returns true if and only if the element has the specified attribute.
|
||||
|
||||
bool hasAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
/// Returns true if and only if the element has the specified attribute.
|
||||
|
||||
NodeList* getElementsByTagNameNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
/// Returns a NodeList of all the descendant Elements with a given local name and namespace URI
|
||||
/// in the order in which they are encountered in a preorder traversal of this Element tree.
|
||||
///
|
||||
/// The special value "*" matches all namespaces, or local names respectively.
|
||||
///
|
||||
/// The returned NodeList must be released with a call
|
||||
/// to release() when no longer needed.
|
||||
|
||||
const XMLString& namespaceURI() const;
|
||||
XMLString prefix() const;
|
||||
const XMLString& localName() const;
|
||||
bool hasAttributes() const;
|
||||
XMLString innerText() const;
|
||||
|
||||
Element* getChildElement(const XMLString& name) const;
|
||||
/// Returns the first child element with the given name, or null
|
||||
/// if such an element does not exist.
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
Element* getChildElementNS(const XMLString& namespaceURI, const XMLString& localName) const;
|
||||
/// Returns the first child element with the given namespaceURI and localName,
|
||||
/// or null if such an element does not exist.
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
Element* getElementById(const XMLString& elementId, const XMLString& idAttribute) const;
|
||||
/// Returns the first Element whose ID attribute (given in idAttribute)
|
||||
/// has the given elementId. If no such element exists, returns null.
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
Element* getElementByIdNS(const XMLString& elementId, const XMLString& idAttributeURI, const XMLString& idAttributeLocalName) const;
|
||||
/// Returns the first Element whose ID attribute (given in idAttributeURI and idAttributeLocalName)
|
||||
/// has the given elementId. If no such element exists, returns null.
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
NamedNodeMap* attributes() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
Element(Document* pOwnerDocument, const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname);
|
||||
Element(Document* pOwnerDocument, const Element& elem);
|
||||
~Element();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
void dispatchNodeRemovedFromDocument();
|
||||
void dispatchNodeInsertedIntoDocument();
|
||||
|
||||
private:
|
||||
const Name& _name;
|
||||
Attr* _pFirstAttr;
|
||||
|
||||
friend class Attr;
|
||||
friend class Document;
|
||||
friend class AttrMap;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Element::tagName() const
|
||||
{
|
||||
return _name.qname();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Element_INCLUDED
|
86
vendor/POCO/XML/include/Poco/DOM/ElementsByTagNameList.h
vendored
Normal file
86
vendor/POCO/XML/include/Poco/DOM/ElementsByTagNameList.h
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// ElementsByTagNameList.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the ElementsByTagNameList and ElementsByTagNameListNS classes.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_ElementsByTagNameList_INCLUDED
|
||||
#define DOM_ElementsByTagNameList_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/NodeList.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API ElementsByTagNameList: public NodeList
|
||||
// This implementation of NodeList is returned
|
||||
// by Document::getElementsByTagName() and
|
||||
// Element::getElementsByTagName().
|
||||
{
|
||||
public:
|
||||
Node* item(unsigned long index) const;
|
||||
unsigned long length() const;
|
||||
void autoRelease();
|
||||
|
||||
protected:
|
||||
ElementsByTagNameList(const Node* pParent, const XMLString& name);
|
||||
~ElementsByTagNameList();
|
||||
|
||||
Node* find(const Node* pParent, unsigned long index) const;
|
||||
|
||||
const Node* _pParent;
|
||||
XMLString _name;
|
||||
mutable unsigned long _count;
|
||||
|
||||
friend class AbstractContainerNode;
|
||||
friend class Element;
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
class XML_API ElementsByTagNameListNS: public NodeList
|
||||
// This implementation of NodeList is returned
|
||||
// by Document::getElementsByTagNameNS() and
|
||||
// Element::getElementsByTagNameNS().
|
||||
{
|
||||
public:
|
||||
virtual Node* item(unsigned long index) const;
|
||||
virtual unsigned long length() const;
|
||||
virtual void autoRelease();
|
||||
|
||||
protected:
|
||||
ElementsByTagNameListNS(const Node* pParent, const XMLString& namespaceURI, const XMLString& localName);
|
||||
~ElementsByTagNameListNS();
|
||||
|
||||
Node* find(const Node* pParent, unsigned long index) const;
|
||||
|
||||
const Node* _pParent;
|
||||
XMLString _localName;
|
||||
XMLString _namespaceURI;
|
||||
mutable unsigned long _count;
|
||||
|
||||
friend class AbstractContainerNode;
|
||||
friend class Element;
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_ElementsByTagNameList_INCLUDED
|
126
vendor/POCO/XML/include/Poco/DOM/Entity.h
vendored
Normal file
126
vendor/POCO/XML/include/Poco/DOM/Entity.h
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// Entity.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Entity class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Entity_INCLUDED
|
||||
#define DOM_Entity_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractContainerNode.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API Entity: public AbstractContainerNode
|
||||
/// This interface represents an entity, either parsed or unparsed, in an XML
|
||||
/// document. Note that this models the entity itself not the entity declaration.
|
||||
/// Entity declaration modeling has been left for a later Level of the DOM
|
||||
/// specification.
|
||||
///
|
||||
/// The nodeName attribute that is inherited from Node contains the name of
|
||||
/// the entity.
|
||||
///
|
||||
/// An XML processor may choose to completely expand entities before the structure
|
||||
/// model is passed to the DOM; in this case there will be no EntityReference
|
||||
/// nodes in the document tree.
|
||||
///
|
||||
/// XML does not mandate that a non-validating XML processor read and process
|
||||
/// entity declarations made in the external subset or declared in external
|
||||
/// parameter entities. This means that parsed entities declared in the external
|
||||
/// subset need not be expanded by some classes of applications, and that the
|
||||
/// replacement value of the entity may not be available. When the replacement
|
||||
/// value is available, the corresponding Entity node's child list represents
|
||||
/// the structure of that replacement text. Otherwise, the child list is empty.
|
||||
///
|
||||
/// The resolution of the children of the Entity (the replacement value) may
|
||||
/// be lazily evaluated; actions by the user (such as calling the childNodes
|
||||
/// method on the Entity Node) are assumed to trigger the evaluation.
|
||||
///
|
||||
/// The DOM Level 1 does not support editing Entity nodes; if a user wants to
|
||||
/// make changes to the contents of an Entity, every related EntityReference
|
||||
/// node has to be replaced in the structure model by a clone of the Entity's
|
||||
/// contents, and then the desired changes must be made to each of those clones
|
||||
/// instead. Entity nodes and all their descendants are readonly.
|
||||
///
|
||||
/// An Entity node does not have any parent.
|
||||
{
|
||||
public:
|
||||
const XMLString& publicId() const;
|
||||
/// Returns the public identifier associated with
|
||||
/// the entity, if specified. If the public identifier
|
||||
/// was not specified, this is the empty string.
|
||||
|
||||
const XMLString& systemId() const;
|
||||
/// Returns the system identifier associated with
|
||||
/// the entity, if specified. If the system identifier
|
||||
/// was not specified, this is the empty string.
|
||||
|
||||
const XMLString& notationName() const;
|
||||
/// Returns, for unparsed entities, the name of the
|
||||
/// notation for the entity. For parsed entities, this
|
||||
/// is the empty string.
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
Entity(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId, const XMLString& notationName);
|
||||
Entity(Document* pOwnerDocument, const Entity& entity);
|
||||
~Entity();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
static const XMLString NODE_NAME;
|
||||
|
||||
XMLString _name;
|
||||
XMLString _publicId;
|
||||
XMLString _systemId;
|
||||
XMLString _notationName;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Entity::publicId() const
|
||||
{
|
||||
return _publicId;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& Entity::systemId() const
|
||||
{
|
||||
return _systemId;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& Entity::notationName() const
|
||||
{
|
||||
return _notationName;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Entity_INCLUDED
|
73
vendor/POCO/XML/include/Poco/DOM/EntityReference.h
vendored
Normal file
73
vendor/POCO/XML/include/Poco/DOM/EntityReference.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// EntityReference.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM EntityReference class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_EntityReference_INCLUDED
|
||||
#define DOM_EntityReference_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractNode.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API EntityReference: public AbstractNode
|
||||
/// EntityReference objects may be inserted into the structure model when an
|
||||
/// entity reference is in the source document, or when the user wishes to insert
|
||||
/// an entity reference. Note that character references and references to predefined
|
||||
/// entities are considered to be expanded by the HTML or XML processor so that
|
||||
/// characters are represented by their Unicode equivalent rather than by an
|
||||
/// entity reference. Moreover, the XML processor may completely expand references
|
||||
/// to entities while building the structure model, instead of providing EntityReference
|
||||
/// objects. If it does provide such objects, then for a given EntityReference
|
||||
/// node, it may be that there is no Entity node representing the referenced
|
||||
/// entity. If such an Entity exists, then the child list of the EntityReference
|
||||
/// node is the same as that of the Entity node.
|
||||
///
|
||||
/// As for Entity nodes, EntityReference nodes and all their descendants are
|
||||
/// readonly.
|
||||
///
|
||||
/// The resolution of the children of the EntityReference (the replacement value
|
||||
/// of the referenced Entity) may be lazily evaluated; actions by the user (such
|
||||
/// as calling the childNodes method on the EntityReference node) are assumed
|
||||
/// to trigger the evaluation.
|
||||
{
|
||||
public:
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
EntityReference(Document* pOwnerDocument, const XMLString& name);
|
||||
EntityReference(Document* pOwnerDocument, const EntityReference& ref);
|
||||
~EntityReference();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
XMLString _name;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_EntityReference_INCLUDED
|
209
vendor/POCO/XML/include/Poco/DOM/Event.h
vendored
Normal file
209
vendor/POCO/XML/include/Poco/DOM/Event.h
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
//
|
||||
// Event.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM Event class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Event_INCLUDED
|
||||
#define DOM_Event_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/DOM/DOMObject.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class EventTarget;
|
||||
class Document;
|
||||
|
||||
|
||||
class XML_API Event: public DOMObject
|
||||
/// The Event interface is used to provide contextual information about an event
|
||||
/// to the handler processing the event. An object which implements the Event
|
||||
/// interface is generally passed as the first parameter to an event handler.
|
||||
/// More specific context information is passed to event handlers by deriving
|
||||
/// additional interfaces from Event which contain information directly relating
|
||||
/// to the type of event they accompany. These derived interfaces are also implemented
|
||||
/// by the object passed to the event listener.
|
||||
{
|
||||
public:
|
||||
enum PhaseType
|
||||
{
|
||||
CAPTURING_PHASE = 1, /// The event is currently being evaluated at the target EventTarget.
|
||||
AT_TARGET = 2, /// The current event phase is the bubbling phase.
|
||||
BUBBLING_PHASE = 3 /// The current event phase is the capturing phase.
|
||||
};
|
||||
|
||||
const XMLString& type() const;
|
||||
/// The name of the event (case-insensitive). The name must be an XML name.
|
||||
|
||||
EventTarget* target() const;
|
||||
/// Used to indicate the EventTarget to which the event was originally dispatched.
|
||||
|
||||
EventTarget* currentTarget() const;
|
||||
/// Used to indicate the EventTarget whose EventListeners are currently being
|
||||
/// processed. This is particularly useful during capturing and bubbling.
|
||||
|
||||
PhaseType eventPhase() const;
|
||||
/// Used to indicate which phase of event flow is currently being evaluated.
|
||||
|
||||
bool bubbles() const;
|
||||
/// Used to indicate whether or not an event is a bubbling event.
|
||||
/// If the event can bubble the value is true, else the value is false.
|
||||
|
||||
bool cancelable() const;
|
||||
/// Used to indicate whether or not an event can have its default action
|
||||
/// prevented. If the default action can be prevented the value is
|
||||
/// true, else the value is false.
|
||||
|
||||
Poco::UInt64 timeStamp() const;
|
||||
/// Used to specify the time (in milliseconds relative to the epoch) at
|
||||
/// which the event was created. Due to the fact that some
|
||||
/// systems may not provide this information the value of timeStamp may
|
||||
/// be not available for all events. When not available, a
|
||||
/// value of 0 will be returned. Examples of epoch time are the time of the
|
||||
/// system start or 0:0:0 UTC 1st January 1970.
|
||||
/// This implementation always returns 0.
|
||||
|
||||
void stopPropagation();
|
||||
/// The stopPropagation method is used prevent further propagation of an
|
||||
/// event during event flow. If this method is called by
|
||||
/// any EventListener the event will cease propagating through the tree.
|
||||
/// The event will complete dispatch to all listeners on the
|
||||
/// current EventTarget before event flow stops. This method may be used
|
||||
/// during any stage of event flow.
|
||||
|
||||
void preventDefault();
|
||||
/// If an event is cancelable, the preventDefault method is used to signify
|
||||
/// that the event is to be canceled, meaning any default
|
||||
/// action normally taken by the implementation as a result of
|
||||
/// the event will not occur. If, during any stage of event flow, the
|
||||
/// preventDefault method is called the event is canceled. Any default
|
||||
/// action associated with the event will not occur. Calling
|
||||
/// this method for a non-cancelable event has no effect. Once
|
||||
/// preventDefault has been called it will remain in effect throughout
|
||||
/// the remainder of the event's propagation. This method may be
|
||||
/// used during any stage of event flow.
|
||||
|
||||
void initEvent(const XMLString& eventType, bool canBubble, bool isCancelable);
|
||||
/// The initEvent method is used to initialize the value of an
|
||||
/// Event created through the DocumentEvent interface. This method
|
||||
/// may only be called before the Event has been dispatched via the
|
||||
/// dispatchEvent method, though it may be called multiple
|
||||
/// times during that phase if necessary. If called multiple
|
||||
/// times the final invocation takes precedence. If called from
|
||||
/// a subclass of Event interface only the values specified in the
|
||||
/// initEvent method are modified, all other attributes are left unchanged.
|
||||
|
||||
void autoRelease();
|
||||
|
||||
protected:
|
||||
Event(Document* pOwnerDocument, const XMLString& type);
|
||||
Event(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool isCancelable);
|
||||
~Event();
|
||||
|
||||
bool isCanceled() const;
|
||||
/// returns true if and only if the event has been cancelled.
|
||||
|
||||
bool isStopped() const;
|
||||
/// returns true if and only if propagation of the event has been stopped.
|
||||
|
||||
void setTarget(EventTarget* pTarget);
|
||||
/// sets the target
|
||||
|
||||
void setCurrentPhase(PhaseType phase);
|
||||
/// sets the current phase
|
||||
|
||||
void setCurrentTarget(EventTarget* pTarget);
|
||||
/// sets the current target
|
||||
|
||||
private:
|
||||
Document* _pOwner;
|
||||
XMLString _type;
|
||||
EventTarget* _pTarget;
|
||||
EventTarget* _pCurrentTarget;
|
||||
PhaseType _currentPhase;
|
||||
bool _bubbles;
|
||||
bool _cancelable;
|
||||
bool _canceled;
|
||||
bool _stopped;
|
||||
|
||||
friend class AbstractNode;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Event::type() const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
|
||||
inline EventTarget* Event::target() const
|
||||
{
|
||||
return _pTarget;
|
||||
}
|
||||
|
||||
|
||||
inline EventTarget* Event::currentTarget() const
|
||||
{
|
||||
return _pCurrentTarget;
|
||||
}
|
||||
|
||||
|
||||
inline Event::PhaseType Event::eventPhase() const
|
||||
{
|
||||
return _currentPhase;
|
||||
}
|
||||
|
||||
|
||||
inline bool Event::bubbles() const
|
||||
{
|
||||
return _bubbles;
|
||||
}
|
||||
|
||||
|
||||
inline bool Event::cancelable() const
|
||||
{
|
||||
return _cancelable;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt64 Event::timeStamp() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool Event::isCanceled() const
|
||||
{
|
||||
return _canceled;
|
||||
}
|
||||
|
||||
|
||||
inline bool Event::isStopped() const
|
||||
{
|
||||
return _stopped;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Event_INCLUDED
|
97
vendor/POCO/XML/include/Poco/DOM/EventDispatcher.h
vendored
Normal file
97
vendor/POCO/XML/include/Poco/DOM/EventDispatcher.h
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// EventDispatcher.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the EventDispatcher class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_EventDispatcher_INCLUDED
|
||||
#define DOM_EventDispatcher_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include <list>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Event;
|
||||
class EventListener;
|
||||
|
||||
|
||||
class XML_API EventDispatcher
|
||||
/// This helper class manages event listener subscriptions
|
||||
/// and event dispatching for AbstractNode.
|
||||
///
|
||||
/// The EventListener list is managed in such a way that
|
||||
/// event listeners can be added and removed even
|
||||
/// from within an EventListener, while events are being
|
||||
/// dispatched.
|
||||
{
|
||||
public:
|
||||
EventDispatcher();
|
||||
/// Creates the EventDispatcher.
|
||||
|
||||
~EventDispatcher();
|
||||
/// Destroys the EventDispatcher.
|
||||
|
||||
void addEventListener(const XMLString& type, EventListener* listener, bool useCapture);
|
||||
/// Adds an EventListener to the internal list.
|
||||
|
||||
void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture);
|
||||
/// Removes an EventListener from the internal list.
|
||||
///
|
||||
/// If a dispatch is currently in progress, the list
|
||||
/// entry is only marked for deletion.
|
||||
/// If no dispatch is currently in progress, all EventListeners
|
||||
/// marked for deletion are removed from the list.
|
||||
|
||||
void dispatchEvent(Event* evt);
|
||||
/// Dispatches the event.
|
||||
///
|
||||
/// Also removes all EventListeners marked for deletion from the
|
||||
/// event dispatcher list.
|
||||
|
||||
void captureEvent(Event* evt);
|
||||
/// Dispatches the event in its capturing phase.
|
||||
///
|
||||
/// Also removes all EventListeners marked for deletion from the
|
||||
/// event dispatcher list.
|
||||
|
||||
void bubbleEvent(Event* evt);
|
||||
/// Dispatches the event in its bubbling phase.
|
||||
///
|
||||
/// Also removes all EventListeners marked for deletion from the
|
||||
/// event dispatcher list.
|
||||
|
||||
private:
|
||||
struct EventListenerItem
|
||||
{
|
||||
XMLString type;
|
||||
EventListener* pListener;
|
||||
bool useCapture;
|
||||
};
|
||||
|
||||
typedef std::list<EventListenerItem> EventListenerList;
|
||||
|
||||
int _inDispatch;
|
||||
EventListenerList _listeners;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_EventDispatcher_INCLUDED
|
81
vendor/POCO/XML/include/Poco/DOM/EventException.h
vendored
Normal file
81
vendor/POCO/XML/include/Poco/DOM/EventException.h
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// EventException.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventException class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_EventException_INCLUDED
|
||||
#define DOM_EventException_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API EventException: public XMLException
|
||||
/// Event operations may throw an EventException as
|
||||
/// specified in their method descriptions.
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
UNSPECIFIED_EVENT_TYPE_ERR = 0 /// If the Event's type was not specified by initializing the
|
||||
/// event before the method was called. Specification of the Event's
|
||||
/// type as null or an empty string will also trigger this exception.
|
||||
};
|
||||
|
||||
EventException(int code);
|
||||
/// Creates an EventException with the given error code.
|
||||
|
||||
EventException(const EventException& exc);
|
||||
/// Creates an EventException by copying another one.
|
||||
|
||||
~EventException() noexcept;
|
||||
/// Destroys the EventException.
|
||||
|
||||
EventException& operator = (const EventException& exc);
|
||||
|
||||
const char* name() const noexcept;
|
||||
/// Returns a static string describing the exception.
|
||||
|
||||
const char* className() const noexcept;
|
||||
/// Returns the name of the exception class.
|
||||
|
||||
unsigned short code() const;
|
||||
/// Returns the Event exception code.
|
||||
|
||||
protected:
|
||||
Poco::Exception* clone() const;
|
||||
|
||||
private:
|
||||
EventException();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline unsigned short EventException::code() const
|
||||
{
|
||||
return UNSPECIFIED_EVENT_TYPE_ERR;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_EventException_INCLUDED
|
57
vendor/POCO/XML/include/Poco/DOM/EventListener.h
vendored
Normal file
57
vendor/POCO/XML/include/Poco/DOM/EventListener.h
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// EventListener.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventListener interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_EventListener_INCLUDED
|
||||
#define DOM_EventListener_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Event;
|
||||
|
||||
|
||||
class XML_API EventListener
|
||||
/// The EventListener interface is the primary method for handling events. Users
|
||||
/// implement the EventListener interface and register their listener on an
|
||||
/// EventTarget using the AddEventListener method. The users should also remove
|
||||
/// their EventListener from its EventTarget after they have completed using
|
||||
/// the listener.
|
||||
///
|
||||
/// When a Node is copied using the cloneNode method the EventListeners attached
|
||||
/// to the source Node are not attached to the copied Node. If the user wishes
|
||||
/// the same EventListeners to be added to the newly created copy the user must
|
||||
/// add them manually.
|
||||
{
|
||||
public:
|
||||
virtual void handleEvent(Event* evt) = 0;
|
||||
/// This method is called whenever an event occurs of the
|
||||
/// type for which the EventListener interface was registered.
|
||||
|
||||
protected:
|
||||
virtual ~EventListener();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_EventListener_INCLUDED
|
76
vendor/POCO/XML/include/Poco/DOM/EventTarget.h
vendored
Normal file
76
vendor/POCO/XML/include/Poco/DOM/EventTarget.h
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// EventTarget.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM EventTarget interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_EventTarget_INCLUDED
|
||||
#define DOM_EventTarget_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/DOMObject.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class EventListener;
|
||||
class Event;
|
||||
|
||||
|
||||
class XML_API EventTarget: public DOMObject
|
||||
/// The EventTarget interface is implemented by all Nodes in an implementation
|
||||
/// which supports the DOM Event Model. Therefore, this interface can be obtained
|
||||
/// by using binding-specific casting methods on an instance of the Node interface.
|
||||
/// The interface allows registration and removal of EventListeners on an EventTarget
|
||||
/// and dispatch of events to that EventTarget.
|
||||
{
|
||||
public:
|
||||
virtual void addEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0;
|
||||
/// This method allows the registration of event listeners on
|
||||
/// the event target. If an EventListener is added to an
|
||||
/// EventTarget while it is processing an event, it will not
|
||||
/// be triggered by the current actions but may be triggered
|
||||
/// during a later stage of event flow, such as the bubbling phase.
|
||||
/// If multiple identical EventListeners are registered on the same
|
||||
/// EventTarget with the same parameters the duplicate instances are
|
||||
/// discarded. They do not cause the EventListener to be called twice and since they are
|
||||
/// discarded they do not need to be removed with the removeEventListener method.
|
||||
|
||||
virtual void removeEventListener(const XMLString& type, EventListener* listener, bool useCapture) = 0;
|
||||
/// This method allows the removal of event listeners from the event
|
||||
/// target. If an EventListener is removed from an EventTarget while it is
|
||||
/// processing an event, it will not be triggered by the current actions.
|
||||
/// EventListeners can never be invoked after being removed.
|
||||
/// Calling removeEventListener with arguments which do not identify
|
||||
/// any currently registered EventListener on the EventTarget has no effect.
|
||||
|
||||
virtual bool dispatchEvent(Event* evt) = 0;
|
||||
/// This method allows the dispatch of events into the implementations
|
||||
/// event model. Events dispatched in this manner will have the same capturing and
|
||||
/// bubbling behavior as events dispatched directly by the
|
||||
/// implementation. The target of the event is the EventTarget on
|
||||
/// which dispatchEvent is called.
|
||||
|
||||
protected:
|
||||
virtual ~EventTarget();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_EventTarget_INCLUDED
|
143
vendor/POCO/XML/include/Poco/DOM/MutationEvent.h
vendored
Normal file
143
vendor/POCO/XML/include/Poco/DOM/MutationEvent.h
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// MutationEvent.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOMEvents
|
||||
//
|
||||
// Definition of the DOM MutationEvent class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_MutationEvent_INCLUDED
|
||||
#define DOM_MutationEvent_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/Event.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
|
||||
|
||||
class XML_API MutationEvent: public Event
|
||||
/// The MutationEvent interface provides specific contextual
|
||||
/// information associated with Mutation events.
|
||||
{
|
||||
public:
|
||||
enum AttrChangeType
|
||||
{
|
||||
MODIFICATION = 1, /// The Attr was modified in place.
|
||||
ADDITION = 2, /// The Attr was just added.
|
||||
REMOVAL = 3 /// The Attr was just removed.
|
||||
};
|
||||
|
||||
Node* relatedNode() const;
|
||||
/// relatedNode is used to identify a secondary node related to a mutation
|
||||
/// event. For example, if a mutation event is dispatched
|
||||
/// to a node indicating that its parent has changed, the relatedNode is the
|
||||
/// changed parent. If an event is instead dispatched to a
|
||||
/// subtree indicating a node was changed within it, the relatedNode is
|
||||
/// the changed node. In the case of the DOMAttrModified
|
||||
/// event it indicates the Attr node which was modified, added, or removed.
|
||||
|
||||
const XMLString& prevValue() const;
|
||||
/// prevValue indicates the previous value of the Attr node in DOMAttrModified
|
||||
/// events, and of the CharacterData node in DOMCharDataModified events.
|
||||
|
||||
const XMLString& newValue() const;
|
||||
/// newValue indicates the new value of the Attr node in DOMAttrModified
|
||||
/// events, and of the CharacterData node in DOMCharDataModified events.
|
||||
|
||||
const XMLString& attrName() const;
|
||||
/// attrName indicates the name of the changed Attr node in a DOMAttrModified event.
|
||||
|
||||
AttrChangeType attrChange() const;
|
||||
/// attrChange indicates the type of change which triggered the
|
||||
/// DOMAttrModified event. The values can be MODIFICATION,
|
||||
/// ADDITION, or REMOVAL.
|
||||
|
||||
void initMutationEvent(const XMLString& type, bool canBubble, bool cancelable, Node* relatedNode,
|
||||
const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change);
|
||||
/// The initMutationEvent method is used to initialize the value of a
|
||||
/// MutationEvent created through the DocumentEvent
|
||||
/// interface. This method may only be called before the MutationEvent
|
||||
/// has been dispatched via the dispatchEvent method,
|
||||
/// though it may be called multiple times during that phase if
|
||||
/// necessary. If called multiple times, the final invocation takes
|
||||
/// precedence.
|
||||
|
||||
// Event Types
|
||||
static const XMLString DOMSubtreeModified;
|
||||
static const XMLString DOMNodeInserted;
|
||||
static const XMLString DOMNodeRemoved;
|
||||
static const XMLString DOMNodeRemovedFromDocument;
|
||||
static const XMLString DOMNodeInsertedIntoDocument;
|
||||
static const XMLString DOMAttrModified;
|
||||
static const XMLString DOMCharacterDataModified;
|
||||
|
||||
protected:
|
||||
MutationEvent(Document* pOwnerDocument, const XMLString& type);
|
||||
MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode);
|
||||
MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode,
|
||||
const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change);
|
||||
~MutationEvent();
|
||||
|
||||
private:
|
||||
XMLString _prevValue;
|
||||
XMLString _newValue;
|
||||
XMLString _attrName;
|
||||
AttrChangeType _change;
|
||||
Node* _pRelatedNode;
|
||||
|
||||
friend class AbstractNode;
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline Node* MutationEvent::relatedNode() const
|
||||
{
|
||||
return _pRelatedNode;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& MutationEvent::prevValue() const
|
||||
{
|
||||
return _prevValue;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& MutationEvent::newValue() const
|
||||
{
|
||||
return _newValue;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& MutationEvent::attrName() const
|
||||
{
|
||||
return _attrName;
|
||||
}
|
||||
|
||||
|
||||
inline MutationEvent::AttrChangeType MutationEvent::attrChange() const
|
||||
{
|
||||
return _change;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_MutationEvent_INCLUDED
|
93
vendor/POCO/XML/include/Poco/DOM/NamedNodeMap.h
vendored
Normal file
93
vendor/POCO/XML/include/Poco/DOM/NamedNodeMap.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// NamedNodeMap.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM NamedNodeMap interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_NamedNodeMap_INCLUDED
|
||||
#define DOM_NamedNodeMap_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/DOMObject.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
|
||||
|
||||
class XML_API NamedNodeMap: public DOMObject
|
||||
/// Objects implementing the NamedNodeMap interface are used to represent collections
|
||||
/// of nodes that can be accessed by name. Note that NamedNodeMap does not inherit
|
||||
/// from NodeList; NamedNodeMaps are not maintained in any particular order.
|
||||
/// Objects contained in an object implementing NamedNodeMap may also be accessed
|
||||
/// by an ordinal index, but this is simply to allow convenient enumeration
|
||||
/// of the contents of a NamedNodeMap, and does not imply that the DOM specifies
|
||||
/// an order to these Nodes.
|
||||
///
|
||||
/// NamedNodeMap objects in the DOM are live.
|
||||
///
|
||||
/// A NamedNodeMap returned from a method must be released with a call to
|
||||
/// release() when no longer needed.
|
||||
{
|
||||
public:
|
||||
virtual Node* getNamedItem(const XMLString& name) const = 0;
|
||||
/// Retrieves a node specified by name.
|
||||
|
||||
virtual Node* setNamedItem(Node* arg) = 0;
|
||||
/// Adds a node using its nodeName attribute. If a node with that name is already
|
||||
/// present in this map, it is replaced by the new one.
|
||||
/// As the nodeName attribute is used to derive the name which the node must
|
||||
/// be stored under, multiple nodes of certain types (those that have a "special"
|
||||
/// string value) cannot be stored as the names would clash. This is seen as
|
||||
/// preferable to allowing nodes to be aliased.
|
||||
|
||||
virtual Node* removeNamedItem(const XMLString& name) = 0;
|
||||
/// Removes a node specified by name. When this map contains the attributes
|
||||
/// attached to an element, if the removed attribute is known to have a default
|
||||
/// value, an attribute immediately appears containing the default value.
|
||||
|
||||
virtual Node* item(unsigned long index) const = 0;
|
||||
/// Returns the index'th item in the map. If index is greater
|
||||
/// than or equal to the number of nodes in the map, this
|
||||
/// returns null.
|
||||
|
||||
virtual unsigned long length() const = 0;
|
||||
/// Returns the number of nodes in the map. The range of valid
|
||||
/// child node indices is 0 to length - 1 inclusive.
|
||||
|
||||
// DOM Level 2
|
||||
virtual Node* getNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) const = 0;
|
||||
/// Retrieves a node specified by name.
|
||||
|
||||
virtual Node* setNamedItemNS(Node* arg) = 0;
|
||||
/// Adds a node using its nodeName attribute.
|
||||
/// If a node with that namespace URI and that local name is already
|
||||
/// present in this map, it is replaced by the new one.
|
||||
|
||||
virtual Node* removeNamedItemNS(const XMLString& namespaceURI, const XMLString& localName) = 0;
|
||||
/// Removes a node specified by name.
|
||||
|
||||
protected:
|
||||
virtual ~NamedNodeMap();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_NamedNodeMap_INCLUDED
|
285
vendor/POCO/XML/include/Poco/DOM/Node.h
vendored
Normal file
285
vendor/POCO/XML/include/Poco/DOM/Node.h
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// Node.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Node interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Node_INCLUDED
|
||||
#define DOM_Node_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/EventTarget.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
#include "Poco/SAX/NamespaceSupport.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class NamedNodeMap;
|
||||
class Document;
|
||||
class NodeList;
|
||||
|
||||
|
||||
class XML_API Node: public EventTarget
|
||||
/// The Node interface is the primary datatype for the entire Document Object
|
||||
/// Model. It represents a single node in the document tree. While all objects
|
||||
/// implementing the Node interface expose methods for dealing with children,
|
||||
/// not all objects implementing the Node interface may have children. For
|
||||
/// example, Text nodes may not have children, and adding children to such
|
||||
/// nodes results in a DOMException being raised.
|
||||
///
|
||||
/// The attributes nodeName, nodeValue and attributes are included as a mechanism
|
||||
/// to get at node information without casting down to the specific derived
|
||||
/// interface. In cases where there is no obvious mapping of these attributes
|
||||
/// for a specific nodeType (e.g., nodeValue for an Element or attributes for
|
||||
/// a Comment), this returns null. Note that the specialized interfaces may
|
||||
/// contain additional and more convenient mechanisms to get and set the relevant
|
||||
/// information.
|
||||
///
|
||||
/// This implementation differs in some ways from the W3C DOM recommendations.
|
||||
/// For example, the DOM specifies that some methods can return null strings.
|
||||
/// Instead of null strings, this implementation always returns empty strings.
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
ELEMENT_NODE = 1, /// The node is an Element.
|
||||
ATTRIBUTE_NODE, /// The node is an Attr.
|
||||
TEXT_NODE, /// The node is a Text node.
|
||||
CDATA_SECTION_NODE, /// The node is a CDATASection.
|
||||
ENTITY_REFERENCE_NODE, /// The node is an EntityReference.
|
||||
ENTITY_NODE, /// The node is an Entity.
|
||||
PROCESSING_INSTRUCTION_NODE, /// The node is a ProcessingInstruction.
|
||||
COMMENT_NODE, /// The node is a Comment.
|
||||
DOCUMENT_NODE, /// The node is a Document.
|
||||
DOCUMENT_TYPE_NODE, /// The node is a DocumentType.
|
||||
DOCUMENT_FRAGMENT_NODE, /// The node is a DocumentFragment.
|
||||
NOTATION_NODE /// The node is a Notation.
|
||||
};
|
||||
|
||||
virtual const XMLString& nodeName() const = 0;
|
||||
/// Returns the name of this node, depending on its type.
|
||||
|
||||
const XMLString& nodeValue() const;
|
||||
/// Returns the value of this node, depending on its type.
|
||||
|
||||
virtual const XMLString& getNodeValue() const = 0;
|
||||
/// Returns the value of this node, depending on its type.
|
||||
|
||||
virtual void setNodeValue(const XMLString& value) = 0;
|
||||
/// Sets the value of this node. Throws an exception
|
||||
/// if the node is read-only.
|
||||
|
||||
virtual unsigned short nodeType() const = 0;
|
||||
/// Returns a code representing the type of the underlying object.
|
||||
|
||||
virtual Node* parentNode() const = 0;
|
||||
/// The parent of this node. All nodes, except Attr, Document, DocumentFragment,
|
||||
/// Entity, and Notation may have a parent. However, if a node has just been
|
||||
/// created and not yet added to the tree, or if it has been removed from the
|
||||
/// tree, this is null.
|
||||
|
||||
virtual NodeList* childNodes() const = 0;
|
||||
/// Returns a NodeList containing all children of this node.
|
||||
///
|
||||
/// The returned NodeList must be released with a call
|
||||
/// to release() when no longer needed.
|
||||
|
||||
virtual Node* firstChild() const = 0;
|
||||
/// Returns the first child of this node. If there is no such
|
||||
/// node, this returns null.
|
||||
|
||||
virtual Node* lastChild() const = 0;
|
||||
/// Returns the last child of this node. If there is no such
|
||||
/// node, this returns null.
|
||||
|
||||
virtual Node* previousSibling() const = 0;
|
||||
/// Returns the node immediately preceding this node. If there
|
||||
/// is no such node, this returns null.
|
||||
|
||||
virtual Node* nextSibling() const = 0;
|
||||
/// Returns the node immediately following this node. If there
|
||||
/// is no such node, this returns null.
|
||||
|
||||
virtual NamedNodeMap* attributes() const = 0;
|
||||
/// Returns a NamedNodeMap containing the attributes of this
|
||||
/// node (if it is an Element) or null otherwise.
|
||||
///
|
||||
/// The returned NamedNodeMap must be released with a call
|
||||
/// to release() when no longer needed.
|
||||
|
||||
virtual Document* ownerDocument() const = 0;
|
||||
/// Returns the Document object associated with this node.
|
||||
/// This is also the Document object used to create new nodes.
|
||||
/// When this node is a Document, this is null.
|
||||
|
||||
virtual Node* insertBefore(Node* newChild, Node* refChild) = 0;
|
||||
/// Inserts the node newChild before the existing child node refChild.
|
||||
///
|
||||
/// If refChild is null, insert newChild at the end of the list of children.
|
||||
/// If newChild is a DocumentFragment object, all of its children are
|
||||
/// inserted in the same order, before refChild. If the newChild is already
|
||||
/// in the tree, it is first removed.
|
||||
|
||||
virtual Node* replaceChild(Node* newChild, Node* oldChild) = 0;
|
||||
/// Replaces the child node oldChild with newChild in the list of children,
|
||||
/// and returns the oldChild node.
|
||||
/// If newChild is a DocumentFragment object, oldChild is replaced by all of
|
||||
/// the DocumentFragment children, which are inserted in the same order. If
|
||||
/// the newChild is already in the tree, it is first removed.
|
||||
|
||||
virtual Node* removeChild(Node* oldChild) = 0;
|
||||
/// Removes the child node indicated by oldChild from the list of children
|
||||
/// and returns it.
|
||||
|
||||
virtual Node* appendChild(Node* newChild) = 0;
|
||||
/// Appends the node newChild to the end of the list of children of this node.
|
||||
/// If newChild is already in the tree, it is first removed.
|
||||
|
||||
virtual bool hasChildNodes() const = 0;
|
||||
/// This is a convenience method to allow easy determination of whether a
|
||||
/// node has any children.
|
||||
/// Returns true if the node has any children, false otherwise.
|
||||
|
||||
virtual Node* cloneNode(bool deep) const = 0;
|
||||
/// Returns a duplicate of this node, i.e., serves as a generic copy constructor
|
||||
/// for nodes. The duplicate node has no parent; (parentNode is null.).
|
||||
/// Cloning an Element copies all attributes and their values, including those
|
||||
/// generated by the XML processor to represent defaulted attributes, but this
|
||||
/// method does not copy any text it contains unless it is a deep clone, since
|
||||
/// the text is contained in a child Text node. Cloning an Attribute directly,
|
||||
/// as opposed to be cloned as part of an Element cloning operation, returns
|
||||
/// a specified attribute (specified is true). Cloning any other type of node
|
||||
/// simply returns a copy of this node.
|
||||
/// Note that cloning an immutable subtree results in a mutable copy, but the
|
||||
/// children of an EntityReference clone are readonly. In addition, clones of
|
||||
/// unspecified Attr nodes are specified. And, cloning Document, DocumentType,
|
||||
/// Entity, and Notation nodes is implementation dependent.
|
||||
|
||||
// DOM Level 2
|
||||
virtual void normalize() = 0;
|
||||
/// Puts all Text nodes in the full depth of the sub-tree underneath this Node,
|
||||
/// including attribute nodes, into a "normal" form where only structure (e.g.,
|
||||
/// elements, comments, processing instructions, CDATA sections, and entity
|
||||
/// references) separates Text nodes, i.e., there are neither adjacent Text
|
||||
/// nodes nor empty Text nodes. This can be used to ensure that the DOM view
|
||||
/// of a document is the same as if it were saved and re-loaded, and is useful
|
||||
/// when operations (such as XPointer lookups) that depend on a particular
|
||||
/// document tree structure are to be used.
|
||||
///
|
||||
/// Note: In cases where the document contains CDATASections, the normalize
|
||||
/// operation alone may not be sufficient, since XPointers do not differentiate
|
||||
/// between Text nodes and CDATASection nodes.
|
||||
|
||||
virtual bool isSupported(const XMLString& feature, const XMLString& version) const = 0;
|
||||
/// Tests whether the DOM implementation implements a specific
|
||||
/// feature and that feature is supported by this node.
|
||||
|
||||
virtual const XMLString& namespaceURI() const = 0;
|
||||
/// Returns the namespace URI of the node.
|
||||
/// This is not a computed value that is the result of a namespace lookup based on an
|
||||
/// examination of the namespace declarations in scope. It is merely the namespace URI
|
||||
/// given at creation time.
|
||||
///
|
||||
/// For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a
|
||||
/// DOM Level 1 method, such as createElement from the Document interface, this is always the
|
||||
/// empty string.
|
||||
|
||||
virtual XMLString prefix() const = 0;
|
||||
/// Returns the namespace prefix from the qualified name of the node.
|
||||
|
||||
virtual const XMLString& localName() const = 0;
|
||||
/// Returns the local name of the node.
|
||||
|
||||
virtual bool hasAttributes() const = 0;
|
||||
/// Returns whether this node (if it is an element) has any attributes.
|
||||
|
||||
// Extensions
|
||||
using NSMap = Poco::XML::NamespaceSupport;
|
||||
|
||||
virtual XMLString innerText() const = 0;
|
||||
/// Returns a string containing the concatenated values of the node
|
||||
/// and all its child nodes.
|
||||
///
|
||||
/// This method is not part of the W3C Document Object Model.
|
||||
|
||||
virtual Node* getNodeByPath(const XMLString& path) const = 0;
|
||||
/// Searches a node (element or attribute) based on a simplified XPath
|
||||
/// expression.
|
||||
///
|
||||
/// Only simple XPath expressions are supported. These are the slash
|
||||
/// notation for specifying paths to elements, and the square bracket
|
||||
/// expression for finding elements by their index, by attribute value,
|
||||
/// or finding attributes by names.
|
||||
///
|
||||
/// The slash at the beginning is optional, the evaluation always starts
|
||||
/// at this element. A double-slash at the beginning recursively searches
|
||||
/// the entire subtree for the first element.
|
||||
///
|
||||
/// Examples:
|
||||
/// elem1/elem2/elem3
|
||||
/// /elem1/elem2/elem3
|
||||
/// /elem1/elem2[1]
|
||||
/// /elem1/elem2[@attr1]
|
||||
/// /elem1/elem2[@attr1='value']
|
||||
/// //elem2[@attr1='value']
|
||||
/// //[@attr1='value']
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
virtual Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const = 0;
|
||||
/// Searches a node (element or attribute) based on a simplified XPath
|
||||
/// expression. The given NSMap must contain mappings from namespace
|
||||
/// prefixes to namespace URIs for all namespace prefixes used in
|
||||
/// the path expression.
|
||||
///
|
||||
/// Only simple XPath expressions are supported. These are the slash
|
||||
/// notation for specifying paths to elements, and the square bracket
|
||||
/// expression for finding elements by their index, by attribute value,
|
||||
/// or finding attributes by names.
|
||||
///
|
||||
/// The slash at the beginning is optional, the evaluation always starts
|
||||
/// at this element. A double-slash at the beginning recursively searches
|
||||
/// the entire subtree for the first element.
|
||||
///
|
||||
/// Examples:
|
||||
/// /ns1:elem1/ns2:elem2/ns2:elem3
|
||||
/// /ns1:elem1/ns2:elem2[1]
|
||||
/// /ns1:elem1/ns2:elem2[@attr1]
|
||||
/// /ns1:elem1/ns2:elem2[@attr1='value']
|
||||
/// //ns2:elem2[@ns1:attr1='value']
|
||||
/// //[@ns1:attr1='value']
|
||||
///
|
||||
/// This method is an extension to the W3C Document Object Model.
|
||||
|
||||
protected:
|
||||
virtual ~Node();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Node::nodeValue() const
|
||||
{
|
||||
return getNodeValue();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Node_INCLUDED
|
81
vendor/POCO/XML/include/Poco/DOM/NodeAppender.h
vendored
Normal file
81
vendor/POCO/XML/include/Poco/DOM/NodeAppender.h
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// NodeAppender.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: NodeAppender
|
||||
//
|
||||
// Definition of the NodeAppender class.
|
||||
//
|
||||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_NodeAppender_INCLUDED
|
||||
#define DOM_NodeAppender_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/Node.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class AbstractNode;
|
||||
class Element;
|
||||
|
||||
|
||||
class XML_API NodeAppender
|
||||
/// The NodeAppender class provides a very fast way to
|
||||
/// build larger DOM documents.
|
||||
///
|
||||
/// In the DOM, child nodes are usually appended to a parent
|
||||
/// node using the appendChild() method. For nodes containing
|
||||
/// more than a few children, this method can be quite slow,
|
||||
/// due to the way it's implemented, and because of the
|
||||
/// requirements of the DOM specification.
|
||||
///
|
||||
/// While the NodeAppender is being used on an Element, no
|
||||
/// children-modifying methods of that Element must be used.
|
||||
///
|
||||
/// This class is not part of the DOM specification.
|
||||
{
|
||||
public:
|
||||
NodeAppender(Element* parent);
|
||||
/// Creates the NodeAppender for the given parent node,
|
||||
/// which must be an Element.
|
||||
|
||||
~NodeAppender();
|
||||
/// Destroys the NodeAppender.
|
||||
|
||||
void appendChild(Node* newChild);
|
||||
/// Appends the node newChild to the end of the list of children of
|
||||
/// the parent node specified in the constructor.
|
||||
/// If the newChild is already in the tree, it is first removed.
|
||||
///
|
||||
/// NewChild can be a DocumentFragment. In this case, all children
|
||||
/// of the fragment become children of the parent element.
|
||||
///
|
||||
/// In order to speed up the function, no DOM events
|
||||
/// are fired.
|
||||
|
||||
private:
|
||||
NodeAppender();
|
||||
NodeAppender(const NodeAppender&);
|
||||
NodeAppender& operator = (const NodeAppender&);
|
||||
|
||||
Element* _pParent;
|
||||
AbstractNode* _pLast;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // #include "Poco/XML/XML.h"
|
||||
|
146
vendor/POCO/XML/include/Poco/DOM/NodeFilter.h
vendored
Normal file
146
vendor/POCO/XML/include/Poco/DOM/NodeFilter.h
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
//
|
||||
// NodeFilter.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: NodeFilter
|
||||
//
|
||||
// Definition of the DOM NodeFilter interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_NodeFilter_INCLUDED
|
||||
#define DOM_NodeFilter_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
|
||||
|
||||
class XML_API NodeFilter
|
||||
/// Filters are objects that know how to "filter out" nodes. If a NodeIterator
|
||||
/// or TreeWalker is given a NodeFilter, it applies the filter before it returns
|
||||
/// the next node. If the filter says to accept the node, the traversal logic
|
||||
/// returns it; otherwise, traversal looks for the next node and pretends that
|
||||
/// the node that was rejected was not there.
|
||||
///
|
||||
/// The DOM does not provide any filters. NodeFilter is just an interface that
|
||||
/// users can implement to provide their own filters.
|
||||
///
|
||||
/// NodeFilters do not need to know how to traverse from node to node, nor do
|
||||
/// they need to know anything about the data structure that is being traversed.
|
||||
/// This makes it very easy to write filters, since the only thing they have
|
||||
/// to know how to do is evaluate a single node. One filter may be used with
|
||||
/// a number of different kinds of traversals, encouraging code reuse.
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
FILTER_ACCEPT = 1,
|
||||
/// Accept the node. Navigation methods defined for NodeIterator or TreeWalker will return this node.
|
||||
|
||||
FILTER_REJECT = 2,
|
||||
/// Reject the node. Navigation methods defined for NodeIterator or TreeWalker
|
||||
/// will not return this node. For TreeWalker, the children of this node will
|
||||
/// also be rejected. NodeIterators treat this as a synonym for FILTER_SKIP.
|
||||
|
||||
FILTER_SKIP = 3
|
||||
/// Skip this single node. Navigation methods defined for NodeIterator or TreeWalker
|
||||
/// will not return this node. For both NodeIterator and TreeWalker, the children
|
||||
/// of this node will still be considered.
|
||||
};
|
||||
|
||||
enum WhatToShow
|
||||
/// These are the available values for the whatToShow parameter used in TreeWalkers
|
||||
/// and NodeIterators. They are the same as the set of possible types for Node,
|
||||
/// and their values are derived by using a bit position corresponding to the
|
||||
/// value of nodeType for the equivalent node type. If a bit in whatToShow is
|
||||
/// set false, that will be taken as a request to skip over this type of node;
|
||||
/// the behavior in that case is similar to that of FILTER_SKIP.
|
||||
///
|
||||
/// Note that if node types greater than 32 are ever introduced, they may not
|
||||
/// be individually testable via whatToShow. If that need should arise, it can
|
||||
/// be handled by selecting SHOW_ALL together with an appropriate NodeFilter.
|
||||
{
|
||||
SHOW_ALL = 0xFFFFFFFF,
|
||||
/// Show all Nodes.
|
||||
|
||||
SHOW_ELEMENT = 0x00000001,
|
||||
/// Show Element nodes.
|
||||
|
||||
SHOW_ATTRIBUTE = 0x00000002,
|
||||
/// Show Attr nodes. This is meaningful only when creating an iterator or tree-walker
|
||||
/// with an attribute node as its root; in this case, it means that the attribute
|
||||
/// node will appear in the first position of the iteration or traversal. Since
|
||||
/// attributes are never children of other nodes, they do not appear when traversing
|
||||
/// over the document tree.
|
||||
|
||||
SHOW_TEXT = 0x00000004,
|
||||
/// Show Text nodes.
|
||||
|
||||
SHOW_CDATA_SECTION = 0x00000008,
|
||||
/// Show CDATASection nodes.
|
||||
|
||||
SHOW_ENTITY_REFERENCE = 0x00000010,
|
||||
/// Show EntityReference nodes.
|
||||
|
||||
SHOW_ENTITY = 0x00000020,
|
||||
/// Show Entity nodes. This is meaningful only when creating an iterator or
|
||||
/// tree-walker with an Entity node as its root; in this case, it means that
|
||||
/// the Entity node will appear in the first position of the traversal. Since
|
||||
/// entities are not part of the document tree, they do not appear when traversing
|
||||
/// over the document tree.
|
||||
|
||||
SHOW_PROCESSING_INSTRUCTION = 0x00000040,
|
||||
/// Show ProcessingInstruction nodes.
|
||||
|
||||
SHOW_COMMENT = 0x00000080,
|
||||
/// Show Comment nodes.
|
||||
|
||||
SHOW_DOCUMENT = 0x00000100,
|
||||
/// Show Document nodes.
|
||||
|
||||
SHOW_DOCUMENT_TYPE = 0x00000200,
|
||||
/// Show DocumentType nodes.
|
||||
|
||||
SHOW_DOCUMENT_FRAGMENT = 0x00000400,
|
||||
/// Show DocumentFragment nodes.
|
||||
|
||||
SHOW_NOTATION = 0x00000800
|
||||
/// Show Notation nodes. This is meaningful only when creating an iterator or
|
||||
/// tree-walker with a Notation node as its root; in this case, it means that
|
||||
/// the Notation node will appear in the first position of the traversal. Since
|
||||
/// notations are not part of the document tree, they do not appear when traversing
|
||||
/// over the document tree.
|
||||
};
|
||||
|
||||
virtual short acceptNode(Node* node) = 0;
|
||||
/// Test whether a specified node is visible in the logical view of a TreeWalker
|
||||
/// or NodeIterator. This function will be called by the implementation of TreeWalker
|
||||
/// and NodeIterator; it is not normally called directly from user code. (Though
|
||||
/// you could do so if you wanted to use the same filter to guide your own application
|
||||
/// logic.)
|
||||
///
|
||||
/// Returns FILTER_ACCEPT, FILTER_REJECT or FILTER_SKIP.
|
||||
|
||||
protected:
|
||||
virtual ~NodeFilter();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_NodeFilter_INCLUDED
|
167
vendor/POCO/XML/include/Poco/DOM/NodeIterator.h
vendored
Normal file
167
vendor/POCO/XML/include/Poco/DOM/NodeIterator.h
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
//
|
||||
// NodeIterator.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: NodeIterator
|
||||
//
|
||||
// Definition of the DOM NodeIterator class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_NodeIterator_INCLUDED
|
||||
#define DOM_NodeIterator_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
class NodeFilter;
|
||||
|
||||
|
||||
class XML_API NodeIterator
|
||||
/// Iterators are used to step through a set of nodes, e.g. the set of nodes
|
||||
/// in a NodeList, the document subtree governed by a particular Node, the results
|
||||
/// of a query, or any other set of nodes. The set of nodes to be iterated is
|
||||
/// determined by the implementation of the NodeIterator. DOM Level 2 specifies
|
||||
/// a single NodeIterator implementation for document-order traversal of a document
|
||||
/// subtree.
|
||||
///
|
||||
/// A NodeIterator can be directly instantiated using one of its constructors -
|
||||
/// the DocumentTraversal interface is not needed and therefore not implemented.
|
||||
/// Unlike most other DOM classes, NodeIterator supports value semantics.
|
||||
///
|
||||
/// If the NodeIterator's current node is removed from the document, the
|
||||
/// result of calling any of the movement methods is undefined. This behavior does
|
||||
/// not conform to the DOM Level 2 Traversal specification.
|
||||
{
|
||||
public:
|
||||
NodeIterator(Node* root, unsigned long whatToShow, NodeFilter* pFilter = 0);
|
||||
/// Creates a NodeIterator over the subtree rooted at the specified node.
|
||||
|
||||
NodeIterator(const NodeIterator& iterator);
|
||||
/// Creates a NodeIterator by copying another NodeIterator.
|
||||
|
||||
NodeIterator& operator = (const NodeIterator& iterator);
|
||||
/// Assignment operator.
|
||||
|
||||
~NodeIterator();
|
||||
/// Destroys the NodeIterator.
|
||||
|
||||
Node* root() const;
|
||||
/// The root node of the NodeIterator, as specified when it was created.
|
||||
|
||||
unsigned long whatToShow() const;
|
||||
/// This attribute determines which node types are presented via the iterator.
|
||||
/// The available set of constants is defined in the NodeFilter interface.
|
||||
/// Nodes not accepted by whatToShow will be skipped, but their children may
|
||||
/// still be considered. Note that this skip takes precedence over the filter,
|
||||
/// if any.
|
||||
|
||||
NodeFilter* filter() const;
|
||||
/// The NodeFilter used to screen nodes.
|
||||
|
||||
bool expandEntityReferences() const;
|
||||
/// The value of this flag determines whether the children of entity reference
|
||||
/// nodes are visible to the iterator. If false, they and their descendants
|
||||
/// will be rejected. Note that this rejection takes precedence over whatToShow
|
||||
/// and the filter. Also note that this is currently the only situation where
|
||||
/// NodeIterators may reject a complete subtree rather than skipping individual
|
||||
/// nodes.
|
||||
///
|
||||
/// To produce a view of the document that has entity references expanded and
|
||||
/// does not expose the entity reference node itself, use the whatToShow flags
|
||||
/// to hide the entity reference node and set expandEntityReferences to true
|
||||
/// when creating the iterator. To produce a view of the document that has entity
|
||||
/// reference nodes but no entity expansion, use the whatToShow flags to show
|
||||
/// the entity reference node and set expandEntityReferences to false.
|
||||
///
|
||||
/// This implementation does not support entity reference expansion and
|
||||
/// thus always returns false.
|
||||
|
||||
Node* nextNode();
|
||||
/// Returns the next node in the set and advances the position of the iterator
|
||||
/// in the set. After a NodeIterator is created, the first call to nextNode()
|
||||
/// returns the first node in the set.
|
||||
|
||||
Node* previousNode();
|
||||
/// Returns the previous node in the set and moves the position of the NodeIterator
|
||||
/// backwards in the set.
|
||||
|
||||
Node* currentNodeNP() const;
|
||||
/// Returns the current node in the set.
|
||||
///
|
||||
/// Leaves the NodeIterator unchanged.
|
||||
///
|
||||
/// Warning: This is a proprietary extension to the DOM Level 2 NodeIterator
|
||||
/// interface.
|
||||
|
||||
void detach();
|
||||
/// Detaches the NodeIterator from the set which it iterated over, releasing
|
||||
/// any computational resources and placing the iterator in the INVALID state.
|
||||
/// After detach has been invoked, calls to nextNode or previousNode will raise
|
||||
/// the exception INVALID_STATE_ERR.
|
||||
|
||||
protected:
|
||||
bool accept(Node* pNode) const;
|
||||
Node* next() const;
|
||||
Node* previous() const;
|
||||
Node* last();
|
||||
|
||||
private:
|
||||
NodeIterator();
|
||||
|
||||
Node* _pRoot;
|
||||
unsigned long _whatToShow;
|
||||
NodeFilter* _pFilter;
|
||||
Node* _pCurrent;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline Node* NodeIterator::root() const
|
||||
{
|
||||
return _pRoot;
|
||||
}
|
||||
|
||||
|
||||
inline Node* NodeIterator::currentNodeNP() const
|
||||
{
|
||||
return _pCurrent;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long NodeIterator::whatToShow() const
|
||||
{
|
||||
return _whatToShow;
|
||||
}
|
||||
|
||||
|
||||
inline NodeFilter* NodeIterator::filter() const
|
||||
{
|
||||
return _pFilter;
|
||||
}
|
||||
|
||||
|
||||
inline bool NodeIterator::expandEntityReferences() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_NodeIterator_INCLUDED
|
61
vendor/POCO/XML/include/Poco/DOM/NodeList.h
vendored
Normal file
61
vendor/POCO/XML/include/Poco/DOM/NodeList.h
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// NodeList.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM NodeList interface.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_NodeList_INCLUDED
|
||||
#define DOM_NodeList_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/DOMObject.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
|
||||
|
||||
class XML_API NodeList: public DOMObject
|
||||
/// The NodeList interface provides the abstraction of an ordered
|
||||
/// collection of nodes, without defining or constraining how this
|
||||
/// collection is implemented.
|
||||
///
|
||||
/// The items in the NodeList are accessible via an integral index,
|
||||
/// starting from 0.
|
||||
///
|
||||
/// A NodeList returned from a method must be released with a call to
|
||||
/// release() when no longer needed.
|
||||
{
|
||||
public:
|
||||
virtual Node* item(unsigned long index) const = 0;
|
||||
/// Returns the index'th item in the collection. If index is
|
||||
/// greater than or equal to the number of nodes in the list,
|
||||
/// this returns null.
|
||||
|
||||
virtual unsigned long length() const = 0;
|
||||
/// Returns the number of nodes in the list. The range of valid
|
||||
/// node indices is 0 to length - 1 inclusive.
|
||||
|
||||
protected:
|
||||
virtual ~NodeList();
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_NodeList_INCLUDED
|
93
vendor/POCO/XML/include/Poco/DOM/Notation.h
vendored
Normal file
93
vendor/POCO/XML/include/Poco/DOM/Notation.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// Notation.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Notation class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Notation_INCLUDED
|
||||
#define DOM_Notation_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractNode.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API Notation: public AbstractNode
|
||||
/// This interface represents a notation declared in the DTD. A notation either
|
||||
/// declares, by name, the format of an unparsed entity (see section 4.7 of
|
||||
/// the XML 1.0 specification <http://www.w3.org/TR/2004/REC-xml-20040204/>),
|
||||
/// or is used for formal declaration of processing
|
||||
/// instruction targets (see section 2.6 of the XML 1.0 specification).
|
||||
/// The nodeName attribute inherited from Node is set to the declared name of
|
||||
/// the notation.
|
||||
///
|
||||
/// The DOM Level 1 does not support editing Notation nodes; they are therefore
|
||||
/// readonly.
|
||||
///
|
||||
/// A Notation node does not have any parent.
|
||||
{
|
||||
public:
|
||||
const XMLString& publicId() const;
|
||||
/// Returns the public identifier of this notation.
|
||||
/// If not specified, this is an empty string (and not null,
|
||||
/// as in the DOM specification).
|
||||
|
||||
const XMLString& systemId() const;
|
||||
/// Returns the system identifier of this notation.
|
||||
/// If not specified, this is an empty string (and not null,
|
||||
/// as in the DOM specification).
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
Notation(Document* pOwnerDocument, const XMLString& name, const XMLString& publicId, const XMLString& systemId);
|
||||
Notation(Document* pOwnerDocument, const Notation& notation);
|
||||
~Notation();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
XMLString _name;
|
||||
XMLString _publicId;
|
||||
XMLString _systemId;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& Notation::publicId() const
|
||||
{
|
||||
return _publicId;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& Notation::systemId() const
|
||||
{
|
||||
return _systemId;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Notation_INCLUDED
|
99
vendor/POCO/XML/include/Poco/DOM/ProcessingInstruction.h
vendored
Normal file
99
vendor/POCO/XML/include/Poco/DOM/ProcessingInstruction.h
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// ProcessingInstruction.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM ProcessingInstruction class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_ProcessingInstruction_INCLUDED
|
||||
#define DOM_ProcessingInstruction_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/AbstractNode.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API ProcessingInstruction: public AbstractNode
|
||||
/// The ProcessingInstruction interface represents a "processing instruction",
|
||||
/// used in XML as a way to keep processor-specific information in the text
|
||||
/// of the document.
|
||||
{
|
||||
public:
|
||||
const XMLString& target() const;
|
||||
/// Returns the target of this processing instruction.
|
||||
/// XML defines this as being the first token following
|
||||
/// the markup that begins the processing instruction.
|
||||
|
||||
const XMLString& data() const;
|
||||
/// Returns the content of this processing instruction. This is from the first non
|
||||
/// white space character after the target to the character immediately preceding
|
||||
/// the ?>.
|
||||
|
||||
const XMLString& getData() const;
|
||||
/// Returns the content of this processing instruction. This is from the first non
|
||||
/// white space character after the target to the character immediately preceding
|
||||
/// the ?>.
|
||||
|
||||
void setData(const XMLString& data);
|
||||
/// Sets the content of this processing instruction.
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
const XMLString& getNodeValue() const;
|
||||
void setNodeValue(const XMLString& data);
|
||||
unsigned short nodeType() const;
|
||||
|
||||
protected:
|
||||
ProcessingInstruction(Document* pOwnerDocument, const XMLString& target, const XMLString& data);
|
||||
ProcessingInstruction(Document* pOwnerDocument, const ProcessingInstruction& processingInstruction);
|
||||
~ProcessingInstruction();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
XMLString _target;
|
||||
XMLString _data;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline const XMLString& ProcessingInstruction::target() const
|
||||
{
|
||||
return _target;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& ProcessingInstruction::data() const
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
||||
inline const XMLString& ProcessingInstruction::getData() const
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_ProcessingInstruction_INCLUDED
|
79
vendor/POCO/XML/include/Poco/DOM/Text.h
vendored
Normal file
79
vendor/POCO/XML/include/Poco/DOM/Text.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// Text.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: DOM
|
||||
//
|
||||
// Definition of the DOM Text class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_Text_INCLUDED
|
||||
#define DOM_Text_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/DOM/CharacterData.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class XML_API Text: public CharacterData
|
||||
/// The Text interface inherits from CharacterData and represents the textual
|
||||
/// content (termed character data in XML) of an Element or Attr. If there is
|
||||
/// no markup inside an element's content, the text is contained in a single
|
||||
/// object implementing the Text interface that is the only child of the element.
|
||||
/// If there is markup, it is parsed into the information items (elements, comments,
|
||||
/// etc.) and Text nodes that form the list of children of the element.
|
||||
///
|
||||
/// When a document is first made available via the DOM, there is only one Text
|
||||
/// node for each block of text. Users may create adjacent Text nodes that represent
|
||||
/// the contents of a given element without any intervening markup, but should
|
||||
/// be aware that there is no way to represent the separations between these
|
||||
/// nodes in XML or HTML, so they will not (in general) persist between DOM
|
||||
/// editing sessions. The normalize() method on Element merges any such adjacent
|
||||
/// Text objects into a single node for each block of text.
|
||||
{
|
||||
public:
|
||||
Text* splitText(unsigned long offset);
|
||||
/// Breaks this node into two nodes at the specified offset, keeping both in
|
||||
/// the tree as siblings. This node then only contains all the content up to
|
||||
/// the offset point. A new node of the same type, which is inserted as the
|
||||
/// next sibling of this node, contains all the content at and after the offset
|
||||
/// point. When the offset is equal to the length of this node, the new node
|
||||
/// has no data.
|
||||
|
||||
// Node
|
||||
const XMLString& nodeName() const;
|
||||
unsigned short nodeType() const;
|
||||
|
||||
// Non-standard extensions
|
||||
XMLString innerText() const;
|
||||
|
||||
protected:
|
||||
Text(Document* pOwnerDocument, const XMLString& data);
|
||||
Text(Document* pOwnerDocument, const Text& text);
|
||||
~Text();
|
||||
|
||||
Node* copyNode(bool deep, Document* pOwnerDocument) const;
|
||||
|
||||
private:
|
||||
static const XMLString NODE_NAME;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_Text_INCLUDED
|
211
vendor/POCO/XML/include/Poco/DOM/TreeWalker.h
vendored
Normal file
211
vendor/POCO/XML/include/Poco/DOM/TreeWalker.h
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
//
|
||||
// TreeWalker.h
|
||||
//
|
||||
// Library: XML
|
||||
// Package: DOM
|
||||
// Module: TreeWalker
|
||||
//
|
||||
// Definition of the DOM TreeWalker class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DOM_TreeWalker_INCLUDED
|
||||
#define DOM_TreeWalker_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/XML/XML.h"
|
||||
#include "Poco/XML/XMLString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
|
||||
class Node;
|
||||
class NodeFilter;
|
||||
|
||||
|
||||
class XML_API TreeWalker
|
||||
/// TreeWalker objects are used to navigate a document tree or subtree using
|
||||
/// the view of the document defined by their whatToShow flags and filter (if
|
||||
/// any). Any function which performs navigation using a TreeWalker will automatically
|
||||
/// support any view defined by a TreeWalker.
|
||||
///
|
||||
/// Omitting nodes from the logical view of a subtree can result in a structure
|
||||
/// that is substantially different from the same subtree in the complete, unfiltered
|
||||
/// document. Nodes that are siblings in the TreeWalker view may be children
|
||||
/// of different, widely separated nodes in the original view. For instance,
|
||||
/// consider a NodeFilter that skips all nodes except for Text nodes and the
|
||||
/// root node of a document. In the logical view that results, all text nodes
|
||||
/// will be siblings and appear as direct children of the root node, no matter
|
||||
/// how deeply nested the structure of the original document.
|
||||
///
|
||||
/// A TreeWalker can be directly instantiated using one of its constructors -
|
||||
/// the DocumentTraversal interface is not needed and therefore not implemented.
|
||||
/// Unlike most other DOM classes, TreeWalker supports value semantics.
|
||||
///
|
||||
/// If the TreeWalker's current node is removed from the document, the
|
||||
/// result of calling any of the movement methods is undefined. This behavior
|
||||
/// does not conform to the DOM Level 2 Traversal specification.
|
||||
{
|
||||
public:
|
||||
TreeWalker(Node* root, unsigned long whatToShow, NodeFilter* pFilter = 0);
|
||||
/// Creates a TreeWalker over the subtree rooted at the specified node.
|
||||
|
||||
TreeWalker(const TreeWalker& walker);
|
||||
/// Creates a TreeWalker by copying another TreeWalker.
|
||||
|
||||
TreeWalker& operator = (const TreeWalker& walker);
|
||||
/// Assignment operator.
|
||||
|
||||
~TreeWalker();
|
||||
/// Destroys the TreeWalker.
|
||||
|
||||
Node* root() const;
|
||||
/// The root node of the TreeWalker, as specified when it was created.
|
||||
|
||||
unsigned long whatToShow() const;
|
||||
/// This attribute determines which node types are presented via the TreeWalker.
|
||||
/// The available set of constants is defined in the NodeFilter interface. Nodes
|
||||
/// not accepted by whatToShow will be skipped, but their children may still
|
||||
/// be considered. Note that this skip takes precedence over the filter, if
|
||||
/// any.
|
||||
|
||||
NodeFilter* filter() const;
|
||||
/// The NodeFilter used to screen nodes.
|
||||
|
||||
bool expandEntityReferences() const;
|
||||
/// The value of this flag determines whether the children of entity reference
|
||||
/// nodes are visible to the iterator. If false, they and their descendants
|
||||
/// will be rejected. Note that this rejection takes precedence over whatToShow
|
||||
/// and the filter. Also note that this is currently the only situation where
|
||||
/// NodeIterators may reject a complete subtree rather than skipping individual
|
||||
/// nodes.
|
||||
///
|
||||
/// To produce a view of the document that has entity references expanded and
|
||||
/// does not expose the entity reference node itself, use the whatToShow flags
|
||||
/// to hide the entity reference node and set expandEntityReferences to true
|
||||
/// when creating the iterator. To produce a view of the document that has entity
|
||||
/// reference nodes but no entity expansion, use the whatToShow flags to show
|
||||
/// the entity reference node and set expandEntityReferences to false.
|
||||
///
|
||||
/// This implementation does not support entity reference expansion and
|
||||
/// thus always returns false.
|
||||
|
||||
Node* currentNode() const;
|
||||
/// The node at which the TreeWalker is currently positioned.
|
||||
/// Alterations to the DOM tree may cause the current node to no longer be accepted
|
||||
/// by the TreeWalker's associated filter. currentNode may also be explicitly
|
||||
/// set to any node, whether or not it is within the subtree specified by the
|
||||
/// root node or would be accepted by the filter and whatToShow flags. Further
|
||||
/// traversal occurs relative to currentNode even if it is not part of the current
|
||||
/// view, by applying the filters in the requested direction; if no traversal
|
||||
/// is possible, currentNode is not changed.
|
||||
|
||||
Node* getCurrentNode() const;
|
||||
/// See currentNode().
|
||||
|
||||
void setCurrentNode(Node* pNode);
|
||||
/// Sets the current node.
|
||||
|
||||
Node* parentNode();
|
||||
/// Moves to and returns the closest visible ancestor node of the current node.
|
||||
/// If the search for parentNode attempts to step upward from the TreeWalker's
|
||||
/// root node, or if it fails to find a visible ancestor node, this method retains
|
||||
/// the current position and returns null.
|
||||
|
||||
Node* firstChild();
|
||||
/// Moves the TreeWalker to the first visible child of the current node, and
|
||||
/// returns the new node. If the current node has no visible children, returns
|
||||
/// null, and retains the current node.
|
||||
|
||||
Node* lastChild();
|
||||
/// Moves the TreeWalker to the last visible child of the current node, and
|
||||
/// returns the new node. If the current node has no visible children, returns
|
||||
/// null, and retains the current node.
|
||||
|
||||
Node* previousSibling();
|
||||
/// Moves the TreeWalker to the previous sibling of the current node, and returns
|
||||
/// the new node. If the current node has no visible previous sibling, returns
|
||||
/// null, and retains the current node.
|
||||
|
||||
Node* nextSibling();
|
||||
/// Moves the TreeWalker to the next sibling of the current node, and returns
|
||||
/// the new node. If the current node has no visible next sibling, returns null,
|
||||
/// and retains the current node.
|
||||
|
||||
Node* previousNode();
|
||||
/// Moves the TreeWalker to the previous visible node in document order relative
|
||||
/// to the current node, and returns the new node. If the current node has no
|
||||
/// previous node, or if the search for previousNode attempts to step upward
|
||||
/// from the TreeWalker's root node, returns null, and retains the current node.
|
||||
|
||||
Node* nextNode();
|
||||
/// Moves the TreeWalker to the next visible node in document order relative
|
||||
/// to the current node, and returns the new node. If the current node has no
|
||||
/// next node, or if the search for nextNode attempts to step upward from the
|
||||
/// TreeWalker's root node, returns null, and retains the current node.
|
||||
|
||||
protected:
|
||||
int accept(Node* pNode) const;
|
||||
Node* next(Node* pNode) const;
|
||||
Node* previous(Node* pNode) const;
|
||||
|
||||
private:
|
||||
TreeWalker();
|
||||
|
||||
Node* _pRoot;
|
||||
unsigned long _whatToShow;
|
||||
NodeFilter* _pFilter;
|
||||
Node* _pCurrent;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline Node* TreeWalker::root() const
|
||||
{
|
||||
return _pRoot;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long TreeWalker::whatToShow() const
|
||||
{
|
||||
return _whatToShow;
|
||||
}
|
||||
|
||||
|
||||
inline NodeFilter* TreeWalker::filter() const
|
||||
{
|
||||
return _pFilter;
|
||||
}
|
||||
|
||||
|
||||
inline bool TreeWalker::expandEntityReferences() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline Node* TreeWalker::currentNode() const
|
||||
{
|
||||
return _pCurrent;
|
||||
}
|
||||
|
||||
|
||||
inline Node* TreeWalker::getCurrentNode() const
|
||||
{
|
||||
return _pCurrent;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::XML
|
||||
|
||||
|
||||
#endif // DOM_TreeWalker_INCLUDED
|
Reference in New Issue
Block a user