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
|
<!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>
<title>Class Poco::TextIterator</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class TextIterator</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Text<br />
<b>Header:</b> Poco/TextIterator.h</p>
<h2>Description</h2>
<div class="description">
<p>An unidirectional iterator for iterating over characters in a string. The <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> uses a <a href="Poco.TextEncoding.html" title="class Poco::TextEncoding">TextEncoding</a> object to work with multi-byte character encodings like UTF-8. Characters are reported in <a href="Poco.Unicode.html" title="class Poco::Unicode">Unicode</a>. </p>
<p>Example: Count the number of UTF-8 characters in a string. </p>
<p></p>
<pre>UTF8Encoding utf8Encoding;
std::string utf8String("....");
TextIterator it(utf8String, utf8Encoding);
TextIterator end(utf8String);
int n = 0;
while (it != end) { ++n; ++it; }
</pre>
<p>NOTE: When an UTF-16 encoding is used, surrogate pairs will be reported as two separate characters, due to restrictions of the <a href="Poco.TextEncoding.html" title="class Poco::TextEncoding">TextEncoding</a> class. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.TextIterator.html#10804" title="Poco::TextIterator::operator !=()">operator !=</a>, <a href="Poco.TextIterator.html#10798" title="Poco::TextIterator::operator *()">operator *</a>, <a href="Poco.TextIterator.html#10799" title="Poco::TextIterator::operator ++()">operator ++</a>, <a href="Poco.TextIterator.html#10794" title="Poco::TextIterator::operator =()">operator =</a>, <a href="Poco.TextIterator.html#10802" title="Poco::TextIterator::operator ==()">operator ==</a>, <a href="Poco.TextIterator.html#10796" title="Poco::TextIterator::swap()">swap</a></p>
<h2>Constructors</h2>
<h3><a name="10779">TextIterator</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>();</p>
<div class="description">
<p>Creates an uninitialized <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>. </p>
</div>
<h3><a name="10787">TextIterator</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>(<br /> const std::string & str<br />);</p>
<div class="description">
<p>Creates an end <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> for the given string. </p>
</div>
<h3><a name="10789">TextIterator</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>(<br /> const std::string::const_iterator & end<br />);</p>
<div class="description">
<p>Creates an end <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>. </p>
</div>
<h3><a name="10792">TextIterator</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>(<br /> const <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> & it<br />);</p>
<div class="description">
<p>Copy constructor. </p>
</div>
<h3><a name="10780">TextIterator</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>(<br /> const std::string & str,<br /> const <a href="Poco.TextEncoding.html" title="class Poco::TextEncoding">TextEncoding</a> & encoding<br />);</p>
<div class="description">
<p>Creates a <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> for the given string. The encoding object must not be deleted as long as the iterator is in use. </p>
</div>
<h3><a name="10783">TextIterator</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>(<br /> const std::string::const_iterator & begin,<br /> const std::string::const_iterator & end,<br /> const <a href="Poco.TextEncoding.html" title="class Poco::TextEncoding">TextEncoding</a> & encoding<br />);</p>
<div class="description">
<p>Creates a <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> for the given range. The encoding object must not be deleted as long as the iterator is in use. </p>
</div>
<h2>Destructor</h2>
<h3><a name="10791">~TextIterator</a></h3>
<p class="decl">~<a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="10804">operator !=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator != (<br /> const <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> & it<br />) const;</p>
<div class="description">
<p>Compares two iterators for inequality. </p>
</div>
<h3><a name="10798">operator *</a></h3>
<p class="decl">int operator * () const;</p>
<div class="description">
<p>Returns the <a href="Poco.Unicode.html" title="class Poco::Unicode">Unicode</a> value of the current character. If there is no valid character at the current position, -1 is returned. </p>
</div>
<h3><a name="10799">operator ++</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> & operator ++ ();</p>
<div class="description">
<p>Prefix increment operator. </p>
</div>
<h3><a name="10800">operator ++</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> operator ++ (<br /> int<br />);</p>
<div class="description">
<p>Postfix increment operator. </p>
</div>
<h3><a name="10794">operator =</a></h3>
<p class="decl"><a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> & operator = (<br /> const <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> & it<br />);</p>
<div class="description">
<p>Assignment operator. </p>
</div>
<h3><a name="10802">operator ==</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool operator == (<br /> const <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> & it<br />) const;</p>
<div class="description">
<p>Compares two iterators for equality. </p>
</div>
<h3><a name="10796">swap</a></h3>
<p class="decl">void swap(<br /> <a href="Poco.TextIterator.html" title="class Poco::TextIterator">TextIterator</a> & it<br />);</p>
<div class="description">
<p>Swaps the iterator with another one. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|