Vault  4.1
Public Member Functions | Protected Member Functions
VBentoCallbackParser Class Reference

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>

List of all members.

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.

Detailed Description

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.

Definition at line 723 of file vbento.h.


Constructor & Destructor Documentation

VBentoCallbackParser::VBentoCallbackParser ( VBinaryIOStream stream)

Constructs a callback parser.

Parameters:
streamthe input stream to read from

Definition at line 2659 of file vbento.cpp.

References processNode().


Member Function Documentation

void VBentoCallbackParser::processNode ( int  depth,
VBinaryIOStream stream 
) [protected]

Processes a single node, including all its children (used recursively).

Parameters:
depththe depth of this node in the hierarchy
streamthe 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.

Parameters:
depththe depth of this attribute's owner node in the hierarchy
streamthe 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.

Parameters:
depththe node's depth in the hierarchy
lengththe node's data length
numAttributesthe number attributes owned by the node
numChildrenthe number of children the node has
namethe 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.

Parameters:
depththe node's depth in the hierarchy
lengththe node's data length
numAttributesthe number attributes owned by the node
numChildrenthe number of children the node has
namethe 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.

Parameters:
depththe node's depth in the hierarchy
lengththe node's data length
numAttributesthe number attributes owned by the node
numChildrenthe number of children the node has
namethe 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.

Parameters:
depththe attribute's owner node's depth in the hierarchy
lengththe attribute's data length
typethe attribute's type
namethe 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.

Parameters:
depththe attribute's owner node's depth in the hierarchy
lengththe attribute's data length
typethe attribute's type
namethe 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.

Parameters:
depththe attribute's owner node's depth in the hierarchy
streamthe input stream to read from
dataLengththe length of the attribute data

Definition at line 2716 of file vbento.cpp.

References VIOStream::skip().


The documentation for this class was generated from the following files:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.