epoc32/include/obexheaders.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
williamr@2
    17
williamr@2
    18
/**
williamr@2
    19
 @file
williamr@2
    20
 @publishedAll
williamr@2
    21
 @released
williamr@2
    22
*/
williamr@2
    23
williamr@2
    24
#ifndef __OBEXHEADERS_H
williamr@2
    25
#define __OBEXHEADERS_H
williamr@2
    26
williamr@2
    27
#include <obextypes.h>
williamr@2
    28
williamr@2
    29
/**
williamr@2
    30
Encapsulates an Obex header.
williamr@2
    31
williamr@2
    32
This class provides the ability to hold a header of any of the Obex
williamr@2
    33
supported types as a native Symbian OS type.
williamr@2
    34
williamr@2
    35
A header may also have one or more attributes set.  These are used by
williamr@2
    36
the object which owns the header collection so that it can keep track
williamr@2
    37
of which headers should be sent (!(ESuppressed || EDeleted)), which have
williamr@2
    38
been sent (ESent), and whether the header should be deleted (EDeleted).
williamr@2
    39
Deletion is a special case---any operation on the Object which causes
williamr@2
    40
a scan of the headers will trigger deletion of any marked headers.
williamr@2
    41
This is required as they are owned by the Object, but can be accessed
williamr@2
    42
seperately (including through the creator keeping a pointer to the
williamr@2
    43
header).
williamr@2
    44
williamr@2
    45
@see CObexBaseObject
williamr@2
    46
@publishedAll
williamr@2
    47
@released
williamr@2
    48
*/
williamr@2
    49
NONSHARABLE_CLASS(CObexHeader) : public CBase
williamr@2
    50
	{
williamr@2
    51
public:
williamr@2
    52
	// Requires friendship with CObexBaseObject to support some aspects of the
williamr@2
    53
	// legacy API (specifically the HTTP accessor method).
williamr@2
    54
	friend class CObexBaseObject;
williamr@2
    55
williamr@2
    56
	enum THeaderType
williamr@2
    57
		{
williamr@2
    58
		EUnicode  = 0x00,
williamr@2
    59
		EByteSeq  = 0x01,
williamr@2
    60
		EByte     = 0x02,
williamr@2
    61
		EFourByte = 0x03
williamr@2
    62
		};
williamr@2
    63
	
williamr@2
    64
	enum THeaderAttr
williamr@2
    65
		{
williamr@2
    66
		ESuppressed = 0x01,
williamr@2
    67
		ESent       = 0x02,
williamr@2
    68
		EDeleted    = 0x04,
williamr@2
    69
		};
williamr@2
    70
		
williamr@2
    71
	IMPORT_C static CObexHeader* NewL();
williamr@2
    72
	virtual ~CObexHeader();
williamr@2
    73
	IMPORT_C CObexHeader* CopyL() const;
williamr@2
    74
	
williamr@2
    75
	//Sets this object to use the same underlying header as the parameter.
williamr@2
    76
	IMPORT_C void Set(CObexHeader* aHeader);
williamr@2
    77
	//Resets the contents of this header, discarding the underlying data.
williamr@2
    78
	IMPORT_C void Reset();
williamr@2
    79
	
williamr@2
    80
	//Resets and destroys all header attributes.
williamr@2
    81
	IMPORT_C void ResetContents();
williamr@2
    82
	
williamr@2
    83
	IMPORT_C void SetAttributes(TUint16 aAttr);
williamr@2
    84
	IMPORT_C TUint16 Attributes() const;
williamr@2
    85
	
williamr@2
    86
	IMPORT_C THeaderType Type() const;
williamr@2
    87
	
williamr@2
    88
	IMPORT_C TUint8   HI() const;
williamr@2
    89
	IMPORT_C TUint8   AsByte() const;
williamr@2
    90
	IMPORT_C TUint32  AsFourByte() const;
williamr@2
    91
	IMPORT_C const TDesC8&  AsByteSeq() const;
williamr@2
    92
	IMPORT_C const TDesC16& AsUnicode() const;
williamr@2
    93
williamr@2
    94
	IMPORT_C void SetByte(const TUint8 aHI, const TUint8 aByte);
williamr@2
    95
	IMPORT_C void SetFourByte(const TUint8 aHI, const TUint32 aFourByte);
williamr@2
    96
	IMPORT_C void SetByteSeqL(const TUint8 aHI, const TDesC8& aByteSeq);
williamr@2
    97
	IMPORT_C void SetUnicodeL(const TUint8 aHI, const TDesC16& aUnicode);
williamr@2
    98
williamr@2
    99
	IMPORT_C TInt EncodedSize() const;
williamr@2
   100
	
williamr@2
   101
private:
williamr@2
   102
	CObexHeader();
williamr@2
   103
	CObexHeader(CObexUnderlyingHeader* aHeader);
williamr@2
   104
	void ConstructL();
williamr@2
   105
	
williamr@2
   106
private:
williamr@2
   107
	CObexUnderlyingHeader* iHeader;
williamr@2
   108
	};
