| Qore Programming Language - C/C++ Library 1.0.8

Public Member Functions | Protected Member Functions | List of all members
OutputStream Class Referenceabstract

Interface for private data of output streams. More...

`#include <OutputStream.h>`

Inheritance diagram for OutputStream:
[legend]
Collaboration diagram for OutputStream:
[legend]

## Public Member Functions
DLLLOCAL bool | check (ExceptionSink *xsink)
| Checks that the current thread is the same as when the instance was created or assigned via unassignThread() and reassignThread() and that the stream has not yet been closed. More...
virtual void | close (ExceptionSink *xsink)=0
| Flushes any buffered (unwritten) bytes, closes the output stream and releases resources. More...
DLLLOCAL void | closeHelper (ExceptionSink *xsink)
| Helper method that checks that the current thread is the same as when the instance was created, that the stream has not yet been closed and calls close(). More...
virtual bool | isClosed ()=0
| Returns true is the stream has been closed. More...
virtual void | write (const void *ptr, int64 count, ExceptionSink *xsink)=0
| Writes bytes to the output stream. More...
DLLLOCAL void | writeHelper (const BinaryNode *data, ExceptionSink *xsink)
| Helper method that checks that the current thread is the same as when the instance was created, that the stream has not yet been closed and calls write(). More...
DLLLOCAL void | writeHelper (const QoreString *data, ExceptionSink *xsink)
| Helper method that checks that the current thread is the same as when the instance was created, that the stream has not yet been closed and calls write(). More...
Public Member Functions inherited from StreamBase
DLLLOCAL bool | check (ExceptionSink *xsink)
| Checks that the current thread is the same as when the instance was created or assigned via unassignThread() and reassignThread() and that the stream has not yet been closed. More...
virtual DLLLOCAL const char * | getName ()=0
| Returns the name of the class. More...
DLLLOCAL int | getThreadId ()
| Get currently assigned thread id.
DLLLOCAL void | reassignThread (ExceptionSink *xsink)
| Reassigns current thread as thread used for stream manipulation, see check() More...
DLLLOCAL void | unassignThread (ExceptionSink *xsink)
| Unassigns current thread as thread used for stream manipulation, see check() More...
Public Member Functions inherited from AbstractPrivateData
virtual DLLLOCAL void | deref (ExceptionSink *xsink)
| decrements the reference count of the object More...
virtual DLLLOCAL void | deref ()
| decrements the reference count of the object without the possibility of throwing a Qore-language exception
DLLLOCAL void | ref () const
| increments the reference count of the object
Public Member Functions inherited from QoreReferenceCounter
DLLEXPORT | QoreReferenceCounter ()
| creates the reference counter object
DLLEXPORT | QoreReferenceCounter (const QoreReferenceCounter &old)
| creates a new object with a reference count of 1 More...
DLLEXPORT | ~QoreReferenceCounter ()
| destroys the reference counter object
DLLEXPORT bool | is_unique () const
| returns true if the reference count is 1 More...
DLLEXPORT int | reference_count () const
| gets the reference count More...
DLLEXPORT bool | ROdereference () const
| atomically decrements the reference count More...
DLLEXPORT void | ROreference () const
| atomically increments the reference count

## Protected Member Functions
| OutputStream ()=default
| Constructor.
Protected Member Functions inherited from StreamBase
| StreamBase ()
| Constructor.
Protected Member Functions inherited from AbstractPrivateData
virtual DLLLOCAL | ~AbstractPrivateData ()
| as these objects are reference counted, the destructor should be called only when the reference count = 0 and not manually

## Detailed Description

Interface for private data of output streams.

Methods in this interface serve as low-level API for using output streams from C++ code.

## Member Function Documentation

## ◆ check()

DLLLOCAL bool OutputStream::check | ( | ExceptionSink * | xsink | ) |
| inline

Checks that the current thread is the same as when the instance was created or assigned via unassignThread() and reassignThread() and that the stream has not yet been closed.

Parameters

  xsink | the exception sink

Returns
  true if the checks passed, false if an exception has been raised

Exceptions

  STREAM-THREAD-ERROR | if the current thread is not the same as when the instance was created
  OUTPUT-STREAM-CLOSED-ERROR | if the stream has been closed

## ◆ close()

virtual void OutputStream::close | ( | ExceptionSink * | xsink | ) |
| pure virtual

Flushes any buffered (unwritten) bytes, closes the output stream and releases resources.

Parameters

  xsink | the exception sink

## ◆ closeHelper()

DLLLOCAL void OutputStream::closeHelper | ( | ExceptionSink * | xsink | ) |
| inline

Helper method that checks that the current thread is the same as when the instance was created, that the stream has not yet been closed and calls close().

Parameters

  xsink | the exception sink

## ◆ isClosed()

virtual bool OutputStream::isClosed | ( |  | ) |
| pure virtual

Returns true is the stream has been closed.

Returns
  true is the stream has been closed

## ◆ write()

virtual void OutputStream::write | ( | const void * | ptr,
|  | int64 | count,
|  | ExceptionSink * | xsink
| ) |  |
| pure virtual

Writes bytes to the output stream.

Parameters

  ptr | the source buffer to write to the stream
  count | the number of bytes to write, must be >= 0
  xsink | the exception sink

## ◆ writeHelper() [1/2]

DLLLOCAL void OutputStream::writeHelper | ( | const BinaryNode * | data,
|  | ExceptionSink * | xsink
| ) |  |
| inline

Helper method that checks that the current thread is the same as when the instance was created, that the stream has not yet been closed and calls write().

Parameters

  data | the data to write
  xsink | the exception sink

## ◆ writeHelper() [2/2]

DLLLOCAL void OutputStream::writeHelper | ( | const QoreString * | data,
|  | ExceptionSink * | xsink
| ) |  |
| inline

Helper method that checks that the current thread is the same as when the instance was created, that the stream has not yet been closed and calls write().

Parameters

  data | the data to write
  xsink | the exception sink

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

- include/qore/OutputStream.h