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


The SFXStreamReader class is used to read data from the input stream such as file, TCP socket and so on.
According to the type of data to be read, select one among the following classes that inherit from the SFXStreamReader class: SFXBinaryStreamReader class, SFXAnsiStringStreamReader class, SFXWideStringStreamReader class.
SFXBinaryStreamReader | SFXAnsiStringStreamReader | SFXWideStringStreamReader | SFXStreamWriter
| Constructor/Destructor |
|---|
|
SFXStreamReader( Void ) Constructor of SFXStreamReader class.
|
|
~SFXStreamReader( Void ) Destructor of SFXStreamReader class.
|
| Public Functions | |
|---|---|
| Void |
Attach(
SFXInputStreamPtr stream
) Delegate the control privilege of SFXInputStream object to the SFXStreamReader object.
|
| Void |
Cancel( Void ) Call the Cancel function for Storage class. And also unregister the callback functions.
|
| SFXInputStreamPtr |
Detach( Void ) Delegate the control privilege of SFXStreamReader object to the SFXInputStream object.
|
| Bool |
Ends( Void ) Check whether the stream ends or not.
|
| SFCError |
Fetch( Void ) Fetch( CallbackSPP spp , VoidPtr reference ) Fetch for reading data newly.
|
| SInt32 |
FirstIndexOf(
Byte byte
, SInt32 index = SINT32_MINIMUM
) FirstIndexOf( VoidConstPtr buffer , UInt32 size , SInt32 index = SINT32_MINIMUM ) FirstIndexOf( SFXBufferConstRef buffer , SInt32 index = SINT32_MINIMUM ) Get the first index of SFXStreamReader object to match with the specified data, searching from the beginning.
|
| UInt32 |
GetReadableSize( Void ) Get the size of readable data.
|
| SInt32 |
LastIndexOf(
Byte byte
, SInt32 index = SINT32_MAXIMUM
) LastIndexOf( VoidConstPtr buffer , UInt32 size , SInt32 index = SINT32_MAXIMUM ) LastIndexOf( SFXBufferConstRef buffer , SInt32 index = SINT32_MAXIMUM ) Get the last index of SFXStreamReader object to match with the specified data, searching from the end.
|
| SFCError |
Read(
SFXBufferPtr buffer
) Read( VoidPtr buffer , UInt32 size ) Read data from the stream.
|
| Void |
Release( Void ) Release the stream.
|
| SFCError |
ResetTrigger( Void ) Reset the trigger when the callback function will be called.
|
| SFCError |
Seek(
UInt32 size
) Move the read pointer foraward.
|
| 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.
|
| Types |
|---|
|
CallbackSPP
(inherits from SFXStream)
Constant that represents Callback function.
|
[ public, explicit ] SFXStreamReader(Void);
[ public, virtual ] virtual ~SFXStreamReader(Void);
[ public ] Void Attach( SFXInputStreamPtr stream // stream to set );
The contents of SFXStreamReader object before calling the SFXStreamReader::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 SFXStreamReader::Fetch function are unregistered.
SFXStreamReader::Fetch | SFXFile::Cancel | SFXTCPSocket::Cancel
[ public ] SFXInputStreamPtr Detach(Void);
[ public, virtual, const ] Bool Ends(Void);
[ public, virtual ] SFCError Fetch(Void);
[ public, virtual ] SFCError Fetch( CallbackSPP spp // callback function VoidPtr reference // data sent to callback function );
There are two types of SFXStreamReader::Fetch functions: one is with the registration of callback function, and the other is without it. Which type of SFXStreamReader::Fetch 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, both types can be used in the file stream.
In case of the SFXStreamReader::Fetch function without the registration of callback function, data is read into the internal buffer immediately after this function is called.
[ public, virtual, const ] SInt32 FirstIndexOf( Byte byte // byte data to match with SInt32 index = SINT32_MINIMUM // starting index to search from );
[ public, virtual, const ] SInt32 FirstIndexOf( SFXBufferConstRef buffer // buffer object to match with SInt32 index = SINT32_MINIMUM // starting index to search from );
[ public, virtual, const ] SInt32 FirstIndexOf( VoidConstPtr buffer // buffer data to match with UInt32 size // size of buffer data to match with SInt32 index = SINT32_MINIMUM // starting index to search from );
To search from other than the beginning, specify the starting index to match with. (The origin index is 0.)
[ public, virtual, const ] UInt32 GetReadableSize(Void);
It is necessary to check the size of readable data by the SFXStreamReader::GetReadableSize function before calling the SFXStreamReader::Read function.
[ public, virtual, const ] SInt32 LastIndexOf( Byte byte // byte data to match with SInt32 index = SINT32_MAXIMUM // starting index to search from );
[ public, virtual, const ] SInt32 LastIndexOf( SFXBufferConstRef buffer // buffer object to match with SInt32 index = SINT32_MAXIMUM // starting index to search from );
[ public, virtual, const ] SInt32 LastIndexOf( VoidConstPtr buffer // buffer data to match with UInt32 size // size of buffer data to match with SInt32 index = SINT32_MAXIMUM // starting index to search from );
To search from other than the end, specify the starting index to match with. (The origin index is 0.)
[ public, virtual ] SFCError Read( SFXBufferPtr buffer // buffer contains the reading data );
[ public, virtual ] SFCError Read( VoidPtr buffer // pointer to the buffer contains the reading data UInt32 size // size of the buffer contains the reading data );
The size of readable data can be gotten to call the SFXStreamReader::GetReadableSize function.
When receiving data by using the SFXBuffer class, set the size to receive data by the SFXBuffer::SetSize function.
[ public ] Void Release(Void);
[ public, virtual ] SFCError ResetTrigger(Void);
Reset the trigger set with the SFXStreamReader::SetTrigger function.
[ public, virtual ] SFCError SetTrigger( UInt32 size // data size to be read through input stream );
[ public, virtual ] SFCError SetTrigger( SFXBufferConstRef buffer // SFXBuffer object to be read through input stream );
[ public, virtual ] SFCError SetTrigger( VoidConstPtr buffer // data to be read through input stream UInt32 size // size of data to be read through input stream );
The callback function registered by the SFXStreamReader::Fetch function is called when the stream buffer is full or the end of data is read.
When the "size" parameter of SFXStreamReader::SetTrigger function is specified, callback function is called every time the "size" data is read.
When the "buffer" parameter of SFXStreamReader::SetTrigger function is specified, callback function is called every time the data same with "buffer" is read.
The callback function is called every time the following line-feed character is read.
SetTrigger("\r\n", 2)
[ public, virtual, const ] Bool Triggers(Void);
The SFXStreamReader::Triggers function is used for the callback function registered by the SFXStreamReader::Fetch function.
|
Copyright (C) 2002 - 2009 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|