This class provides a facility for redirecting stdout and stderr to temporary files, retrieving output from the respective temporary file and comparing the output to user‐supplied character buffers. An OutputRedirector object can be in an un‐redirected state or a redirected state. If the redirector is in a redirected state, it will redirect either stdout or stderr, but not both simultaneously. An OutputRedirector object has the concept of a scratch buffer, where output captured from the process' stdout or stderr stream is stored when the OutputRedirector object is in the redirected state. Throughout this class, the term "captured output" refers to data that has been written to the stdout or stderr stream and is waiting to be loaded into the scratch buffer. Each time the load method is called, the scratch buffer is truncated, and the captured output is moved into the scratch buffer. When this is done, there is no longer any captured output.
Synopsis
Declared in <bsls_outputredirector.h>
class OutputRedirector;
Enums
Name |
Description |
Identifies the standard stream redirected by this object. |
Member Functions
Name |
Description |
|
Create an |
|
Destroy this |
Reset the scratch buffer to empty. The behavior is undefined unless |
|
|
|
If the redirector is in a redirected state, restore the original target of the redirected stream and close the temporary buffer. If the redirector is not in a redirected state, this method is a no‐op. Calling this method invalidates all output in the temporary file, so a call to |
|
If the |
|
Return the address of the scratch buffer. |
|
Return |
|
Return |
|
Read captured output into the scratch buffer. Return |
|
Return the value of the global |
|
Return the number of bytes currently loaded into the scratch buffer. |
|
Return the value of the global |
|
Return |
Static Data Members
Name |
Description |
The size of the buffer used to store the captured values loaded in the |
|
The size of the buffer used to hold a file name. |
Created with MrDocs