mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
0fd9123eac
This patch was generated by a script. Here's the source of the script for future reference: function convert() { echo "Converting $1 to $2..." find . ! -wholename "*nsprpub*" \ ! -wholename "*security/nss*" \ ! -wholename "*/.hg*" \ ! -wholename "obj-ff-dbg*" \ ! -name nsXPCOMCID.h \ ! -name prtypes.h \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert PRInt8 int8_t convert PRUint8 uint8_t convert PRInt16 int16_t convert PRUint16 uint16_t convert PRInt32 int32_t convert PRUint32 uint32_t convert PRInt64 int64_t convert PRUint64 uint64_t convert PRIntn int convert PRUintn unsigned convert PRSize size_t convert PROffset32 int32_t convert PROffset64 int64_t convert PRPtrdiff ptrdiff_t convert PRFloat64 double
121 lines
4.7 KiB
C++
121 lines
4.7 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef nsCookie_h__
|
|
#define nsCookie_h__
|
|
|
|
#include "nsICookie.h"
|
|
#include "nsICookie2.h"
|
|
#include "nsString.h"
|
|
|
|
/**
|
|
* The nsCookie class is the main cookie storage medium for use within cookie
|
|
* code. It implements nsICookie2, which extends nsICookie, a frozen interface
|
|
* for xpcom access of cookie objects.
|
|
*/
|
|
|
|
/******************************************************************************
|
|
* nsCookie:
|
|
* implementation
|
|
******************************************************************************/
|
|
|
|
class nsCookie : public nsICookie2
|
|
{
|
|
public:
|
|
// nsISupports
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSICOOKIE
|
|
NS_DECL_NSICOOKIE2
|
|
|
|
private:
|
|
// for internal use only. see nsCookie::Create().
|
|
nsCookie(const char *aName,
|
|
const char *aValue,
|
|
const char *aHost,
|
|
const char *aPath,
|
|
const char *aEnd,
|
|
int64_t aExpiry,
|
|
int64_t aLastAccessed,
|
|
int64_t aCreationTime,
|
|
bool aIsSession,
|
|
bool aIsSecure,
|
|
bool aIsHttpOnly)
|
|
: mName(aName)
|
|
, mValue(aValue)
|
|
, mHost(aHost)
|
|
, mPath(aPath)
|
|
, mEnd(aEnd)
|
|
, mExpiry(aExpiry)
|
|
, mLastAccessed(aLastAccessed)
|
|
, mCreationTime(aCreationTime)
|
|
, mIsSession(aIsSession != false)
|
|
, mIsSecure(aIsSecure != false)
|
|
, mIsHttpOnly(aIsHttpOnly != false)
|
|
{
|
|
}
|
|
|
|
public:
|
|
// Generate a unique and monotonically increasing creation time. See comment
|
|
// in nsCookie.cpp.
|
|
static int64_t GenerateUniqueCreationTime(int64_t aCreationTime);
|
|
|
|
// public helper to create an nsCookie object. use |operator delete|
|
|
// to destroy an object created by this method.
|
|
static nsCookie * Create(const nsACString &aName,
|
|
const nsACString &aValue,
|
|
const nsACString &aHost,
|
|
const nsACString &aPath,
|
|
int64_t aExpiry,
|
|
int64_t aLastAccessed,
|
|
int64_t aCreationTime,
|
|
bool aIsSession,
|
|
bool aIsSecure,
|
|
bool aIsHttpOnly);
|
|
|
|
virtual ~nsCookie() {}
|
|
|
|
// fast (inline, non-xpcom) getters
|
|
inline const nsDependentCString Name() const { return nsDependentCString(mName, mValue - 1); }
|
|
inline const nsDependentCString Value() const { return nsDependentCString(mValue, mHost - 1); }
|
|
inline const nsDependentCString Host() const { return nsDependentCString(mHost, mPath - 1); }
|
|
inline const nsDependentCString RawHost() const { return nsDependentCString(IsDomain() ? mHost + 1 : mHost, mPath - 1); }
|
|
inline const nsDependentCString Path() const { return nsDependentCString(mPath, mEnd); }
|
|
inline int64_t Expiry() const { return mExpiry; } // in seconds
|
|
inline int64_t LastAccessed() const { return mLastAccessed; } // in microseconds
|
|
inline int64_t CreationTime() const { return mCreationTime; } // in microseconds
|
|
inline bool IsSession() const { return mIsSession; }
|
|
inline bool IsDomain() const { return *mHost == '.'; }
|
|
inline bool IsSecure() const { return mIsSecure; }
|
|
inline bool IsHttpOnly() const { return mIsHttpOnly; }
|
|
|
|
// setters
|
|
inline void SetExpiry(int64_t aExpiry) { mExpiry = aExpiry; }
|
|
inline void SetLastAccessed(int64_t aTime) { mLastAccessed = aTime; }
|
|
inline void SetIsSession(bool aIsSession) { mIsSession = (bool) aIsSession; }
|
|
// Set the creation time manually, overriding the monotonicity checks in
|
|
// Create(). Use with caution!
|
|
inline void SetCreationTime(int64_t aTime) { mCreationTime = aTime; }
|
|
|
|
protected:
|
|
// member variables
|
|
// we use char* ptrs to store the strings in a contiguous block,
|
|
// so we save on the overhead of using nsCStrings. However, we
|
|
// store a terminating null for each string, so we can hand them
|
|
// out as nsAFlatCStrings.
|
|
const char *mName;
|
|
const char *mValue;
|
|
const char *mHost;
|
|
const char *mPath;
|
|
const char *mEnd;
|
|
int64_t mExpiry;
|
|
int64_t mLastAccessed;
|
|
int64_t mCreationTime;
|
|
bool mIsSession;
|
|
bool mIsSecure;
|
|
bool mIsHttpOnly;
|
|
};
|
|
|
|
#endif // nsCookie_h__
|