Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > ed376d6842ea322c25405e7c23b3bc12 > files > 361

libcommoncpp-devel-1.8.0-5.1mdv2010.1.i586.rpm

<!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>GNU CommonC++: ost::StringTokenizer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_string_tokenizer.html">StringTokenizer</a>
  </div>
</div>
<div class="contents">
<h1>ost::StringTokenizer Class Reference</h1><!-- doxytag: class="ost::StringTokenizer" -->
<p>Splits delimited string into tokens.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="tokenizer_8h_source.html">tokenizer.h</a>&gt;</code></p>

<p><a href="classost_1_1_string_tokenizer-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">iterator</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The input forward iterator for tokens.  <a href="classost_1_1_string_tokenizer_1_1iterator.html#_details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer_1_1_no_such_element_exception.html">NoSuchElementException</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="classost_1_1_exception.html" title="Mainline exception handler, this is the root for all Common C++ exceptions and assures...">Exception</a> thrown, if someone tried to read beyond the end of the tokens.  <a href="classost_1_1_string_tokenizer_1_1_no_such_element_exception.html#_details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#a67c853d283920854b98c41fbe4e84d52">StringTokenizer</a> (const char *str, const char *delim, bool skipAllDelim=false, bool trim=false)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">creates a new <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a> for a string and a given set of delimiters.  <a href="#a67c853d283920854b98c41fbe4e84d52"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#ad92ba14c987eee96b10f9fa177b5a4e0">StringTokenizer</a> (const char *s)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">create a new <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a> which splits the input string at whitespaces.  <a href="#ad92ba14c987eee96b10f9fa177b5a4e0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">iterator</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#aec7ea216033f881b2bac13777525e415">begin</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">returns the begin iterator  <a href="#aec7ea216033f881b2bac13777525e415"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#a192f7b20b494671b6f69225b4df3e299">setDelimiters</a> (const char *d)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">changes the set of delimiters used in subsequent iterations.  <a href="#a192f7b20b494671b6f69225b4df3e299"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">iterator</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#af3dfeb0e48c9d2fc9629076da65acd86">begin</a> (const char *d)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">returns a begin iterator with an alternate set of delimiters.  <a href="#af3dfeb0e48c9d2fc9629076da65acd86"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">iterator</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#a74b3471e3e481c0144758385c29cbfbf">end</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">the iterator marking the end.  <a href="#a74b3471e3e481c0144758385c29cbfbf"></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 char *const&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#a4018e923303101ebd6d01cdbca10ce38">SPACE</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">a delimiter string containing all usual whitespace delimiters.  <a href="#a4018e923303101ebd6d01cdbca10ce38"></a><br/></td></tr>
<tr><td colspan="2"><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_string_tokenizer.html#a46c74d7c3ebac303a827a759155b5879">StringTokenizer::iterator</a></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Splits delimited string into tokens. </p>
<p>The <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a> takes a pointer to a string and a pointer to a string containing a number of possible delimiters. The <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a> provides an input forward iterator which allows to iterate through all tokens. An iterator behaves like a logical pointer to the tokens, i.e. to shift to the next token, you've to increment the iterator, you get the token by dereferencing the iterator.</p>
<p>Memory consumption: This class operates on the original string and only allocates memory for the individual tokens actually requested, so this class allocates at maximum the space required for the longest token in the given string. Since for each iteration, memory is reclaimed for the last token, you MAY NOT store pointers to them; if you need them afterwards, copy them. You may not modify the original string while you operate on it with the <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a>; the behaviour is undefined in that case.</p>
<p>The iterator has one special method 'nextDelimiter()' which returns a character containing the next delimiter following this tokenization process or '\0', if there are no following delimiters. In case of skipAllDelim, it returns the FIRST delimiter.</p>
<p>With the method 'setDelimiters(const char*)' you may change the set of delimiters. It affects all running iterators.</p>
<p>Example: <code></p>
<pre>
  <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a> st("mary had a little lamb;its fleece was..", " ;");
  <a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html" title="The input forward iterator for tokens.">StringTokenizer::iterator</a> i;
  for (i = st.begin() ; i != st.end() ; ++i) {
        cout &lt;&lt; "Token: '" &lt;&lt; *i &lt;&lt; "'\t";
        cout &lt;&lt; " next Delim: '" &lt;&lt; i.nextDelimiter() &lt;&lt; "'" &lt;&lt; endl;
  }
  </pre><p></code></p>
