Vault
4.1
|
VBentoAttribute is an abstract base class for all of the concrete VBento attribute classes. More...
#include <vbento.h>
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 VBentoAttribute * | clone () const =0 |
VBentoAttribute & | operator= (const VBentoAttribute &rhs) |
const VString & | getName () const |
Returns the attribute name. | |
const VString & | getDataType () 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 VBentoAttribute * | newObjectFromStream (VBinaryIOStream &stream) |
Creates a new attribute object by reading a binary stream. | |
static VBentoAttribute * | newObjectFromStream (VTextIOStream &stream) |
Creates a new attribute object by reading a text XML stream. | |
static VBentoAttribute * | newObjectFromBentoTextValues (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. |
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.
Constructs with name and type.
name | the attribute name |
dataType | the data type |
Definition at line 345 of file vbento.cpp.
const VString & VBentoAttribute::getName | ( | ) | const |
Returns the attribute name.
Definition at line 354 of file vbento.cpp.
const VString & VBentoAttribute::getDataType | ( | ) | const |
Returns the data type name.
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.
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.
Definition at line 370 of file vbento.cpp.
References calculateContentSize().
void VBentoAttribute::writeToStream | ( | VBinaryIOStream & | stream | ) | const |
Writes the attribute to a binary stream.
stream | the 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.
stream | the 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.
stream | the stream to write to |
lineWrap | true if each bento node should start on its own indented line |
indentDepth | if 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.
hexDump | the 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] |
Creates a new attribute object by reading a binary stream.
stream | the stream to read from |
Definition at line 492 of file vbento.cpp.
References VBentoS8::DATA_TYPE_ID(), VBentoU8::DATA_TYPE_ID(), VBentoS16::DATA_TYPE_ID(), VBentoU16::DATA_TYPE_ID(), VBentoS32::DATA_TYPE_ID(), VBentoU32::DATA_TYPE_ID(), VBentoS64::DATA_TYPE_ID(), VBentoU64::DATA_TYPE_ID(), VBentoBool::DATA_TYPE_ID(), VBentoString::DATA_TYPE_ID(), VBentoChar::DATA_TYPE_ID(), VBentoFloat::DATA_TYPE_ID(), VBentoDouble::DATA_TYPE_ID(), VBentoDuration::DATA_TYPE_ID(), VBentoInstant::DATA_TYPE_ID(), VBentoSize::DATA_TYPE_ID(), VBentoISize::DATA_TYPE_ID(), VBentoPoint::DATA_TYPE_ID(), VBentoIPoint::DATA_TYPE_ID(), VBentoPoint3D::DATA_TYPE_ID(), VBentoIPoint3D::DATA_TYPE_ID(), VBentoLine::DATA_TYPE_ID(), VBentoILine::DATA_TYPE_ID(), VBentoRect::DATA_TYPE_ID(), VBentoIRect::DATA_TYPE_ID(), VBentoPolygon::DATA_TYPE_ID(), VBentoIPolygon::DATA_TYPE_ID(), VBentoColor::DATA_TYPE_ID(), VBentoBinary::DATA_TYPE_ID(), VBentoS8Array::DATA_TYPE_ID(), VBentoS16Array::DATA_TYPE_ID(), VBentoS32Array::DATA_TYPE_ID(), VBentoS64Array::DATA_TYPE_ID(), VBentoStringArray::DATA_TYPE_ID(), VBentoBoolArray::DATA_TYPE_ID(), VBentoDoubleArray::DATA_TYPE_ID(), VBentoDurationArray::DATA_TYPE_ID(), VBentoInstantArray::DATA_TYPE_ID(), VBentoChar::LEGACY_DATA_TYPE_ID(), and VBentoChar::newFromLegacyCharStream().
VBentoAttribute * VBentoAttribute::newObjectFromStream | ( | VTextIOStream & | stream | ) | [static] |
Creates a new attribute object by reading a text XML stream.
stream | the stream to read from |
Definition at line 582 of file vbento.cpp.
virtual Vs64 VBentoAttribute::getDataLength | ( | ) | const [protected, pure virtual] |
Returns the length of this object's raw data only; pure virtual.
Implemented in VBentoInstantArray, VBentoDurationArray, VBentoDoubleArray, VBentoBoolArray, VBentoStringArray, VBentoS64Array, VBentoS32Array, VBentoS16Array, VBentoS8Array, VBentoUnknownValue, VBentoBinary, VBentoColor, VBentoIPolygon, VBentoPolygon, VBentoIRect, VBentoRect, VBentoILine, VBentoLine, VBentoIPoint3D, VBentoPoint3D, VBentoIPoint, VBentoPoint, VBentoISize, VBentoSize, VBentoInstant, VBentoDuration, VBentoDouble, VBentoFloat, VBentoChar, VBentoString, VBentoBool, VBentoU64, VBentoS64, VBentoU32, VBentoS32, VBentoU16, VBentoS16, VBentoU8, and VBentoS8.
virtual void VBentoAttribute::writeDataToBinaryStream | ( | VBinaryIOStream & | stream | ) | const [protected, pure virtual] |
Writes the object's raw data only to a binary stream; pure virtual.
stream | the stream to write to |
Implemented in VBentoInstantArray, VBentoDurationArray, VBentoDoubleArray, VBentoBoolArray, VBentoStringArray, VBentoS64Array, VBentoS32Array, VBentoS16Array, VBentoS8Array, VBentoUnknownValue, VBentoBinary, VBentoColor, VBentoIPolygon, VBentoPolygon, VBentoIRect, VBentoRect, VBentoILine, VBentoLine, VBentoIPoint3D, VBentoPoint3D, VBentoIPoint, VBentoPoint, VBentoISize, VBentoSize, VBentoInstant, VBentoDuration, VBentoDouble, VBentoFloat, VBentoChar, VBentoString, VBentoBool, VBentoU64, VBentoS64, VBentoU32, VBentoS32, VBentoU16, VBentoS16, VBentoU8, and VBentoS8.
void VBentoAttribute::_escapeXMLValue | ( | VString & | text | ) | [static, protected] |
Modifies the input XML value string by replacing any necessary characters with XML escape sequences.
text | the value text to be escaped |
Definition at line 797 of file vbento.cpp.
References VString::length().