📄 cryptlib_8cpp-source.html
字号:
<a name="l00324"></a>00324 <a name="l00325"></a><a class="code" href="class_buffered_transformation.html#acdeedab8dc8557d17b12b67a9ff94dc">00325</a> <span class="keywordtype">size_t</span> <a class="code" href="class_buffered_transformation.html#5fa048faf8c043ad57ae0a8911070090" title="peek at the next byte without removing it from the output buffer">BufferedTransformation::Peek</a>(byte *outString, <span class="keywordtype">size_t</span> peekMax)<span class="keyword"> const</span><a name="l00326"></a>00326 <span class="keyword"></span>{<a name="l00327"></a>00327 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00328"></a>00328 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#5fa048faf8c043ad57ae0a8911070090" title="peek at the next byte without removing it from the output buffer">Peek</a>(outString, peekMax);<a name="l00329"></a>00329 <span class="keywordflow">else</span><a name="l00330"></a>00330 {<a name="l00331"></a>00331 <a class="code" href="class_array_sink.html" title="Copy input to a memory buffer.">ArraySink</a> arraySink(outString, peekMax);<a name="l00332"></a>00332 <span class="keywordflow">return</span> (<span class="keywordtype">size_t</span>)<a class="code" href="class_buffered_transformation.html#8d4359262c67b3e10d193ba30ef193c5" title="copy copyMax bytes of the buffered output to target as input">CopyTo</a>(arraySink, peekMax);<a name="l00333"></a>00333 }<a name="l00334"></a>00334 }<a name="l00335"></a>00335 <a name="l00336"></a><a class="code" href="class_buffered_transformation.html#0c25529ded99db20ad35ccef3f7234e6">00336</a> lword <a class="code" href="class_buffered_transformation.html#0c25529ded99db20ad35ccef3f7234e6" title="discard skipMax bytes from the output buffer">BufferedTransformation::Skip</a>(lword skipMax)<a name="l00337"></a>00337 {<a name="l00338"></a>00338 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00339"></a>00339 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#0c25529ded99db20ad35ccef3f7234e6" title="discard skipMax bytes from the output buffer">Skip</a>(skipMax);<a name="l00340"></a>00340 <span class="keywordflow">else</span><a name="l00341"></a>00341 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#91c4526148274ae9cb68803bb2d2a2aa" title="move transferMax bytes of the buffered output to target as input">TransferTo</a>(TheBitBucket(), skipMax);<a name="l00342"></a>00342 }<a name="l00343"></a>00343 <a name="l00344"></a><a class="code" href="class_buffered_transformation.html#b4e77f500d62436a8bd1597e6b6443a1">00344</a> lword <a class="code" href="class_buffered_transformation.html#b4e77f500d62436a8bd1597e6b6443a1">BufferedTransformation::TotalBytesRetrievable</a>()<span class="keyword"> const</span><a name="l00345"></a>00345 <span class="keyword"></span>{<a name="l00346"></a>00346 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00347"></a>00347 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#b4e77f500d62436a8bd1597e6b6443a1">TotalBytesRetrievable</a>();<a name="l00348"></a>00348 <span class="keywordflow">else</span><a name="l00349"></a>00349 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#30b2076bce5fb29e992b6457485c67c2" title="returns number of bytes that is currently ready for retrieval">MaxRetrievable</a>();<a name="l00350"></a>00350 }<a name="l00351"></a>00351 <a name="l00352"></a><a class="code" href="class_buffered_transformation.html#56bcbb4306a9c04cda838f96e85a2116">00352</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_buffered_transformation.html#56bcbb4306a9c04cda838f96e85a2116" title="number of times MessageEnd() has been received minus messages retrieved or skipped...">BufferedTransformation::NumberOfMessages</a>()<span class="keyword"> const</span><a name="l00353"></a>00353 <span class="keyword"></span>{<a name="l00354"></a>00354 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00355"></a>00355 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#56bcbb4306a9c04cda838f96e85a2116" title="number of times MessageEnd() has been received minus messages retrieved or skipped...">NumberOfMessages</a>();<a name="l00356"></a>00356 <span class="keywordflow">else</span><a name="l00357"></a>00357 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#83945ad467ad20665cfb0a9a9a46ebec">CopyMessagesTo</a>(TheBitBucket());<a name="l00358"></a>00358 }<a name="l00359"></a>00359 <a name="l00360"></a><a class="code" href="class_buffered_transformation.html#a0d7fdaa525a59cf72cdc431570f3df8">00360</a> <span class="keywordtype">bool</span> <a class="code" href="class_buffered_transformation.html#a0d7fdaa525a59cf72cdc431570f3df8" title="returns true if NumberOfMessages() > 0">BufferedTransformation::AnyMessages</a>()<span class="keyword"> const</span><a name="l00361"></a>00361 <span class="keyword"></span>{<a name="l00362"></a>00362 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00363"></a>00363 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#a0d7fdaa525a59cf72cdc431570f3df8" title="returns true if NumberOfMessages() > 0">AnyMessages</a>();<a name="l00364"></a>00364 <span class="keywordflow">else</span><a name="l00365"></a>00365 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#56bcbb4306a9c04cda838f96e85a2116" title="number of times MessageEnd() has been received minus messages retrieved or skipped...">NumberOfMessages</a>() != 0;<a name="l00366"></a>00366 }<a name="l00367"></a>00367 <a name="l00368"></a><a class="code" href="class_buffered_transformation.html#8dc8562950fd563f7c62d1f1e5ec6b1e">00368</a> <span class="keywordtype">bool</span> <a class="code" href="class_buffered_transformation.html#8dc8562950fd563f7c62d1f1e5ec6b1e" title="start retrieving the next message">BufferedTransformation::GetNextMessage</a>()<a name="l00369"></a>00369 {<a name="l00370"></a>00370 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00371"></a>00371 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#8dc8562950fd563f7c62d1f1e5ec6b1e" title="start retrieving the next message">GetNextMessage</a>();<a name="l00372"></a>00372 <span class="keywordflow">else</span><a name="l00373"></a>00373 {<a name="l00374"></a>00374 assert(!<a class="code" href="class_buffered_transformation.html#a0d7fdaa525a59cf72cdc431570f3df8" title="returns true if NumberOfMessages() > 0">AnyMessages</a>());<a name="l00375"></a>00375 <span class="keywordflow">return</span> <span class="keyword">false</span>;<a name="l00376"></a>00376 }<a name="l00377"></a>00377 }<a name="l00378"></a>00378 <a name="l00379"></a><a class="code" href="class_buffered_transformation.html#ce560f14489f478bb4cd17c41905774e">00379</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_buffered_transformation.html#ce560f14489f478bb4cd17c41905774e" title="skip count number of messages">BufferedTransformation::SkipMessages</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count)<a name="l00380"></a>00380 {<a name="l00381"></a>00381 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00382"></a>00382 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#ce560f14489f478bb4cd17c41905774e" title="skip count number of messages">SkipMessages</a>(count);<a name="l00383"></a>00383 <span class="keywordflow">else</span><a name="l00384"></a>00384 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#c80a018cfc3eb7c4ae3f0d4a804eb6d5">TransferMessagesTo</a>(TheBitBucket(), count);<a name="l00385"></a>00385 }<a name="l00386"></a>00386 <a name="l00387"></a><a class="code" href="class_buffered_transformation.html#0a9ba0f5307ff55f7e1a828188728985">00387</a> <span class="keywordtype">size_t</span> <a class="code" href="class_buffered_transformation.html#0a9ba0f5307ff55f7e1a828188728985" title="upon return, messageCount contains number of messages that have finished being transfered...">BufferedTransformation::TransferMessagesTo2</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &target, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> &messageCount, <span class="keyword">const</span> std::string &channel, <span class="keywordtype">bool</span> blocking)<a name="l00388"></a>00388 {<a name="l00389"></a>00389 <span class="keywordflow">if</span> (<a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>())<a name="l00390"></a>00390 <span class="keywordflow">return</span> <a class="code" href="class_buffered_transformation.html#ba6bbc169e26ed77a6bb5d50f91abda0" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-><a class="code" href="class_buffered_transformation.html#0a9ba0f5307ff55f7e1a828188728985" title="upon return, messageCount contains number of messages that have finished being transfered...">TransferMessagesTo2</a>(target, messageCount, channel, blocking);<a name="l00391"></a>00391 <span class="keywordflow">else</span><a name="l00392"></a>00392 {<a name="l00393"></a>00393 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxMessages = messageCount;<a name="l00394"></a>00394 <span class="keywordflow">for</span> (messageCount=0; messageCount < maxMessages && <a class="code" href="class_buffered_transformation.html#a0d7fdaa525a59cf72cdc431570f3df8" title="returns true if NumberOfMessages() > 0">AnyMessages</a>(); messageCount++)<a name="l00395"></a>00395 {<a name="l00396"></a>00396 <span class="keywordtype">size_t</span> blockedBytes;<a name="l00397"></a>00397 lword transferredBytes;<a name="l00398"></a>00398 <a name="l00399"></a>00399 <span class="keywordflow">while</span> (<a class="code" href="class_buffered_transformation.html#8c1e2ca57fc06a1f3694d8fe7f8508ff" title="returns whether any bytes are currently ready for retrieval">AnyRetrievable</a>())<a name="l00400"></a>00400 {<a name="l00401"></a>00401 transferredBytes = LWORD_MAX;<a name="l00402"></a>00402 blockedBytes = <a class="code" href="class_buffered_transformation.html#041e8af260c474a43bd232cd4143f406" title="upon return, byteCount contains number of bytes that have finished being transfered...">TransferTo2</a>(target, transferredBytes, channel, blocking);<a name="l00403"></a>00403 <span class="keywordflow">if</span> (blockedBytes > 0)<a name="l00404"></a>00404 <span class="keywordflow">return</span> blockedBytes;<a name="l00405"></a>00405 }<a name="l00406"></a>00406 <a name="l00407"></a>00407 <span class="keywordflow">if</span> (target.<a class="code" href="class_buffered_transformation.html#e0b37b299c5835083e58b205f9cc25cc">ChannelMessageEnd</a>(channel, <a class="code" href="class_buffered_transformation.html#76a32fc46e74c3c509934a11b8f5fec7
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -