Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a74ec78bdb789d910d054e3918f3f007 > files > 127

libsword1-devel-1.5.5-2mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>cipherfil.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
<hr><h1>cipherfil.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
00002 <font class="comment"> *</font>
00003 <font class="comment"> * cipherfil -  SWFilter decendant to decipher a module</font>
00004 <font class="comment"> */</font>
00005 
00006 
00007 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
00008 <font class="preprocessor">#include &lt;string.h&gt;</font>
00009 <font class="preprocessor">#include &lt;cipherfil.h&gt;</font>
00010 
00011 
00012 CipherFilter::CipherFilter(<font class="keyword">const</font> <font class="keywordtype">char</font> *key) {
00013         cipher = <font class="keyword">new</font> SWCipher((<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *)key);
00014 }
00015 
00016 
00017 CipherFilter::~CipherFilter() {
00018         <font class="keyword">delete</font> cipher;
00019 }
00020 
00021 
00022 SWCipher *CipherFilter::getCipher() {
00023         <font class="keywordflow">return</font> cipher;
00024 }
00025 
00026 
00027 <font class="keywordtype">char</font> CipherFilter::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key, <font class="keyword">const</font> <a class="code" href="class_s_w_module.html">SWModule</a> *module) {
00028         <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> len;
00029 <font class="comment">//      len = strlen(text);</font>
00030         len = maxlen;
00031      <font class="keywordflow">if</font> (len &gt; 0) {
00032                 cipher-&gt;cipherBuf(&amp;len, text);
00033                 strncpy(text, cipher-&gt;Buf(), (len &lt; (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>)maxlen) ? len : maxlen);
00034      }
00035         text[maxlen] = 0;
00036         text[maxlen+1] = 0;
00037         <font class="keywordflow">return</font> 0;
00038 }
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:12:58 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>