Buffer.hpp
Go to the documentation of this file.
#ifndef UI_GXML_BUFFER_HPP
#define UI_GXML_BUFFER_HPP
// STDC++
#include <string>
// C libraries
#include <libxml/tree.h>
// C++ libraries
#include <ui-gxmlcpp/Exception.hpp>
#include <ui-gxmlcpp/Util.hpp>
namespace UI {
namespace GXML {
class Buffer: private UI::Util::auto_base<xmlBuffer>
{
public:
enum ErrorCode
{
Mem_
};
typedef CodeException<ErrorCode> Exception;
Buffer();
~Buffer();
void concat(std::string const & text);
char const * getBuf() const;
int getSize() const;
using UI::Util::auto_base<xmlBuffer>::get;
};
class OutputBuffer: private Buffer
{
public:
OutputBuffer();
using Buffer::ErrorCode;
using Buffer::Exception;
using Buffer::concat;
#ifdef LIBXML2_NEW_BUFFER
~OutputBuffer();
char const * getBuf() const;
int getSize() const;
#else
using Buffer::getBuf;
using Buffer::getSize;
#endif
xmlOutputBuffer * get() const;
xmlOutputBuffer * operator->() const;
private:
#ifdef LIBXML2_NEW_BUFFER
xmlOutputBuffer * outbuf_;
#else
xmlOutputBuffer outbuf_;
#endif
};
}}
#endif
Exception.hpp
Util.hpp
UI::GXML::Buffer::getBuf
char const * getBuf() const
Get buffer content address.
Definition Buffer.cpp:56
UI::GXML::Buffer::concat
void concat(std::string const &text)
Append text.
Definition Buffer.cpp:48
UI::GXML::Buffer::Exception
CodeException< ErrorCode > Exception
Exceptions for this class.
Definition Buffer.hpp:36
UI::GXML::Buffer::ErrorCode
ErrorCode
Error codes for exceptions.
Definition Buffer.hpp:32
UI::GXML::Buffer::getSize
int getSize() const
Get buffer content size.
Definition Buffer.cpp:61
UI::GXML::CodeException
Adding code facility to Exception.
Definition Exception.hpp:35
UI::GXML::OutputBuffer::getBuf
char const * getBuf() const
Get buffer content address.
Definition Buffer.cpp:56
UI::GXML::OutputBuffer::get
xmlOutputBuffer * get() const
Get underlying pointer.
Definition Buffer.cpp:106
UI::GXML::OutputBuffer::getSize
int getSize() const
Get buffer content size.
Definition Buffer.cpp:61
UI::GXML::OutputBuffer::operator->
xmlOutputBuffer * operator->() const
Smart dereferencing.
Definition Buffer.cpp:111
UI::GXML
Namespace for library project "ui-gxmlcpp".
Definition Buffer.cpp:31
UI
Namespace for all Schlund+Partner Code.
Definition Buffer.cpp:30