![]() ![]() ![]()
|
BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1 |
#include <SFXStreamWriter.h.hpp>
class SFXStreamWriter : public SFXOutputStream;
SFMTYPEDEFCLASS(SFXStreamWriter)


The SFXStreamWriter class is used to write data onto the output stream such as file, TCP socket and so on.
According to the type of data to be written, select one among the following classes that inherit from the SFXStreamWriter class: SFXBinaryStreamWriter class, SFXAnsiStringStreamWriter class, SFXWideStringStreamWriter class.
SFXBinaryStreamWriter | SFXAnsiStringStreamWriter | SFXWideStringStreamWriter | SFXStreamReader
| Constructor/Destructor |
|---|
|
SFXStreamWriter( Void ) Constructor of SFXStreamWriter class.
|
|
~SFXStreamWriter( Void ) Destructor of SFXStreamWriter class.
|
| Public Functions | |
|---|---|
| Void |
Attach(
SFXOutputStreamPtr stream
) Delegate the control privilege of SFXOutputStream object to the SFXStreamWriter object.
|
| Void |
Cancel( Void ) Call the Cancel function for Storage class. And also unregister the callback functions.
|
| SFXOutputStreamPtr |
Detach( Void ) Delegate the control privilege of SFXStreamWriter object to the SFXOutputStream object.
|
| SFCError |
Flush( Void ) Flush( CallbackSPP spp , VoidPtr reference ) Flush the written data.
|
| UInt32 |
GetWritableSize( Void ) Get the size of writable data.
|
| Void |
Release( Void ) Release the stream.
|
| SFCError |
ResetTrigger( Void ) Reset the trigger when the callback function will be called.
|
| SFCError |
SetTrigger(
UInt32 size
) SetTrigger( VoidConstPtr buffer , UInt32 size ) SetTrigger( SFXBufferConstRef buffer ) Set the trigger when the callback function will be called.
|
| Bool |
Triggers( Void ) Check whether the callback function is called by trigger or not.
|
| SFCError |
Write(
SFXBufferConstRef buffer
) Write( VoidConstPtr buffer , UInt32 size ) Write data onto the stream.
|
| Types |
|---|
|
CallbackSPP
(inherits from SFXStream)
Constant that represents Callback function.
|
[ public, explicit ] SFXStreamWriter(Void);
[ public, virtual ] virtual ~SFXStreamWriter(Void);
[ public ] Void Attach( SFXOutputStreamPtr stream // stream to set );
The contents of SFXStreamWriter object before calling the SFXStreamWriter::Attach function will be destroyed.
What is delegation?: In object oriented programming, deligation means that an object have another deputy object behave like itself.
[ public, virtual ] Void Cancel(Void);
Call the SFXFile::Cancel function for file, SFXTCPSocket::Cancel function for TCP socket, etc.
And also the callback functions registered by the SFXStreamWriter::Flush function are unregistered.
SFXStreamWriter::Flush | SFXFile::Cancel | SFXTCPSocket::Cancel
[ public ] SFXOutputStreamPtr Detach(Void);
[ public, virtual ] SFCError Flush(Void);
[ public, virtual ] SFCError Flush( CallbackSPP spp // callback function VoidPtr reference // data sent to callback function );
There are two types of SFXStreamWriter::Flush functions: one is with the registration of callback function, and the other is without it. Which type of SFXStreamWriter::Flush function is available depends upon the storage of stream.
For example, only the type with the registration of callback function is availavle for TCP stream. However file stream can use both types.
In case of the SFXStreamWriter::Flush function without the registration of callback function, data is flushed immediately after this function is called.
[ public, virtual, const ] UInt32 GetWritableSize(Void);
If the size of data to be written is larger than the return value of SFXStreamWriter::GetWritableSize function, it is necessary to call the SFXStreamWriter::Flush function.
[ public ] Void Release(Void);
[ public, virtual ] SFCError ResetTrigger(Void);
Reset the trigger set with the SFXStreamWriter::SetTrigger function.
[ public, virtual ] SFCError SetTrigger( UInt32 size // data size to be written through output stream );
[ public, virtual ] SFCError SetTrigger( SFXBufferConstRef buffer // SFXBuffer object to be written through output stream );
[ public, virtual ] SFCError SetTrigger( VoidConstPtr buffer // data to be written through output stream UInt32 size // size of data to be written through output stream );
The callback function registered by the SFXStreamWriter::Flush function is called when the stream buffer is full or the end of data is written.
When the "size" parameter of SFXStreamWriter::SetTrigger function is specified, callback function is called every time the "size" data is written.
When the "buffer" parameter of SFXStreamWriter::SetTrigger function is specified, callback function is called every time the data same with "buffer" is written.
The callback function is called every time the line-feed following character is written.
SetTrigger("\r\n", 2)
[ public, virtual, const ] Bool Triggers(Void);
The SFXStreamWriter::Triggers function is used for the callback function registered by the SFXStreamWriter::Flush function.
[ public, virtual ] SFCError Write( SFXBufferConstRef buffer // writing data );
[ public, virtual ] SFCError Write( VoidConstPtr buffer // writing data UInt32 size // size of writing data );
If the size of data to be written is larger than the return value of SFXStreamWriter::GetWritableSize function, it is necessary to call the SFXStreamWriter::Flush function.
|
Copyright (C) 2002 - 2009 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|