libfossil
fsl::ContextOStream Class Reference

A std::ostream which redirects its output to the output channel configured for a fsl_cx instance. More...

#include "fossil.hpp"

Inheritance diagram for fsl::ContextOStream:

Public Member Functions

 ContextOStream (fsl_cx *f)
 Sets up this buffer to direct all stream output sent to this buffer to fsl_output() instead, using f as the first argument to that function. More...
 
 ContextOStream (Context &cx)
 Equivalent to passing cx.handle() to the other ctor. More...
 
virtual ~ContextOStream () throw ()
 If initialized, it calls fsl_flush(), otherwise it has no visible side-effects. More...
 
ContextOStreamappendf (char const *fmt,...)
 Appends a formatted string, as per fsl_outputf(), to the stream. More...
 

Detailed Description

A std::ostream which redirects its output to the output channel configured for a fsl_cx instance.

Example usage:

ContextOStream os(someContext.handle());
os << "hi, world!\n"; // goes through fsl_output()

Definition at line 2066 of file fossil.hpp.

Constructor & Destructor Documentation

fsl::ContextOStream::ContextOStream ( fsl_cx f)
explicit

Sets up this buffer to direct all stream output sent to this buffer to fsl_output() instead, using f as the first argument to that function.

Ownership of f is not changed. f must outlive this object.

fsl::ContextOStream::ContextOStream ( Context cx)
explicit

Equivalent to passing cx.handle() to the other ctor.

virtual fsl::ContextOStream::~ContextOStream ( )
throw (
)
virtual

If initialized, it calls fsl_flush(), otherwise it has no visible side-effects.

Member Function Documentation

ContextOStream& fsl::ContextOStream::appendf ( char const *  fmt,
  ... 
)

Appends a formatted string, as per fsl_outputf(), to the stream.

This is primarily intended for adding SQL-related escaping to the buffer using the q/Q specifiers.

Returns this object.


The documentation for this class was generated from the following file: