1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: wxStringBuffer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td id="projectlogo">
<a href="http://www.wxwidgets.org/" target="_new">
<img alt="wxWidgets" src="logo.png"/>
</a>
</td>
<td style="padding-left: 0.5em; text-align: right;">
<span id="projectnumber">Version: 3.0.2</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Categories</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classwx_string_buffer-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">wxStringBuffer Class Reference<div class="ingroups"><a class="el" href="group__group__class__data.html">Data Structures</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <wx/string.h></code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This tiny class allows you to conveniently access the <a class="el" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> internal buffer as a writable pointer without any risk of forgetting to restore the string to the usable state later. </p>
<p>For example, assuming you have a low-level OS function called <code>"GetMeaningOfLifeAsString(char *)"</code> returning the value in the provided buffer (which must be writable, of course) you might call it like this:</p>
<div class="fragment"><div class="line"><a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> theAnswer;</div>
<div class="line">GetMeaningOfLifeAsString(<a class="code" href="classwx_string_buffer.html#abcb53ccbb849af669bb51402ea57d7c8" title="Constructs a writable string buffer object associated with the given string and containing enough spa...">wxStringBuffer</a>(theAnswer, 1024));</div>
<div class="line"><span class="keywordflow">if</span> ( theAnswer != <span class="stringliteral">"42"</span> )</div>
<div class="line"> <a class="code" href="group__group__funcmacro__log.html#ga0dd3c633f990f794e76065c9a7af4c87" title="The functions to use for error messages, i.e.">wxLogError</a>(<span class="stringliteral">"Something is very wrong!"</span>);</div>
</div><!-- fragment --><p>Note that the exact usage of this depends on whether or not <code>wxUSE_STL</code> is enabled. If <code>wxUSE_STL</code> is enabled, <a class="el" href="classwx_string_buffer.html" title="This tiny class allows you to conveniently access the wxString internal buffer as a writable pointer ...">wxStringBuffer</a> creates a separate empty character buffer, and if <code>wxUSE_STL</code> is disabled, it uses GetWriteBuf() from <a class="el" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a>, keeping the same buffer <a class="el" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> uses intact. In other words, relying on <a class="el" href="classwx_string_buffer.html" title="This tiny class allows you to conveniently access the wxString internal buffer as a writable pointer ...">wxStringBuffer</a> containing the old <a class="el" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> data is not a good idea if you want to build your program both with and without <code>wxUSE_STL</code>.</p>
<h2></h2>
<div><span class="lib">Library:</span>  <span class="lib_text"><a class="el" href="page_libs.html#page_libs_wxbase">wxBase</a></span></div><div><span class="category">Category:</span>  <span class="category_text"><a class="el" href="group__group__class__data.html">Data Structures</a></span></div> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:abcb53ccbb849af669bb51402ea57d7c8"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_string_buffer.html#abcb53ccbb849af669bb51402ea57d7c8">wxStringBuffer</a> (const <a class="el" href="classwx_string.html">wxString</a> &str, size_t len)</td></tr>
<tr class="memdesc:abcb53ccbb849af669bb51402ea57d7c8"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a writable string buffer object associated with the given string and containing enough space for at least <em>len</em> characters. <a href="#abcb53ccbb849af669bb51402ea57d7c8"></a><br/></td></tr>
<tr class="separator:abcb53ccbb849af669bb51402ea57d7c8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae7801d52c22c50d100b2a2a5fdb6dccc"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_string_buffer.html#ae7801d52c22c50d100b2a2a5fdb6dccc">~wxStringBuffer</a> ()</td></tr>
<tr class="memdesc:ae7801d52c22c50d100b2a2a5fdb6dccc"><td class="mdescLeft"> </td><td class="mdescRight">Restores the string passed to the constructor to the usable state by calling <a class="el" href="classwx_string.html#a3783b441b540bac783a8e5a2cceaae7d" title="Puts the string back into a reasonable state (in which it can be used normally), after GetWriteBuf() ...">wxString::UngetWriteBuf()</a> on it. <a href="#ae7801d52c22c50d100b2a2a5fdb6dccc"></a><br/></td></tr>
<tr class="separator:ae7801d52c22c50d100b2a2a5fdb6dccc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0483dde557c8c40f519ec52536d7fad8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__string.html#gaf558f1d34fbf3cf5e3258e42a40875fd">wxStringCharType</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_string_buffer.html#a0483dde557c8c40f519ec52536d7fad8">operator wxStringCharType *</a> ()</td></tr>
<tr class="memdesc:a0483dde557c8c40f519ec52536d7fad8"><td class="mdescLeft"> </td><td class="mdescRight">Returns the writable pointer to a buffer of the size at least equal to the length specified in the constructor. <a href="#a0483dde557c8c40f519ec52536d7fad8"></a><br/></td></tr>
<tr class="separator:a0483dde557c8c40f519ec52536d7fad8"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="abcb53ccbb849af669bb51402ea57d7c8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxStringBuffer::wxStringBuffer </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>str</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructs a writable string buffer object associated with the given string and containing enough space for at least <em>len</em> characters. </p>
<p>Basically, this is equivalent to calling <a class="el" href="classwx_string.html#a0c87e85cee09e65d314457379e5aba19" title="Returns a writable buffer of at least len bytes.">wxString::GetWriteBuf()</a> and saving the result. </p>
</div>
</div>
<a class="anchor" id="ae7801d52c22c50d100b2a2a5fdb6dccc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxStringBuffer::~wxStringBuffer </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Restores the string passed to the constructor to the usable state by calling <a class="el" href="classwx_string.html#a3783b441b540bac783a8e5a2cceaae7d" title="Puts the string back into a reasonable state (in which it can be used normally), after GetWriteBuf() ...">wxString::UngetWriteBuf()</a> on it. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a0483dde557c8c40f519ec52536d7fad8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__string.html#gaf558f1d34fbf3cf5e3258e42a40875fd">wxStringCharType</a>* wxStringBuffer::operator <a class="el" href="group__group__funcmacro__string.html#gaf558f1d34fbf3cf5e3258e42a40875fd">wxStringCharType</a> * </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the writable pointer to a buffer of the size at least equal to the length specified in the constructor. </p>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:59 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>
|