williamr@2
   109
williamr@2
   110
/**
williamr@2
   111
Used to allow the iterator to decide whether to present a header to
williamr@2
   112
the user, by passing in a possible header HI value.  Headers present
williamr@2
   113
in the object will be presented to the Interested() function in the 
williamr@2
   114
object in which they are held (if received from a remote device
williamr@2
   115
this will be the order in which they were received, otherwise this will
williamr@2
   116
be the order in which they were set).
williamr@2
   117
The function can implement any desired behaviour, including relying on
williamr@2
   118
the order in which the headers are presented.
williamr@2
   119
williamr@2
   120
In case any state is held, the object also provides a Reset() function.
williamr@2
   121
Reset() provides a default empty implementation.
williamr@2
   122
williamr@2
   123
Note: there is no destructor. 
williamr@2
   124
 
williamr@2
   125
@publishedAll
williamr@2
   126
@released
williamr@2
   127
*/
williamr@2
   128
class MObexHeaderCheck 
williamr@2
   129
	{
williamr@2
   130
public:
williamr@2
   131
	/**
williamr@2
   132
	Called to discover is the user is interested in the contents of
williamr@2
   133
	this header.
williamr@2
   134
	
williamr@2
   135
	@param aHI The identifier of the header, including type bits.
williamr@2
   136
	@return ETrue if the user is interested in the contents of this
williamr@2
   137
	header.
williamr@2
   138
	@publishedAll
williamr@2
   139
	@released
williamr@2
   140
	*/
williamr@2
   141
	IMPORT_C virtual TBool Interested(TUint8 aHI) =0;
williamr@2
   142
	
williamr@2
   143
	/**
williamr@2
   144
	Called in response to First() being called on the iterator object.
williamr@2
   145
	The default implementation does nothing---some implementations may
williamr@2
   146
	wish to reset state variables.
williamr@2
   147
	
williamr@2
   148
	@publishedAll
williamr@2
   149
	@released
williamr@2
   150
	*/
williamr@2
   151
	IMPORT_C virtual void Reset();
williamr@2
   152
	
williamr@2
   153
	/**
williamr@2
   154
 	Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
williamr@2
   155
	@param aInterface UID of the interface to return
williamr@2
   156
	@param aObject the container for another interface as specified by aInterface
williamr@2
   157
	@internalComponent
williamr@2
   158
	*/
williamr@2
   159
	IMPORT_C virtual void MOHC_ExtensionInterfaceL(TUid aInterface, void*& aObject);
williamr@2
   160
	};
williamr@2
   161
williamr@2
   162
/**
williamr@2
   163
A collection of headers.  Includes code to filter based on the header HI
williamr@2
   164
value, iterate through the set of interesting headers, and extract headers
williamr@2
   165
with specific HI values.
williamr@2
   166
 
williamr@2
   167
@publishedAll
williamr@2
   168
@released
williamr@2
   169
*/
williamr@2
   170
