Vault  4.1
vbento.h
Go to the documentation of this file.
00001 /*
00002 Copyright c1997-2014 Trygve Isaacson. All rights reserved.
00003 This file is part of the Code Vault version 4.1
00004 http://www.bombaydigital.com/
00005 License: MIT. See LICENSE.md in the Vault top level directory.
00006 */
00007 
00008 #ifndef vbento_h
00009 #define vbento_h
00010 
00013 #include "vmemorystream.h"
00014 #include "vhex.h"
00015 #include "vinstant.h"
00016 #include "vexception.h"
00017 #include "vgeometry.h"
00018 #include "vcolor.h"
00019 
00020 class VBinaryIOStream;
00021 class VTextIOStream;
00022 
00023 /*
00024 VBento
00025 Bento presents an extensible, typed, named data hierarchy; it can be used as
00026 an abstraction of an XML DOM or a binary version of the same. A large part of
00027 its purpose is to allow you to write data (a wire protocol or file format,
00028 for example) such that the reader can read the data, without any effort, with
00029 following two important backward/forward-compatibility aspects:
00030 
00031 - unexpected data is harmlessly ignored
00032 - missing expected data can be easily set to default values
00033 
00034 This allows you to revise the protocol with new parameters, without breaking
00035 the binary compatibility of old clients and old servers.
00036 
00037 Bento Binary Stream Format
00038 
00039 In the following description, "dyn-len" indicates a "dynamic length" value. A
00040 dynamic length value holds a length, but the size of value depends on the
00041 value. See VBinaryIOStream::readDynamicLength() and writeDynamicLength(). In
00042 short, values <= 252 are encoded in a single byte; larger values are encoded
00043 in more bytes, with a leading 0xFF, 0xFE, or 0xFD indicating whether the next
00044 2, 4, or 8 bytes hold the value. In the stream, the length is stored in
00045 network order ("big-endian") if it is more than 1 byte long. The purpose of
00046 using a dynamic length is to allow for huge elements whose length requires
00047 2 or 4 or 8 bytes to express, while keeping the cost to just 1 byte for the
00048 vast majority of cases.
00049 
00050 In addition, "string" indicates a string that is stored in this format:
00051 
00052     - dyn-len: length of text
00053     - text (byte stream)
00054 
00055 A stream consists of "atom" elements. An atom is either a "node" or an
00056 "attribute". The general format of atom is:
00057 
00058     - dyn-len: length of content
00059     - content (byte stream)
00060 
00061 For a "node" atom, the content section is:
00062 
00063     - Vs32: number of attributes "na"
00064     - Vs32: number of child nodes "nc"
00065     - string: name
00066     - array[na] of attribute atoms
00067     - array[nc] of child node atoms
00068 
00069 For an "attribute" atom, the content section is:
00070 
00071     - Vs8[4]: data type indicator ("vs_8" | "vu_8" | "vs16" | "vu16" | "vs32" | "vu32" | "vs64" | "vu64" | "bool" | "vstr" | "char" | "flot" | "doub" | "dura" | "inst" | "sizd" | "sizi" | "pt_d" | "pt_i" | "recd" | "reci" | "pold" | "poli" | "bina" )
00072     - string: name
00073     - data (type-dependent)
00074 
00075 For the numeric data types, the attribute data is 1 to 8 network order bytes ("big-endian").
00076 For the boolean data type, the attribute data is one byte, either 1 or 0.
00077 For the string data type, the attribute data is a string as described above.
00078 
00079 Bento Text Format
00080 
00081 Bento also defines a text format that it can write and read. The purpose of
00082 this format is not to be the primary transmission format for Bento data, but
00083 rather to provide a capability for recording and replaying messages. The
00084 data in the Bento Text Format retains all of the attributes of the original
00085 data: hierarchical, named, strongly typed data. The text format is optimized
00086 for readability by inferring the the most commonly used data types from the
00087 form of the data; this means that the data type need only be specified for
00088 the less-used types.
00089 
00090 Here is the Bento Text Format syntax:
00091 
00092 node : { name attributes children }
00093   A node is identified by curly braces.
00094   A node has a name, optional attributes, and optional children.
00095   The children are nodes, which gives the data a hierarchical nature.
00096   The attributes are typically where the real "data" is located.
00097 
00098 name : "double-quoted string"
00099   Node and attribute names must double-quoted strings.
00100   Backslash is used to escape a double-quote inside the string.
00101   Backslash is used to escape a backslash inside the string.
00102 
00103 attributes : zero or more attribute
00104   See attribute definition below.
00105 
00106 children : zero or more node
00107   Each child is simply another set of curly braces inside its parent.
00108 
00109 attribute : [ name type = value ]
00110   An attribute is identified by square brackets.
00111   The attribute name comes first. See "name" definition above.
00112   The type is optional for string, bool, and int.
00113 
00114 type : (type_abbrev)
00115   A type is identified by parentheses.
00116   The value must be one of the 4-character "data type indicator" codes described above.
00117   For string, bool, and int (vs32), the type can be omitted if the value is formatted
00118     as described below, since the type can then be inferred.
00119 
00120 value : the text representation of the attribute's value
00121   For types that can be inferred:
00122     'vstr' values MUST be double-quoted, with escaping like names described above.
00123       If the type is omitted and the value is not double-quoted, an attempt will
00124       be made to interpret it as a 'bool' or a 'vs32', not as a string.
00125     'bool' values MUST NOT be double-quoted IF the type is omitted.
00126       If the type is omitted and the value is double-quoted, it will be interpreted
00127       as a string, not a 'bool'.
00128       The permitted values are "true" and "false".
00129     'vs32' values MUST NOT be double-quoted IF the type is omitted.
00130       If the type is omitted and the value is double-quoted, it will be interpreted
00131       as a string, not a 'vs32'.
00132   For all other types (they cannot be inferred) :
00133     The type must be specified.
00134     Double-quotes are optional.
00135 
00136 'flot' and 'doub' values when written to Bento Text Format use 6 decimal places of
00137 accuracy. This may place practical limits on using the text format for these data
00138 types, if exact equality of values with many decimal places is needed. If this
00139 becomes a problem, the method VBentoDouble::getValueAsBentoTextString() could be
00140 changed to use a string format with more decimal places than the IEEE default of 6.
00141 */
00142 
00143 class VBentoAttribute;
00144 typedef std::vector<VBentoAttribute*> VBentoAttributePtrVector;
00145 
00146 class VBentoNode;
00147 typedef std::vector<VBentoNode*> VBentoNodePtrVector;
00148 
00149 // Forward declarations for most attribute types.
00150 class VBentoS32;
00151 class VBentoBool;
00152 class VBentoString;
00153 class VBentoChar;
00154 class VBentoDouble;
00155 class VBentoDuration;
00156 class VBentoInstant;
00157 class VBentoSize;
00158 class VBentoISize;
00159 class VBentoPoint;
00160 class VBentoIPoint;
00161 class VBentoPoint3D;
00162 class VBentoIPoint3D;
00163 class VBentoLine;
00164 class VBentoILine;
00165 class VBentoRect;
00166 class VBentoIRect;
00167 class VBentoPolygon;
00168 class VBentoIPolygon;
00169 class VBentoColor;
00170 
00171 class VBentoS8;
00172 class VBentoU8;
00173 class VBentoS16;
00174 class VBentoU16;
00175 class VBentoS32;
00176 class VBentoU32;
00177 class VBentoS64;
00178 class VBentoU64;
00179 class VBentoFloat;
00180 class VBentoBinary;
00181 
00182 // Forward declarations for array attribute types.
00183 class VBentoStringArray;
00184 typedef std::vector<Vs8> Vs8Array;
00185 class VBentoS8Array;
00186 typedef std::vector<Vs16> Vs16Array;
00187 class VBentoS16Array;
00188 typedef std::vector<Vs32> Vs32Array;
00189 class VBentoS32Array;
00190 typedef std::vector<Vs64> Vs64Array;
00191 class VBentoS64Array;
00192 typedef std::vector<bool> VBoolArray;
00193 class VBentoBoolArray;
00194 typedef std::vector<VDouble> VDoubleArray;
00195 class VBentoDoubleArray;
00196 class VBentoDurationArray;
00197 class VBentoInstantArray;
00198 
00199 class DOMNode;
00200 class DOMElement;
00201 
00207 class VBentoNode {
00208     public:
00209 
00210         // Lifecycle methods -------------------------------------------------
00211 
00216         virtual ~VBentoNode();
00217 
00218         // Methods for creating and serializing a data hierarchy -------------
00219 
00223         VBentoNode();
00228         VBentoNode(const VString& name);
00231         VBentoNode(const VBentoNode& original);
00237         void addChildNode(VBentoNode* node);
00244         VBentoNode* addNewChildNode(const VString& name);
00245 
00246         // It is best to use this first set of data types, because they
00247         // are more naturally represented in other languages. Note that
00248         // "int" is just a more convenient name here for S32.
00249         void addInt(const VString& name, int value);                  
00250         void addBool(const VString& name, bool value);                
00251         void addString(const VString& name, const VString& value, const VString& encoding = VString::EMPTY());  
00252         void addStringIfNotEmpty(const VString& name, const VString& value, const VString& encoding = VString::EMPTY());  
00253         void addChar(const VString& name, const VCodePoint& value);   
00254         void addDouble(const VString& name, VDouble value);           
00255         void addDuration(const VString& name, const VDuration& value);
00256         void addInstant(const VString& name, const VInstant& value);  
00257         void addSize(const VString& name, const VSize& value);        
00258         void addISize(const VString& name, const VISize& value);      
00259         void addPoint(const VString& name, const VPoint& value);      
00260         void addIPoint(const VString& name, const VIPoint& value);    
00261         void addPoint3D(const VString& name, const VPoint3D& value);  
00262         void addIPoint3D(const VString& name, const VIPoint3D& value);
00263         void addLine(const VString& name, const VLine& value);        
00264         void addILine(const VString& name, const VILine& value);      
00265         void addRect(const VString& name, const VRect& value);        
00266         void addIRect(const VString& name, const VIRect& value);      
00267         void addPolygon(const VString& name, const VPolygon& value);  
00268         void addIPolygon(const VString& name, const VIPolygon& value);
00269         void addColor(const VString& name, const VColor& value);      
00270 
00271         void addS8(const VString& name, Vs8 value);                   
00272         void addU8(const VString& name, Vu8 value);                   
00273         void addS16(const VString& name, Vs16 value);                 
00274         void addU16(const VString& name, Vu16 value);                 
00275         void addS32(const VString& name, Vs32 value);                 
00276         void addU32(const VString& name, Vu32 value);                 
00277         void addS64(const VString& name, Vs64 value);                 
00278         void addU64(const VString& name, Vu64 value);                 
00279         void addFloat(const VString& name, VFloat value);             
00280         void addBinary(const VString& name, const Vu8* data, Vs64 length);
00281         void addBinary(const VString& name, Vu8* data, VMemoryStream::BufferAllocationType allocationType, bool adoptBuffer, Vs64 suppliedBufferSize, Vs64 suppliedEOFOffset);
00282 
00283         VBentoS8Array* addS8Array(const VString& name);                                             
00284         VBentoS8Array* addS8Array(const VString& name, const Vs8Array& value);                      
00285         VBentoS16Array* addS16Array(const VString& name);                                           
00286         VBentoS16Array* addS16Array(const VString& name, const Vs16Array& value);                   
00287         VBentoS32Array* addS32Array(const VString& name);                                           
00288         VBentoS32Array* addS32Array(const VString& name, const Vs32Array& value);                   
00289         VBentoS64Array* addS64Array(const VString& name);                                           
00290         VBentoS64Array* addS64Array(const VString& name, const Vs64Array& value);                   
00291         VBentoStringArray* addStringArray(const VString& name);                                     
00292         VBentoStringArray* addStringArray(const VString& name, const VStringVector& value);         
00293         VBentoBoolArray* addBoolArray(const VString& name);                                         
00294         VBentoBoolArray* addBoolArray(const VString& name, const VBoolArray& value);                
00295         VBentoDoubleArray* addDoubleArray(const VString& name);                                     
00296         VBentoDoubleArray* addDoubleArray(const VString& name, const VDoubleArray& value);          
00297         VBentoDurationArray* addDurationArray(const VString& name);                                 
00298         VBentoDurationArray* addDurationArray(const VString& name, const VDurationVector& value);   
00299         VBentoInstantArray* addInstantArray(const VString& name);                                   
00300         VBentoInstantArray* addInstantArray(const VString& name, const VInstantVector& value);      
00301 
00307         void writeToStream(VBinaryIOStream& stream) const;
00315         void writeToBentoTextStream(VTextIOStream& stream, bool lineWrap = false, int indentDepth = 0) const;
00324         void writeToBentoTextString(VString& s, bool lineWrap = false) const;
00325 
00326         // Methods for de-serializing and reading a data hierarchy -----------
00327 
00333         VBentoNode(VBinaryIOStream& stream);
00339         VBentoNode(VTextIOStream& bentoTextStream);
00340 
00350         void readFromStream(VBinaryIOStream& stream);
00360         void readFromBentoTextStream(VTextIOStream& bentoTextStream);
00370         void readFromBentoTextString(const VString& bentoTextString);
00371 
00378         VBentoNode* getParentNode() const;
00379 
00384         const VBentoNodePtrVector& getNodes() const;
00391         const VBentoNode* findNode(const VString& nodeName) const;
00404         const VBentoNode* findNode(const VString& nodeName, const VString& attributeName, const VString& dataType) const;
00405 
00406         int getInt(const VString& name, int defaultValue) const; 
00407         int getInt(const VString& name) const; 
00408         bool getBool(const VString& name, bool defaultValue) const; 
00409         bool getBool(const VString& name) const; 
00410         const VString& getString(const VString& name, const VString& defaultValue) const; 
00411         const VString& getString(const VString& name) const; 
00412         const VCodePoint& getChar(const VString& name, const VCodePoint& defaultValue) const; 
00413         const VCodePoint& getChar(const VString& name) const; 
00414         VDouble getDouble(const VString& name, VDouble defaultValue) const; 
00415         VDouble getDouble(const VString& name) const; 
00416         const VDuration& getDuration(const VString& name, const VDuration& defaultValue) const; 
00417         const VDuration& getDuration(const VString& name) const; 
00418         const VInstant& getInstant(const VString& name, const VInstant& defaultValue) const; 
00419         const VInstant& getInstant(const VString& name) const; 
00420         const VSize& getSize(const VString& name, const VSize& defaultValue) const;
00421         const VSize& getSize(const VString& name) const;
00422         const VISize& getISize(const VString& name, const VISize& defaultValue) const;
00423         const VISize& getISize(const VString& name) const;
00424         const VPoint& getPoint(const VString& name, const VPoint& defaultValue) const;
00425         const VPoint& getPoint(const VString& name) const;
00426         const VIPoint& getIPoint(const VString& name, const VIPoint& defaultValue) const;
00427         const VIPoint& getIPoint(const VString& name) const;
00428         const VPoint3D& getPoint3D(const VString& name, const VPoint3D& defaultValue) const;
00429         const VPoint3D& getPoint3D(const VString& name) const;
00430         const VIPoint3D& getIPoint3D(const VString& name, const VIPoint3D& defaultValue) const;
00431         const VIPoint3D& getIPoint3D(const VString& name) const;
00432         const VLine& getLine(const VString& name, const VLine& defaultValue) const;
00433         const VLine& getLine(const VString& name) const;
00434         const VILine& getILine(const VString& name, const VILine& defaultValue) const;
00435         const VILine& getILine(const VString& name) const;
00436         const VRect& getRect(const VString& name, const VRect& defaultValue) const;
00437         const VRect& getRect(const VString& name) const;
00438         const VIRect& getIRect(const VString& name, const VIRect& defaultValue) const;
00439         const VIRect& getIRect(const VString& name) const;
00440         const VPolygon& getPolygon(const VString& name, const VPolygon& defaultValue) const;
00441         const VPolygon& getPolygon(const VString& name) const;
00442         const VIPolygon& getIPolygon(const VString& name, const VIPolygon& defaultValue) const;
00443         const VIPolygon& getIPolygon(const VString& name) const;
00444         const VColor& getColor(const VString& name, const VColor& defaultValue) const;
00445         const VColor& getColor(const VString& name) const;
00446 
00447         Vs8 getS8(const VString& name, Vs8 defaultValue) const;    
00448         Vs8 getS8(const VString& name) const;    
00449         Vu8 getU8(const VString& name, Vu8 defaultValue) const;    
00450         Vu8 getU8(const VString& name) const;    
00451         Vs16 getS16(const VString& name, Vs16 defaultValue) const;    
00452         Vs16 getS16(const VString& name) const;    
00453         Vu16 getU16(const VString& name, Vu16 defaultValue) const;    
00454         Vu16 getU16(const VString& name) const;    
00455         Vs32 getS32(const VString& name, Vs32 defaultValue) const;    
00456         Vs32 getS32(const VString& name) const;    
00457         Vu32 getU32(const VString& name, Vu32 defaultValue) const;    
00458         Vu32 getU32(const VString& name) const;    
00459         Vs64 getS64(const VString& name, Vs64 defaultValue) const;    
00460         Vs64 getS64(const VString& name) const;    
00461         Vu64 getU64(const VString& name, Vu64 defaultValue) const;    
00462         Vu64 getU64(const VString& name) const;    
00463         VFloat getFloat(const VString& name, VFloat defaultValue) const; 
00464         VFloat getFloat(const VString& name) const; 
00465         bool getBinary(const VString& name, VReadOnlyMemoryStream& returnedReader) const; 
00466         VReadOnlyMemoryStream getBinary(const VString& name) const; 
00467 
00468         const Vs8Array& getS8Array(const VString& name, const Vs8Array& defaultValue) const;    
00469         const Vs8Array& getS8Array(const VString& name) const;    
00470         const Vs16Array& getS16Array(const VString& name, const Vs16Array& defaultValue) const;    
00471         const Vs16Array& getS16Array(const VString& name) const;    
00472         const Vs32Array& getS32Array(const VString& name, const Vs32Array& defaultValue) const;    
00473         const Vs32Array& getS32Array(const VString& name) const;    
00474         const Vs64Array& getS64Array(const VString& name, const Vs64Array& defaultValue) const;    
00475         const Vs64Array& getS64Array(const VString& name) const;    
00476         const VStringVector& getStringArray(const VString& name, const VStringVector& defaultValue) const;    
00477         const VStringVector& getStringArray(const VString& name) const;    
00478         const VBoolArray& getBoolArray(const VString& name, const VBoolArray& defaultValue) const;    
00479         const VBoolArray& getBoolArray(const VString& name) const;    
00480         const VDoubleArray& getDoubleArray(const VString& name, const VDoubleArray& defaultValue) const;    
00481         const VDoubleArray& getDoubleArray(const VString& name) const;    
00482         const VDurationVector& getDurationArray(const VString& name, const VDurationVector& defaultValue) const;    
00483         const VDurationVector& getDurationArray(const VString& name) const;    
00484         const VInstantVector& getInstantArray(const VString& name, const VInstantVector& defaultValue) const;    
00485         const VInstantVector& getInstantArray(const VString& name) const;    
00486 
00487         // These setters update an existing attribute's value if the attribute exists, and adds a new attribute if it does not (just as if addXXX had been called);
00488         void setInt(const VString& name, int value);                  
00489         void setBool(const VString& name, bool value);                
00490         void setString(const VString& name, const VString& value, const VString& encoding = VString::EMPTY());  
00491         void setChar(const VString& name, const VCodePoint& value);   
00492         void setDouble(const VString& name, VDouble value);           
00493         void setDuration(const VString& name, const VDuration& value);
00494         void setInstant(const VString& name, const VInstant& value);  
00495         void setSize(const VString& name, const VSize& value);        
00496         void setISize(const VString& name, const VISize& value);      
00497         void setPoint(const VString& name, const VPoint& value);      
00498         void setIPoint(const VString& name, const VIPoint& value);    
00499         void setPoint3D(const VString& name, const VPoint3D& value);  
00500         void setIPoint3D(const VString& name, const VIPoint3D& value);
00501         void setLine(const VString& name, const VLine& value);        
00502         void setILine(const VString& name, const VILine& value);      
00503         void setRect(const VString& name, const VRect& value);        
00504         void setIRect(const VString& name, const VIRect& value);      
00505         void setPolygon(const VString& name, const VPolygon& value);  
00506         void setIPolygon(const VString& name, const VIPolygon& value);
00507         void setColor(const VString& name, const VColor& value);      
00508         void setS64(const VString& name, Vs64 value);                 
00509 
00514         const VBentoAttributePtrVector& getAttributes() const;
00515 
00516         const VBentoAttribute* findAttribute(const VString& name, const VString& dataType) const { return this->_findAttribute(name, dataType); }
00517 
00522         const VString& getName() const;
00527         void setName(const VString& name);
00528 
00529         // Debugging and other miscellaneous methods -------------------------
00530 
00538         void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap = false, int indentDepth = 0) const;
00542         void printXML() const;
00546         void printHexDump(VHex& hexDump) const;
00547 
00556         void clear();
00561         void orphanAttributes();
00566         void orphanNodes();
00573         void orphanNode(const VBentoNode* node);
00580         void adoptFrom(VBentoNode* node);
00593         void updateFrom(const VBentoNode& node);
00594 
00595     private:
00596 
00604         Vs64 _calculateContentSize() const;
00612         Vs64 _calculateTotalSize() const;
00613 
00619         void _addAttribute(VBentoAttribute* attribute);
00620 
00631         const VBentoAttribute* _findAttribute(const VString& name, const VString& dataType) const;
00642         VBentoAttribute* _findMutableAttribute(const VString& name, const VString& dataType);
00643 
00649         static Vs64 _readLengthFromStream(VBinaryIOStream& stream);
00655         static void _writeLengthToStream(VBinaryIOStream& stream, Vs64 length);
00662         static Vs64 _getLengthOfLength(Vs64 length);
00668         static void _readFourCharCodeFromStream(VBinaryIOStream& stream, VString& code);
00676         static void _writeFourCharCodeToStream(VBinaryIOStream& stream, const VString& code);
00682         static Vs64 _getBinaryStringLength(const VString& s);
00683 
00684         VString                     mName;          
00685         VBentoAttributePtrVector    mAttributes;    
00686         VBentoNode*                 mParentNode;    
00687         VBentoNodePtrVector         mChildNodes;    
00688 
00690         void operator=(const VBentoNode&);
00691 
00692         // Comparison operators allow Bento nodes to be sorted by name.
00693         friend inline bool operator< (const VBentoNode& lhs, const VBentoNode& rhs);    
00694         friend inline bool operator<=(const VBentoNode& lhs, const VBentoNode& rhs);    
00695         friend inline bool operator>=(const VBentoNode& lhs, const VBentoNode& rhs);    
00696         friend inline bool operator> (const VBentoNode& lhs, const VBentoNode& rhs);    
00697 
00698         // These related classes use some of our private static utility functions.
00699         friend class VBentoAttribute;
00700         friend class VBentoCallbackParser;
00701         friend class VBentoString;
00702         friend class VBentoBinary;
00703         friend class VBentoUnit;
00704         friend class VBentoTextNodeParser;
00705         friend class VBentoStringArray;
00706 };
00707 
00708 inline bool operator< (const VBentoNode& lhs, const VBentoNode& rhs) { return lhs.getName() < rhs.getName(); } 
00709 inline bool operator<=(const VBentoNode& lhs, const VBentoNode& rhs) { return !operator>(lhs, rhs); }
00710 inline bool operator>=(const VBentoNode& lhs, const VBentoNode& rhs) { return !operator<(lhs, rhs); }
00711 inline bool operator> (const VBentoNode& lhs, const VBentoNode& rhs) { return  operator<(rhs, lhs); }
00712 
00723 class VBentoCallbackParser {
00724     public:
00725 
00730         VBentoCallbackParser(VBinaryIOStream& stream);
00731         virtual ~VBentoCallbackParser() {}    
00732 
00733     protected:
00734 
00740         void processNode(int depth, VBinaryIOStream& stream);
00746         void processAttribute(int depth, VBinaryIOStream& stream);
00747 
00758         virtual void nodeHeaderComplete(int depth, Vs64 length, Vs32 numAttributes, Vs32 numChildren, const VString& name);
00769         virtual void nodeAttributesComplete(int depth, Vs64 length, Vs32 numAttributes, Vs32 numChildren, const VString& name);
00780         virtual void nodeComplete(int depth, Vs64 length, Vs32 numAttributes, Vs32 numChildren, const VString& name);
00790         virtual void attributeHeaderComplete(int depth, Vs64 length, const VString& type, const VString& name);
00799         virtual void attributeComplete(int depth, Vs64 length, const VString& type, const VString& name);
00807         virtual void readAttributeData(int depth, VBinaryIOStream& stream, Vu64 dataLength);
00808 };
00809 
00818 class VBentoAttribute {
00819     public:
00820 
00821         VBentoAttribute(); 
00822         VBentoAttribute(VBinaryIOStream& stream, const VString& dataType); 
00823         VBentoAttribute(const VString& name, const VString& dataType); 
00824         virtual ~VBentoAttribute(); 
00825 
00826         virtual VBentoAttribute* clone() const = 0;
00827         VBentoAttribute& operator=(const VBentoAttribute& rhs) { mName = rhs.mName; mDataType = rhs.mDataType; return *this; }
00828 
00829         const VString& getName() const; 
00830         const VString& getDataType() const; 
00831 
00832         virtual bool xmlAppearsAsArray() const { return false; } 
00833         virtual void getValueAsXMLText(VString& s) const = 0; 
00834         virtual void getValueAsString(VString& s) const = 0; 
00835         virtual void getValueAsBentoTextString(VString& s) const = 0; 
00836 
00837         Vs64 calculateContentSize() const; 
00838         Vs64 calculateTotalSize() const; 
00839         void writeToStream(VBinaryIOStream& stream) const; 
00840         void writeToBentoTextStream(VTextIOStream& stream) const; 
00841 
00842         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
00843 
00844         void printHexDump(VHex& hexDump) const; 
00845 
00846         static VBentoAttribute* newObjectFromStream(VBinaryIOStream& stream); 
00847         static VBentoAttribute* newObjectFromStream(VTextIOStream& stream); 
00848         static VBentoAttribute* newObjectFromBentoTextValues(const VString& attributeName, const VString& attributeType, const VString& attributeValue, const VString& attributeQualifier);
00849 
00850     protected:
00851 
00852         virtual Vs64 getDataLength() const = 0; 
00853         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const = 0; 
00854 
00855         static void _escapeXMLValue(VString& text); 
00856 
00857     private:
00858 
00859         VString mName;      
00860         VString mDataType;  
00861 };
00862 
00866 class VBentoS8 : public VBentoAttribute {
00867     public:
00868 
00869         static const VString& DATA_TYPE_ID() { static const VString kID("vs_8"); return kID; } 
00870 
00871         VBentoS8() : mValue(0) {} 
00872         VBentoS8(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readS8()) {} 
00873         VBentoS8(const VString& name, Vs8 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
00874         virtual ~VBentoS8() {} 
00875 
00876         virtual VBentoAttribute* clone() const { return new VBentoS8(this->getName(), mValue); }
00877         VBentoS8& operator=(const VBentoS8& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
00878 
00879         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_S8(mValue); }
00880         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_S8 " 0x%02X", mValue, mValue); }
00881         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_S8(mValue); }
00882 
00883         inline Vs8 getValue() const { return mValue; } 
00884         inline void setValue(Vs8 i) { mValue = i; } 
00885 
00886     protected:
00887 
00888         virtual Vs64 getDataLength() const { return 1; } 
00889         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeS8(mValue); } 
00890 
00891     private:
00892 
00893         Vs8 mValue; 
00894 };
00895 
00899 class VBentoU8 : public VBentoAttribute {
00900     public:
00901 
00902         static const VString& DATA_TYPE_ID() { static const VString kID("vu_8"); return kID; } 
00903 
00904         VBentoU8() : mValue(0) {} 
00905         VBentoU8(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readU8()) {} 
00906         VBentoU8(const VString& name, Vu8 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
00907         virtual ~VBentoU8() {} 
00908 
00909         virtual VBentoAttribute* clone() const { return new VBentoU8(this->getName(), mValue); }
00910         VBentoU8& operator=(const VBentoU8& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
00911 
00912         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_U8(mValue); }
00913         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_U8 " 0x%02X", mValue, mValue); }
00914         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_U8(mValue); }
00915 
00916         inline Vu8 getValue() const { return mValue; } 
00917         inline void setValue(Vu8 i) { mValue = i; } 
00918 
00919     protected:
00920 
00921         virtual Vs64 getDataLength() const { return 1; } 
00922         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeU8(mValue); } 
00923 
00924     private:
00925 
00926         Vu8 mValue; 
00927 };
00928 
00932 class VBentoS16 : public VBentoAttribute {
00933     public:
00934 
00935         static const VString& DATA_TYPE_ID() { static const VString kID("vs16"); return kID; } 
00936 
00937         VBentoS16() : mValue(0) {} 
00938         VBentoS16(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readS16()) {} 
00939         VBentoS16(const VString& name, Vs16 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
00940         virtual ~VBentoS16() {} 
00941 
00942         virtual VBentoAttribute* clone() const { return new VBentoS16(this->getName(), mValue); }
00943         VBentoS16& operator=(const VBentoS16& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
00944 
00945         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_S16(mValue); }
00946         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_S16 " 0x%04X", mValue, mValue); }
00947         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_S16(mValue); }
00948 
00949         inline Vs16 getValue() const { return mValue; } 
00950         inline void setValue(Vs16 i) { mValue = i; } 
00951 
00952     protected:
00953 
00954         virtual Vs64 getDataLength() const { return 2; } 
00955         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeS16(mValue); } 
00956 
00957     private:
00958 
00959         Vs16 mValue; 
00960 };
00961 
00965 class VBentoU16 : public VBentoAttribute {
00966     public:
00967 
00968         static const VString& DATA_TYPE_ID() { static const VString kID("vu16"); return kID; } 
00969 
00970         VBentoU16() : mValue(0) {} 
00971         VBentoU16(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readU16()) {} 
00972         VBentoU16(const VString& name, Vu16 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
00973         virtual ~VBentoU16() {} 
00974 
00975         virtual VBentoAttribute* clone() const { return new VBentoU16(this->getName(), mValue); }
00976         VBentoU16& operator=(const VBentoU16& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
00977 
00978         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_U16(mValue); }
00979         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_U16 " 0x%04X", mValue, mValue); }
00980         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_U16(mValue); }
00981 
00982         inline Vu16 getValue() const { return mValue; } 
00983         inline void setValue(Vu16 i) { mValue = i; } 
00984 
00985     protected:
00986 
00987         virtual Vs64 getDataLength() const { return 2; } 
00988         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeU16(mValue); } 
00989 
00990     private:
00991 
00992         Vu16 mValue; 
00993 };
00994 
00998 class VBentoS32 : public VBentoAttribute {
00999     public:
01000 
01001         static const VString& DATA_TYPE_ID() { static const VString kID("vs32"); return kID; } 
01002 
01003         VBentoS32() : mValue(0) {} 
01004         VBentoS32(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readS32()) {} 
01005         VBentoS32(const VString& name, Vs32 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
01006         virtual ~VBentoS32() {} 
01007 
01008         virtual VBentoAttribute* clone() const { return new VBentoS32(this->getName(), mValue); }
01009         VBentoS32& operator=(const VBentoS32& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01010 
01011         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_S32(mValue); }
01012         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_S32 " 0x%08X", mValue, mValue); }
01013         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_S32(mValue); }
01014 
01015         inline Vs32 getValue() const { return mValue; } 
01016         inline void setValue(Vs32 i) { mValue = i; } 
01017 
01018     protected:
01019 
01020         virtual Vs64 getDataLength() const { return 4; } 
01021         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeS32(mValue); } 
01022 
01023     private:
01024 
01025         Vs32 mValue; 
01026 };
01027 
01031 class VBentoU32 : public VBentoAttribute {
01032     public:
01033 
01034         static const VString& DATA_TYPE_ID() { static const VString kID("vu32"); return kID; } 
01035 
01036         VBentoU32() : mValue(0) {} 
01037         VBentoU32(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readU32()) {} 
01038         VBentoU32(const VString& name, Vu32 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
01039         virtual ~VBentoU32() {} 
01040 
01041         virtual VBentoAttribute* clone() const { return new VBentoU32(this->getName(), mValue); }
01042         VBentoU32& operator=(const VBentoU32& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01043 
01044         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_U32(mValue); }
01045         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_U32 " 0x%08X", mValue, mValue); }
01046         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_U32(mValue); }
01047 
01048         inline Vu32 getValue() const { return mValue; } 
01049         inline void setValue(Vu32 i) { mValue = i; } 
01050 
01051     protected:
01052 
01053         virtual Vs64 getDataLength() const { return 4; } 
01054         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeU32(mValue); } 
01055 
01056     private:
01057 
01058         Vu32 mValue; 
01059 };
01060 
01064 class VBentoS64 : public VBentoAttribute {
01065     public:
01066 
01067         static const VString& DATA_TYPE_ID() { static const VString kID("vs64"); return kID; } 
01068 
01069         VBentoS64() : mValue(0) {} 
01070         VBentoS64(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readS64()) {} 
01071         VBentoS64(const VString& name, Vs64 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
01072         virtual ~VBentoS64() {} 
01073 
01074         virtual VBentoAttribute* clone() const { return new VBentoS64(this->getName(), mValue); }
01075         VBentoS64& operator=(const VBentoS64& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01076 
01077         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_S64(mValue); }
01078         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_S64 " 0x%016llX", mValue, mValue); }
01079         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_S64(mValue); }
01080 
01081         inline Vs64 getValue() const { return mValue; } 
01082         inline void setValue(Vs64 i) { mValue = i; } 
01083 
01084     protected:
01085 
01086         virtual Vs64 getDataLength() const { return 8; } 
01087         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeS64(mValue); } 
01088 
01089     private:
01090 
01091         Vs64 mValue; 
01092 };
01093 
01097 class VBentoU64 : public VBentoAttribute {
01098     public:
01099 
01100         static const VString& DATA_TYPE_ID() { static const VString kID("vu64"); return kID; } 
01101 
01102         VBentoU64() : mValue(0) {} 
01103         VBentoU64(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readU64()) {} 
01104         VBentoU64(const VString& name, Vu64 i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
01105         virtual ~VBentoU64() {} 
01106 
01107         virtual VBentoAttribute* clone() const { return new VBentoU64(this->getName(), mValue); }
01108         VBentoU64& operator=(const VBentoU64& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01109 
01110         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_U64(mValue); }
01111         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_U64 " 0x%016llX", mValue, mValue); }
01112         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_U64(mValue); }
01113 
01114         inline Vu64 getValue() const { return mValue; } 
01115         inline void setValue(Vu64 i) { mValue = i; } 
01116 
01117     protected:
01118 
01119         virtual Vs64 getDataLength() const { return 8; } 
01120         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeU64(mValue); } 
01121 
01122     private:
01123 
01124         Vu64 mValue; 
01125 };
01126 
01130 class VBentoBool : public VBentoAttribute {
01131     public:
01132 
01133         static const VString& DATA_TYPE_ID() { static const VString kID("bool"); return kID; } 
01134 
01135         VBentoBool() : mValue(false) {} 
01136         VBentoBool(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readBool()) {} 
01137         VBentoBool(const VString& name, bool b) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(b) {} 
01138         virtual ~VBentoBool() {} 
01139 
01140         virtual VBentoAttribute* clone() const { return new VBentoBool(this->getName(), mValue); }
01141         VBentoBool& operator=(const VBentoBool& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01142 
01143         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_BOOL(mValue); }
01144         virtual void getValueAsString(VString& s) const { s.format("%s 0x%02X", (mValue ? "true" : "false"), static_cast<Vu8>(mValue)); }
01145         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_BOOL(mValue); }
01146 
01147         inline bool getValue() const { return mValue; } 
01148         inline void setValue(bool b) { mValue = b; } 
01149 
01150     protected:
01151 
01152         virtual Vs64 getDataLength() const { return 1; } 
01153         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeBool(mValue); } 
01154 
01155     private:
01156 
01157         bool mValue; 
01158 };
01159 
01163 class VBentoString : public VBentoAttribute {
01164     public:
01165 
01166         static const VString& DATA_TYPE_ID() { static const VString kID("vstr"); return kID; } 
01167 
01168         VBentoString() : mValue() {} 
01169         VBentoString(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mEncoding(stream.readString()), mValue(stream.readString()) {} 
01170         VBentoString(const VString& name, const VString& s, const VString& encoding) : VBentoAttribute(name, DATA_TYPE_ID()), mEncoding(encoding), mValue(s) {} 
01171         virtual ~VBentoString() {} 
01172 
01173         virtual VBentoAttribute* clone() const { return new VBentoString(this->getName(), mValue, mEncoding); }
01174         VBentoString& operator=(const VBentoString& rhs) { VBentoAttribute::operator=(rhs); mEncoding = rhs.mEncoding; mValue = rhs.mValue; return *this; }
01175 
01176         virtual void getValueAsXMLText(VString& s) const { s = mValue; VBentoAttribute::_escapeXMLValue(s); }
01177         virtual void getValueAsString(VString& s) const { s.format("\"%s\"", mValue.chars()); }
01178         virtual void getValueAsBentoTextString(VString& s) const { s = mValue; }
01179 
01180         inline const VString& getValue() const { return mValue; } 
01181         inline void setValue(const VString& s) { mValue = s; } 
01182 
01183         inline const VString& getEncoding() const { return mEncoding; } 
01184         inline void setEncoding(const VString& encoding) { mEncoding = encoding; } 
01185 
01186     protected:
01187 
01188         virtual Vs64 getDataLength() const { return VBentoNode::_getBinaryStringLength(mEncoding) + VBentoNode::_getBinaryStringLength(mValue); } 
01189         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeString(mEncoding); stream.writeString(mValue); } 
01190 
01191     private:
01192 
01193         VString mEncoding; 
01194         VString mValue; 
01195 };
01196 
01216 class VBentoChar : public VBentoAttribute {
01217     public:
01218 
01219         static const VString& LEGACY_DATA_TYPE_ID() { static const VString kID("char"); return kID; } 
01220         static const VString& DATA_TYPE_ID() { static const VString kID("u8ch"); return kID; } 
01221         
01222         static VBentoChar* newFromLegacyCharStream(VBinaryIOStream& stream); 
01223 
01224         VBentoChar() : mValue(' ') {} 
01225         VBentoChar(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01226         VBentoChar(const VString& name, const VCodePoint& c) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(c) {} 
01227         virtual ~VBentoChar() {} 
01228 
01229         virtual VBentoAttribute* clone() const { return new VBentoChar(this->getName(), mValue); }
01230         VBentoChar& operator=(const VBentoChar& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01231 
01232         virtual void getValueAsXMLText(VString& s) const { s = mValue; VBentoAttribute::_escapeXMLValue(s); }
01233         virtual void getValueAsString(VString& s) const { s = mValue.toString(); }
01234         virtual void getValueAsBentoTextString(VString& s) const { s = mValue; }
01235 
01236         inline const VCodePoint& getValue() const { return mValue; } 
01237         inline void setValue(const VCodePoint& c) { mValue = c; } 
01238 
01239     protected:
01240 
01241         virtual Vs64 getDataLength() const { return mValue.getUTF8Length(); } 
01242         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToBinaryStream(stream); } 
01243 
01244     private:
01245 
01246         VCodePoint mValue; 
01247 };
01248 
01252 class VBentoFloat : public VBentoAttribute {
01253     public:
01254 
01255         static const VString& DATA_TYPE_ID() { static const VString kID("flot"); return kID; } 
01256 
01257         VBentoFloat() : mValue(0.0f) {} 
01258         VBentoFloat(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readFloat()) {} 
01259         VBentoFloat(const VString& name, VFloat f) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(f) {} 
01260         virtual ~VBentoFloat() {} 
01261 
01262         virtual VBentoAttribute* clone() const { return new VBentoFloat(this->getName(), mValue); }
01263         VBentoFloat& operator=(const VBentoFloat& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01264 
01265         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_FLOAT(mValue); }
01266         virtual void getValueAsString(VString& s) const { s = VSTRING_FLOAT(mValue); }
01267         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_FLOAT(mValue); }
01268 
01269         inline VFloat getValue() const { return mValue; } 
01270         inline void setValue(VFloat f) { mValue = f; } 
01271 
01272     protected:
01273 
01274         virtual Vs64 getDataLength() const { return 4; } 
01275         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeFloat(mValue); } 
01276 
01277     private:
01278 
01279         VFloat mValue; 
01280 };
01281 
01285 class VBentoDouble : public VBentoAttribute {
01286     public:
01287 
01288         static const VString& DATA_TYPE_ID() { static const VString kID("doub"); return kID; } 
01289 
01290         VBentoDouble() : mValue(0.0) {} 
01291         VBentoDouble(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream.readDouble()) {} 
01292         VBentoDouble(const VString& name, VDouble d) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(d) {} 
01293         virtual ~VBentoDouble() {} 
01294 
01295         virtual VBentoAttribute* clone() const { return new VBentoDouble(this->getName(), mValue); }
01296         VBentoDouble& operator=(const VBentoDouble& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01297 
01298         virtual void getValueAsXMLText(VString& s) const { s = VSTRING_DOUBLE(mValue); }
01299         virtual void getValueAsString(VString& s) const { s = VSTRING_DOUBLE(mValue); }
01300         virtual void getValueAsBentoTextString(VString& s) const { s = VSTRING_DOUBLE(mValue); } // Note: %lf uses 6 decimal places by default; this limits output resolution.
01301 
01302         inline VDouble getValue() const { return mValue; } 
01303         inline void setValue(VDouble d) { mValue = d; } 
01304 
01305     protected:
01306 
01307         virtual Vs64 getDataLength() const { return 8; } 
01308         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeDouble(mValue); } 
01309 
01310     private:
01311 
01312         VDouble mValue; 
01313 };
01314 
01318 class VBentoDuration : public VBentoAttribute {
01319     public:
01320 
01321         static const VString& DATA_TYPE_ID() { static const VString kID("dura"); return kID; } 
01322 
01323         VBentoDuration() : mValue() {} 
01324         VBentoDuration(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(VDuration::MILLISECOND() * stream.readS64()) {} 
01325         VBentoDuration(const VString& name, const VDuration& d) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(d) {} 
01326         virtual ~VBentoDuration() {} 
01327 
01328         virtual VBentoAttribute* clone() const { return new VBentoDuration(this->getName(), mValue); }
01329         VBentoDuration& operator=(const VBentoDuration& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01330 
01331         virtual void getValueAsXMLText(VString& s) const { s = (mValue.isSpecific() ? (VSTRING_S64(mValue.getDurationMilliseconds())) : (mValue.getDurationString())); }
01332         virtual void getValueAsString(VString& s) const { s.format(VSTRING_FORMATTER_S64 "ms", mValue.getDurationMilliseconds()); }
01333         virtual void getValueAsBentoTextString(VString& s) const { s.format(VSTRING_FORMATTER_S64 "ms", mValue.getDurationMilliseconds()); }
01334 
01335         inline const VDuration& getValue() const { return mValue; } 
01336         inline void setValue(const VDuration& d) { mValue = d; } 
01337 
01338     protected:
01339 
01340         virtual Vs64 getDataLength() const { return 8; } 
01341         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeS64(mValue.getDurationMilliseconds()); } 
01342 
01343     private:
01344 
01345         VDuration mValue; 
01346 };
01347 
01351 class VBentoInstant : public VBentoAttribute {
01352     public:
01353 
01354         static const VString& DATA_TYPE_ID() { static const VString kID("inst"); return kID; } 
01355 
01356         VBentoInstant() : mValue() {} 
01357         VBentoInstant(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(VInstant::instantFromRawValue(stream.readS64())) {} 
01358         VBentoInstant(const VString& name, const VInstant& i) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(i) {} 
01359         virtual ~VBentoInstant() {} 
01360 
01361         virtual VBentoAttribute* clone() const { return new VBentoInstant(this->getName(), mValue); }
01362         VBentoInstant& operator=(const VBentoInstant& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01363 
01364         virtual void getValueAsXMLText(VString& s) const { s = mValue.getUTCString(); }
01365         virtual void getValueAsString(VString& s) const { s = mValue.getUTCString(); }
01366         virtual void getValueAsBentoTextString(VString& s) const { s = mValue.getUTCString(); }
01367 
01368         inline const VInstant& getValue() const { return mValue; } 
01369         inline void setValue(const VInstant& i) { mValue = i; } 
01370 
01371     protected:
01372 
01373         virtual Vs64 getDataLength() const { return 8; } 
01374         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { stream.writeS64(mValue.getValue()); } 
01375 
01376     private:
01377 
01378         VInstant mValue; 
01379 };
01380 
01384 class VBentoSize : public VBentoAttribute {
01385     public:
01386 
01387         static const VString& DATA_TYPE_ID() { static const VString kID("sizd"); return kID; } 
01388 
01389         VBentoSize() : mValue() {} 
01390         VBentoSize(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01391         VBentoSize(const VString& name, const VSize& s) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(s) {} 
01392         virtual ~VBentoSize() {} 
01393 
01394         virtual VBentoAttribute* clone() const { return new VBentoSize(this->getName(), mValue); }
01395         VBentoSize& operator=(const VBentoSize& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01396 
01397         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01398         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01399 
01400         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01401         virtual void getValueAsString(VString& s) const { s.format("%lf,%lf", mValue.getWidth(), mValue.getHeight()); }
01402         virtual void getValueAsBentoTextString(VString& s) const { s.format("%lf,%lf", mValue.getWidth(), mValue.getHeight()); }
01403 
01404         inline const VSize& getValue() const { return mValue; } 
01405         inline void setValue(const VSize& i) { mValue = i; } 
01406 
01407     protected:
01408 
01409         virtual Vs64 getDataLength() const { return 16; } 
01410         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01411 
01412     private:
01413 
01414         VSize mValue; 
01415 };
01416 
01420 class VBentoISize : public VBentoAttribute {
01421     public:
01422 
01423         static const VString& DATA_TYPE_ID() { static const VString kID("sizi"); return kID; } 
01424 
01425         VBentoISize() : mValue() {} 
01426         VBentoISize(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01427         VBentoISize(const VString& name, const VISize& s) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(s) {} 
01428         virtual ~VBentoISize() {} 
01429 
01430         virtual VBentoAttribute* clone() const { return new VBentoISize(this->getName(), mValue); }
01431         VBentoISize& operator=(const VBentoISize& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01432 
01433         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01434         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01435 
01436         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01437         virtual void getValueAsString(VString& s) const { s.format("%d,%d", mValue.getWidth(), mValue.getHeight()); }
01438         virtual void getValueAsBentoTextString(VString& s) const { s.format("%d,%d", mValue.getWidth(), mValue.getHeight()); }
01439 
01440         inline const VISize& getValue() const { return mValue; } 
01441         inline void setValue(const VISize& i) { mValue = i; } 
01442 
01443     protected:
01444 
01445         virtual Vs64 getDataLength() const { return 8; } 
01446         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01447 
01448     private:
01449 
01450         VISize mValue; 
01451 };
01452 
01456 class VBentoPoint : public VBentoAttribute {
01457     public:
01458 
01459         static const VString& DATA_TYPE_ID() { static const VString kID("pt_d"); return kID; } 
01460 
01461         VBentoPoint() : mValue() {} 
01462         VBentoPoint(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01463         VBentoPoint(const VString& name, const VPoint& p) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(p) {} 
01464         virtual ~VBentoPoint() {} 
01465 
01466         virtual VBentoAttribute* clone() const { return new VBentoPoint(this->getName(), mValue); }
01467         VBentoPoint& operator=(const VBentoPoint& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01468 
01469         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01470         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01471 
01472         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01473         virtual void getValueAsString(VString& s) const { s.format("%lf,%lf", mValue.getX(), mValue.getY()); }
01474         virtual void getValueAsBentoTextString(VString& s) const { s.format("%lf,%lf", mValue.getX(), mValue.getY()); }
01475 
01476         inline const VPoint& getValue() const { return mValue; } 
01477         inline void setValue(const VPoint& i) { mValue = i; } 
01478 
01479     protected:
01480 
01481         virtual Vs64 getDataLength() const { return 16; } 
01482         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01483 
01484     private:
01485 
01486         VPoint mValue; 
01487 };
01488 
01492 class VBentoIPoint : public VBentoAttribute {
01493     public:
01494 
01495         static const VString& DATA_TYPE_ID() { static const VString kID("pt_i"); return kID; } 
01496 
01497         VBentoIPoint() : mValue() {} 
01498         VBentoIPoint(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01499         VBentoIPoint(const VString& name, const VIPoint& s) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(s) {} 
01500         virtual ~VBentoIPoint() {} 
01501 
01502         virtual VBentoAttribute* clone() const { return new VBentoIPoint(this->getName(), mValue); }
01503         VBentoIPoint& operator=(const VBentoIPoint& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01504 
01505         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01506         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01507 
01508         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01509         virtual void getValueAsString(VString& s) const { s.format("%d,%d", mValue.getX(), mValue.getY()); }
01510         virtual void getValueAsBentoTextString(VString& s) const { s.format("%d,%d", mValue.getX(), mValue.getY()); }
01511 
01512         inline const VIPoint& getValue() const { return mValue; } 
01513         inline void setValue(const VIPoint& i) { mValue = i; } 
01514 
01515     protected:
01516 
01517         virtual Vs64 getDataLength() const { return 8; } 
01518         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01519 
01520     private:
01521 
01522         VIPoint mValue; 
01523 };
01524 
01528 class VBentoPoint3D : public VBentoAttribute {
01529     public:
01530 
01531         static const VString& DATA_TYPE_ID() { static const VString kID("pt3d"); return kID; } 
01532 
01533         VBentoPoint3D() : mValue() {} 
01534         VBentoPoint3D(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01535         VBentoPoint3D(const VString& name, const VPoint3D& p) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(p) {} 
01536         virtual ~VBentoPoint3D() {} 
01537 
01538         virtual VBentoAttribute* clone() const { return new VBentoPoint3D(this->getName(), mValue); }
01539         VBentoPoint3D& operator=(const VBentoPoint3D& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01540 
01541         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01542         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01543 
01544         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01545         virtual void getValueAsString(VString& s) const { s.format("%lf,%lf,%lf", mValue.getX(), mValue.getY(), mValue.getZ()); }
01546         virtual void getValueAsBentoTextString(VString& s) const { s.format("%lf,%lf,%lf", mValue.getX(), mValue.getY(), mValue.getZ()); }
01547 
01548         inline const VPoint3D& getValue() const { return mValue; } 
01549         inline void setValue(const VPoint3D& i) { mValue = i; } 
01550 
01551     protected:
01552 
01553         virtual Vs64 getDataLength() const { return 24; } 
01554         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01555 
01556     private:
01557 
01558         VPoint3D mValue; 
01559 };
01560 
01564 class VBentoIPoint3D : public VBentoAttribute {
01565     public:
01566 
01567         static const VString& DATA_TYPE_ID() { static const VString kID("pt3i"); return kID; } 
01568 
01569         VBentoIPoint3D() : mValue() {} 
01570         VBentoIPoint3D(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01571         VBentoIPoint3D(const VString& name, const VIPoint3D& s) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(s) {} 
01572         virtual ~VBentoIPoint3D() {} 
01573 
01574         virtual VBentoAttribute* clone() const { return new VBentoIPoint3D(this->getName(), mValue); }
01575         VBentoIPoint3D& operator=(const VBentoIPoint3D& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01576 
01577         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01578         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01579 
01580         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01581         virtual void getValueAsString(VString& s) const { s.format("%d,%d,%d", mValue.getX(), mValue.getY(), mValue.getZ()); }
01582         virtual void getValueAsBentoTextString(VString& s) const { s.format("%d,%d,%d", mValue.getX(), mValue.getY(), mValue.getZ()); }
01583 
01584         inline const VIPoint3D& getValue() const { return mValue; } 
01585         inline void setValue(const VIPoint3D& i) { mValue = i; } 
01586 
01587     protected:
01588 
01589         virtual Vs64 getDataLength() const { return 12; } 
01590         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01591 
01592     private:
01593 
01594         VIPoint3D mValue; 
01595 };
01596 
01600 class VBentoLine : public VBentoAttribute {
01601     public:
01602 
01603         static const VString& DATA_TYPE_ID() { static const VString kID("line"); return kID; } 
01604 
01605         VBentoLine() : mValue() {} 
01606         VBentoLine(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01607         VBentoLine(const VString& name, const VLine& v) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(v) {} 
01608         virtual ~VBentoLine() {} 
01609 
01610         virtual VBentoAttribute* clone() const { return new VBentoLine(this->getName(), mValue); }
01611         VBentoLine& operator=(const VBentoLine& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01612 
01613         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01614         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01615 
01616         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01617         virtual void getValueAsString(VString& s) const { s.format("%lf,%lf:%lf,%lf", mValue.getP1().getX(), mValue.getP1().getY(), mValue.getP2().getX(), mValue.getP2().getY()); }
01618         virtual void getValueAsBentoTextString(VString& s) const { s.format("%lf,%lf:%lf,%lf", mValue.getP1().getX(), mValue.getP1().getY(), mValue.getP2().getX(), mValue.getP2().getY()); }
01619 
01620         inline const VLine& getValue() const { return mValue; } 
01621         inline void setValue(const VLine& i) { mValue = i; } 
01622 
01623     protected:
01624 
01625         virtual Vs64 getDataLength() const { return 32; } 
01626         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01627 
01628     private:
01629 
01630         VLine mValue; 
01631 };
01632 
01636 class VBentoILine : public VBentoAttribute {
01637     public:
01638 
01639         static const VString& DATA_TYPE_ID() { static const VString kID("lini"); return kID; } 
01640 
01641         VBentoILine() : mValue() {} 
01642         VBentoILine(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01643         VBentoILine(const VString& name, const VILine& v) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(v) {} 
01644         virtual ~VBentoILine() {} 
01645 
01646         virtual VBentoAttribute* clone() const { return new VBentoILine(this->getName(), mValue); }
01647         VBentoILine& operator=(const VBentoILine& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01648 
01649         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01650         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01651 
01652         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01653         virtual void getValueAsString(VString& s) const { s.format("%d,%d:%d,%d", mValue.getP1().getX(), mValue.getP1().getY(), mValue.getP2().getX(), mValue.getP2().getY()); }
01654         virtual void getValueAsBentoTextString(VString& s) const { s.format("%d,%d:%d,%d", mValue.getP1().getX(), mValue.getP1().getY(), mValue.getP2().getX(), mValue.getP2().getY()); }
01655 
01656         inline const VILine& getValue() const { return mValue; } 
01657         inline void setValue(const VILine& i) { mValue = i; } 
01658 
01659     protected:
01660 
01661         virtual Vs64 getDataLength() const { return 16; } 
01662         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01663 
01664     private:
01665 
01666         VILine mValue; 
01667 };
01668 
01672 class VBentoRect : public VBentoAttribute {
01673     public:
01674 
01675         static const VString& DATA_TYPE_ID() { static const VString kID("recd"); return kID; } 
01676 
01677         VBentoRect() : mValue() {} 
01678         VBentoRect(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01679         VBentoRect(const VString& name, const VRect& p) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(p) {} 
01680         virtual ~VBentoRect() {} 
01681 
01682         virtual VBentoAttribute* clone() const { return new VBentoRect(this->getName(), mValue); }
01683         VBentoRect& operator=(const VBentoRect& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01684 
01685         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01686         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01687 
01688         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01689         virtual void getValueAsString(VString& s) const { s.format("%lf,%lf:%lf*%lf", mValue.getLeft(), mValue.getTop(), mValue.getWidth(), mValue.getHeight()); }
01690         virtual void getValueAsBentoTextString(VString& s) const { s.format("%lf,%lf:%lf*%lf", mValue.getLeft(), mValue.getTop(), mValue.getWidth(), mValue.getHeight()); }
01691 
01692         inline const VRect& getValue() const { return mValue; } 
01693         inline void setValue(const VRect& i) { mValue = i; } 
01694 
01695     protected:
01696 
01697         virtual Vs64 getDataLength() const { return 32; } 
01698         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01699 
01700     private:
01701 
01702         VRect mValue; 
01703 };
01704 
01708 class VBentoIRect : public VBentoAttribute {
01709     public:
01710 
01711         static const VString& DATA_TYPE_ID() { static const VString kID("reci"); return kID; } 
01712 
01713         VBentoIRect() : mValue() {} 
01714         VBentoIRect(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01715         VBentoIRect(const VString& name, const VIRect& s) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(s) {} 
01716         virtual ~VBentoIRect() {} 
01717 
01718         virtual VBentoAttribute* clone() const { return new VBentoIRect(this->getName(), mValue); }
01719         VBentoIRect& operator=(const VBentoIRect& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01720 
01721         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01722         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01723 
01724         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01725         virtual void getValueAsString(VString& s) const { s.format("%d,%d:%d*%d", mValue.getLeft(), mValue.getTop(), mValue.getWidth(), mValue.getHeight()); }
01726         virtual void getValueAsBentoTextString(VString& s) const { s.format("%d,%d:%d*%d", mValue.getLeft(), mValue.getTop(), mValue.getWidth(), mValue.getHeight()); }
01727 
01728         inline const VIRect& getValue() const { return mValue; } 
01729         inline void setValue(const VIRect& i) { mValue = i; } 
01730 
01731     protected:
01732 
01733         virtual Vs64 getDataLength() const { return 16; } 
01734         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01735 
01736     private:
01737 
01738         VIRect mValue; 
01739 };
01740 
01744 class VBentoPolygon : public VBentoAttribute {
01745     public:
01746 
01747         static const VString& DATA_TYPE_ID() { static const VString kID("pold"); return kID; } 
01748 
01749         VBentoPolygon() : mValue() {} 
01750         VBentoPolygon(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01751         VBentoPolygon(const VString& name, const VPolygon& p) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(p) {} 
01752         virtual ~VBentoPolygon() {} 
01753 
01754         virtual VBentoAttribute* clone() const { return new VBentoPolygon(this->getName(), mValue); }
01755         VBentoPolygon& operator=(const VBentoPolygon& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01756 
01757         static void readPolygonFromBentoTextString(const VString& s, VPolygon& p);
01758 
01759         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01760         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01761 
01762         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01763         virtual void getValueAsString(VString& s) const { VBentoPolygon::_formatPolygonAsBentoTextString(mValue, s); }
01764         virtual void getValueAsBentoTextString(VString& s) const { VBentoPolygon::_formatPolygonAsBentoTextString(mValue, s); }
01765 
01766         inline const VPolygon& getValue() const { return mValue; } 
01767         inline void setValue(const VPolygon& i) { mValue = i; } 
01768 
01769     protected:
01770 
01771         virtual Vs64 getDataLength() const { return 4 + (16 * mValue.getNumPoints()); } 
01772         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01773 
01774     private:
01775 
01776         static void _formatPolygonAsBentoTextString(const VPolygon& p, VString& s);
01777 
01778         VPolygon mValue; 
01779 };
01780 
01784 class VBentoIPolygon : public VBentoAttribute {
01785     public:
01786 
01787         static const VString& DATA_TYPE_ID() { static const VString kID("poli"); return kID; } 
01788 
01789         VBentoIPolygon() : mValue() {} 
01790         VBentoIPolygon(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01791         VBentoIPolygon(const VString& name, const VIPolygon& s) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(s) {} 
01792         virtual ~VBentoIPolygon() {} 
01793 
01794         virtual VBentoAttribute* clone() const { return new VBentoIPolygon(this->getName(), mValue); }
01795         VBentoIPolygon& operator=(const VBentoIPolygon& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01796 
01797         static void readPolygonFromBentoTextString(const VString& s, VIPolygon& p);
01798 
01799         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01800         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int indentDepth) const; 
01801 
01802         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01803         virtual void getValueAsString(VString& s) const { VBentoIPolygon::_formatPolygonAsBentoTextString(mValue, s); }
01804         virtual void getValueAsBentoTextString(VString& s) const { VBentoIPolygon::_formatPolygonAsBentoTextString(mValue, s); }
01805 
01806         inline const VIPolygon& getValue() const { return mValue; } 
01807         inline void setValue(const VIPolygon& i) { mValue = i; } 
01808 
01809     protected:
01810 
01811         virtual Vs64 getDataLength() const { return 4 + (8 * mValue.getNumPoints()); } 
01812         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01813 
01814     private:
01815 
01816         static void _formatPolygonAsBentoTextString(const VIPolygon& p, VString& s);
01817 
01818         VIPolygon mValue; 
01819 };
01820 
01824 class VBentoColor : public VBentoAttribute {
01825     public:
01826 
01827         static const VString& DATA_TYPE_ID() { static const VString kID("rgba"); return kID; } 
01828 
01829         VBentoColor() : mValue() {} 
01830         VBentoColor(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(stream) {} 
01831         VBentoColor(const VString& name, const VColor& c) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(c) {} 
01832         virtual ~VBentoColor() {} 
01833 
01834         virtual VBentoAttribute* clone() const { return new VBentoColor(this->getName(), mValue); }
01835         VBentoColor& operator=(const VBentoColor& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01836 
01837         virtual void getValueAsXMLText(VString& s) const { s = mValue.getCSSColor(); }
01838         virtual void getValueAsString(VString& s) const { s.format("%d,%d,%d,%d", mValue.getRed(), mValue.getGreen(), mValue.getBlue(), mValue.getAlpha()); }
01839         virtual void getValueAsBentoTextString(VString& s) const { s.format("%d,%d,%d,%d", mValue.getRed(), mValue.getGreen(), mValue.getBlue(), mValue.getAlpha()); }
01840 
01841         inline const VColor& getValue() const { return mValue; } 
01842         inline void setValue(const VColor& i) { mValue = i; } 
01843 
01844     protected:
01845 
01846         virtual Vs64 getDataLength() const { return 4; } 
01847         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { mValue.writeToStream(stream); } 
01848 
01849     private:
01850 
01851         VColor mValue; 
01852 };
01853 
01857 class VBentoBinary : public VBentoAttribute {
01858     public:
01859 
01860         static VBentoBinary* newFromBentoTextString(const VString& name, const VString& bentoText);
01861 
01862         static const VString& DATA_TYPE_ID() { static const VString kID("bina"); return kID; } 
01863 
01864         VBentoBinary() : mValue(0) {} 
01865         VBentoBinary(VBinaryIOStream& stream) : VBentoAttribute(stream, DATA_TYPE_ID()), mValue(0) { Vs64 length = VBentoNode::_readLengthFromStream(stream); (void) VStream::streamCopy(stream, mValue, length); } 
01866         VBentoBinary(const VString& name, const Vu8* data, Vs64 length) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(0) { (void) mValue.write(data, length); } 
01867         VBentoBinary(const VString& name, Vu8* data, VMemoryStream::BufferAllocationType allocationType, bool adoptBuffer, Vs64 suppliedBufferSize, Vs64 suppliedEOFOffset) : VBentoAttribute(name, DATA_TYPE_ID()), mValue(data, allocationType, adoptBuffer, suppliedBufferSize, suppliedEOFOffset) {} 
01868         virtual ~VBentoBinary() {} 
01869 
01870         virtual VBentoAttribute* clone() const { return new VBentoBinary(this->getName(), mValue.getBuffer(), mValue.getEOFOffset()); }
01871         VBentoBinary& operator=(const VBentoBinary& rhs) { VBentoAttribute::operator=(rhs); mValue = rhs.mValue; return *this; }
01872 
01873         virtual void getValueAsXMLText(VString& s) const { this->_getValueAsHexString(s); }
01874         virtual void getValueAsString(VString& s) const { this->_getValueAsHexString(s); }
01875         virtual void getValueAsBentoTextString(VString& s) const { this->_getValueAsHexString(s); }
01876 
01877         inline VReadOnlyMemoryStream getReader() const { return VReadOnlyMemoryStream(mValue.getBuffer(), mValue.getEOFOffset()); } 
01878         inline void setValue(Vu8* buffer, VMemoryStream::BufferAllocationType allocationType, bool adoptBuffer, Vs64 suppliedBufferSize, Vs64 suppliedEOFOffset) { mValue.adoptBuffer(buffer, allocationType, adoptBuffer, suppliedBufferSize, suppliedEOFOffset); } 
01879 
01880     protected:
01881 
01882         virtual Vs64 getDataLength() const { Vs64 bufferLength = mValue.getEOFOffset(); return VBentoNode::_getLengthOfLength(bufferLength) + bufferLength; } 
01883         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const; 
01884 
01885     private:
01886 
01887         void _getValueAsHexString(VString& s) const;
01888 
01889         VMemoryStream mValue; 
01890 };
01891 
01899 class VBentoUnknownValue : public VBentoAttribute {
01900     public:
01901 
01902         static const VString& DATA_TYPE_ID() { static const VString kID("unkn"); return kID; } 
01903 
01904         VBentoUnknownValue() : mValue() {} 
01905         VBentoUnknownValue(VBinaryIOStream& stream, Vs64 dataLength, const VString& dataType); 
01906         virtual ~VBentoUnknownValue() {} 
01907 
01908         virtual VBentoAttribute* clone() const { throw VUnimplementedException("VBentoUnknownValue does not support clone()."); }
01909         VBentoAttribute& operator=(const VBentoAttribute& /*rhs*/) { throw VUnimplementedException("VBentoUnknownValue does not support operator=()."); }
01910 
01911         virtual void getValueAsXMLText(VString& s) const { VHex::bufferToHexString(mValue.getBuffer(), mValue.getEOFOffset(), s, true/* want leading "0x" */); }
01912         virtual void getValueAsString(VString& s) const { VHex::bufferToHexString(mValue.getBuffer(), mValue.getEOFOffset(), s, true/* want leading "0x" */); }
01913         virtual void getValueAsBentoTextString(VString& s) const { VHex::bufferToHexString(mValue.getBuffer(), mValue.getEOFOffset(), s, true/* want leading "0x" */); }
01914 
01915         inline const VMemoryStream& getValue() const { return mValue; } 
01916 
01917     protected:
01918 
01919         virtual Vs64 getDataLength() const { return mValue.getEOFOffset(); } 
01920         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const; 
01921 
01922     private:
01923 
01924         VMemoryStream mValue; 
01925 };
01926 
01931 class VBentoArray : public VBentoAttribute {
01932     public:
01933 
01934         VBentoArray() : VBentoAttribute() {} 
01935         VBentoArray(VBinaryIOStream& stream, const VString& dataType) : VBentoAttribute(stream, dataType) {} 
01936         VBentoArray(const VString& name, const VString& dataType) : VBentoAttribute(name, dataType) {} 
01937         virtual ~VBentoArray() {} 
01938 
01939         VBentoArray& operator=(const VBentoArray& rhs) { VBentoAttribute::operator=(rhs); return *this; }
01940 
01941         virtual bool xmlAppearsAsArray() const { return true; } // Complex attribute requires its own child tag, formatted via writeToXMLTextStream().
01942         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const = 0; // Force subclasses to implement.
01943 
01944         virtual void getValueAsXMLText(VString&) const {} // n/a, since xmlAppearsAsArray() returns true for this class
01945         virtual void getValueAsString(VString& s) const { this->_getValueAsBentoTextString(s); }
01946         virtual void getValueAsBentoTextString(VString& s) const { this->_getValueAsBentoTextString(s); }
01947 
01948     protected:
01949 
01950         virtual int _getNumElements() const = 0;
01951         virtual void _appendElementBentoText(int elementIndex, VString& s) const = 0;
01952 
01953     private:
01954 
01955         void _getValueAsBentoTextString(VString& s) const;
01956 };
01957 
01961 class VBentoS8Array : public VBentoArray {
01962     public:
01963 
01964         static VBentoS8Array* newFromBentoTextString(const VString& name, const VString& bentoText);
01965 
01966         static const VString& DATA_TYPE_ID() { static const VString kID("s8_a"); return kID; } 
01967 
01968         VBentoS8Array() : VBentoArray(), mValue() {} 
01969         VBentoS8Array(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readS8()); } 
01970         VBentoS8Array(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
01971         VBentoS8Array(const VString& name, const Vs8Array& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
01972         virtual ~VBentoS8Array() {} 
01973 
01974         virtual VBentoAttribute* clone() const { return new VBentoS8Array(this->getName(), mValue); }
01975         VBentoS8Array& operator=(const VBentoS8Array& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
01976 
01977         inline const Vs8Array& getValue() const { return mValue; } 
01978         inline void setValue(const Vs8Array& elements) { mValue = elements; } 
01979         inline void appendValue(Vs8 element) { mValue.push_back(element); } 
01980         inline void appendValues(const Vs8Array& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
01981 
01982         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
01983 
01984     protected:
01985 
01986         virtual Vs64 getDataLength() const { return 4 + (1 * mValue.size()); } 
01987         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (Vs8Array::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeS8(*i); } 
01988 
01989         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
01990         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += mValue[elementIndex]; }
01991 
01992     private:
01993 
01994         Vs8Array mValue; 
01995 };
01996 
02000 class VBentoS16Array : public VBentoArray {
02001     public:
02002 
02003         static VBentoS16Array* newFromBentoTextString(const VString& name, const VString& bentoText);
02004 
02005         static const VString& DATA_TYPE_ID() { static const VString kID("s16a"); return kID; } 
02006 
02007         VBentoS16Array() : VBentoArray(), mValue() {} 
02008         VBentoS16Array(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readS16()); } 
02009         VBentoS16Array(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02010         VBentoS16Array(const VString& name, const Vs16Array& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02011         virtual ~VBentoS16Array() {} 
02012 
02013         virtual VBentoAttribute* clone() const { return new VBentoS16Array(this->getName(), mValue); }
02014         VBentoS16Array& operator=(const VBentoS16Array& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02015 
02016         inline const Vs16Array& getValue() const { return mValue; } 
02017         inline void setValue(const Vs16Array& elements) { mValue = elements; } 
02018         inline void appendValue(Vs16 element) { mValue.push_back(element); } 
02019         inline void appendValues(const Vs16Array& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02020 
02021         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02022 
02023     protected:
02024 
02025         virtual Vs64 getDataLength() const { return 4 + (2 * mValue.size()); } 
02026         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (Vs16Array::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeS16(*i); } 
02027 
02028         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02029         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += mValue[elementIndex]; }
02030 
02031     private:
02032 
02033         Vs16Array mValue; 
02034 };
02035 
02039 class VBentoS32Array : public VBentoArray {
02040     public:
02041 
02042         static VBentoS32Array* newFromBentoTextString(const VString& name, const VString& bentoText);
02043 
02044         static const VString& DATA_TYPE_ID() { static const VString kID("s32a"); return kID; } 
02045 
02046         VBentoS32Array() : VBentoArray(), mValue() {} 
02047         VBentoS32Array(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readS32()); } 
02048         VBentoS32Array(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02049         VBentoS32Array(const VString& name, const Vs32Array& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02050         virtual ~VBentoS32Array() {} 
02051 
02052         virtual VBentoAttribute* clone() const { return new VBentoS32Array(this->getName(), mValue); }
02053         VBentoS32Array& operator=(const VBentoS32Array& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02054 
02055         inline const Vs32Array& getValue() const { return mValue; } 
02056         inline void setValue(const Vs32Array& elements) { mValue = elements; } 
02057         inline void appendValue(Vs32 element) { mValue.push_back(element); } 
02058         inline void appendValues(const Vs32Array& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02059 
02060         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02061 
02062     protected:
02063 
02064         virtual Vs64 getDataLength() const { return 4 + (4 * mValue.size()); } 
02065         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (Vs32Array::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeS32(*i); } 
02066 
02067         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02068         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += mValue[elementIndex]; }
02069 
02070     private:
02071 
02072         Vs32Array mValue; 
02073 };
02074 
02078 class VBentoS64Array : public VBentoArray {
02079     public:
02080 
02081         static VBentoS64Array* newFromBentoTextString(const VString& name, const VString& bentoText);
02082 
02083         static const VString& DATA_TYPE_ID() { static const VString kID("s64a"); return kID; } 
02084 
02085         VBentoS64Array() : VBentoArray(), mValue() {} 
02086         VBentoS64Array(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readS64()); } 
02087         VBentoS64Array(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02088         VBentoS64Array(const VString& name, const Vs64Array& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02089         virtual ~VBentoS64Array() {} 
02090 
02091         virtual VBentoAttribute* clone() const { return new VBentoS64Array(this->getName(), mValue); }
02092         VBentoS64Array& operator=(const VBentoS64Array& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02093 
02094         inline const Vs64Array& getValue() const { return mValue; } 
02095         inline void setValue(const Vs64Array& elements) { mValue = elements; } 
02096         inline void appendValue(Vs64 element) { mValue.push_back(element); } 
02097         inline void appendValues(const Vs64Array& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02098 
02099         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02100 
02101     protected:
02102 
02103         virtual Vs64 getDataLength() const { return 4 + (8 * mValue.size()); } 
02104         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (Vs64Array::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeS64(*i); } 
02105 
02106         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02107         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += mValue[elementIndex]; }
02108 
02109     private:
02110 
02111         Vs64Array mValue; 
02112 };
02113 
02117 class VBentoStringArray : public VBentoArray {
02118     public:
02119 
02120         static VBentoStringArray* newFromBentoTextString(const VString& name, const VString& bentoText);
02121 
02122         static const VString& DATA_TYPE_ID() { static const VString kID("vsta"); return kID; } 
02123 
02124         VBentoStringArray() : VBentoArray(), mValue() {} 
02125         VBentoStringArray(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readString()); } 
02126         VBentoStringArray(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02127         VBentoStringArray(const VString& name, const VStringVector& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02128         virtual ~VBentoStringArray() {} 
02129 
02130         virtual VBentoAttribute* clone() const { return new VBentoStringArray(this->getName(), mValue); }
02131         VBentoStringArray& operator=(const VBentoStringArray& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02132 
02133         inline const VStringVector& getValue() const { return mValue; } 
02134         inline void setValue(const VStringVector& elements) { mValue = elements; } 
02135         inline void appendValue(const VString& element) { mValue.push_back(element); } 
02136         inline void appendValues(const VStringVector& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02137 
02138         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02139 
02140     protected:
02141 
02142         virtual Vs64 getDataLength() const { Vs64 binaryStringsLength = 0; for (VStringVector::const_iterator i = mValue.begin(); i != mValue.end(); ++i) binaryStringsLength += VBentoNode::_getBinaryStringLength(*i); return 4 + binaryStringsLength; } 
02143         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (VStringVector::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeString(*i); } 
02144 
02145         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02146         virtual void _appendElementBentoText(int elementIndex, VString& s) const { VString valueString = mValue[elementIndex]; valueString.replace("\"", "\\\\\""); s += '"'; s += valueString; s += '"'; }
02147 
02148     private:
02149 
02150         VStringVector mValue; 
02151 };
02152 
02156 class VBentoBoolArray : public VBentoArray {
02157     public:
02158 
02159         static VBentoBoolArray* newFromBentoTextString(const VString& name, const VString& bentoText);
02160 
02161         static const VString& DATA_TYPE_ID() { static const VString kID("booa"); return kID; } 
02162 
02163         VBentoBoolArray() : VBentoArray(), mValue() {} 
02164         VBentoBoolArray(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readBool()); } 
02165         VBentoBoolArray(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02166         VBentoBoolArray(const VString& name, const VBoolArray& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02167         virtual ~VBentoBoolArray() {} 
02168 
02169         virtual VBentoAttribute* clone() const { return new VBentoBoolArray(this->getName(), mValue); }
02170         VBentoBoolArray& operator=(const VBentoBoolArray& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02171 
02172         inline const VBoolArray& getValue() const { return mValue; } 
02173         inline void setValue(const VBoolArray& elements) { mValue = elements; } 
02174         inline void appendValue(bool element) { mValue.push_back(element); } 
02175         inline void appendValues(const VBoolArray& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02176 
02177         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02178 
02179     protected:
02180 
02181         virtual Vs64 getDataLength() const { return 4 + (1 * mValue.size()); } 
02182         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (VBoolArray::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeBool(*i); } 
02183 
02184         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02185         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += (mValue[elementIndex] ? "true" : "false"); }
02186 
02187     private:
02188 
02189         VBoolArray mValue; 
02190 };
02191 
02195 class VBentoDoubleArray : public VBentoArray {
02196     public:
02197 
02198         static VBentoDoubleArray* newFromBentoTextString(const VString& name, const VString& bentoText);
02199 
02200         static const VString& DATA_TYPE_ID() { static const VString kID("duba"); return kID; } 
02201 
02202         VBentoDoubleArray() : VBentoArray(), mValue() {} 
02203         VBentoDoubleArray(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readDouble()); } 
02204         VBentoDoubleArray(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02205         VBentoDoubleArray(const VString& name, const VDoubleArray& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02206         virtual ~VBentoDoubleArray() {} 
02207 
02208         virtual VBentoAttribute* clone() const { return new VBentoDoubleArray(this->getName(), mValue); }
02209         VBentoDoubleArray& operator=(const VBentoDoubleArray& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02210 
02211         inline const VDoubleArray& getValue() const { return mValue; } 
02212         inline void setValue(const VDoubleArray& elements) { mValue = elements; } 
02213         inline void appendValue(VDouble element) { mValue.push_back(element); } 
02214         inline void appendValues(const VDoubleArray& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02215 
02216         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02217 
02218     protected:
02219 
02220         virtual Vs64 getDataLength() const { return 4 + (8 * mValue.size()); } 
02221         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (VDoubleArray::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeDouble(*i); } 
02222 
02223         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02224         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += mValue[elementIndex]; }
02225 
02226     private:
02227 
02228         VDoubleArray mValue; 
02229 };
02230 
02234 class VBentoDurationArray : public VBentoArray {
02235     public:
02236 
02237         static VBentoDurationArray* newFromBentoTextString(const VString& name, const VString& bentoText);
02238 
02239         static const VString& DATA_TYPE_ID() { static const VString kID("draa"); return kID; } 
02240 
02241         VBentoDurationArray() : VBentoArray(), mValue() {} 
02242         VBentoDurationArray(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readDuration()); } 
02243         VBentoDurationArray(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02244         VBentoDurationArray(const VString& name, const VDurationVector& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02245         virtual ~VBentoDurationArray() {} 
02246 
02247         virtual VBentoAttribute* clone() const { return new VBentoDurationArray(this->getName(), mValue); }
02248         VBentoDurationArray& operator=(const VBentoDurationArray& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02249 
02250         inline const VDurationVector& getValue() const { return mValue; } 
02251         inline void setValue(const VDurationVector& elements) { mValue = elements; } 
02252         inline void appendValue(const VDuration& element) { mValue.push_back(element); } 
02253         inline void appendValues(const VDurationVector& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02254 
02255         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02256 
02257     protected:
02258 
02259         virtual Vs64 getDataLength() const { return 4 + (8 * mValue.size()); } 
02260         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (VDurationVector::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeDuration(*i); } 
02261 
02262         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02263         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += mValue[elementIndex].getDurationMilliseconds(); s += "ms"; }
02264 
02265     private:
02266 
02267         VDurationVector mValue; 
02268 };
02269 
02273 class VBentoInstantArray : public VBentoArray {
02274     public:
02275 
02276         static VBentoInstantArray* newFromBentoTextString(const VString& name, const VString& bentoText);
02277 
02278         static const VString& DATA_TYPE_ID() { static const VString kID("insa"); return kID; } 
02279 
02280         VBentoInstantArray() : VBentoArray(), mValue() {} 
02281         VBentoInstantArray(VBinaryIOStream& stream) : VBentoArray(stream, DATA_TYPE_ID()), mValue() { int numElements = static_cast<int>(stream.readS32()); for (int i = 0; i < numElements; ++i) mValue.push_back(stream.readInstant()); } 
02282         VBentoInstantArray(const VString& name) : VBentoArray(name, DATA_TYPE_ID()), mValue() {} 
02283         VBentoInstantArray(const VString& name, const VInstantVector& elements) : VBentoArray(name, DATA_TYPE_ID()), mValue(elements) {} 
02284         virtual ~VBentoInstantArray() {} 
02285 
02286         virtual VBentoAttribute* clone() const { return new VBentoInstantArray(this->getName(), mValue); }
02287         VBentoInstantArray& operator=(const VBentoInstantArray& rhs) { VBentoArray::operator=(rhs); mValue = rhs.mValue; return *this; }
02288 
02289         inline const VInstantVector& getValue() const { return mValue; } 
02290         inline void setValue(const VInstantVector& elements) { mValue = elements; } 
02291         inline void appendValue(const VInstant& element) { mValue.push_back(element); } 
02292         inline void appendValues(const VInstantVector& elements) { mValue.insert(mValue.end(), elements.begin(), elements.end()); } 
02293 
02294         virtual void writeToXMLTextStream(VTextIOStream& stream, bool lineWrap, int depth) const; 
02295 
02296     protected:
02297 
02298         virtual Vs64 getDataLength() const { return 4 + (8 * mValue.size()); } 
02299         virtual void writeDataToBinaryStream(VBinaryIOStream& stream) const { int numElements = static_cast<int>(mValue.size()); stream.writeS32(numElements); for (VInstantVector::const_iterator i = mValue.begin(); i != mValue.end(); ++i) stream.writeInstant(*i); } 
02300 
02301         virtual int _getNumElements() const { return static_cast<int>(mValue.size()); }
02302         virtual void _appendElementBentoText(int elementIndex, VString& s) const { s += mValue[elementIndex].getUTCString(); }
02303 
02304     private:
02305 
02306         VInstantVector mValue; 
02307 };
02308 
02314 class VBentoNotFoundException : public VStackTraceException {
02315     public:
02316 
02317         static const int BENTO_ATTRIBUTE_NOT_FOUND_ERROR = -2; 
02318 
02319         VBentoNotFoundException(const VString& dataTypeID, const VString& attributeName)
02320             : VStackTraceException(BENTO_ATTRIBUTE_NOT_FOUND_ERROR, VSTRING_FORMAT("Attribute type '%s' name '%s' not found.", dataTypeID.chars(), attributeName.chars()))
02321             , mDataTypeID(dataTypeID)
02322             , mAttributeName(attributeName)
02323             {}
02324         virtual ~VBentoNotFoundException() throw() {}
02325 
02326         const VString mDataTypeID;
02327         const VString mAttributeName;
02328 };
02329 
02330 #endif /* vbento_h */

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