Regina Calculation Engine
|
An XML element reader that reads the data for an individual packet. More...
#include <packet/nxmlpacketreader.h>
Public Member Functions | |
NXMLPacketReader (NXMLTreeResolver &resolver) | |
Creates a new packet element reader. More... | |
virtual NPacket * | getPacket () |
Returns the newly allocated packet that has been read by this element reader. More... | |
virtual NXMLElementReader * | startContentSubElement (const std::string &subTagName, const regina::xml::XMLPropertyDict &subTagProps) |
Used instead of startSubElement() for XML subelements that are not child packets or packet tags. More... | |
virtual void | endContentSubElement (const std::string &subTagName, NXMLElementReader *subReader) |
Used instead of endSubElement() for XML subelements that are not child packets or packet tags. More... | |
virtual NXMLElementReader * | startSubElement (const std::string &subTagName, const regina::xml::XMLPropertyDict &subTagProps) |
Signifies that a subelement of this XML element is about to be parsed. More... | |
virtual void | endSubElement (const std::string &subTagName, NXMLElementReader *subReader) |
Signifies that parsing has finished for a subelement of this XML element. More... | |
virtual void | abort (NXMLElementReader *subReader) |
Signifies that XML parsing has been aborted. More... | |
virtual void | startElement (const std::string &tagName, const regina::xml::XMLPropertyDict &tagProps, NXMLElementReader *parentReader) |
Signifies that parsing of this XML element is beginning. More... | |
virtual void | initialChars (const std::string &chars) |
Signifies that the initial text belonging to this XML element has been read. More... | |
virtual void | endElement () |
Signifies that parsing of this XML element is finished. More... | |
virtual void | usingParser (regina::xml::XMLParser *parser) |
Called for the top-level element in an XML file when parsing begins. More... | |
Protected Attributes | |
NXMLTreeResolver & | resolver_ |
The master resolver that will be used to fix dangling packet references after the entire XML file has been read. More... | |
An XML element reader that reads the data for an individual packet.
Generally a subclass of NXMLPacketReader will be used to receive and store packets that you care about. However, if you simply wish to ignore a particular packet (and all of its descendants), you can use class NXMLPacketReader itself for the packet(s) you wish to ignore.
Routine getPacket() is used to return the packet that was read; see its documentation for further notes on how the packet should be constructed.
Routines startSubElement() and endSubElement() should not be overridden by derived classes. They determine whether the subelement is another packet element or a packet tag; if so then they deal with the subelement themselves (packet elements will be read using a new NXMLPacketReader of the correct type), and if not then they call startContentSubElement() and endContentSubElement() which should be overridden for processing of non-packet XML subelements.
If routine abort() is overridden, it must at some point call NXMLPacketReader::abort() which will destroy whatever new packets have already been created.
|
inline |
Creates a new packet element reader.
resolver | the master resolver that will be used to fix dangling packet references after the entire XML file has been read. |
|
virtual |
Signifies that XML parsing has been aborted.
This element reader will be destroyed shortly after this routine is called.
The default implementation does nothing.
subReader | the corresponding child reader if a subelement is currently being parsed, or 0 otherwise. If this parameter is non-zero, it is guaranteed that abort() has already been called upon the child reader and that the child reader has not yet been destroyed. |
Reimplemented from regina::NXMLElementReader.
|
inlinevirtual |
Used instead of endSubElement() for XML subelements that are not child packets or packet tags.
The default implementation does nothing.
subTagName | the name of the subelement closing tag. |
subReader | the child reader that was used to parse the subelement (this is the reader that was returned by the corresponding startContentSubElement() call). It is guaranteed that endElement() has already been called upon this child reader and that the child reader has not yet been destroyed. |
Reimplemented in regina::NXMLTextReader, regina::NXMLScriptReader, regina::NXMLNormalSurfaceListReader, regina::NXMLFilterPacketReader, regina::NXMLAngleStructureListReader, regina::NXMLPDFReader, regina::NXMLDim2TriangulationReader, regina::NXMLSnapPeaReader, and regina::NXMLTriangulationReader.
|
inlinevirtualinherited |
Signifies that parsing of this XML element is finished.
It is guaranteed that endSubElement() has not yet been called upon the parent reader (if one exists).
The default implementation does nothing.
|
virtual |
Signifies that parsing has finished for a subelement of this XML element.
The default implementation does nothing.
subTagName | the name of the subelement closing tag. |
subReader | the child reader that was used to parse the subelement (this is the reader that was returned by the corresponding startSubElement() call). It is guaranteed that endElement() has already been called upon this child reader and that the child reader has not yet been destroyed. |
Reimplemented from regina::NXMLElementReader.
|
inlinevirtual |
Returns the newly allocated packet that has been read by this element reader.
Deallocation of this new packet is not the responsibility of this class. Once this routine gives a non-zero return value, it should continue to give the same non-zero return value from this point onwards.
If this routine is ever to give a non-zero return value, it must be giving that non-zero return value by the time the first child packet or packet tag is encountered; otherwise child packets will not be inserted into the packet tree and/or packet tags will not be added.
The newly allocated packet should not be given a packet label. This will be done by NXMLPacketReader::endSubElement().
The newly allocated packet may or may not be inserted in the packet tree structure; this does not matter (although if it is inserted it must be inserted in the correct place).
The newly allocated packet should not be given any associated packet tags. This will be done by NXMLPacketReader::startSubElement().
The default implementation returns 0.
Reimplemented in regina::NXMLTextReader, regina::NXMLScriptReader, regina::NXMLNormalSurfaceListReader, regina::NXMLFilterPacketReader, regina::NXMLAngleStructureListReader, regina::NXMLPDFReader, regina::NXMLContainerReader, regina::NXMLDim2TriangulationReader, regina::NXMLSnapPeaReader, and regina::NXMLTriangulationReader.
|
inlinevirtualinherited |
Signifies that the initial text belonging to this XML element has been read.
The initial text is everything between the opening tag and the first subelement or closing tag.
The default implementation does nothing.
chars | the initial text for this element. |
Reimplemented in regina::NXMLCharsReader, regina::NXMLNormalSurfaceReader, regina::NXMLAngleStructureReader, and regina::NXMLAbelianGroupReader.
|
inlinevirtual |
Used instead of startSubElement() for XML subelements that are not child packets or packet tags.
The default implementation returns a new NXMLElementReader which can be used to ignore the subelement completely.
subTagName | the name of the subelement opening tag. |
subTagProps | the properties associated with the subelement opening tag. |
Reimplemented in regina::NXMLTextReader, regina::NXMLScriptReader, regina::NXMLNormalSurfaceListReader, regina::NXMLFilterPacketReader, regina::NXMLAngleStructureListReader, regina::NXMLPDFReader, regina::NXMLDim2TriangulationReader, regina::NXMLSnapPeaReader, and regina::NXMLTriangulationReader.
|
inlinevirtualinherited |
Signifies that parsing of this XML element is beginning.
The default implementation does nothing.
tagName | the name of the opening tag for this element. |
tagProps | the properties associated with the opening tag. |
parentReader | the reader currently parsing the parent XML element, or 0 if this is the top-level element. If this paraneter is non-zero, it is guaranteed that startSubElement() has already been called upon the parent reader. |
Reimplemented in regina::NXMLGroupPresentationReader, regina::NXMLNormalSurfaceReader, regina::NXMLAngleStructureReader, and regina::NXMLAbelianGroupReader.
|
virtual |
Signifies that a subelement of this XML element is about to be parsed.
The default implementation returns a new NXMLElementReader which can be used to ignore the subelement completely.
subTagName | the name of the subelement opening tag. |
subTagProps | the properties associated with the subelement opening tag. |
Reimplemented from regina::NXMLElementReader.
|
inlinevirtualinherited |
Called for the top-level element in an XML file when parsing begins.
This allows direct access to the parser if needed (for instance, to change the character encoding).
The default implementation does nothing.
parser | the current XML parser. |
|
protected |
The master resolver that will be used to fix dangling packet references after the entire XML file has been read.