top | up | prev | next

Document Abstract Class

Definition at line 15 of Document.hpp

Constructors

Document()
Document(Document&&) delete
Document(const Document&) delete

Member Functions

void Accept(Visitor& visitor) override
Node* AppendChild(std::unique_ptr<Node>&& newChild) override
void CheckValidInsert(Node* node, Node* refNode)
std::unique_ptr<Node> CloneNode(bool deep) override
Element* DocumentElement()
Element* GetElementById(const std::u32string& elementId)
Node* InsertBefore(std::unique_ptr<Node>&& newChild, Node* refChild) override
void InternalInvalidateIndex()
std::unique_ptr<Node> RemoveChild(Node* oldChild) override
std::unique_ptr<Node> ReplaceChild(std::unique_ptr<Node>&& newChild, Node* oldChild) override
void SetXmlEncoding(const std::u32string& xmlEncoding_)
void SetXmlStandalone(bool xmlStandalone_)
void SetXmlVersion(const std::u32string& xmlVersion_)
void Write(CodeFormatter& formatter) override
const std::u32string& XmlEncoding() const
bool XmlStandalone() const
const std::u32string& XmlVersion() const
Document& operator=(Document&&) delete
Document& operator=(const Document&) delete

Member Variables

Element* documentElement
std::unordered_map<std::u32string, Element*> elementsByIdMap
bool indexValid
std::u32string xmlEncoding
bool xmlStandalone
std::u32string xmlVersion

Constructor Details

Document Constructor

sngxml::dom::Document::Document()

Definition at line 16 of Document.cpp :
 16 : ParentNode(NodeType::documentNodeU"document")documentElement(nullptr)indexValid(false)xmlStandalone(false)
 17 {
 18 }


Declaration at line 18 of Document.hpp


Document Constructor

sngxml::dom::Document::Document(Document &&) delete

Definition at line 21 of Document.hpp


Document Constructor

sngxml::dom::Document::Document(const Document &) delete

Definition at line 19 of Document.hpp


Member Function Details

Accept Member Function

void sngxml::dom::Document::Accept(Visitor & visitor) override

Definition at line 107 of Document.cpp :
108 {
109     visitor.BeginVisit(this);
110     ParentNode::Accept(visitor);
111     visitor.EndVisit(this);
112 }


Declaration at line 37 of Document.hpp

Base class overridden functions: sngxml::dom::Node::Accept , sngxml::dom::ParentNode::Accept

Calls: sngxml::dom::ParentNode::Accept

Called by: sngxml::dom::Document::GetElementById


AppendChild Member Function

Node * sngxml::dom::Document::AppendChild(std::unique_ptr<Node >&& newChild) override

Definition at line 91 of Document.cpp :
 92 {
 93     CheckValidInsert(newChild.get()nullptr);
 94     if (newChild->GetNodeType() == NodeType::elementNode)
 95     {
 96         Assert(documentElement == nullptr"document element is not null");
 97         documentElement = static_cast<Element*>(newChild.get());
 98     }
 99     return ParentNode::AppendChild(std::move(newChild));
100 }


Declaration at line 29 of Document.hpp

Base class overridden functions: sngxml::dom::ParentNode::AppendChild

Calls: sngxml::dom::Document::CheckValidInsert , sngxml::dom::Node::GetNodeType , sngxml::dom::ParentNode::AppendChild

Called by: sngxml::dom::Document::ReplaceChild


CheckValidInsert Member Function

void sngxml::dom::Document::CheckValidInsert(Node * node, Node * refNode)

Definition at line 154 of Document.cpp :
155 {
156     if (node->GetNodeType() == NodeType::elementNode)
157     {
158         if (refNode != nullptr || documentElement != nullptr)
159         {
160             throw DomException("attempt to insert a second element to a document");
161         }
162     }
163 }


Declaration at line 41 of Document.hpp

Calls: sngxml::dom::Node::GetNodeType

Called by: sngxml::dom::Document::AppendChild , sngxml::dom::Document::InsertBefore , sngxml::dom::Document::ReplaceChild


CloneNode Member Function

std::unique_ptr<Node > sngxml::dom::Document::CloneNode(bool deep) override

Definition at line 29 of Document.cpp :
 30 {
 31     std::unique_ptr<Node> clonedDocument = std::unique_ptr<Node>(new Document());
 32     if (deep)
 33     {
 34         ParentNode* parentNode = static_cast<ParentNode*>(clonedDocument.get());
 35         CloneChildrenTo(parentNode);
 36     }
 37     return clonedDocument;
 38 }


Declaration at line 23 of Document.hpp

Base class overridden functions: sngxml::dom::Node::CloneNode

Calls: sngxml::dom::ParentNode::CloneChildrenTo


DocumentElement Member Function

Element * sngxml::dom::Document::DocumentElement()

