Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 98d6b53e11e983e268c3e19f14e091a0 > files > 4571

kdepim-devel-doc-3.5.9-9mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!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" lang="en_US" xml:lang="en_US">

<head>
  <title>libkmime: KMime::Decoder Class Reference (libkmime)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta http-equiv="Content-Style-Type" content="text/css" />

  <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org"  r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org"  r (n 0 s 0 v 0 l 0))' />

  <meta name="trademark" content="KDE e.V." />
  <meta name="description" content="K Desktop Environment Homepage, KDE.org" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <meta name="robots" content="all" />

  <link rel="shortcut icon" href="../../favicon.ico" />

<link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" />



<style type="text/css">
<!--
hr { display: none; }
#content h2 { margin-left: 0px; }
table.mdTable { background-color: #f8f8f8; border: .2em solid #d7d7d7; }
td.mdRow { padding: 8px 20px; }
td.md { font-weight: bold; }
td.mdname1 { font-weight: bold; color: #602020; }
td.mdname { font-weight: bold; color: #602020;  }

-->
</style>

</head>

<body>

<div id="nav_header_top" align="right">
  <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a>

  <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a>
  <span class="doNotDisplay">::</span>
  <img id="nav_header_logo_right" alt="" align="right" src="../../pimlogo.png" border="0" />

  <div id="nav_header_title" align="left">KDE PIM API Reference</div>


</div>

<div id="nav_header_bottom" align="right">
  <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span>
  <div id="nav_header_bottom_left" style="text-align: left;">
/ <a href="../../">API Reference</a>
 / <a href=".">libkmime</a>
  </div>
</div>


<table id="main" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
      <td valign="top" class="menuheader" height="0"></td>

  <td id="contentcolumn" valign="top" rowspan="2" >
    <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;">
    <h2><a name="content"></a>libkmime</h2>


<!-- Generated by Doxygen 1.5.5 -->
  <div class="navpath"><b>KMime</b>::<a class="el" href="classKMime_1_1Decoder.html">Decoder</a>
  </div>
<div class="contents">
<h1>KMime::Decoder Class Reference</h1><!-- doxytag: class="KMime::Decoder" --><code>#include &lt;<a class="el" href="kmime__codecs_8h-source.html">kmime_codecs.h</a>&gt;</code>
<p>
Inherited by KMime::Base64Decoder, KMime::IdentityEnDecoder, KMime::QuotedPrintableDecoder, and KMime::UUDecoder.
<p>

<p>
<a href="classKMime_1_1Decoder-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
Stateful decoder class, modelled after QTextDecoder. 
<p>
<h2><a class="anchor" name="Overview">
Overview</a></h2>
KMime decoders are designed to be able to process encoded data in chunks of arbitrary size and to work with output buffers of also arbitrary size. They maintain any state necessary to go on where the previous call left off.<p>
The class consists of only two methods of interest: see decode, which decodes an input block and finalize, which flushes any remaining data to the output stream.<p>
Typically, you will create a decoder instance, call decode as often as necessary, then call finalize (most often a single call suffices, but it might be that during that call the output buffer is filled, so you should be prepared to call finalize as often as necessary, ie. until it returns <code>true</code>).<h2><a class="anchor" name="Return">
Values</a></h2>
Both methods return <code>true</code> to indicate that they've finished their job. For decode, a return value of <code>true</code> means that the current input block has been finished (<code>false</code> most often means that the output buffer is full, but that isn't required behavior. The decode call is free to return at arbitrary times during processing).<p>
For finalize, a return value of <code>true</code> means that all data implicitly or explicitly stored in the decoder instance has been flushed to the output buffer. A <code>false</code> return value should be interpreted as "check if the output buffer is full and call me again", just as with decode.<h2><a class="anchor" name="Usage">
Pattern</a></h2>
Since the decoder maintains state, you can only use it once. After a sequence of input blocks has been processed, you finalize the output and then delete the decoder instance. If you want to process another input block sequence, you create a new instance.<p>
Typical usage (<code>in</code> contains the (base64-encoded) input data), taking into account all the conventions detailed above:<p>
<pre>
 <a class="el" href="classKMime_1_1Codec.html" title="Abstract base class of codecs like base64 and quoted-printable.">KMime::Codec</a> * codec = KMime::Codec::codecForName( "base64" );
 kdFatal( !codec ) &lt;&lt; "No codec found for base64!" &lt;&lt; endl;
 <a class="el" href="classKMime_1_1Decoder.html" title="Stateful decoder class, modelled after QTextDecoder.">KMime::Decoder</a> * dec = codec-&gt;makeDecoder();
 assert( dec ); // should not happen
 QByteArray out( 256 ); // small buffer is enough ;-)
 QByteArray::Iterator iit = in.begin();
 QByteArray::Iterator oit = out.begin();
 // decode the chunk
 while ( !dec-&gt;decode( iit, in.end(), oit, out.end() ) )
   if ( oit == out.end() ) { // output buffer full, process contents
     do_something_with( out );
     oit = out.begin();
   }
 // repeat while loop for each input block
 // ...
 // finish (flush remaining data from decoder):
 while ( !dec-&gt;finish( oit, out.end() ) )
   if ( oit == out.end() ) { // output buffer full, process contents
     do_something_with( out );
     oit = out.begin();
   }
 // now process last chunk:
 out.resize( oit - out.begin() );
 do_something_with( out );
 // _delete_ the decoder, but not the codec:
 delete dec;
 </pre><p>
Stateful CTE decoder class <dl class="author" compact><dt><b>Author:</b></dt><dd>Marc Mutz &lt;<a href="mailto:mutz@kde.org">mutz@kde.org</a>&gt; </dd></dl>

<p>Definition at line <a class="el" href="kmime__codecs_8h-source.html#l00268">268</a> of file <a class="el" href="kmime__codecs_8h-source.html">kmime_codecs.h</a>.</p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKMime_1_1Decoder.html#1991c45377e59be92f31284e473e3514">decode</a> (const char *&amp;scursor, const char *const send, char *&amp;dcursor, const char *const dend)=0</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKMime_1_1Decoder.html#b6cdf12608bb645002e72209507cf7d5">finish</a> (char *&amp;dcursor, const char *const dend)=0</td></tr>

<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classKMime_1_1Decoder.html#f4ee1d10c38a201fc62fc57029047e53">Decoder</a> (bool withCRLF=false)</td></tr>

<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="22557150653526ff8960982d3aac9f1b"></a><!-- doxytag: member="KMime::Decoder::mWithCRLF" ref="22557150653526ff8960982d3aac9f1b" args="" -->
const bool&nbsp;</td><td class="memItemRight" valign="bottom"><b>mWithCRLF</b></td></tr>

<tr><td colspan="2"><br><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="5f161bb3dfc2a04eeac3d219c2f80ddd"></a><!-- doxytag: member="KMime::Decoder::Codec" ref="5f161bb3dfc2a04eeac3d219c2f80ddd" args="" -->
class&nbsp;</td><td class="memItemRight" valign="bottom"><b>Codec</b></td></tr>

</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="f4ee1d10c38a201fc62fc57029047e53"></a><!-- doxytag: member="KMime::Decoder::Decoder" ref="f4ee1d10c38a201fc62fc57029047e53" args="(bool withCRLF=false)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">KMime::Decoder::Decoder           </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>withCRLF</em> = <code>false</code>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline, protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Protected constructor. 
<p>
Use KMime::Codec::makeDecoder to create an instance. The bool parameter determines whether lines end with CRLF (true) or LF (false, default). 
<p>Definition at line <a class="el" href="kmime__codecs_8h-source.html#l00276">276</a> of file <a class="el" href="kmime__codecs_8h-source.html">kmime_codecs.h</a>.</p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="1991c45377e59be92f31284e473e3514"></a><!-- doxytag: member="KMime::Decoder::decode" ref="1991c45377e59be92f31284e473e3514" args="(const char *&amp;scursor, const char *const send, char *&amp;dcursor, const char *const dend)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool KMime::Decoder::decode           </td>
          <td>(</td>
          <td class="paramtype">const char *&amp;&nbsp;</td>
          <td class="paramname"> <em>scursor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *const &nbsp;</td>
          <td class="paramname"> <em>send</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&amp;&nbsp;</td>
          <td class="paramname"> <em>dcursor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *const &nbsp;</td>
          <td class="paramname"> <em>dend</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Decode a chunk of data, maintaining state information between calls. 
<p>
See class decumentation for calling conventions. 
</div>
</div><p>
<a class="anchor" name="b6cdf12608bb645002e72209507cf7d5"></a><!-- doxytag: member="KMime::Decoder::finish" ref="b6cdf12608bb645002e72209507cf7d5" args="(char *&amp;dcursor, const char *const dend)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool KMime::Decoder::finish           </td>
          <td>(</td>
          <td class="paramtype">char *&amp;&nbsp;</td>
          <td class="paramname"> <em>dcursor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *const &nbsp;</td>
          <td class="paramname"> <em>dend</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Call this method to finalize the output stream. 
<p>
Writes all remaining data and resets the decoder. See <a class="el" href="classKMime_1_1Codec.html" title="Abstract base class of codecs like base64 and quoted-printable.">KMime::Codec</a> for calling conventions. 
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="kmime__codecs_8h-source.html">kmime_codecs.h</a></ul>
</div>
    </div></div>


      </td>
  </tr>
  <tr>
    <td valign="top" id="leftmenu" width="25%">
      <a name="navigation"></a>
      <div class="menu_box"><h2>libkmime</h2>
<div class="nav_list">
<ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li></ul>
<!--
<h2>Class Picker</h2>
<div style="text-align: center;">
<form name="guideform">
<select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value">
<option value="annotated.html">-- Choose --</option>
  <option value="classAddressField.html">addressfield</option>,  <option value="classBCC.html">bcc</option>,  <option value="classBoolFlags.html">boolflags</option>,  <option value="classCC.html">cc</option>,  <option value="classCDescription.html">cdescription</option>,  <option value="classCDisposition.html">cdisposition</option>,  <option value="classContentType.html">contenttype</option>,  <option value="classCTEncoding.html">ctencoding</option>,  <option value="classFrom.html">from</option>,  <option value="classKMime_1_1Base.html">kmime::base</option>,  <option value="classKMime_1_1Codec.html">kmime::codec</option>,  <option value="classKMime_1_1Content.html">kmime::content</option>,  <option value="classKMime_1_1DateFormatter.html">kmime::dateformatter</option>,  <option value="classKMime_1_1Decoder.html">kmime::decoder</option>,  <option value="classKMime_1_1Encoder.html">kmime::encoder</option>,  <option value="classKMime_1_1Headers_1_1AddressField.html">kmime::headers::addressfield</option>,  <option value="classKMime_1_1Headers_1_1Base.html">kmime::headers::base</option>,  <option value="classKMime_1_1Headers_1_1BCC.html">kmime::headers::bcc</option>,  <option value="classKMime_1_1Headers_1_1CC.html">kmime::headers::cc</option>,  <option value="classKMime_1_1Headers_1_1CDescription.html">kmime::headers::cdescription</option>,  <option value="classKMime_1_1Headers_1_1CDisposition.html">kmime::headers::cdisposition</option>,  <option value="classKMime_1_1Headers_1_1ContentType.html">kmime::headers::contenttype</option>,  <option value="classKMime_1_1Headers_1_1Control.html">kmime::headers::control</option>,  <option value="classKMime_1_1Headers_1_1CTEncoding.html">kmime::headers::ctencoding</option>,  <option value="classKMime_1_1Headers_1_1Date.html">kmime::headers::date</option>,  <option value="classKMime_1_1Headers_1_1FollowUpTo.html">kmime::headers::followupto</option>,  <option value="classKMime_1_1Headers_1_1From.html">kmime::headers::from</option>,  <option value="classKMime_1_1Headers_1_1Generic.html">kmime::headers::generic</option>,  <option value="classKMime_1_1Headers_1_1Generics_1_1AddressList.html">kmime::headers::generics::addresslist</option>,  <option value="classKMime_1_1Headers_1_1Generics_1_1GIdent.html">kmime::headers::generics::gident</option>,  <option value="classKMime_1_1Headers_1_1Generics_1_1GStructured.html">kmime::headers::generics::gstructured</option>,  <option value="classKMime_1_1Headers_1_1Generics_1_1GToken.html">kmime::headers::generics::gtoken</option>,  <option value="classKMime_1_1Headers_1_1Generics_1_1GUnstructured.html">kmime::headers::generics::gunstructured</option>,  <option value="classKMime_1_1Headers_1_1Generics_1_1MailboxList.html">kmime::headers::generics::mailboxlist</option>,  <option value="classKMime_1_1Headers_1_1Lines.html">kmime::headers::lines</option>,  <option value="classKMime_1_1Headers_1_1MailCopiesTo.html">kmime::headers::mailcopiesto</option>,  <option value="classKMime_1_1Headers_1_1MessageID.html">kmime::headers::messageid</option>,  <option value="classKMime_1_1Headers_1_1Newsgroups.html">kmime::headers::newsgroups</option>,  <option value="classKMime_1_1Headers_1_1Organization.html">kmime::headers::organization</option>,  <option value="classKMime_1_1Headers_1_1References.html">kmime::headers::references</option>,  <option value="classKMime_1_1Headers_1_1ReplyTo.html">kmime::headers::replyto</option>,  <option value="classKMime_1_1Headers_1_1ReturnPath.html">kmime::headers::returnpath</option>,  <option value="classKMime_1_1Headers_1_1Subject.html">kmime::headers::subject</option>,  <option value="classKMime_1_1Headers_1_1Supersedes.html">kmime::headers::supersedes</option>,  <option value="classKMime_1_1Headers_1_1To.html">kmime::headers::to</option>,  <option value="classKMime_1_1Headers_1_1UserAgent.html">kmime::headers::useragent</option>,  <option value="classKMime_1_1Parser_1_1MultiPart.html">kmime::parser::multipart</option>,  <option value="classKMime_1_1Parser_1_1NonMimeParser.html">kmime::parser::nonmimeparser</option>,  <option value="classKMime_1_1Parser_1_1UUEncoded.html">kmime::parser::uuencoded</option>,  <option value="classKMime_1_1Parser_1_1YENCEncoded.html">kmime::parser::yencencoded</option>,  <option value="classMailCopiesTo.html">mailcopiesto</option>,  <option value="classMessageID.html">messageid</option>,  <option value="classReferences.html">references</option>,  <option value="classReplyTo.html">replyto</option>,  <option value="classSupersedes.html">supersedes</option>,  <option value="classTo.html">to</option>,
</select>
</form>
</div>
-->
</div></div>
<div class="menu_box"><h2>API Dox</h2>
<div class="nav_list">
<ul>
<li><a href="../../akregator/html/index.html">akregator</a></li><li>&nbsp;&nbsp;<a href="../../akregator/src/html/index.html">src</a></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li>&nbsp;&nbsp;<a href="../../certmanager/lib/html/index.html">lib</a></li><li><a href="../../kaddressbook/html/index.html">kaddressbook</a></li><li><a href="../../kalarm/html/index.html">kalarm</a></li><li>&nbsp;&nbsp;<a href="../../kalarm/lib/html/index.html">lib</a></li><li><a href="../../kandy/html/index.html">kandy</a></li><li><a href="../../karm/html/index.html">karm</a></li><li><a href="../../kdgantt/html/index.html">kdgantt</a></li><li><a href="../../kgantt/html/index.html">kgantt</a></li><li><a href="../../kioslaves/html/index.html">kioslaves</a></li><li>&nbsp;&nbsp;<a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li>&nbsp;&nbsp;<a href="../../kioslaves/mbox/html/index.html">mbox</a></li><li><a href="../../kitchensync/html/index.html">kitchensync</a></li><li><a href="../../kmail/html/index.html">kmail</a></li><li><a href="../../knotes/html/index.html">knotes</a></li><li><a href="../../konsolekalendar/html/index.html">konsolekalendar</a></li><li><a href="../../kontact/html/index.html">kontact</a></li><li><a href="../../korganizer/html/index.html">korganizer</a></li><li><a href="../../kpilot/html/index.html">kpilot</a></li><li>&nbsp;&nbsp;<a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li>&nbsp;&nbsp;<a href="../../kpilot/lib/html/index.html">lib</a></li><li><a href="../../libemailfunctions/html/index.html">libemailfunctions</a></li><li><a href="../../libkcal/html/index.html">libkcal</a></li><li><a href="../../libkdepim/html/index.html">libkdepim</a></li><li><a href="../../libkholidays/html/index.html">libkholidays</a></li><li><a href="../../libkmime/html/index.html">libkmime</a></li><li><a href="../../libkpgp/html/index.html">libkpgp</a></li><li><a href="../../libkpimidentities/html/index.html">libkpimidentities</a></li>
</ul></div></div>


        </td>
</tr>
</table>

<span class="doNotDisplay">
  <a href="http://www.kde.org/" accesskey="8">KDE Home</a> |
  <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> |
  <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a>
</span>


<div style="height: 8px"></div>

<div id="footer">
  <div id="footer_left">
    Maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">Allen Winter</a>.
<br/>
    KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
    <a href="http://www.kde.org/contact/impressum.php">Legal</a>
  </div>
  <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div>
</div>

<!--
WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL
BE BLOCKED INSTANTLY AND PERMANENTLY!
<a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a>
WARNING END
-->

</body>
</html>