re61.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>&lt;GString&gt;: </title>
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.2">
  7. <link rel="home" href="index.html" title="">
  8. <link rel="up" href="ch01.html" title="GLib">
  9. <link rel="prev" href="re60.html" title="&lt;%GLibSpawnFlags&gt;">
  10. <link rel="next" href="re62.html" title="&lt;%GLibTestFileType&gt;">
  11. <meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
  12. <link rel="stylesheet" href="style.css" type="text/css">
  13. </head>
  14. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  15. <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
  16. <td width="100%" align="left" class="shortcuts"></td>
  17. <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
  18. <td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
  19. <td><a accesskey="p" href="re60.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
  20. <td><a accesskey="n" href="re62.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
  21. </tr></table>
  22. <div class="refentry">
  23. <a name="id-1.1.62"></a><div class="titlepage"></div>
  24. <div class="refnamediv">
  25. <h2>&lt;GString&gt;</h2>
  26. <p>&lt;GString&gt;</p>
  27. </div>
  28. <div class="refsect1">
  29. <a name="id-1.1.62.2"></a><h2>Description</h2>
  30. <p>The GString struct contains the public fields of a GString.</p>
  31. </div>
  32. <div class="refsect1">
  33. <a name="id-1.1.62.3"></a><h2>Functions</h2>
  34. <div class="refsect2">
  35. <a name="id-1.1.62.3.2"></a><h3>append</h3>
  36. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append self val))
  37. </pre></div>
  38. <p>Adds a string onto the end of a <span class="type">GString</span>, expanding
  39. it if necessary.</p>
  40. <div class="refsect3">
  41. <a name="id-1.1.62.3.2.4"></a><h4>Parameters</h4>
  42. <div class="informaltable"><table>
  43. <tr>
  44. <td class="parameter_name"><p>string</p></td>
  45. <td class="parameter_description">
  46. <p>a <span class="type">GString</span></p>
  47. <p>Passed as <code class="code">self</code></p>
  48. </td>
  49. </tr>
  50. <tr>
  51. <td class="parameter_name"><p>val</p></td>
  52. <td class="parameter_description">
  53. <p>the string to append onto the end of <em class="parameter"><code>string</code></em></p>
  54. <p>Passed as <code class="code">val</code></p>
  55. </td>
  56. </tr>
  57. </table></div>
  58. </div>
  59. </div>
  60. <div class="refsect2">
  61. <a name="id-1.1.62.3.3"></a><h3>append-c</h3>
  62. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append-c self c))
  63. </pre></div>
  64. <p>Adds a byte onto the end of a <span class="type">GString</span>, expanding
  65. it if necessary.</p>
  66. <div class="refsect3">
  67. <a name="id-1.1.62.3.3.4"></a><h4>Parameters</h4>
  68. <div class="informaltable"><table>
  69. <tr>
  70. <td class="parameter_name"><p>string</p></td>
  71. <td class="parameter_description">
  72. <p>a <span class="type">GString</span></p>
  73. <p>Passed as <code class="code">self</code></p>
  74. </td>
  75. </tr>
  76. <tr>
  77. <td class="parameter_name"><p>c</p></td>
  78. <td class="parameter_description">
  79. <p>the byte to append onto the end of <em class="parameter"><code>string</code></em></p>
  80. <p>Passed as <code class="code">c</code></p>
  81. </td>
  82. </tr>
  83. </table></div>
  84. </div>
  85. </div>
  86. <div class="refsect2">
  87. <a name="id-1.1.62.3.4"></a><h3>append-len</h3>
  88. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append-len self val len))
  89. </pre></div>
  90. <p>Appends <em class="parameter"><code>len</code></em> bytes of <em class="parameter"><code>val</code></em> to <em class="parameter"><code>string</code></em>.
  91. </p>
  92. <p>If <em class="parameter"><code>len</code></em> is positive, <em class="parameter"><code>val</code></em> may contain embedded nuls and need
  93. not be nul-terminated. It is the caller's responsibility to
  94. ensure that <em class="parameter"><code>val</code></em> has at least <em class="parameter"><code>len</code></em> addressable bytes.
  95. </p>
  96. <p>If <em class="parameter"><code>len</code></em> is negative, <em class="parameter"><code>val</code></em> must be nul-terminated and <em class="parameter"><code>len</code></em>
  97. is considered to request the entire string length. This
  98. makes <code class="function">g_string_append_len()</code> equivalent to <code class="function">g_string_append()</code>.</p>
  99. <div class="refsect3">
  100. <a name="id-1.1.62.3.4.6"></a><h4>Parameters</h4>
  101. <div class="informaltable"><table>
  102. <tr>
  103. <td class="parameter_name"><p>string</p></td>
  104. <td class="parameter_description">
  105. <p>a <span class="type">GString</span></p>
  106. <p>Passed as <code class="code">self</code></p>
  107. </td>
  108. </tr>
  109. <tr>
  110. <td class="parameter_name"><p>val</p></td>
  111. <td class="parameter_description">
  112. <p>bytes to append</p>
  113. <p>Passed as <code class="code">val</code></p>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td class="parameter_name"><p>len</p></td>
  118. <td class="parameter_description">
  119. <p>number of bytes of <em class="parameter"><code>val</code></em> to use, or -1 for all of <em class="parameter"><code>val</code></em></p>
  120. <p>Passed as <code class="code">len</code></p>
  121. </td>
  122. </tr>
  123. </table></div>
  124. </div>
  125. </div>
  126. <div class="refsect2">
  127. <a name="id-1.1.62.3.5"></a><h3>append-unichar</h3>
  128. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:append-unichar self wc))
  129. </pre></div>
  130. <p>Converts a Unicode character into UTF-8, and appends it
  131. to the string.</p>
  132. <div class="refsect3">
  133. <a name="id-1.1.62.3.5.4"></a><h4>Parameters</h4>
  134. <div class="informaltable"><table>
  135. <tr>
  136. <td class="parameter_name"><p>string</p></td>
  137. <td class="parameter_description">
  138. <p>a <span class="type">GString</span></p>
  139. <p>Passed as <code class="code">self</code></p>
  140. </td>
  141. </tr>
  142. <tr>
  143. <td class="parameter_name"><p>wc</p></td>
  144. <td class="parameter_description">
  145. <p>a Unicode character</p>
  146. <p>Passed as <code class="code">wc</code></p>
  147. </td>
  148. </tr>
  149. </table></div>
  150. </div>
  151. </div>
  152. <div class="refsect2">
  153. <a name="id-1.1.62.3.6"></a><h3>append-uri-escaped</h3>
  154. <div class="informalexample"><pre class="programlisting">(define-values
  155. (%return)
  156. (string:append-uri-escaped self unescaped reserved-chars-allowed allow-utf8))
  157. </pre></div>
  158. <p>Appends <em class="parameter"><code>unescaped</code></em> to <em class="parameter"><code>string</code></em>, escaping any characters that
  159. are reserved in URIs using URI-style escape sequences.</p>
  160. <div class="refsect3">
  161. <a name="id-1.1.62.3.6.4"></a><h4>Parameters</h4>
  162. <div class="informaltable"><table>
  163. <tr>
  164. <td class="parameter_name"><p>string</p></td>
  165. <td class="parameter_description">
  166. <p>a <span class="type">GString</span></p>
  167. <p>Passed as <code class="code">self</code></p>
  168. </td>
  169. </tr>
  170. <tr>
  171. <td class="parameter_name"><p>unescaped</p></td>
  172. <td class="parameter_description">
  173. <p>a string</p>
  174. <p>Passed as <code class="code">unescaped</code></p>
  175. </td>
  176. </tr>
  177. <tr>
  178. <td class="parameter_name"><p>reserved_chars_allowed</p></td>
  179. <td class="parameter_description">
  180. <p>a string of reserved characters allowed
  181. to be used, or <code class="constant">NULL</code></p>
  182. <p>Passed as <code class="code">reserved-chars-allowed</code></p>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td class="parameter_name"><p>allow_utf8</p></td>
  187. <td class="parameter_description">
  188. <p>set <code class="constant">TRUE</code> if the escaped string may include UTF8 characters</p>
  189. <p>Passed as <code class="code">allow-utf8</code></p>
  190. </td>
  191. </tr>
  192. </table></div>
  193. </div>
  194. </div>
  195. <div class="refsect2">
  196. <a name="id-1.1.62.3.7"></a><h3>ascii-down</h3>
  197. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:ascii-down self))
  198. </pre></div>
  199. <p>Converts all uppercase ASCII letters to lowercase ASCII letters.</p>
  200. <div class="refsect3">
  201. <a name="id-1.1.62.3.7.4"></a><h4>Parameters</h4>
  202. <div class="informaltable"><table><tr>
  203. <td class="parameter_name"><p>string</p></td>
  204. <td class="parameter_description">
  205. <p>a GString</p>
  206. <p>Passed as <code class="code">self</code></p>
  207. </td>
  208. </tr></table></div>
  209. </div>
  210. </div>
  211. <div class="refsect2">
  212. <a name="id-1.1.62.3.8"></a><h3>ascii-up</h3>
  213. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:ascii-up self))
  214. </pre></div>
  215. <p>Converts all lowercase ASCII letters to uppercase ASCII letters.</p>
  216. <div class="refsect3">
  217. <a name="id-1.1.62.3.8.4"></a><h4>Parameters</h4>
  218. <div class="informaltable"><table><tr>
  219. <td class="parameter_name"><p>string</p></td>
  220. <td class="parameter_description">
  221. <p>a GString</p>
  222. <p>Passed as <code class="code">self</code></p>
  223. </td>
  224. </tr></table></div>
  225. </div>
  226. </div>
  227. <div class="refsect2">
  228. <a name="id-1.1.62.3.9"></a><h3>assign</h3>
  229. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:assign self rval))
  230. </pre></div>
  231. <p>Copies the bytes from a string into a <span class="type">GString</span>,
  232. destroying any previous contents. It is rather like
  233. the standard <code class="function">strcpy()</code> function, except that you do not
  234. have to worry about having enough space to copy the string.</p>
  235. <div class="refsect3">
  236. <a name="id-1.1.62.3.9.4"></a><h4>Parameters</h4>
  237. <div class="informaltable"><table>
  238. <tr>
  239. <td class="parameter_name"><p>string</p></td>
  240. <td class="parameter_description">
  241. <p>the destination <span class="type">GString</span>. Its current contents
  242. are destroyed.</p>
  243. <p>Passed as <code class="code">self</code></p>
  244. </td>
  245. </tr>
  246. <tr>
  247. <td class="parameter_name"><p>rval</p></td>
  248. <td class="parameter_description">
  249. <p>the string to copy into <em class="parameter"><code>string</code></em></p>
  250. <p>Passed as <code class="code">rval</code></p>
  251. </td>
  252. </tr>
  253. </table></div>
  254. </div>
  255. </div>
  256. <div class="refsect2">
  257. <a name="id-1.1.62.3.10"></a><h3>down</h3>
  258. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:down self))
  259. </pre></div>
  260. <p>Converts a <span class="type">GString</span> to lowercase.</p>
  261. <div class="refsect3">
  262. <a name="id-1.1.62.3.10.4"></a><h4>Parameters</h4>
  263. <div class="informaltable"><table><tr>
  264. <td class="parameter_name"><p>string</p></td>
  265. <td class="parameter_description">
  266. <p>a <span class="type">GString</span></p>
  267. <p>Passed as <code class="code">self</code></p>
  268. </td>
  269. </tr></table></div>
  270. </div>
  271. </div>
  272. <div class="refsect2">
  273. <a name="id-1.1.62.3.11"></a><h3>equal?</h3>
  274. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:equal? self v2))
  275. </pre></div>
  276. <p>Compares two strings for equality, returning <code class="constant">TRUE</code> if they are equal.
  277. For use with <span class="type">GHashTable</span>.</p>
  278. <div class="refsect3">
  279. <a name="id-1.1.62.3.11.4"></a><h4>Parameters</h4>
  280. <div class="informaltable"><table>
  281. <tr>
  282. <td class="parameter_name"><p>v</p></td>
  283. <td class="parameter_description">
  284. <p>a <span class="type">GString</span></p>
  285. <p>Passed as <code class="code">self</code></p>
  286. </td>
  287. </tr>
  288. <tr>
  289. <td class="parameter_name"><p>v2</p></td>
  290. <td class="parameter_description">
  291. <p>another <span class="type">GString</span></p>
  292. <p>Passed as <code class="code">v2</code></p>
  293. </td>
  294. </tr>
  295. </table></div>
  296. </div>
  297. </div>
  298. <div class="refsect2">
  299. <a name="id-1.1.62.3.12"></a><h3>erase</h3>
  300. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:erase self pos len))
  301. </pre></div>
  302. <p>Removes <em class="parameter"><code>len</code></em> bytes from a <span class="type">GString</span>, starting at position <em class="parameter"><code>pos</code></em>.
  303. The rest of the <span class="type">GString</span> is shifted down to fill the gap.</p>
  304. <div class="refsect3">
  305. <a name="id-1.1.62.3.12.4"></a><h4>Parameters</h4>
  306. <div class="informaltable"><table>
  307. <tr>
  308. <td class="parameter_name"><p>string</p></td>
  309. <td class="parameter_description">
  310. <p>a <span class="type">GString</span></p>
  311. <p>Passed as <code class="code">self</code></p>
  312. </td>
  313. </tr>
  314. <tr>
  315. <td class="parameter_name"><p>pos</p></td>
  316. <td class="parameter_description">
  317. <p>the position of the content to remove</p>
  318. <p>Passed as <code class="code">pos</code></p>
  319. </td>
  320. </tr>
  321. <tr>
  322. <td class="parameter_name"><p>len</p></td>
  323. <td class="parameter_description">
  324. <p>the number of bytes to remove, or -1 to remove all
  325. following bytes</p>
  326. <p>Passed as <code class="code">len</code></p>
  327. </td>
  328. </tr>
  329. </table></div>
  330. </div>
  331. </div>
  332. <div class="refsect2">
  333. <a name="id-1.1.62.3.13"></a><h3>free</h3>
  334. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:free self free-segment))
  335. </pre></div>
  336. <p>Frees the memory allocated for the <span class="type">GString</span>.
  337. If <em class="parameter"><code>free_segment</code></em> is <code class="constant">TRUE</code> it also frees the character data. If
  338. it's <code class="constant">FALSE</code>, the caller gains ownership of the buffer and must
  339. free it after use with <code class="function">g_free()</code>.</p>
  340. <div class="refsect3">
  341. <a name="id-1.1.62.3.13.4"></a><h4>Parameters</h4>
  342. <div class="informaltable"><table>
  343. <tr>
  344. <td class="parameter_name"><p>string</p></td>
  345. <td class="parameter_description">
  346. <p>a <span class="type">GString</span></p>
  347. <p>Passed as <code class="code">self</code></p>
  348. </td>
  349. </tr>
  350. <tr>
  351. <td class="parameter_name"><p>free_segment</p></td>
  352. <td class="parameter_description">
  353. <p>if <code class="constant">TRUE</code>, the actual character data is freed as well</p>
  354. <p>Passed as <code class="code">free-segment</code></p>
  355. </td>
  356. </tr>
  357. </table></div>
  358. </div>
  359. </div>
  360. <div class="refsect2">
  361. <a name="id-1.1.62.3.14"></a><h3>free-to-bytes</h3>
  362. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:free-to-bytes self))
  363. </pre></div>
  364. <p>Transfers ownership of the contents of <em class="parameter"><code>string</code></em> to a newly allocated
  365. <span class="type">GBytes</span>. The <span class="type">GString</span> structure itself is deallocated, and it is
  366. therefore invalid to use <em class="parameter"><code>string</code></em> after invoking this function.
  367. </p>
  368. <p>Note that while <span class="type">GString</span> ensures that its buffer always has a
  369. trailing nul character (not reflected in its "len"), the returned
  370. <span class="type">GBytes</span> does not include this extra nul; i.e. it has length exactly
  371. equal to the "len" member.</p>
  372. <div class="refsect3">
  373. <a name="id-1.1.62.3.14.5"></a><h4>Parameters</h4>
  374. <div class="informaltable"><table><tr>
  375. <td class="parameter_name"><p>string</p></td>
  376. <td class="parameter_description">
  377. <p>a <span class="type">GString</span></p>
  378. <p>Passed as <code class="code">self</code></p>
  379. </td>
  380. </tr></table></div>
  381. </div>
  382. </div>
  383. <div class="refsect2">
  384. <a name="id-1.1.62.3.15"></a><h3>hash</h3>
  385. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:hash self))
  386. </pre></div>
  387. <p>Creates a hash code for <em class="parameter"><code>str</code></em>; for use with <span class="type">GHashTable</span>.</p>
  388. <div class="refsect3">
  389. <a name="id-1.1.62.3.15.4"></a><h4>Parameters</h4>
  390. <div class="informaltable"><table><tr>
  391. <td class="parameter_name"><p>str</p></td>
  392. <td class="parameter_description">
  393. <p>a string to hash</p>
  394. <p>Passed as <code class="code">self</code></p>
  395. </td>
  396. </tr></table></div>
  397. </div>
  398. </div>
  399. <div class="refsect2">
  400. <a name="id-1.1.62.3.16"></a><h3>insert</h3>
  401. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert self pos val))
  402. </pre></div>
  403. <p>Inserts a copy of a string into a <span class="type">GString</span>,
  404. expanding it if necessary.</p>
  405. <div class="refsect3">
  406. <a name="id-1.1.62.3.16.4"></a><h4>Parameters</h4>
  407. <div class="informaltable"><table>
  408. <tr>
  409. <td class="parameter_name"><p>string</p></td>
  410. <td class="parameter_description">
  411. <p>a <span class="type">GString</span></p>
  412. <p>Passed as <code class="code">self</code></p>
  413. </td>
  414. </tr>
  415. <tr>
  416. <td class="parameter_name"><p>pos</p></td>
  417. <td class="parameter_description">
  418. <p>the position to insert the copy of the string</p>
  419. <p>Passed as <code class="code">pos</code></p>
  420. </td>
  421. </tr>
  422. <tr>
  423. <td class="parameter_name"><p>val</p></td>
  424. <td class="parameter_description">
  425. <p>the string to insert</p>
  426. <p>Passed as <code class="code">val</code></p>
  427. </td>
  428. </tr>
  429. </table></div>
  430. </div>
  431. </div>
  432. <div class="refsect2">
  433. <a name="id-1.1.62.3.17"></a><h3>insert-c</h3>
  434. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert-c self pos c))
  435. </pre></div>
  436. <p>Inserts a byte into a <span class="type">GString</span>, expanding it if necessary.</p>
  437. <div class="refsect3">
  438. <a name="id-1.1.62.3.17.4"></a><h4>Parameters</h4>
  439. <div class="informaltable"><table>
  440. <tr>
  441. <td class="parameter_name"><p>string</p></td>
  442. <td class="parameter_description">
  443. <p>a <span class="type">GString</span></p>
  444. <p>Passed as <code class="code">self</code></p>
  445. </td>
  446. </tr>
  447. <tr>
  448. <td class="parameter_name"><p>pos</p></td>
  449. <td class="parameter_description">
  450. <p>the position to insert the byte</p>
  451. <p>Passed as <code class="code">pos</code></p>
  452. </td>
  453. </tr>
  454. <tr>
  455. <td class="parameter_name"><p>c</p></td>
  456. <td class="parameter_description">
  457. <p>the byte to insert</p>
  458. <p>Passed as <code class="code">c</code></p>
  459. </td>
  460. </tr>
  461. </table></div>
  462. </div>
  463. </div>
  464. <div class="refsect2">
  465. <a name="id-1.1.62.3.18"></a><h3>insert-len</h3>
  466. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert-len self pos val len))
  467. </pre></div>
  468. <p>Inserts <em class="parameter"><code>len</code></em> bytes of <em class="parameter"><code>val</code></em> into <em class="parameter"><code>string</code></em> at <em class="parameter"><code>pos</code></em>.
  469. </p>
  470. <p>If <em class="parameter"><code>len</code></em> is positive, <em class="parameter"><code>val</code></em> may contain embedded nuls and need
  471. not be nul-terminated. It is the caller's responsibility to
  472. ensure that <em class="parameter"><code>val</code></em> has at least <em class="parameter"><code>len</code></em> addressable bytes.
  473. </p>
  474. <p>If <em class="parameter"><code>len</code></em> is negative, <em class="parameter"><code>val</code></em> must be nul-terminated and <em class="parameter"><code>len</code></em>
  475. is considered to request the entire string length.
  476. </p>
  477. <p>If <em class="parameter"><code>pos</code></em> is -1, bytes are inserted at the end of the string.</p>
  478. <div class="refsect3">
  479. <a name="id-1.1.62.3.18.7"></a><h4>Parameters</h4>
  480. <div class="informaltable"><table>
  481. <tr>
  482. <td class="parameter_name"><p>string</p></td>
  483. <td class="parameter_description">
  484. <p>a <span class="type">GString</span></p>
  485. <p>Passed as <code class="code">self</code></p>
  486. </td>
  487. </tr>
  488. <tr>
  489. <td class="parameter_name"><p>pos</p></td>
  490. <td class="parameter_description">
  491. <p>position in <em class="parameter"><code>string</code></em> where insertion should
  492. happen, or -1 for at the end</p>
  493. <p>Passed as <code class="code">pos</code></p>
  494. </td>
  495. </tr>
  496. <tr>
  497. <td class="parameter_name"><p>val</p></td>
  498. <td class="parameter_description">
  499. <p>bytes to insert</p>
  500. <p>Passed as <code class="code">val</code></p>
  501. </td>
  502. </tr>
  503. <tr>
  504. <td class="parameter_name"><p>len</p></td>
  505. <td class="parameter_description">
  506. <p>number of bytes of <em class="parameter"><code>val</code></em> to insert, or -1 for all of <em class="parameter"><code>val</code></em></p>
  507. <p>Passed as <code class="code">len</code></p>
  508. </td>
  509. </tr>
  510. </table></div>
  511. </div>
  512. </div>
  513. <div class="refsect2">
  514. <a name="id-1.1.62.3.19"></a><h3>insert-unichar</h3>
  515. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:insert-unichar self pos wc))
  516. </pre></div>
  517. <p>Converts a Unicode character into UTF-8, and insert it
  518. into the string at the given position.</p>
  519. <div class="refsect3">
  520. <a name="id-1.1.62.3.19.4"></a><h4>Parameters</h4>
  521. <div class="informaltable"><table>
  522. <tr>
  523. <td class="parameter_name"><p>string</p></td>
  524. <td class="parameter_description">
  525. <p>a <span class="type">GString</span></p>
  526. <p>Passed as <code class="code">self</code></p>
  527. </td>
  528. </tr>
  529. <tr>
  530. <td class="parameter_name"><p>pos</p></td>
  531. <td class="parameter_description">
  532. <p>the position at which to insert character, or -1
  533. to append at the end of the string</p>
  534. <p>Passed as <code class="code">pos</code></p>
  535. </td>
  536. </tr>
  537. <tr>
  538. <td class="parameter_name"><p>wc</p></td>
  539. <td class="parameter_description">
  540. <p>a Unicode character</p>
  541. <p>Passed as <code class="code">wc</code></p>
  542. </td>
  543. </tr>
  544. </table></div>
  545. </div>
  546. </div>
  547. <div class="refsect2">
  548. <a name="id-1.1.62.3.20"></a><h3>overwrite</h3>
  549. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:overwrite self pos val))
  550. </pre></div>
  551. <p>Overwrites part of a string, lengthening it if necessary.</p>
  552. <div class="refsect3">
  553. <a name="id-1.1.62.3.20.4"></a><h4>Parameters</h4>
  554. <div class="informaltable"><table>
  555. <tr>
  556. <td class="parameter_name"><p>string</p></td>
  557. <td class="parameter_description">
  558. <p>a <span class="type">GString</span></p>
  559. <p>Passed as <code class="code">self</code></p>
  560. </td>
  561. </tr>
  562. <tr>
  563. <td class="parameter_name"><p>pos</p></td>
  564. <td class="parameter_description">
  565. <p>the position at which to start overwriting</p>
  566. <p>Passed as <code class="code">pos</code></p>
  567. </td>
  568. </tr>
  569. <tr>
  570. <td class="parameter_name"><p>val</p></td>
  571. <td class="parameter_description">
  572. <p>the string that will overwrite the <em class="parameter"><code>string</code></em> starting at <em class="parameter"><code>pos</code></em></p>
  573. <p>Passed as <code class="code">val</code></p>
  574. </td>
  575. </tr>
  576. </table></div>
  577. </div>
  578. </div>
  579. <div class="refsect2">
  580. <a name="id-1.1.62.3.21"></a><h3>overwrite-len</h3>
  581. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:overwrite-len self pos val len))
  582. </pre></div>
  583. <p>Overwrites part of a string, lengthening it if necessary.
  584. This function will work with embedded nuls.</p>
  585. <div class="refsect3">
  586. <a name="id-1.1.62.3.21.4"></a><h4>Parameters</h4>
  587. <div class="informaltable"><table>
  588. <tr>
  589. <td class="parameter_name"><p>string</p></td>
  590. <td class="parameter_description">
  591. <p>a <span class="type">GString</span></p>
  592. <p>Passed as <code class="code">self</code></p>
  593. </td>
  594. </tr>
  595. <tr>
  596. <td class="parameter_name"><p>pos</p></td>
  597. <td class="parameter_description">
  598. <p>the position at which to start overwriting</p>
  599. <p>Passed as <code class="code">pos</code></p>
  600. </td>
  601. </tr>
  602. <tr>
  603. <td class="parameter_name"><p>val</p></td>
  604. <td class="parameter_description">
  605. <p>the string that will overwrite the <em class="parameter"><code>string</code></em> starting at <em class="parameter"><code>pos</code></em></p>
  606. <p>Passed as <code class="code">val</code></p>
  607. </td>
  608. </tr>
  609. <tr>
  610. <td class="parameter_name"><p>len</p></td>
  611. <td class="parameter_description">
  612. <p>the number of bytes to write from <em class="parameter"><code>val</code></em></p>
  613. <p>Passed as <code class="code">len</code></p>
  614. </td>
  615. </tr>
  616. </table></div>
  617. </div>
  618. </div>
  619. <div class="refsect2">
  620. <a name="id-1.1.62.3.22"></a><h3>prepend</h3>
  621. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend self val))
  622. </pre></div>
  623. <p>Adds a string on to the start of a <span class="type">GString</span>,
  624. expanding it if necessary.</p>
  625. <div class="refsect3">
  626. <a name="id-1.1.62.3.22.4"></a><h4>Parameters</h4>
  627. <div class="informaltable"><table>
  628. <tr>
  629. <td class="parameter_name"><p>string</p></td>
  630. <td class="parameter_description">
  631. <p>a <span class="type">GString</span></p>
  632. <p>Passed as <code class="code">self</code></p>
  633. </td>
  634. </tr>
  635. <tr>
  636. <td class="parameter_name"><p>val</p></td>
  637. <td class="parameter_description">
  638. <p>the string to prepend on the start of <em class="parameter"><code>string</code></em></p>
  639. <p>Passed as <code class="code">val</code></p>
  640. </td>
  641. </tr>
  642. </table></div>
  643. </div>
  644. </div>
  645. <div class="refsect2">
  646. <a name="id-1.1.62.3.23"></a><h3>prepend-c</h3>
  647. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend-c self c))
  648. </pre></div>
  649. <p>Adds a byte onto the start of a <span class="type">GString</span>,
  650. expanding it if necessary.</p>
  651. <div class="refsect3">
  652. <a name="id-1.1.62.3.23.4"></a><h4>Parameters</h4>
  653. <div class="informaltable"><table>
  654. <tr>
  655. <td class="parameter_name"><p>string</p></td>
  656. <td class="parameter_description">
  657. <p>a <span class="type">GString</span></p>
  658. <p>Passed as <code class="code">self</code></p>
  659. </td>
  660. </tr>
  661. <tr>
  662. <td class="parameter_name"><p>c</p></td>
  663. <td class="parameter_description">
  664. <p>the byte to prepend on the start of the <span class="type">GString</span></p>
  665. <p>Passed as <code class="code">c</code></p>
  666. </td>
  667. </tr>
  668. </table></div>
  669. </div>
  670. </div>
  671. <div class="refsect2">
  672. <a name="id-1.1.62.3.24"></a><h3>prepend-len</h3>
  673. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend-len self val len))
  674. </pre></div>
  675. <p>Prepends <em class="parameter"><code>len</code></em> bytes of <em class="parameter"><code>val</code></em> to <em class="parameter"><code>string</code></em>.
  676. </p>
  677. <p>If <em class="parameter"><code>len</code></em> is positive, <em class="parameter"><code>val</code></em> may contain embedded nuls and need
  678. not be nul-terminated. It is the caller's responsibility to
  679. ensure that <em class="parameter"><code>val</code></em> has at least <em class="parameter"><code>len</code></em> addressable bytes.
  680. </p>
  681. <p>If <em class="parameter"><code>len</code></em> is negative, <em class="parameter"><code>val</code></em> must be nul-terminated and <em class="parameter"><code>len</code></em>
  682. is considered to request the entire string length. This
  683. makes <code class="function">g_string_prepend_len()</code> equivalent to <code class="function">g_string_prepend()</code>.</p>
  684. <div class="refsect3">
  685. <a name="id-1.1.62.3.24.6"></a><h4>Parameters</h4>
  686. <div class="informaltable"><table>
  687. <tr>
  688. <td class="parameter_name"><p>string</p></td>
  689. <td class="parameter_description">
  690. <p>a <span class="type">GString</span></p>
  691. <p>Passed as <code class="code">self</code></p>
  692. </td>
  693. </tr>
  694. <tr>
  695. <td class="parameter_name"><p>val</p></td>
  696. <td class="parameter_description">
  697. <p>bytes to prepend</p>
  698. <p>Passed as <code class="code">val</code></p>
  699. </td>
  700. </tr>
  701. <tr>
  702. <td class="parameter_name"><p>len</p></td>
  703. <td class="parameter_description">
  704. <p>number of bytes in <em class="parameter"><code>val</code></em> to prepend, or -1 for all of <em class="parameter"><code>val</code></em></p>
  705. <p>Passed as <code class="code">len</code></p>
  706. </td>
  707. </tr>
  708. </table></div>
  709. </div>
  710. </div>
  711. <div class="refsect2">
  712. <a name="id-1.1.62.3.25"></a><h3>prepend-unichar</h3>
  713. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:prepend-unichar self wc))
  714. </pre></div>
  715. <p>Converts a Unicode character into UTF-8, and prepends it
  716. to the string.</p>
  717. <div class="refsect3">
  718. <a name="id-1.1.62.3.25.4"></a><h4>Parameters</h4>
  719. <div class="informaltable"><table>
  720. <tr>
  721. <td class="parameter_name"><p>string</p></td>
  722. <td class="parameter_description">
  723. <p>a <span class="type">GString</span></p>
  724. <p>Passed as <code class="code">self</code></p>
  725. </td>
  726. </tr>
  727. <tr>
  728. <td class="parameter_name"><p>wc</p></td>
  729. <td class="parameter_description">
  730. <p>a Unicode character</p>
  731. <p>Passed as <code class="code">wc</code></p>
  732. </td>
  733. </tr>
  734. </table></div>
  735. </div>
  736. </div>
  737. <div class="refsect2">
  738. <a name="id-1.1.62.3.26"></a><h3>replace</h3>
  739. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:replace self find replace limit))
  740. </pre></div>
  741. <p>Undocumented</p>
  742. <div class="refsect3">
  743. <a name="id-1.1.62.3.26.4"></a><h4>Parameters</h4>
  744. <div class="informaltable"><table>
  745. <tr>
  746. <td class="parameter_name"><p>string</p></td>
  747. <td class="parameter_description">
  748. <p></p>
  749. <p>Passed as <code class="code">self</code></p>
  750. </td>
  751. </tr>
  752. <tr>
  753. <td class="parameter_name"><p>find</p></td>
  754. <td class="parameter_description">
  755. <p></p>
  756. <p>Passed as <code class="code">find</code></p>
  757. </td>
  758. </tr>
  759. <tr>
  760. <td class="parameter_name"><p>replace</p></td>
  761. <td class="parameter_description">
  762. <p></p>
  763. <p>Passed as <code class="code">replace</code></p>
  764. </td>
  765. </tr>
  766. <tr>
  767. <td class="parameter_name"><p>limit</p></td>
  768. <td class="parameter_description">
  769. <p></p>
  770. <p>Passed as <code class="code">limit</code></p>
  771. </td>
  772. </tr>
  773. </table></div>
  774. </div>
  775. </div>
  776. <div class="refsect2">
  777. <a name="id-1.1.62.3.27"></a><h3>set-size</h3>
  778. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:set-size self len))
  779. </pre></div>
  780. <p>Sets the length of a <span class="type">GString</span>. If the length is less than
  781. the current length, the string will be truncated. If the
  782. length is greater than the current length, the contents
  783. of the newly added area are undefined. (However, as
  784. always, string-&gt;str[string-&gt;len] will be a nul byte.)</p>
  785. <div class="refsect3">
  786. <a name="id-1.1.62.3.27.4"></a><h4>Parameters</h4>
  787. <div class="informaltable"><table>
  788. <tr>
  789. <td class="parameter_name"><p>string</p></td>
  790. <td class="parameter_description">
  791. <p>a <span class="type">GString</span></p>
  792. <p>Passed as <code class="code">self</code></p>
  793. </td>
  794. </tr>
  795. <tr>
  796. <td class="parameter_name"><p>len</p></td>
  797. <td class="parameter_description">
  798. <p>the new length</p>
  799. <p>Passed as <code class="code">len</code></p>
  800. </td>
  801. </tr>
  802. </table></div>
  803. </div>
  804. </div>
  805. <div class="refsect2">
  806. <a name="id-1.1.62.3.28"></a><h3>truncate</h3>
  807. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:truncate self len))
  808. </pre></div>
  809. <p>Cuts off the end of the GString, leaving the first <em class="parameter"><code>len</code></em> bytes.</p>
  810. <div class="refsect3">
  811. <a name="id-1.1.62.3.28.4"></a><h4>Parameters</h4>
  812. <div class="informaltable"><table>
  813. <tr>
  814. <td class="parameter_name"><p>string</p></td>
  815. <td class="parameter_description">
  816. <p>a <span class="type">GString</span></p>
  817. <p>Passed as <code class="code">self</code></p>
  818. </td>
  819. </tr>
  820. <tr>
  821. <td class="parameter_name"><p>len</p></td>
  822. <td class="parameter_description">
  823. <p>the new size of <em class="parameter"><code>string</code></em></p>
  824. <p>Passed as <code class="code">len</code></p>
  825. </td>
  826. </tr>
  827. </table></div>
  828. </div>
  829. </div>
  830. <div class="refsect2">
  831. <a name="id-1.1.62.3.29"></a><h3>up</h3>
  832. <div class="informalexample"><pre class="programlisting">(define-values (%return) (string:up self))
  833. </pre></div>
  834. <p>Converts a <span class="type">GString</span> to uppercase.</p>
  835. <div class="refsect3">
  836. <a name="id-1.1.62.3.29.4"></a><h4>Parameters</h4>
  837. <div class="informaltable"><table><tr>
  838. <td class="parameter_name"><p>string</p></td>
  839. <td class="parameter_description">
  840. <p>a <span class="type">GString</span></p>
  841. <p>Passed as <code class="code">self</code></p>
  842. </td>
  843. </tr></table></div>
  844. </div>
  845. </div>
  846. </div>
  847. </div>
  848. <div class="footer">
  849. <hr>Generated by GTK-Doc V1.33.1</div>
  850. </body>
  851. </html>