]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/tbuffer.tex
Applied ref-couting patch.
[wxWidgets.git] / docs / latex / wx / tbuffer.tex
CommitLineData
40ca9449
RN
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: tbuffer.tex
3%% Purpose: wxXXXBuffer classes overview
4%% Author: Ryan Norton <wxprojects@comcast.net>
5%% Modified by: All wxWidgets Developers
6%% Created: 04/08/2005
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets team
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{Buffer classes overview}\label{bufferclasses}
13
14wxWidgets uses two classes of classes for dealing with buffers in memory.
15
16The 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.
17
18Secondly, wxWidgets uses, although only rarely currently, wxMemoryBuffer for dealing with raw buffers in memory.
19
20\subsection{wxXCharBuffer Overview}\label{wxcbov}
21
22\wxheading{General Usage}
23
24As 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.
25
26wxCharBuffer 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.
27
28\wxheading{Destruction}
29
30It 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.
31