Vault  4.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions
VBentoAttribute Class Reference

VBentoAttribute is an abstract base class for all of the concrete VBento attribute classes. More...

#include <vbento.h>

Inheritance diagram for VBentoAttribute:
VBentoArray VBentoBinary VBentoBool VBentoChar VBentoColor VBentoDouble VBentoDuration VBentoFloat VBentoILine VBentoInstant VBentoIPoint VBentoIPoint3D VBentoIPolygon VBentoIRect VBentoISize VBentoLine VBentoPoint VBentoPoint3D VBentoPolygon VBentoRect VBentoS16 VBentoS32 VBentoS64 VBentoS8 VBentoSize VBentoString VBentoU16 VBentoU32 VBentoU64 VBentoU8 VBentoUnknownValue

List of all members.

Public Member Functions

 VBentoAttribute ()
 Constructs with uninitialized name.
 VBentoAttribute (VBinaryIOStream &stream, const VString &dataType)
 Constructs by reading from stream.
 VBentoAttribute (const VString &name, const VString &dataType)
 Constructs with name and type.
virtual ~VBentoAttribute ()
 Destructor.
virtual VBentoAttributeclone () const =0
VBentoAttributeoperator= (const VBentoAttribute &rhs)
const VStringgetName () const
 Returns the attribute name.
const VStringgetDataType () const
 Returns the data type name.
virtual bool xmlAppearsAsArray () const
 True if XML output requires this attribute to use a separate child tag for its array elements; implies override of writeToXMLTextStream.
virtual void getValueAsXMLText (VString &s) const =0
 Returns a string suitable for an XML attribute value, including escaping via _escapeXMLValue() if needed.
virtual void getValueAsString (VString &s) const =0
 Returns a printable form of the attribute value.
virtual void getValueAsBentoTextString (VString &s) const =0
 Returns a Bento Text form of the attribute value.
Vs64 calculateContentSize () const
 Returns the size, in bytes, of the attribute content if written to a binary stream.
Vs64 calculateTotalSize () const
 Returns the size, in bytes, of the attribute content plus dynamic size indicator if written to a binary stream.
void writeToStream (VBinaryIOStream &stream) const
 Writes the attribute to a binary stream.
void writeToBentoTextStream (VTextIOStream &stream) const
 Writes the object, including its attributes and contained child objects, to a text stream in Bento Text Format.
virtual void writeToXMLTextStream (VTextIOStream &stream, bool lineWrap, int indentDepth) const
 Writes the attribute to a text stream as XML.
void printHexDump (VHex &hexDump) const
 Debugging method. Prints a hex dump of the stream.

Static Public Member Functions

static VBentoAttributenewObjectFromStream (VBinaryIOStream &stream)
 Creates a new attribute object by reading a binary stream.
static VBentoAttributenewObjectFromStream (VTextIOStream &stream)
 Creates a new attribute object by reading a text XML stream.
static VBentoAttributenewObjectFromBentoTextValues (const VString &attributeName, const VString &attributeType, const VString &attributeValue, const VString &attributeQualifier)

Protected Member Functions

virtual Vs64 getDataLength () const =0
 Returns the length of this object's raw data only; pure virtual.
virtual void writeDataToBinaryStream (VBinaryIOStream &stream) const =0
 Writes the object's raw data only to a binary stream; pure virtual.

Static Protected Member Functions

static void _escapeXMLValue (VString &text)
 Modifies the input XML value string by replacing any necessary characters with XML escape sequences.

Detailed Description

VBentoAttribute is an abstract base class for all of the concrete VBento attribute classes.

Each VBentoNode object in the object hierarchy can have zero or more attributes; each such attribute exists in memory as a concrete VBentoAttribute-derived class. These objects know how to read/write themselves from the stream, when asked to do so by the VBentoNode objects that contain them.

Definition at line 818 of file vbento.h.


Constructor & Destructor Documentation

VBentoAttribute::VBentoAttribute ( const VString name,
const VString dataType 
)

Constructs with name and type.

Parameters:
namethe attribute name
dataTypethe data type

