summaryrefslogtreecommitdiff
path: root/classpw__utils.html
blob: 5c3318f807438a5d4c584f02d86e9f392792fd79 (plain)
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PipeWire: pw_utils 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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">PipeWire
   &#160;<span id="projectnumber">0.2.9</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classpw__utils.html','');});
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">pw_utils Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Various utility functions.  
 <a href="classpw__utils.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a40eebfe720dbba23dbc86347dd95ba0b"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpw__utils.html#a40eebfe720dbba23dbc86347dd95ba0b">pw_destroy_t</a>) (void *object)</td></tr>
<tr class="memdesc:a40eebfe720dbba23dbc86347dd95ba0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">a function to destroy an item  <a href="#a40eebfe720dbba23dbc86347dd95ba0b">More...</a><br /></td></tr>
<tr class="separator:a40eebfe720dbba23dbc86347dd95ba0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><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:a3dae48f70b92a377a5ba0bd1060382ce"><td class="memItemLeft" align="right" valign="top">SPA_EXPORT const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpw__utils.html#a3dae48f70b92a377a5ba0bd1060382ce">pw_split_walk</a> (const char *str, const char *delimiter, size_t *len, const char **state)</td></tr>
<tr class="memdesc:a3dae48f70b92a377a5ba0bd1060382ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">Split a string based on delimiters.  <a href="#a3dae48f70b92a377a5ba0bd1060382ce">More...</a><br /></td></tr>
<tr class="separator:a3dae48f70b92a377a5ba0bd1060382ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a49b83deb0d19e23830facddb1e03bae1"><td class="memItemLeft" align="right" valign="top">SPA_EXPORT char **&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpw__utils.html#a49b83deb0d19e23830facddb1e03bae1">pw_split_strv</a> (const char *str, const char *delimiter, int max_tokens, int *n_tokens)</td></tr>
<tr class="memdesc:a49b83deb0d19e23830facddb1e03bae1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Split a string based on delimiters.  <a href="#a49b83deb0d19e23830facddb1e03bae1">More...</a><br /></td></tr>
<tr class="separator:a49b83deb0d19e23830facddb1e03bae1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adfbe5fb619ea56867116d16fa27c2076"><td class="memItemLeft" align="right" valign="top">SPA_EXPORT void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpw__utils.html#adfbe5fb619ea56867116d16fa27c2076">pw_free_strv</a> (char **str)</td></tr>
<tr class="memdesc:adfbe5fb619ea56867116d16fa27c2076"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free a NULL terminated array of strings.  <a href="#adfbe5fb619ea56867116d16fa27c2076">More...</a><br /></td></tr>
<tr class="separator:adfbe5fb619ea56867116d16fa27c2076"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac50c6fcfe11d26670d97203e84892f69"><td class="memItemLeft" align="right" valign="top">SPA_EXPORT char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpw__utils.html#ac50c6fcfe11d26670d97203e84892f69">pw_strip</a> (char *str, const char *whitespace)</td></tr>
<tr class="memdesc:ac50c6fcfe11d26670d97203e84892f69"><td class="mdescLeft">&#160;</td><td class="mdescRight">Strip all whitespace before and after a string.  <a href="#ac50c6fcfe11d26670d97203e84892f69">More...</a><br /></td></tr>
<tr class="separator:ac50c6fcfe11d26670d97203e84892f69"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Various utility functions. </p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a id="a40eebfe720dbba23dbc86347dd95ba0b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a40eebfe720dbba23dbc86347dd95ba0b">&#9670;&nbsp;</a></span>pw_destroy_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* pw_destroy_t) (void *object)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>a function to destroy an item </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="adfbe5fb619ea56867116d16fa27c2076"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adfbe5fb619ea56867116d16fa27c2076">&#9670;&nbsp;</a></span>pw_free_strv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPA_EXPORT void pw_free_strv </td>
          <td>(</td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Free a NULL terminated array of strings. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>a NULL terminated array of string</td></tr>
  </table>
  </dd>
</dl>
<p>Free all the strings in the array and the array </p>

</div>
</div>
<a id="a49b83deb0d19e23830facddb1e03bae1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a49b83deb0d19e23830facddb1e03bae1">&#9670;&nbsp;</a></span>pw_split_strv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPA_EXPORT char ** pw_split_strv </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>delimiter</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_tokens</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>n_tokens</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Split a string based on delimiters. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">str</td><td>a string to split </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">delimiter</td><td>delimiter characters to split on </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">max_tokens</td><td>the max number of tokens to split </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">n_tokens</td><td>the number of tokens </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a NULL terminated array of strings that should be freed with <a class="el" href="classpw__utils.html#adfbe5fb619ea56867116d16fa27c2076">pw_free_strv</a>. </dd></dl>

<p class="reference">References <a class="el" href="structpw__array.html#ab0929cdf2f7acb291f2f17be299b8ea5">pw_array::data</a>, <a class="el" href="structpw__array.html#a8d035221a3657cf9d2ede737a62a7c77">pw_array::pw_array_add_ptr</a>, <a class="el" href="structpw__array.html#a41905dd179bcee03cceef47579e0a22e">pw_array::pw_array_init()</a>, and <a class="el" href="classpw__utils.html#a3dae48f70b92a377a5ba0bd1060382ce">pw_split_walk()</a>.</p>

<p class="reference">Referenced by <a class="el" href="classpw__module.html#a6162cea8c99d7ac59d4479e3204bb0d4">pw_module::pw_module_load()</a>.</p>

</div>
</div>
<a id="a3dae48f70b92a377a5ba0bd1060382ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3dae48f70b92a377a5ba0bd1060382ce">&#9670;&nbsp;</a></span>pw_split_walk()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPA_EXPORT const char * pw_split_walk </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>delimiter</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char **&#160;</td>
          <td class="paramname"><em>state</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Split a string based on delimiters. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">str</td><td>a string to split </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">delimiter</td><td>delimiter characters to split on </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">len</td><td>the length of the current string </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">state</td><td>a state variable </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a string or NULL when the end is reached</dd></dl>
<p>Repeatedly call this function to split <em>str</em> into all substrings delimited by <em>delimiter</em>. <em>state</em> should be set to NULL on the first invocation and passed to the function until NULL is returned. </p>

<p class="reference">Referenced by <a class="el" href="classpw__utils.html#a49b83deb0d19e23830facddb1e03bae1">pw_split_strv()</a>.</p>

</div>
</div>
<a id="ac50c6fcfe11d26670d97203e84892f69"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac50c6fcfe11d26670d97203e84892f69">&#9670;&nbsp;</a></span>pw_strip()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPA_EXPORT char * pw_strip </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>whitespace</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Strip all whitespace before and after a string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>a string to strip </td></tr>
    <tr><td class="paramname">whitespace</td><td>characters to strip </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the stripped part of <em>str</em> </dd></dl>
<p>Strip whitespace before and after <em>str</em>. <em>str</em> will be modified. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="utils_8h_source.html">utils.h</a></li>
<li><a class="el" href="utils_8c.html">utils.c</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classpw__utils.html">pw_utils</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
  </ul>
</div>
</body>
</html>