<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!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"/> <title>ICU 4.4.1: StringPiece Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.6.2-20100208 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul> <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>Modules</span></a></li> <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="classes.html"><span>Data Structure Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Data Fields</span></a></li> </ul> </div> </div> <div class="contents"> <h1>StringPiece Class Reference</h1><!-- doxytag: class="StringPiece" --><!-- doxytag: inherits="UMemory" --> <p>A string-like object that points to a sized piece of memory. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>></code></p> <div class="dynheader"> Inheritance diagram for StringPiece:</div> <div class="dynsection"> <div class="center"> <img src="classStringPiece.png" usemap="#StringPiece_map" alt=""/> <map id="StringPiece_map" name="StringPiece_map"> <area href="classUMemory.html" alt="UMemory" shape="rect" coords="0,0,77,24"/> </map> </div> </div> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a0f45b54fa594663333d1ac3c8d7c8997">StringPiece</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor, creates an empty <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. <a href="#a0f45b54fa594663333d1ac3c8d7c8997"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a1f2ea703262cb6af2948bafb29b7325e">StringPiece</a> (const char *str)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Constructs from a NUL-terminated const char * pointer. <a href="#a1f2ea703262cb6af2948bafb29b7325e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a698a3300cd837fbf68746ffc0c1ef3f3">StringPiece</a> (const U_STD_NSQ string &str)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Constructs from a std::string. <a href="#a698a3300cd837fbf68746ffc0c1ef3f3"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a1ebd684e27ba92ffdc17e9870355c56c">StringPiece</a> (const char *offset, int32_t len)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Constructs from a const char * pointer and a specified length. <a href="#a1ebd684e27ba92ffdc17e9870355c56c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a6066a9bef281ff60b010610c15f71597">StringPiece</a> (const <a class="el" href="classStringPiece.html">StringPiece</a> &x, int32_t pos)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Substring of another <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. <a href="#a6066a9bef281ff60b010610c15f71597"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a4d6d3a0ad4cee017317272cd3a515174">StringPiece</a> (const <a class="el" href="classStringPiece.html">StringPiece</a> &x, int32_t pos, int32_t len)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Substring of another <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. <a href="#a4d6d3a0ad4cee017317272cd3a515174"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a8c0f2264485f90b1d60aab587cab352f">data</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the string pointer. <a href="#a8c0f2264485f90b1d60aab587cab352f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a31645a6f83a6e338936007135d8f8a4d">size</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the string length. <a href="#a31645a6f83a6e338936007135d8f8a4d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a56e2e8113c07d379a3deaaeed05dca60">length</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the string length. <a href="#a56e2e8113c07d379a3deaaeed05dca60"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a4789a54e17fc082bdbbb615a67a19120">empty</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether the string is empty. <a href="#a4789a54e17fc082bdbbb615a67a19120"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#aba33c86f6353d50835ee4627a7b70326">clear</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Sets to an empty string. <a href="#aba33c86f6353d50835ee4627a7b70326"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#abe0d6966ad467ae5fa675e3ecb16be77">set</a> (const char *data, int32_t len)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Reset the stringpiece to refer to new data. <a href="#abe0d6966ad467ae5fa675e3ecb16be77"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a3507b0b94d609529a659f35ca928b60b">set</a> (const char *str)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Reset the stringpiece to refer to new data. <a href="#a3507b0b94d609529a659f35ca928b60b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a52b2f79cab62b8bc75e204dcc896baae">remove_prefix</a> (int32_t n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Removes the first n string units. <a href="#a52b2f79cab62b8bc75e204dcc896baae"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#ad1ed9b146e3ba745f3b91debff9511ac">remove_suffix</a> (int32_t n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Removes the last n string units. <a href="#ad1ed9b146e3ba745f3b91debff9511ac"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classStringPiece.html">StringPiece</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#aad0e95f16e143ccfa69afbb33a9cf702">substr</a> (int32_t pos, int32_t len=<a class="el" href="classStringPiece.html#a640079800d8239870fa07c84b7c5895b">npos</a>) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a substring of this <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. <a href="#aad0e95f16e143ccfa69afbb33a9cf702"></a><br/></td></tr> <tr><td colspan="2"><h2>Static Public Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static const int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classStringPiece.html#a640079800d8239870fa07c84b7c5895b">npos</a> = 0x7fffffff</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Maximum integer, used as a default value for substring methods. <a href="#a640079800d8239870fa07c84b7c5895b"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>A string-like object that points to a sized piece of memory. </p> <p>We provide non-explicit singleton constructors so users can pass in a "const char*" or a "string" wherever a "StringPiece" is expected.</p> <p>Functions or methods may use const <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>& parameters to accept either a "const char*" or a "string" value that will be implicitly converted to a <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>.</p> <p>Systematic usage of <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a> is encouraged as it will reduce unnecessary conversions from "const char*" to "string" and back again.</p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000370">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00052">52</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a0f45b54fa594663333d1ac3c8d7c8997"></a><!-- doxytag: member="StringPiece::StringPiece" ref="a0f45b54fa594663333d1ac3c8d7c8997" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">StringPiece::StringPiece </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Default constructor, creates an empty <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000371">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00062">62</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a1f2ea703262cb6af2948bafb29b7325e"></a><!-- doxytag: member="StringPiece::StringPiece" ref="a1f2ea703262cb6af2948bafb29b7325e" args="(const char *str)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">StringPiece::StringPiece </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>str</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Constructs from a NUL-terminated const char * pointer. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>a NUL-terminated const char * pointer </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000372">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="a698a3300cd837fbf68746ffc0c1ef3f3"></a><!-- doxytag: member="StringPiece::StringPiece" ref="a698a3300cd837fbf68746ffc0c1ef3f3" args="(const U_STD_NSQ string &str)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">StringPiece::StringPiece </td> <td>(</td> <td class="paramtype">const U_STD_NSQ string & </td> <td class="paramname"> <em>str</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Constructs from a std::string. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000373">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00074">74</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a1ebd684e27ba92ffdc17e9870355c56c"></a><!-- doxytag: member="StringPiece::StringPiece" ref="a1ebd684e27ba92ffdc17e9870355c56c" args="(const char *offset, int32_t len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">StringPiece::StringPiece </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>offset</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Constructs from a const char * pointer and a specified length. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>offset</em> </td><td>a const char * pointer (need not be terminated) </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>the length of the string; must be non-negative </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000374">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00083">83</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a6066a9bef281ff60b010610c15f71597"></a><!-- doxytag: member="StringPiece::StringPiece" ref="a6066a9bef281ff60b010610c15f71597" args="(const StringPiece &x, int32_t pos)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">StringPiece::StringPiece </td> <td>(</td> <td class="paramtype">const <a class="el" href="classStringPiece.html">StringPiece</a> & </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>pos</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Substring of another <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>x</em> </td><td>the other <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a> </td></tr> <tr><td valign="top"></td><td valign="top"><em>pos</em> </td><td>start position in x; must be non-negative and <= x.length(). </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000375">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <a class="anchor" id="a4d6d3a0ad4cee017317272cd3a515174"></a><!-- doxytag: member="StringPiece::StringPiece" ref="a4d6d3a0ad4cee017317272cd3a515174" args="(const StringPiece &x, int32_t pos, int32_t len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">StringPiece::StringPiece </td> <td>(</td> <td class="paramtype">const <a class="el" href="classStringPiece.html">StringPiece</a> & </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>pos</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Substring of another <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>x</em> </td><td>the other <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a> </td></tr> <tr><td valign="top"></td><td valign="top"><em>pos</em> </td><td>start position in x; must be non-negative and <= x.length(). </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length of the substring; must be non-negative and will be pinned to at most x.length() - pos. </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000376">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="aba33c86f6353d50835ee4627a7b70326"></a><!-- doxytag: member="StringPiece::clear" ref="aba33c86f6353d50835ee4627a7b70326" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void StringPiece::clear </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Sets to an empty string. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000381">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00135">135</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> <p>References <a class="el" href="utypes_8h_source.html#l00292">NULL</a>.</p> </div> </div> <a class="anchor" id="a8c0f2264485f90b1d60aab587cab352f"></a><!-- doxytag: member="StringPiece::data" ref="a8c0f2264485f90b1d60aab587cab352f" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* StringPiece::data </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the string pointer. </p> <p>May be NULL if it is empty.</p> <p><a class="el" href="classStringPiece.html#a8c0f2264485f90b1d60aab587cab352f" title="Returns the string pointer.">data()</a> may return a pointer to a buffer with embedded NULs, and the returned buffer may or may not be null terminated. Therefore it is typically a mistake to pass <a class="el" href="classStringPiece.html#a8c0f2264485f90b1d60aab587cab352f" title="Returns the string pointer.">data()</a> to a routine that expects a NUL terminated string. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>the string pointer </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000377">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00111">111</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a4789a54e17fc082bdbbb615a67a19120"></a><!-- doxytag: member="StringPiece::empty" ref="a4789a54e17fc082bdbbb615a67a19120" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> StringPiece::empty </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns whether the string is empty. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>TRUE if the string is empty </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000380">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00129">129</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a56e2e8113c07d379a3deaaeed05dca60"></a><!-- doxytag: member="StringPiece::length" ref="a56e2e8113c07d379a3deaaeed05dca60" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int32_t StringPiece::length </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the string length. </p> <p>Same as <a class="el" href="classStringPiece.html#a31645a6f83a6e338936007135d8f8a4d" title="Returns the string length.">size()</a>. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>the string length </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000379">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00123">123</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a52b2f79cab62b8bc75e204dcc896baae"></a><!-- doxytag: member="StringPiece::remove_prefix" ref="a52b2f79cab62b8bc75e204dcc896baae" args="(int32_t n)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void StringPiece::remove_prefix </td> <td>(</td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>n</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Removes the first n string units. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>n</em> </td><td>prefix length, must be non-negative and <=length() </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000382">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00157">157</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="ad1ed9b146e3ba745f3b91debff9511ac"></a><!-- doxytag: member="StringPiece::remove_suffix" ref="ad1ed9b146e3ba745f3b91debff9511ac" args="(int32_t n)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void StringPiece::remove_suffix </td> <td>(</td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>n</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Removes the last n string units. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>n</em> </td><td>suffix length, must be non-negative and <=length() </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000383">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00172">172</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a3507b0b94d609529a659f35ca928b60b"></a><!-- doxytag: member="StringPiece::set" ref="a3507b0b94d609529a659f35ca928b60b" args="(const char *str)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void StringPiece::set </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>str</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Reset the stringpiece to refer to new data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>a pointer to a NUL-terminated string. </td></tr> </table> </dd> </dl> <dl class="internal"><dt><b><a class="el" href="internal.html#_internal000085">Internal:</a></b></dt><dd>Do not use. This API is for internal use only. </dd></dl> </div> </div> <a class="anchor" id="abe0d6966ad467ae5fa675e3ecb16be77"></a><!-- doxytag: member="StringPiece::set" ref="abe0d6966ad467ae5fa675e3ecb16be77" args="(const char *data, int32_t len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void StringPiece::set </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Reset the stringpiece to refer to new data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>pointer the new string data. Need not be nul terminated. </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>the length of the new data </td></tr> </table> </dd> </dl> <dl class="internal"><dt><b><a class="el" href="internal.html#_internal000084">Internal:</a></b></dt><dd>Do not use. This API is for internal use only. </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00143">143</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="a31645a6f83a6e338936007135d8f8a4d"></a><!-- doxytag: member="StringPiece::size" ref="a31645a6f83a6e338936007135d8f8a4d" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int32_t StringPiece::size </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the string length. </p> <p>Same as <a class="el" href="classStringPiece.html#a56e2e8113c07d379a3deaaeed05dca60" title="Returns the string length.">length()</a>. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>the string length </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000378">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00117">117</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <a class="anchor" id="aad0e95f16e143ccfa69afbb33a9cf702"></a><!-- doxytag: member="StringPiece::substr" ref="aad0e95f16e143ccfa69afbb33a9cf702" args="(int32_t pos, int32_t len=npos) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classStringPiece.html">StringPiece</a> StringPiece::substr </td> <td>(</td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>pos</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>len</em> = <code><a class="el" href="classStringPiece.html#a640079800d8239870fa07c84b7c5895b">npos</a></code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a substring of this <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a>. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pos</em> </td><td>start position; must be non-negative and <= <a class="el" href="classStringPiece.html#a56e2e8113c07d379a3deaaeed05dca60" title="Returns the string length.">length()</a>. </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>length of the substring; must be non-negative and will be pinned to at most <a class="el" href="classStringPiece.html#a56e2e8113c07d379a3deaaeed05dca60" title="Returns the string length.">length()</a> - pos. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the substring <a class="el" href="classStringPiece.html" title="A string-like object that points to a sized piece of memory.">StringPiece</a> </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000385">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00196">196</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <hr/><h2>Field Documentation</h2> <a class="anchor" id="a640079800d8239870fa07c84b7c5895b"></a><!-- doxytag: member="StringPiece::npos" ref="a640079800d8239870fa07c84b7c5895b" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const int32_t <a class="el" href="classStringPiece.html#a640079800d8239870fa07c84b7c5895b">StringPiece::npos</a> = 0x7fffffff<code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Maximum integer, used as a default value for substring methods. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000384">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="stringpiece_8h_source.html#l00186">186</a> of file <a class="el" href="stringpiece_8h_source.html">stringpiece.h</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="stringpiece_8h_source.html">stringpiece.h</a></li> </ul> </div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Defines</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>