Chapter 7.  XmlData

#include <DbXml.hpp>

class DbXml::XmlData { 
public: 
    XmlData::XmlData()
    XmlData::XmlData(const Dbt &dbt) 
    XmlData::XmlData(void *data, size_t size) 
    XmlData::XmlData(const XmlData &o) 
    XmlData &operator = (const XmlData &o) 
    virtual XmlData::~XmlData() 
    ...
            
    void set(const void *data, size_t size); 
    void append(const void *data, size_t size);
            
    void * get_data() const;
            
    size_t get_size() const; void set_size(size_t size);
    
   size_t reserve(size_t size); void getReservedSize() const;
            
   void adoptBuffer(XmlData &src); 
}; 

The XmlData class encapsulates a buffer for storing and retrieving binary data (uninterpreted bytes). The default and copy constructors for XmlData manage their own memory and the application need not be aware of it. The constructors, XmlData(const Dbt &dbt) and XmlData(void *data, size_t size), create "wrapper" objects for the memory passed in and in those instances it is up to the application to own and manage the memory. If a wrapper object is assigned data that is larger than its memory buffer an exception will be thrown.

XmlData Methods