SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Constructs a stream and audits the bytes that pass through it. More...
#include <rw/auditbuf.h>
Inherits streambuf.
Public Member Functions | |
RWAuditStreamBuffer () | |
RWAuditStreamBuffer (RWauditFunction, void *=0) | |
RWAuditStreamBuffer (std::istream &, RWauditFunction=0, void *=0) | |
RWAuditStreamBuffer (std::iostream &, RWauditFunction=0, void *=0) | |
RWAuditStreamBuffer (std::ostream &, RWauditFunction=0, void *=0) | |
RWAuditStreamBuffer (std::streambuf *, RWauditFunction=0, void *=0) | |
operator unsigned long () | |
unsigned long | reset (unsigned long val=0ul) |
Related Functions | |
(Note that these are not member functions.) | |
typedef void(* | RWauditFunction) (unsigned char, void *) |
Class RWAuditStreamBuffer is used to construct a stream, after which the RWAuditStreamBuffer instance counts all the bytes that pass through the stream. If constructed with a function pointer, RWAuditStreamBuffer calls that function with each byte that passes through the stream. The counting capacity provides for streams the equivalent of the method RWCollectable::recursiveStoreSize(), which is available only for RWFile.
Program output:
RWAuditStreamBuffer::RWAuditStreamBuffer | ( | ) |
Constructs a new RWAuditStreamBuffer that may be used only to examine and count every byte that passes into an std::ostream that has the RWAuditStreamBuffer instance as its std::streambuf. It does not forward the bytes to any stream, nor accept bytes from a stream.
RWAuditStreamBuffer::RWAuditStreamBuffer | ( | RWauditFunction | , |
void * | = 0 |
||
) |
Constructs a new RWAuditStreamBuffer that may be used only to examine and count every byte that passes into an std::ostream that has the RWAuditStreamBuffer instance as its std::streambuf. It does not forward the bytes to any stream, nor accept bytes from a stream. The second parameter to the constructor allows you to supply storage for the byte count. It is optional.
RWAuditStreamBuffer::RWAuditStreamBuffer | ( | std::istream & | , |
RWauditFunction | = 0 , |
||
void * | = 0 |
||
) |
Constructs a new RWAuditStreamBuffer that passes bytes from the std::istream on which it is constructed to the std::istream that has the RWAuditStreamBuffer instance as its std::streambuf. A typical use would be to count or examine the bytes being input from a file through a stream derived from RWvistream. The third parameter to the constructor allows you to supply storage for the byte count. It is optional.
RWAuditStreamBuffer::RWAuditStreamBuffer | ( | std::iostream & | , |
RWauditFunction | = 0 , |
||
void * | = 0 |
||
) |
Constructs a new RWAuditStreamBuffer that passes bytes to and from the std::iostream on which it is constructed to and from the std::istream that has the RWAuditStreamBuffer instance as its std::streambuf. A typical use would be to count or examine the bytes being transferred to and from a file used to store and retrieve changing data. The third parameter to the constructor allows you to supply storage for the byte count. It is optional.
RWAuditStreamBuffer::RWAuditStreamBuffer | ( | std::ostream & | , |
RWauditFunction | = 0 , |
||
void * | = 0 |
||
) |
Constructs a new RWAuditStreamBuffer that passes bytes into the std::ostream on which it is constructed from the std::ostream that has the RWAuditStreamBuffer instance as its std::streambuf. A typical use would be to count or examine the bytes being output to a file through a stream derived from RWvostream. The third parameter to the constructor allows you to supply storage for the byte count. It is optional.
RWAuditStreamBuffer::RWAuditStreamBuffer | ( | std::streambuf * | , |
RWauditFunction | = 0 , |
||
void * | = 0 |
||
) |
Constructs a new RWAuditStreamBuffer that passes bytes into the std::ostream on which it is constructed from the std::ostream that has the RWAuditStreamBuffer instance as its std::streambuf. A typical use would be to count or examine the bytes being output to a file through a stream derived from RWvostream. The third parameter to the constructor allows you to supply storage for the byte count. It is optional.
|
inline |
Provides the count of bytes seen so far.
|
inline |
Resets the count of bytes seen so far. Returns the current count.
|
related |
If you wish to do more than count each character handled by the buffer, you may provide an RWauditFunction to the constructor. The first parameter to this function is a byte provided by the stream. The second parameter is the address of the counter to be manipulated by RWAuditFunction.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |