CCookie Class Reference
class CCookie : public CBase |
Class to store the data that makes up a cookie
Nested Classes and Structures
Public Member Functions |
---|
| ~CCookie() |
IMPORT_C void | AddToRequestL(RHTTPHeaders, TInt) |
IMPORT_C TInt | Attribute(TCookieAttributeName, THTTPHdrVal &) |
TInt
| Attribute(TCookieAttributeName, THTTPHdrVal &, TBool &) |
CCookie * | CloneL(const CCookie &, const TDesC8 &, const TDesC8 &, const TDesC8 &) |
void | CopyFromL(const CCookie &, const TDesC8 &, const TDesC8 &, const TDesC8 &) |
TBool
| Expired() |
TBool
| FromCookie2() |
TBool
| FromNetscapeVersion() |
TBool
| IsUnknownVersion() |
IMPORT_C CCookie * | NewL(RHTTPHeaders, TInt, RStringF, RStringPool, const TUriC8 &) |
IMPORT_C CCookie * | NewL(RStringPool) |
TBool
| Persistent() |
void | RemoveAttribute(TCookieAttributeName) |
TPtrC8
| RemoveQuotes(const TDesC8 &) |
IMPORT_C TInt | SetAttribute(TCookieAttributeName, const THTTPHdrVal &) |
TInt
| SetAttribute(TCookieAttributeName, const THTTPHdrVal &, TBool) |
void | SetCookie2(TBool) |
void | SetFromNetscape(TBool) |
TInt
| Size(TBool) |
RStringPool
| StringPool() |
Private Member Functions |
---|
| CCookie(RStringPool) |
void | AddDefaultPathL(const TUriC8 &) |
void | ConstructL(RHTTPHeaders, TInt, RStringF, const TUriC8 &) |
TBool
| ExpiredNetscapeL(THTTPHdrVal) |
TInt
| FindAttribute(TCookieAttributeName, TCookieAttribute &) |
TInt
| FindTokens(const TDesC8 &, const TDesC8 &, const TInt, TInt *) |
HBufC8 * | GetCleanedDateTimeLC(HBufC8 *) |
TInt
| GetLocalOffset(HBufC8 *, TInt &, TInt &, TInt &) |
TInt
| GetMilitaryOffset(HBufC8 *, TInt &) |
TInt
| GetTimeZone(HBufC8 *, TInt &, TInt &) |
void | Log(TInt) |
void | RemoveAttribute(TInt) |
Public Member Enumerations |
---|
enum | TCookieAttributeName { EName, EValue, EComment, ECommentURI, EDiscard, EDomain, EMaxAge, EPath, EPort, ESecure, EVersion, EExpires, EDate, ELastAttribute } |
Constructor & Destructor Documentation
~CCookie()
IMPORT_C | ~CCookie | ( | ) | [virtual] |
Member Functions Documentation
AddDefaultPathL(const TUriC8 &)
void | AddDefaultPathL | ( | const TUriC8 & | aUri | ) | [private] |
When the cookie does not have a Path attribute, we have to add a default Path attribute. This method does this addition.
Parameters
const TUriC8 & aUri | An initialized URI parser. |
AddToRequestL(RHTTPHeaders, TInt)
This method writes the cookie (i.e. its attributes) into the specified part of the HTTP header. The method may leave if writing is not successful (e.g. when RHTTPHeaders::SetParamL leaves) or if the cookie is not properly initialized.
Parameters
RHTTPHeaders aRequestHeaders | The current HTTP header collection to which we add this cookie, |
TInt aPartIndex | The part of the header. |
Attribute(TCookieAttributeName, THTTPHdrVal &)
Attribute retrieves the value of an attribute
Attribute(TCookieAttributeName, THTTPHdrVal &, TBool &)
Attribute retrieves the value of an attribute
Parameters
TCookieAttributeName aAttributeName | Identifies the attribute |
THTTPHdrVal & aAttributeVal | The value being retrieved |
TBool & aDefaulted | A TBool indicating whether the current attribute's value is defaulted or specified. |
CloneL(const CCookie &, const TDesC8 &, const TDesC8 &, const TDesC8 &)
ConstructL(RHTTPHeaders, TInt, RStringF, const TUriC8 &)
Parameters
RHTTPHeaders aRequestHeaders | A collection of header fields associated with the current HTTP message, |
TInt aPartIndex | The index of the part in the header, |
RStringF aFieldName | The HTTP header name, |
const TUriC8 & aUri | HTTP request's URI. |
CopyFromL(const CCookie &, const TDesC8 &, const TDesC8 &, const TDesC8 &)
Copy from an already existing one.
Parameters
const CCookie & aCopyFrom | The already existing CCookie object |
const TDesC8 & aDomain | |
const TDesC8 & aPath | |
const TDesC8 & aPort | |
Expired()
Returns whether This cookie has expired or not.
ExpiredNetscapeL(THTTPHdrVal)
Determines if the cookie had expired in case of Netscape style Method may leave with KErrNoMemory KErrNotFound, if parsing the date string fails (not a well formed string)
Parameters
THTTPHdrVal aAttrVal | The THTTPHdrVal holding the Expires date as a string |
FindAttribute(TCookieAttributeName, TCookieAttribute &)
Finds the specified attribute in this cookie
FindTokens(const TDesC8 &, const TDesC8 &, const TInt, TInt *)
TInt
| FindTokens | ( | const TDesC8 & | aString, |
| const TDesC8 & | aTokenSeparators, |
| const TInt | aTokenCount, |
| TInt * | aTokens |
| ) | const [private] |
Parameters
const TDesC8 & aString | string to be tokenized |
const TDesC8 & aTokenSeparators | separator characters |
const TInt aTokenCount | expected number of tokens |
TInt * aTokens | position of token separators found in aString |
FromCookie2()
TBool
| FromCookie2 | ( | ) | const [inline] |
Did this cookie come from a SetCookie2 header?
FromNetscapeVersion()
TBool
| FromNetscapeVersion | ( | ) | const [inline] |
Did this cookie come from a Netscape-version header?
GetCleanedDateTimeLC(HBufC8 *)
Takes an HTTP header date-time information and returnes it in a format supported by TTime.
GetLocalOffset(HBufC8 *, TInt &, TInt &, TInt &)
GetMilitaryOffset(HBufC8 *, TInt &)
GetTimeZone(HBufC8 *, TInt &, TInt &)
IsUnknownVersion()
TBool
| IsUnknownVersion | ( | ) | const |
Returns whether the cookie's Version attribute is known or not.
Log(TInt)
void | Log | ( | TInt | aAssociatedId = 0 | ) | const [private] |
NewL(RHTTPHeaders, TInt, RStringF, RStringPool, const TUriC8 &)
Parameters
RHTTPHeaders aRequestHeaders | A collection of header fields associated with the current HTTP message, |
TInt aPartIndex | The index of the part in the header, |
RStringF aFieldName | The HTTP header name, |
RStringPool aStringPool | The current string pool, |
const TUriC8 & aUri | HTTP request's URI. |
Persistent()
Returns whether This cookie is persistent or not.
RemoveAttribute(TCookieAttributeName)
Removes a cookie attribute. The attribute is closed, removed from the attribute list and the cookie size is also updated.
RemoveAttribute(TInt)
void | RemoveAttribute | ( | TInt | aIndex | ) | [private] |
Removes a cookie attribute. The attribute is closed, removed from the attribute list and the cookie size is also updated.
Parameters
TInt aIndex | The position of the cooke attribute in the attribute list. |
RemoveQuotes(const TDesC8 &)
Returns a descriptor which is equivalent to the input descriptor, but without the surrounding quotation marks. This method always returns the appropriate string even if there are no quotation marks, or at least one of them is missing. This is required because cookie attributes may be surrounded by double quotes.
Parameters
const TDesC8 & aDes | The descriptor to be cleaned. |
SetAttribute(TCookieAttributeName, const THTTPHdrVal &)
SetAttribute sets an attribute on the cookie. Adding an attribute where one exists will replace the existing one
SetAttribute(TCookieAttributeName, const THTTPHdrVal &, TBool)
SetAttribute sets an attribute on the cookie. Adding an attribute where one exists will replace the existing one
Parameters
TCookieAttributeName aAttributeName | identifies the attribute |
const THTTPHdrVal & aAttributeVal | the value being set |
TBool aDefaulted | a TBool indicating whether it is a defaulted or a supplied value |
SetCookie2(TBool)
void | SetCookie2 | ( | TBool | aFromCookie2 | ) | [inline] |
Use this method to specify whether this cookie came from a SetCookie2 header.
Parameters
TBool aFromCookie2 | ETrue, if the cookie came from a SetCookie2 header, EFalse otherwise. |
SetFromNetscape(TBool)
void | SetFromNetscape | ( | TBool | aFromNetscape | ) | [inline] |
Use this method to specify whether this cookie is a Netscape style one or an RFC compliant.
Parameters
TBool aFromNetscape | ETrue, if the cookie is a Netscape style one, EFalse otherwise. |
Size(TBool)
TInt
| Size | ( | TBool | aSuppressDefaulted | ) | const [inline] |
Returns the number of bytes this cookie would require if it was stored in a flat buffer and one attribute followed the other. Note : the attributes are stored in a way that we first write out the size (TInt) of the attribute in question and then the attribute value. E.g. assuming a NAME attribute with the value of SESSIONID, we write out 9 as the length of NAME (again, stored as TInt) and then write out the value of NAME (i.e. SESSIONID).
Parameters
TBool aSuppressDefaulted | If ETrue, the method does not add the size of defaulted attributes to the overall size of the cookie. |
StringPool()
Returns this cookie's StringPool.
Member Enumerations Documentation
Enum TCookieAttributeName
Enumeration of all the elements of data that make up a cookie
Enumerators
EName | |
EValue | |
EComment | |
ECommentURI | |
EDiscard | |
EDomain | |
EMaxAge | |
EPath | |
EPort | |
ESecure | |
EVersion | |
EExpires | |
EDate | |
ELastAttribute | |
Member Data Documentation
RArray< TCookieAttribute > iAttributes
Array of the attributes of this cookie
TBool
iNetscape
Flag indicating whether this cookie is Netscape or RFC compliant It is important to know it as they have different fields, different defaulting and handling.
TTime
iReceivedTime
TTime
| iReceivedTime | [private] |
TBool
iSetCookie2
TBool
| iSetCookie2 | [private] |
Flag indicating whether this cookie was received in a SetCookie2 header
RStringPool
iStringPool
String pool that can be used by this cookie
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.