#ifndef ParsedCookie_h
#define ParsedCookie_h
#include "Cookie.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WTF {
class String;
}
namespace WebCore {
class KURL;
class ParsedCookie : public RefCounted<ParsedCookie> {
public:
static PassRefPtr<ParsedCookie> create(double currentTime) { return adoptRef(new ParsedCookie(currentTime)); }
static PassRefPtr<ParsedCookie> create(const String& name, const String& value, const String& domain, const String& protocol, const String& path, double expiry, double lastAccessed, double creationTime, bool isSecure, bool isHttpOnly) { return adoptRef(new ParsedCookie(name, value, domain, protocol, path, expiry, lastAccessed, creationTime, isSecure, isHttpOnly)); };
const String& name() const { return m_name; }
void setName(const String& name) { m_name = name; }
const String& value() const { return m_value; }
void setValue(const String& value) { m_value = value; }
const String& path() const { return m_path; }
void setPath(const String& path) { m_path = path; }
const String& domain() const { return m_domain; }
void setDomain(const String& domain, bool domainIsIPAddress = false) { m_domain = domain.lower(); m_domainIsIPAddress = domainIsIPAddress; }
const String& protocol() const { return m_protocol; }
void setProtocol(const String& protocol) { m_protocol = protocol; }
double expiry() const { return m_expiry; }
void setExpiry(const String&);
void forceExpire() { m_isForceExpired = true; }
void setMaxAge(const String&);
double lastAccessed() const { return m_lastAccessed; }
void setLastAccessed(double lastAccessed) { m_lastAccessed = lastAccessed;}
double creationTime() const { return m_creationTime; }
void setCreationTime(double creationTime) { m_creationTime = creationTime; }
bool isSecure() const { return m_isSecure; }
void setSecureFlag(bool secure) { m_isSecure = secure; }
bool isHttpOnly() const { return m_isHttpOnly; }
void setIsHttpOnly(bool isHttpOnly) { m_isHttpOnly = isHttpOnly; }
bool isSession() const { return m_isSession; }
bool isHostOnly() const { return !m_domain.startsWith("."); }
bool hasExpired() const;
bool isForceExpired() const { return m_isForceExpired; }
bool isUnderSizeLimit() const;
bool domainIsIPAddress() const { return m_domainIsIPAddress; }
String toString() const;
String toNameValuePair() const;
void appendWebCoreCookie(Vector<Cookie>& cookieVector) const;
private:
ParsedCookie(double currentTime);
ParsedCookie(const String& name, const String& value, const String& domain, const String& protocol, const String& path, double expiry, double lastAccessed, double creationTime, bool isSecure, bool isHttpOnly);
String m_name;
String m_value;
String m_domain;
String m_protocol;
String m_path;
double m_expiry;
double m_creationTime;
double m_lastAccessed;
bool m_isSecure;
bool m_isHttpOnly;
bool m_isSession;
bool m_isForceExpired;
bool m_domainIsIPAddress;
};
}
#endif // ParsedCookie_h