mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-26 21:04:23 +08:00
125 lines
6.8 KiB
HTML
125 lines
6.8 KiB
HTML
<!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.18"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>protobuf-c: ProtobufCBuffer Struct 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>
|
|
<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">protobuf-c
|
|
 <span id="projectnumber">1.3.3</span>
|
|
</div>
|
|
<div id="projectbrief">Protocol Buffers implementation in C</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.18 -->
|
|
</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&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('structProtobufCBuffer.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-attribs">Data Fields</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">ProtobufCBuffer Struct Reference<div class="ingroups"><a class="el" href="group__api.html">Public API</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Structure for defining a virtual append-only buffer.
|
|
<a href="structProtobufCBuffer.html#details">More...</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
|
|
Data Fields</h2></td></tr>
|
|
<tr class="memitem:aeeb00c0f599dc77f07802abde27e1b99"><td class="memItemLeft" align="right" valign="top">void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="structProtobufCBuffer.html#aeeb00c0f599dc77f07802abde27e1b99">append</a> )(<a class="el" href="structProtobufCBuffer.html">ProtobufCBuffer</a> *buffer, size_t len, const uint8_t *data)</td></tr>
|
|
<tr class="memdesc:aeeb00c0f599dc77f07802abde27e1b99"><td class="mdescLeft"> </td><td class="mdescRight">Append function. <a href="structProtobufCBuffer.html#aeeb00c0f599dc77f07802abde27e1b99">More...</a><br /></td></tr>
|
|
<tr class="separator:aeeb00c0f599dc77f07802abde27e1b99"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Structure for defining a virtual append-only buffer. </p>
|
|
<p>Used by <a class="el" href="group__api.html#ga0883bacc5a5b0ba927fdd79204f9ad68" title="Serialise a message from its in-memory representation to a virtual buffer.">protobuf_c_message_pack_to_buffer()</a> to abstract the consumption of serialized bytes.</p>
|
|
<p><code><a class="el" href="structProtobufCBuffer.html" title="Structure for defining a virtual append-only buffer.">ProtobufCBuffer</a></code> "subclasses" may be defined on the stack. For example, to write to a <code>FILE</code> object:</p>
|
|
<div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
|
|
<div class="line"> <a class="code" href="structProtobufCBuffer.html" title="Structure for defining a virtual append-only buffer.">ProtobufCBuffer</a> base;</div>
|
|
<div class="line"> FILE *fp;</div>
|
|
<div class="line">} BufferAppendToFile;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span></div>
|
|
<div class="line">my_buffer_file_append(<a class="code" href="structProtobufCBuffer.html" title="Structure for defining a virtual append-only buffer.">ProtobufCBuffer</a> *buffer,</div>
|
|
<div class="line"> <span class="keywordtype">size_t</span> len,</div>
|
|
<div class="line"> <span class="keyword">const</span> uint8_t *data)</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> BufferAppendToFile *file_buf = (BufferAppendToFile *) buffer;</div>
|
|
<div class="line"> fwrite(data, len, 1, file_buf->fp); <span class="comment">// XXX: No error handling!</span></div>
|
|
<div class="line">}</div>
|
|
</div><!-- fragment --><p>To use this new type of <a class="el" href="structProtobufCBuffer.html" title="Structure for defining a virtual append-only buffer.">ProtobufCBuffer</a>, it could be called as follows:</p>
|
|
<div class="fragment"><div class="line">...</div>
|
|
<div class="line">BufferAppendToFile tmp = {0};</div>
|
|
<div class="line">tmp.base.append = my_buffer_file_append;</div>
|
|
<div class="line">tmp.fp = fp;</div>
|
|
<div class="line"><a class="code" href="group__api.html#ga0883bacc5a5b0ba927fdd79204f9ad68" title="Serialise a message from its in-memory representation to a virtual buffer.">protobuf_c_message_pack_to_buffer</a>(&message, &tmp);</div>
|
|
<div class="line">...</div>
|
|
</div><!-- fragment --> </div><h2 class="groupheader">Field Documentation</h2>
|
|
<a id="aeeb00c0f599dc77f07802abde27e1b99"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aeeb00c0f599dc77f07802abde27e1b99">◆ </a></span>append</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void(* ProtobufCBuffer::append) (<a class="el" href="structProtobufCBuffer.html">ProtobufCBuffer</a> *buffer, size_t len, const uint8_t *data)</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Append function. </p>
|
|
<p>Consumes the <code>len</code> bytes stored at <code>data</code>. </p>
|
|
|
|
</div>
|
|
</div>
|
|
</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="structProtobufCBuffer.html">ProtobufCBuffer</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.18 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|