CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
Public Member Functions | Public Attributes | Private Attributes
claw::graphic::jpeg::writer::destination_manager Struct Reference

Destination manager that allow us to write in a std::ostream. More...

#include <jpeg.hpp>

List of all members.

Public Member Functions

 destination_manager (std::ostream &os)
 Constructor.
 ~destination_manager ()
 Destructor.
void flush ()
 Write the content of the buffer in the file.
void term ()
 Write the last pending bytes in the file.

Public Attributes

struct jpeg_destination_mgr pub
 "public" fields, needed by the jpeg library.

Private Attributes

std::ostream & m_output
 The stream in which we write the data.
JOCTET * m_buffer
 Pointer on the begining of the buffer.
const unsigned int m_buffer_size
 Number of bytes in the buffer.

Detailed Description

Destination manager that allow us to write in a std::ostream.

Author:
Julien Jorge

Definition at line 195 of file jpeg.hpp.


Constructor & Destructor Documentation

claw::graphic::jpeg::writer::destination_manager::destination_manager ( std::ostream &  os)

Constructor.

Parameters:
osThe stream we write in.

Definition at line 91 of file jpeg_writer.cpp.

  : m_output(os), m_buffer_size(1024)
{
  m_buffer = new JOCTET[m_buffer_size];
  pub.next_output_byte = m_buffer;
  pub.free_in_buffer = m_buffer_size;
} // jpeg::writer::destination_manager::destination_manager()
claw::graphic::jpeg::writer::destination_manager::~destination_manager ( )

Destructor.

Definition at line 103 of file jpeg_writer.cpp.

References m_buffer.

{
  delete[] m_buffer;
} // jpeg::writer::destination_manager::~destination_manager()

Member Function Documentation

void claw::graphic::jpeg::writer::destination_manager::flush ( )

Write the content of the buffer in the file.

Definition at line 112 of file jpeg_writer.cpp.

{
  m_output.write((char*)m_buffer, m_buffer_size);

  pub.next_output_byte = m_buffer;
  pub.free_in_buffer = m_buffer_size;
} // jpeg::writer::destination_manager::fill_output_buffer()
void claw::graphic::jpeg::writer::destination_manager::term ( )

Write the last pending bytes in the file.

Definition at line 125 of file jpeg_writer.cpp.

{
  m_output.write((char*)m_buffer, m_buffer_size - pub.free_in_buffer);
} // jpeg::writer::destination_manager::term()

Member Data Documentation

Pointer on the begining of the buffer.

Definition at line 213 of file jpeg.hpp.

Referenced by ~destination_manager().

Number of bytes in the buffer.

Definition at line 216 of file jpeg.hpp.

The stream in which we write the data.

Definition at line 210 of file jpeg.hpp.

"public" fields, needed by the jpeg library.

Definition at line 206 of file jpeg.hpp.

Referenced by claw::graphic::jpeg::writer::create_compress_info().


The documentation for this struct was generated from the following files: