#include <mw/obexobjects.h>
class CObexBufObject : public CObexBaseObject |
Public Member Enumerations | |
---|---|
enum | TFileBuffering { ESingleBuffering, EDoubleBuffering } |
Public Member Functions | |
---|---|
virtual | ~CObexBufObject() |
IMPORT_C CBufBase * | DataBuf() |
HBufC * | FileName() |
IMPORT_C CObexBufObject * | NewL(CBufBase *) |
IMPORT_C void | SetDataBufL(TObexBufferingDetails &) |
IMPORT_C void | SetDataBufL(CBufBase *) |
IMPORT_C void | SetDataBufL(const TPtrC &) |
IMPORT_C void | SetDataBufL(const TPtrC &, CBufBase *) |
IMPORT_C void | SetDataBufL(const TPtrC &, CBufBase &, const TFileBuffering) |
IMPORT_C TInt | WriteToFile(const TPtrC &) |
Inherited Enumerations | |
---|---|
CObexBaseObject:TProgress |
Use this class to hold objects where the body part is stored in a CBufFlat object. Please note that although parameters are supplied as CBufBase objects, non-CBufFlat parameters are not supported and will have unpredictable results. At no point does the CObexBufObject create, or take ownership of any CBaseBuf object it uses - it is always the responsibility of the creator/owner of the CBaseBuf to free it when no longer required.
As this class does not take ownership of the buffers it uses, it equally can not create its own buffers ad-hoc for storing new data into. Hence at no time is it valid for a CObexBufObject to exist with out it having a valid data buffer set. If such a situation arises, where it is required that received information should be discarded, consider using a CObexNullObject.
It is also posible to supply a file instead of a memory buffer, or to supply both. This functionality is due to the MObexServerNotify class expecting to work only on CObexBufObjects, so CObexFileObjects cannot be returned from the upcalls. To use a file for body storage, call NewL() passing in a NULL pointer, then call SetDataBufL() manually afterwards. There are three overloads---to allow purely memory based objects, purely file based, or a hybrid. The hybrid object buffers into a memory buffer (which is not allowed to grow), then writes data to the file when the buffer is full. The buffering behaviour can therefore be tuned to the application by setting the size of the buffer prior to use.
This class is not designed for user derivation.
HBufC * | FileName | ( | ) |
Returns a pointer to the HBuf holding the filename this object is using. May return a null pointer.
Returns: iFilename The file name.
IMPORT_C CObexBufObject * | NewL | ( | CBufBase * | aDataBuf | ) | [static] |
Allocates and constructs a new OBEX dynamic buffer object, specifying a buffer.
Parameter | Description |
---|---|
aDataBuf | The buffer for the body of the object. This must be set either by this constructor or by calling SetDataBufL() before using the object. |
Returns: New OBEX dynamic buffer object
IMPORT_C void | SetDataBufL | ( | TObexBufferingDetails & | aDetails | ) |
Parameter | Description |
---|---|
aDetails | The buffering techniques to use. This only has to persist over the duration of the call to SetDataBufL, once this has returned it can be allowed to go out of scope. |
IMPORT_C void | SetDataBufL | ( | CBufBase * | aDataBuf | ) |
Sets a buffer to use the object body data.
Note that the function can leave.
Parameter | Description |
---|---|
aDataBuf | The buffer for the body of the object. |
IMPORT_C void | SetDataBufL | ( | const TPtrC & | aFilename | ) |
Set object to use aFilename as its data area. Leaves if unable to open file.
Parameter | Description |
---|---|
aFilename | The filename to link the object to. |
Set object to use aFilename as its data area. Leaves if unable to open file. Buffers data into aDataBuf before writing to file. Will not grow the memory buffer, so user can tune buffering behaviour when calling function.
Parameter | Description |
---|---|
aFilename | The filename to link the object to. |
aDataBuf | The buffer for the body of the object. |
IMPORT_C void | SetDataBufL | ( | const TPtrC & | aFilename, |
CBufBase & | aDataBuf, | |||
const TFileBuffering | aBufferingStrategy | |||
) |
Set object to write to file, using buffering and the specified buffering strategy. Note the size of the buffer passed to this function will determine the size of the second buffer if double buffering is employed.
Parameter | Description |
---|---|
aFilename | The file to link the object to. |
aDataBuf | A buffer to use. |
aBufferingStrategy | The buffering strategy to employ. |