<dl class="author"><dt><b>Author:</b></dt><dd>Henner Zeller &lt;<a href="mailto:H.Zeller@acm.org">H.Zeller@acm.org</a>&gt; </dd></dl>
<dl class="user"><dt><b>License:</b></dt><dd>LGPL </dd></dl>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a67c853d283920854b98c41fbe4e84d52"></a><!-- doxytag: member="ost::StringTokenizer::StringTokenizer" ref="a67c853d283920854b98c41fbe4e84d52" args="(const char *str, const char *delim, bool skipAllDelim=false, bool trim=false)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ost::StringTokenizer::StringTokenizer </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>delim</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>skipAllDelim</em> = <code>false</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>trim</em> = <code>false</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>creates a new <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a> for a string and a given set of delimiters. </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>&nbsp;</td><td><a class="el" href="classost_1_1_string.html" title="This is a generic and portable string class.">String</a> to be split up. This string will not be modified by this <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a>, but you may as well not modfiy this string while tokenizing is in process, which may lead to undefined behaviour.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>delim</em>&nbsp;</td><td><a class="el" href="classost_1_1_string.html" title="This is a generic and portable string class.">String</a> containing the characters which should be regarded as delimiters.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>skipAllDelim</em>&nbsp;</td><td>OPTIONAL. true, if subsequent delimiters should be skipped at once or false, if empty tokens should be returned for two delimiters with no other text inbetween. The first behaviour may be desirable for whitespace skipping, the second for input with delimited entry e.g. /etc/passwd like files or CSV input. NOTE, that 'true' here resembles the ANSI-C strtok(char *s,char *d) behaviour. DEFAULT = false</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>trim</em>&nbsp;</td><td>OPTIONAL. true, if the tokens returned should be trimmed, so that they don't have any whitespaces at the beginning or end. Whitespaces are any of the characters defined in <a class="el" href="classost_1_1_string_tokenizer.html#a4018e923303101ebd6d01cdbca10ce38" title="a delimiter string containing all usual whitespace delimiters.">StringTokenizer::SPACE</a>. If delim itself is <a class="el" href="classost_1_1_string_tokenizer.html#a4018e923303101ebd6d01cdbca10ce38" title="a delimiter string containing all usual whitespace delimiters.">StringTokenizer::SPACE</a>, this will result in a behaviour with skipAllDelim = true. DEFAULT = false </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ad92ba14c987eee96b10f9fa177b5a4e0"></a><!-- doxytag: member="ost::StringTokenizer::StringTokenizer" ref="ad92ba14c987eee96b10f9fa177b5a4e0" args="(const char *s)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ost::StringTokenizer::StringTokenizer </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>s</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>create a new <a class="el" href="classost_1_1_string_tokenizer.html" title="Splits delimited string into tokens.">StringTokenizer</a> which splits the input string at whitespaces. </p>
<p>The tokens are stripped from whitespaces. This means, if you change the set of delimiters in either the 'begin(const char *delim)' method or in 'setDelimiters()', you then get whitespace trimmed tokens, delimited by the new set. Behaves like StringTokenizer(s, StringTokenizer::SPACE,false,true); </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="af3dfeb0e48c9d2fc9629076da65acd86"></a><!-- doxytag: member="ost::StringTokenizer::begin" ref="af3dfeb0e48c9d2fc9629076da65acd86" args="(const char *d)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">iterator</a> ost::StringTokenizer::begin </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>d</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>returns a begin iterator with an alternate set of delimiters. </p>

</div>
</div>
<a class="anchor" id="aec7ea216033f881b2bac13777525e415"></a><!-- doxytag: member="ost::StringTokenizer::begin" ref="aec7ea216033f881b2bac13777525e415" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">iterator</a> ost::StringTokenizer::begin </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>returns the begin iterator </p>

</div>
</div>
<a class="anchor" id="a74b3471e3e481c0144758385c29cbfbf"></a><!-- doxytag: member="ost::StringTokenizer::end" ref="a74b3471e3e481c0144758385c29cbfbf" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">iterator</a>&amp; ost::StringTokenizer::end </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>the iterator marking the end. </p>

</div>
</div>
<a class="anchor" id="a192f7b20b494671b6f69225b4df3e299"></a><!-- doxytag: member="ost::StringTokenizer::setDelimiters" ref="a192f7b20b494671b6f69225b4df3e299" args="(const char *d)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::StringTokenizer::setDelimiters </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>d</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>changes the set of delimiters used in subsequent iterations. </p>

</div>
</div>
<hr/><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="a46c74d7c3ebac303a827a759155b5879"></a><!-- doxytag: member="ost::StringTokenizer::StringTokenizer::iterator" ref="a46c74d7c3ebac303a827a759155b5879" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classost_1_1_string_tokenizer_1_1iterator.html">StringTokenizer::iterator</a><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a4018e923303101ebd6d01cdbca10ce38"></a><!-- doxytag: member="ost::StringTokenizer::SPACE" ref="a4018e923303101ebd6d01cdbca10ce38" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* const <a class="el" href="classost_1_1_string_tokenizer.html#a4018e923303101ebd6d01cdbca10ce38">ost::StringTokenizer::SPACE</a><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>a delimiter string containing all usual whitespace delimiters. </p>
<p>These are space, tab, newline, carriage return, formfeed and vertical tab. (see isspace() manpage). </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tokenizer_8h_source.html">tokenizer.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Nov 12 09:55:48 2010 for GNU CommonC++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>