%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name:        tbuffer.tex
%% Purpose:     wxXXXBuffer classes overview
%% Author:      Ryan Norton <wxprojects@comcast.net>
%% Modified by: All wxWidgets Developers
%% Created:     04/08/2005
%% RCS-ID:      $Id: tbuffer.tex 33435 2005-04-08 19:11:58Z RN $
%% Copyright:   (c) wxWidgets team
%% License:     wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Buffer classes overview}\label{bufferclasses}

wxWidgets uses two classes of classes for dealing with buffers in memory.

The first is one for dealing with character buffers, namely wxCharBuffer for char pointer or multi-byte c strings and wxWCharBuffer for wchar\_t pointer or wide character c strings.

Secondly, wxWidgets uses, although only rarely currently, wxMemoryBuffer for dealing with raw buffers in memory.

\subsection{wxXCharBuffer Overview}\label{wxcbov}

\wxheading{General Usage}

As mentioned, wxCharBuffer and its wide character variant wxWCharBuffer deal with c strings in memory.  They have two constructors, one in which you pass the c string you want them to have a copy of, and another where you specify the size of the buffer in memory in characters you want.

wxCharBuffer and its variant only contain the c string as a member, so they can be used safely to c functions with variable arguments such as printf.  They also contain standard assignment, character access operators and a copy constructor.

\wxheading{Destruction}

It should be noted that on destruction wxCharBuffer and its wide character variant delete the c string that hold onto.  If you want to get the pointer to the buffer and don't want wxCharBuffer to delete it on destruction, use the member function release to do so.