Definition at line 24 of Document.hpp :
24 { return documentElement; }


GetElementById Member Function

Element * sngxml::dom::Document::GetElementById(const std::u32string& elementId)

Definition at line 136 of Document.cpp
Declaration at line 30 of Document.hpp

Calls: sngxml::dom::Document::Accept


InsertBefore Member Function

Node * sngxml::dom::Document::InsertBefore(std::unique_ptr<Node >&& newChild, Node * refChild) override

Definition at line 40 of Document.cpp :
 41 {
 42     CheckValidInsert(newChild.get()refChild);
 43     if (newChild->GetNodeType() == NodeType::elementNode)
 44     {
 45         Assert(documentElement == nullptr"document element is not null");
 46         documentElement = static_cast<Element*>(newChild.get());
 47     }
 48     return ParentNode::InsertBefore(std::move(newChild)refChild);
 49 }


Declaration at line 26 of Document.hpp

Base class overridden functions: sngxml::dom::ParentNode::InsertBefore

Calls: sngxml::dom::Document::CheckValidInsert , sngxml::dom::Node::GetNodeType , sngxml::dom::ParentNode::InsertBefore


InternalInvalidateIndex Member Function

void sngxml::dom::Document::InternalInvalidateIndex()

Definition at line 102 of Document.cpp :
103 {
104     indexValid = false;
105 }


Declaration at line 38 of Document.hpp

Called by: sngxml::dom::ParentNode::AppendChild , sngxml::dom::ParentNode::InsertBefore , sngxml::dom::ParentNode::RemoveChild , sngxml::dom::ParentNode::ReplaceChild


RemoveChild Member Function

std::unique_ptr<Node > sngxml::dom::Document::RemoveChild(Node * oldChild) override

Definition at line 74 of Document.cpp
Declaration at line 28 of Document.hpp

Base class overridden functions: sngxml::dom::ParentNode::RemoveChild

Calls: sngxml::dom::Node::GetNodeType , sngxml::dom::Node::Parent , sngxml::dom::ParentNode::RemoveChild

Called by: sngxml::dom::Document::ReplaceChild


ReplaceChild Member Function

std::unique_ptr<Node > sngxml::dom::Document::ReplaceChild(std::unique_ptr<Node >&& newChild, Node * oldChild) override

Definition at line 51 of Document.cpp
Declaration at line 27 of Document.hpp

Base class overridden functions: sngxml::dom::ParentNode::ReplaceChild

Calls: sngxml::dom::Document::AppendChild , sngxml::dom::Document::CheckValidInsert , sngxml::dom::Document::RemoveChild , sngxml::dom::Node::GetNodeType , sngxml::dom::Node::Parent , sngxml::dom::ParentNode::ReplaceChild


SetXmlEncoding Member Function

void sngxml::dom::Document::SetXmlEncoding(const std::u32string& xmlEncoding_)

Definition at line 35 of Document.hpp :
35 { xmlEncoding = xmlEncoding_; }


SetXmlStandalone Member Function

void sngxml::dom::Document::SetXmlStandalone(bool xmlStandalone_)

Definition at line 31 of Document.hpp :
31 { xmlStandalone = xmlStandalone_; }


SetXmlVersion Member Function

void sngxml::dom::Document::SetXmlVersion(const std::u32string& xmlVersion_)

Definition at line 33 of Document.hpp :
33 { xmlVersion = xmlVersion_; }


Write Member Function

void sngxml::dom::Document::Write(CodeFormatter& formatter) override

Definition at line 20 of Document.cpp :
 21 {
 22     if (!xmlVersion.empty() && !xmlEncoding.empty())
 23     {
 24         formatter.WriteLine("<?xml version=\"" + ToUtf8(xmlVersion) + "\" encoding=\"" + ToUtf8(xmlEncoding) + "\"?>");
 25     }
 26     ParentNode::Write(formatter);
 27 }


Declaration at line 25 of Document.hpp

Calls: sngxml::dom::ParentNode::Write


XmlEncoding Member Function

const std::u32string& sngxml::dom::Document::XmlEncoding() const

Definition at line 36 of Document.hpp :
36 { return xmlEncoding; }


XmlStandalone Member Function

bool sngxml::dom::Document::XmlStandalone() const

Definition at line 32 of Document.hpp :
32 { return xmlStandalone; }


XmlVersion Member Function

const std::u32string& sngxml::dom::Document::XmlVersion() const

Definition at line 34 of Document.hpp :
34 { return xmlVersion; }


operator= Member Function

Document & sngxml::dom::Document::operator=(Document &&) delete

Definition at line 22 of Document.hpp


operator= Member Function

Document & sngxml::dom::Document::operator=(const Document &) delete

Definition at line 20 of Document.hpp


top | up | prev | next