1.1 --- a/epoc32/include/obexheaders.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/obexheaders.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,241 @@
1.4 -obexheaders.h
1.5 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __OBEXHEADERS_H
1.29 +#define __OBEXHEADERS_H
1.30 +
1.31 +#include <obextypes.h>
1.32 +
1.33 +/**
1.34 +Encapsulates an Obex header.
1.35 +
1.36 +This class provides the ability to hold a header of any of the Obex
1.37 +supported types as a native Symbian OS type.
1.38 +
1.39 +A header may also have one or more attributes set. These are used by
1.40 +the object which owns the header collection so that it can keep track
1.41 +of which headers should be sent (!(ESuppressed || EDeleted)), which have
1.42 +been sent (ESent), and whether the header should be deleted (EDeleted).
1.43 +Deletion is a special case---any operation on the Object which causes
1.44 +a scan of the headers will trigger deletion of any marked headers.
1.45 +This is required as they are owned by the Object, but can be accessed
1.46 +seperately (including through the creator keeping a pointer to the
1.47 +header).
1.48 +
1.49 +@see CObexBaseObject
1.50 +@publishedAll
1.51 +@released
1.52 +*/
1.53 +NONSHARABLE_CLASS(CObexHeader) : public CBase
1.54 + {
1.55 +public:
1.56 + // Requires friendship with CObexBaseObject to support some aspects of the
1.57 + // legacy API (specifically the HTTP accessor method).
1.58 + friend class CObexBaseObject;
1.59 +
1.60 + enum THeaderType
1.61 + {
1.62 + EUnicode = 0x00,
1.63 + EByteSeq = 0x01,
1.64 + EByte = 0x02,
1.65 + EFourByte = 0x03
1.66 + };
1.67 +
1.68 + enum THeaderAttr
1.69 + {
1.70 + ESuppressed = 0x01,
1.71 + ESent = 0x02,
1.72 + EDeleted = 0x04,
1.73 + };
1.74 +
1.75 + IMPORT_C static CObexHeader* NewL();
1.76 + virtual ~CObexHeader();
1.77 + IMPORT_C CObexHeader* CopyL() const;
1.78 +
1.79 + //Sets this object to use the same underlying header as the parameter.
1.80 + IMPORT_C void Set(CObexHeader* aHeader);
1.81 + //Resets the contents of this header, discarding the underlying data.
1.82 + IMPORT_C void Reset();
1.83 +
1.84 + //Resets and destroys all header attributes.
1.85 + IMPORT_C void ResetContents();
1.86 +
1.87 + IMPORT_C void SetAttributes(TUint16 aAttr);
1.88 + IMPORT_C TUint16 Attributes() const;
1.89 +
1.90 + IMPORT_C THeaderType Type() const;
1.91 +
1.92 + IMPORT_C TUint8 HI() const;
1.93 + IMPORT_C TUint8 AsByte() const;
1.94 + IMPORT_C TUint32 AsFourByte() const;
1.95 + IMPORT_C const TDesC8& AsByteSeq() const;
1.96 + IMPORT_C const TDesC16& AsUnicode() const;
1.97 +
1.98 + IMPORT_C void SetByte(const TUint8 aHI, const TUint8 aByte);
1.99 + IMPORT_C void SetFourByte(const TUint8 aHI, const TUint32 aFourByte);
1.100 + IMPORT_C void SetByteSeqL(const TUint8 aHI, const TDesC8& aByteSeq);
1.101 + IMPORT_C void SetUnicodeL(const TUint8 aHI, const TDesC16& aUnicode);
1.102 +
1.103 + IMPORT_C TInt EncodedSize() const;
1.104 +
1.105 +private:
1.106 + CObexHeader();
1.107 + CObexHeader(CObexUnderlyingHeader* aHeader);
1.108 + void ConstructL();
1.109 +
1.110 +private:
1.111 + CObexUnderlyingHeader* iHeader;
1.112 + };
1.113 +
1.114 +/**
1.115 +Used to allow the iterator to decide whether to present a header to
1.116 +the user, by passing in a possible header HI value. Headers present
1.117 +in the object will be presented to the Interested() function in the
1.118 +object in which they are held (if received from a remote device
1.119 +this will be the order in which they were received, otherwise this will
1.120 +be the order in which they were set).
1.121 +The function can implement any desired behaviour, including relying on
1.122 +the order in which the headers are presented.
1.123 +
1.124 +In case any state is held, the object also provides a Reset() function.
1.125 +Reset() provides a default empty implementation.
1.126 +
1.127 +Note: there is no destructor.
1.128 +
1.129 +@publishedAll
1.130 +@released
1.131 +*/
1.132 +class MObexHeaderCheck
1.133 + {
1.134 +public:
1.135 + /**
1.136 + Called to discover is the user is interested in the contents of
1.137 + this header.
1.138 +
1.139 + @param aHI The identifier of the header, including type bits.
1.140 + @return ETrue if the user is interested in the contents of this
1.141 + header.
1.142 + @publishedAll
1.143 + @released
1.144 + */
1.145 + IMPORT_C virtual TBool Interested(TUint8 aHI) =0;
1.146 +
1.147 + /**
1.148 + Called in response to First() being called on the iterator object.
1.149 + The default implementation does nothing---some implementations may
1.150 + wish to reset state variables.
1.151 +
1.152 + @publishedAll
1.153 + @released
1.154 + */
1.155 + IMPORT_C virtual void Reset();
1.156 +
1.157 + /**
1.158 + Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
1.159 + @param aInterface UID of the interface to return
1.160 + @param aObject the container for another interface as specified by aInterface
1.161 + @internalComponent
1.162 + */
1.163 + IMPORT_C virtual void MOHC_ExtensionInterfaceL(TUid aInterface, void*& aObject);
1.164 + };
1.165 +
1.166 +/**
1.167 +A collection of headers. Includes code to filter based on the header HI
1.168 +value, iterate through the set of interesting headers, and extract headers
1.169 +with specific HI values.
1.170 +
1.171 +@publishedAll
1.172 +@released
1.173 +*/
1.174 +NONSHARABLE_CLASS(CObexHeaderSet) : public CBase
1.175 + {
1.176 +public:
1.177 + IMPORT_C static CObexHeaderSet* NewL();
1.178 + IMPORT_C CObexHeaderSet* CopyL();
1.179 + IMPORT_C CObexHeaderSet* CopyL(MObexHeaderCheck& aHeaderCheck);
1.180 + ~CObexHeaderSet();
1.181 +
1.182 + IMPORT_C TInt AddHeader(CObexHeader* aHeader);
1.183 + IMPORT_C void DeleteCurrentHeader();
1.184 +
1.185 + IMPORT_C void SetMask(MObexHeaderCheck* aMask);
1.186 + IMPORT_C void DeleteMasked();
1.187 +
1.188 + IMPORT_C void First() const;
1.189 + IMPORT_C TInt This(CObexHeader* aHeader) const;
1.190 + IMPORT_C TInt Next() const;
1.191 + IMPORT_C TInt Next(TInt aSkip) const;
1.192 + IMPORT_C TInt Count() const;
1.193 +
1.194 + IMPORT_C TInt Find(TUint8 aHI, CObexHeader& aHeader) const;
1.195 +
1.196 +private:
1.197 + CObexHeaderSet();
1.198 +
1.199 +private:
1.200 + RPointerArray<CObexHeader> iHeaders;
1.201 + mutable MObexHeaderCheck* iMask;
1.202 + mutable TInt iPos;
1.203 + };
1.204 +
1.205 +/**
1.206 +@publishedAll
1.207 +@released
1.208 +*/
1.209 +NONSHARABLE_CLASS(TObexMatchHeader) : public MObexHeaderCheck
1.210 + {
1.211 +public:
1.212 + virtual EXPORT_C TBool Interested(TUint8 aHI);
1.213 + IMPORT_C void SetHeader(TUint8 aHI);
1.214 +
1.215 +private:
1.216 + TUint8 iHI;
1.217 +
1.218 +private:
1.219 + // This data padding has been added to help prevent future binary compatibility breaks
1.220 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.221 + TUint32 iPadding1;
1.222 + TUint32 iPadding2;
1.223 + };
1.224 +
1.225 +/**
1.226 +@publishedAll
1.227 +@released
1.228 +*/
1.229 +NONSHARABLE_CLASS(TObexMatchHeaderType) : public MObexHeaderCheck
1.230 +{
1.231 +public:
1.232 + virtual EXPORT_C TBool Interested(TUint8 aHI);
1.233 + IMPORT_C void SetType(CObexHeader::THeaderType aType);
1.234 +
1.235 +private:
1.236 + TInt iType;
1.237 +
1.238 +private:
1.239 + // This data padding has been added to help prevent future binary compatibility breaks
1.240 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.241 + TUint32 iPadding1;
1.242 + TUint32 iPadding2;
1.243 + };
1.244 +
1.245 +#endif // __OBEXHEADERS_H