NONSHARABLE_CLASS(CObexHeaderSet) : public CBase
williamr@2
   171
	{
williamr@2
   172
public:
williamr@2
   173
	IMPORT_C static CObexHeaderSet* NewL();
williamr@2
   174
	IMPORT_C CObexHeaderSet* CopyL();
williamr@2
   175
	IMPORT_C CObexHeaderSet* CopyL(MObexHeaderCheck& aHeaderCheck);
williamr@2
   176
	~CObexHeaderSet();
williamr@2
   177
williamr@2
   178
	IMPORT_C TInt AddHeader(CObexHeader* aHeader);
williamr@2
   179
	IMPORT_C void DeleteCurrentHeader();
williamr@2
   180
williamr@2
   181
	IMPORT_C void SetMask(MObexHeaderCheck* aMask);
williamr@2
   182
	IMPORT_C void DeleteMasked();
williamr@2
   183
	
williamr@2
   184
	IMPORT_C void First() const;
williamr@2
   185
	IMPORT_C TInt This(CObexHeader* aHeader) const;
williamr@2
   186
	IMPORT_C TInt Next() const;
williamr@2
   187
	IMPORT_C TInt Next(TInt aSkip) const;
williamr@2
   188
	IMPORT_C TInt Count() const;
williamr@2
   189
	
williamr@2
   190
	IMPORT_C TInt Find(TUint8 aHI, CObexHeader& aHeader) const;
williamr@2
   191
	
williamr@2
   192
private:
williamr@2
   193
	CObexHeaderSet();
williamr@2
   194
williamr@2
   195
private:
williamr@2
   196
	RPointerArray<CObexHeader> iHeaders;
williamr@2
   197
	mutable MObexHeaderCheck* iMask;
williamr@2
   198
	mutable TInt iPos;
williamr@2
   199
	};
williamr@2
   200
williamr@2
   201
/** 
williamr@2
   202
@publishedAll
williamr@2
   203
@released
williamr@2
   204
*/
williamr@2
   205
NONSHARABLE_CLASS(TObexMatchHeader) : public MObexHeaderCheck
williamr@2
   206
	{
williamr@2
   207
public:
williamr@2
   208
	virtual EXPORT_C TBool Interested(TUint8 aHI);
williamr@2
   209
	IMPORT_C void SetHeader(TUint8 aHI);
williamr@2
   210
williamr@2
   211
private:
williamr@2
   212
	TUint8 iHI;
williamr@2
   213
	
williamr@2
   214
private:
williamr@2
   215
	// This data padding has been added to help prevent future binary compatibility breaks	
williamr@2
   216
	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
williamr@2
   217
	TUint32     iPadding1; 
williamr@2
   218
	TUint32     iPadding2; 	
williamr@2
   219
	};
williamr@2
   220
williamr@2
   221
/** 
williamr@2
   222
@publishedAll
williamr@2
   223
@released
williamr@2
   224
*/
williamr@2
   225
NONSHARABLE_CLASS(TObexMatchHeaderType) : public MObexHeaderCheck
williamr@2
   226
{
williamr@2
   227
public:
williamr@2
   228
	virtual EXPORT_C TBool Interested(TUint8 aHI);
williamr@2
   229
	IMPORT_C void SetType(CObexHeader::THeaderType aType);
williamr@2
   230
williamr@2
   231
private:
williamr@2
   232
	TInt iType;
williamr@2
   233
williamr@2
   234
private:
williamr@2
   235
	// This data padding has been added to help prevent future binary compatibility breaks	
williamr@2
   236
	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
williamr@2
   237
	TUint32     iPadding1; 
williamr@2
   238
	TUint32     iPadding2; 	
williamr@2
   239
	};
williamr@2
   240
williamr@2
   241
#endif // __OBEXHEADERS_H