Definition at line 345 of file vbento.cpp.


Member Function Documentation

const VString & VBentoAttribute::getName ( ) const

Returns the attribute name.

Returns:
a reference to the attribute name string.

Definition at line 354 of file vbento.cpp.

const VString & VBentoAttribute::getDataType ( ) const

Returns the data type name.

Returns:
a reference to the data type name string.

Definition at line 358 of file vbento.cpp.

Vs64 VBentoAttribute::calculateContentSize ( ) const

Returns the size, in bytes, of the attribute content if written to a binary stream.

Returns:
the attribute's binary size

Definition at line 362 of file vbento.cpp.

References getDataLength().

Vs64 VBentoAttribute::calculateTotalSize ( ) const

Returns the size, in bytes, of the attribute content plus dynamic size indicator if written to a binary stream.

Returns:
the attribute's binary size

Definition at line 370 of file vbento.cpp.

References calculateContentSize().

void VBentoAttribute::writeToStream ( VBinaryIOStream stream) const

Writes the attribute to a binary stream.

Parameters:
streamthe stream to write to

Definition at line 377 of file vbento.cpp.

References calculateContentSize(), writeDataToBinaryStream(), and VBinaryIOStream::writeString().

void VBentoAttribute::writeToBentoTextStream ( VTextIOStream stream) const

Writes the object, including its attributes and contained child objects, to a text stream in Bento Text Format.

Parameters:
streamthe stream to write to

Definition at line 411 of file vbento.cpp.

References VString::chars(), VBentoS32::DATA_TYPE_ID(), VBentoBool::DATA_TYPE_ID(), VBentoString::DATA_TYPE_ID(), VBentoChar::DATA_TYPE_ID(), VBentoStringArray::DATA_TYPE_ID(), VBentoString::getEncoding(), getValueAsBentoTextString(), VString::isEmpty(), and VTextIOStream::writeString().

void VBentoAttribute::writeToXMLTextStream ( VTextIOStream stream,
bool  lineWrap,
int  indentDepth 
) const [virtual]

Writes the attribute to a text stream as XML.

Parameters:
streamthe stream to write to
lineWraptrue if each bento node should start on its own indented line
indentDepthif lineWrap is true, the indent level depth of this node

Reimplemented in VBentoInstantArray, VBentoDurationArray, VBentoDoubleArray, VBentoBoolArray, VBentoStringArray, VBentoS64Array, VBentoS32Array, VBentoS16Array, VBentoS8Array, VBentoArray, VBentoIPolygon, VBentoPolygon, VBentoIRect, VBentoRect, VBentoILine, VBentoLine, VBentoIPoint3D, VBentoPoint3D, VBentoIPoint, VBentoPoint, VBentoISize, and VBentoSize.

Definition at line 471 of file vbento.cpp.

References getValueAsXMLText(), VTextIOStream::writeString(), and xmlAppearsAsArray().

void VBentoAttribute::printHexDump ( VHex hexDump) const

Debugging method. Prints a hex dump of the stream.

Parameters:
hexDumpthe hex dump formatter object

Definition at line 483 of file vbento.cpp.

References VMemoryStream::getBuffer(), VMemoryStream::getEOFOffset(), VHex::printHex(), and writeToStream().

VBentoAttribute * VBentoAttribute::newObjectFromStream ( VBinaryIOStream stream) [static]
VBentoAttribute * VBentoAttribute::newObjectFromStream ( VTextIOStream stream) [static]

Creates a new attribute object by reading a text XML stream.

Parameters:
streamthe stream to read from
Returns:
the new object

Definition at line 582 of file vbento.cpp.

virtual Vs64 VBentoAttribute::getDataLength ( ) const [protected, pure virtual]
virtual void VBentoAttribute::writeDataToBinaryStream ( VBinaryIOStream stream) const [protected, pure virtual]
void VBentoAttribute::_escapeXMLValue ( VString text) [static, protected]

Modifies the input XML value string by replacing any necessary characters with XML escape sequences.

Parameters:
textthe value text to be escaped

Definition at line 797 of file vbento.cpp.

References VString::length().


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.