Vault
4.1
|
VBentoCallbackParser is provided for you to subclass if you need to read a bento object (or complete hierarchy) from the stream "manually". More...
#include <vbento.h>
Public Member Functions | |
VBentoCallbackParser (VBinaryIOStream &stream) | |
Constructs a callback parser. | |
virtual | ~VBentoCallbackParser () |
Destructor. | |
Protected Member Functions | |
void | processNode (int depth, VBinaryIOStream &stream) |
Processes a single node, including all its children (used recursively). | |
void | processAttribute (int depth, VBinaryIOStream &stream) |
Processes a single attribute. | |
virtual void | nodeHeaderComplete (int depth, Vs64 length, Vs32 numAttributes, Vs32 numChildren, const VString &name) |
Virtual function you can override to take action when a node's header has been completely read; called when the node's header has been read, prior to the node's attributes or children being read. | |
virtual void | nodeAttributesComplete (int depth, Vs64 length, Vs32 numAttributes, Vs32 numChildren, const VString &name) |
Virtual function you can override to take action when a node's header and attributes have been completely read; called when the node's header and attributes have been read, prior to the node's children being read. | |
virtual void | nodeComplete (int depth, Vs64 length, Vs32 numAttributes, Vs32 numChildren, const VString &name) |
Virtual function you can override to take action when a node has been completely read; called when the node's header and attributes and children have all been read. | |
virtual void | attributeHeaderComplete (int depth, Vs64 length, const VString &type, const VString &name) |
Virtual function you can override to take action when an attribute's header has been completely read; called when the attribute's header has been read, prior to its data being read. | |
virtual void | attributeComplete (int depth, Vs64 length, const VString &type, const VString &name) |
Virtual function you can override to take action when an attribute has been completely read; called when the attributes's header and data have all been read. | |
virtual void | readAttributeData (int depth, VBinaryIOStream &stream, Vu64 dataLength) |
Virtual function you can override to read the attribute's data; if you don't override this, the attribute data is simply skipped over. |
VBentoCallbackParser is provided for you to subclass if you need to read a bento object (or complete hierarchy) from the stream "manually".
You can think of this as analogous to an XML "SAX"-like parser, where you get called as the data is read, rather than having the whole document tree read into memory first. Typical example is for large objects that would be inefficient to simply copy into memory in one chunk as a bento hierarchy node. Normally you would just pick and choose which of the "xxxxComplete()" methods to override, and/or override readAttributeData() to read the actual data. If you don't override readAttributeData, the data is skipped over in the input stream.
VBentoCallbackParser::VBentoCallbackParser | ( | VBinaryIOStream & | stream | ) |
Constructs a callback parser.
stream | the input stream to read from |
Definition at line 2659 of file vbento.cpp.
References processNode().
void VBentoCallbackParser::processNode | ( | int | depth, |
VBinaryIOStream & | stream | ||
) | [protected] |
Processes a single node, including all its children (used recursively).
depth | the depth of this node in the hierarchy |
stream | the input stream to read from |
Definition at line 2663 of file vbento.cpp.
References nodeAttributesComplete(), nodeComplete(), nodeHeaderComplete(), processAttribute(), VBinaryIOStream::readS32(), and VBinaryIOStream::readString().
void VBentoCallbackParser::processAttribute | ( | int | depth, |
VBinaryIOStream & | stream | ||
) | [protected] |
Processes a single attribute.
depth | the depth of this attribute's owner node in the hierarchy |
stream | the input stream to read from |
Definition at line 2686 of file vbento.cpp.
References attributeComplete(), attributeHeaderComplete(), readAttributeData(), and VBinaryIOStream::readString().
void VBentoCallbackParser::nodeHeaderComplete | ( | int | depth, |
Vs64 | length, | ||
Vs32 | numAttributes, | ||
Vs32 | numChildren, | ||
const VString & | name | ||
) | [protected, virtual] |
Virtual function you can override to take action when a node's header has been completely read; called when the node's header has been read, prior to the node's attributes or children being read.
depth | the node's depth in the hierarchy |
length | the node's data length |
numAttributes | the number attributes owned by the node |
numChildren | the number of children the node has |
name | the node's name |
Definition at line 2701 of file vbento.cpp.
void VBentoCallbackParser::nodeAttributesComplete | ( | int | depth, |
Vs64 | length, | ||
Vs32 | numAttributes, | ||
Vs32 | numChildren, | ||
const VString & | name | ||
) | [protected, virtual] |
Virtual function you can override to take action when a node's header and attributes have been completely read; called when the node's header and attributes have been read, prior to the node's children being read.
depth | the node's depth in the hierarchy |
length | the node's data length |
numAttributes | the number attributes owned by the node |
numChildren | the number of children the node has |
name | the node's name |
Definition at line 2704 of file vbento.cpp.
void VBentoCallbackParser::nodeComplete | ( | int | depth, |
Vs64 | length, | ||
Vs32 | numAttributes, | ||
Vs32 | numChildren, | ||
const VString & | name | ||
) | [protected, virtual] |
Virtual function you can override to take action when a node has been completely read; called when the node's header and attributes and children have all been read.
depth | the node's depth in the hierarchy |
length | the node's data length |
numAttributes | the number attributes owned by the node |
numChildren | the number of children the node has |
name | the node's name |
Definition at line 2707 of file vbento.cpp.
void VBentoCallbackParser::attributeHeaderComplete | ( | int | depth, |
Vs64 | length, | ||
const VString & | type, | ||
const VString & | name | ||
) | [protected, virtual] |
Virtual function you can override to take action when an attribute's header has been completely read; called when the attribute's header has been read, prior to its data being read.
depth | the attribute's owner node's depth in the hierarchy |
length | the attribute's data length |
type | the attribute's type |
name | the node's name |
Definition at line 2710 of file vbento.cpp.
void VBentoCallbackParser::attributeComplete | ( | int | depth, |
Vs64 | length, | ||
const VString & | type, | ||
const VString & | name | ||
) | [protected, virtual] |
Virtual function you can override to take action when an attribute has been completely read; called when the attributes's header and data have all been read.
depth | the attribute's owner node's depth in the hierarchy |
length | the attribute's data length |
type | the attribute's type |
name | the node's name |
Definition at line 2713 of file vbento.cpp.
void VBentoCallbackParser::readAttributeData | ( | int | depth, |
VBinaryIOStream & | stream, | ||
Vu64 | dataLength | ||
) | [protected, virtual] |
Virtual function you can override to read the attribute's data; if you don't override this, the attribute data is simply skipped over.
depth | the attribute's owner node's depth in the hierarchy |
stream | the input stream to read from |
dataLength | the length of the attribute data |
Definition at line 2716 of file vbento.cpp.
References VIOStream::skip().