00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00040 #ifndef BTCOOKIE_H
00041 #define BTCOOKIE_H
00042
00043 #include "StringHash.h"
00044 #include "wtf/HashMap.h"
00045 #include "PlatformString.h"
00046
00047 using WebCore::String;
00048
00054 class BTCookie {
00055 public:
00056 BTCookie() : m_expires(0), m_secure(false) {}
00057
00058 BTCookie(String& name, String& value, String& , String& ) :
00059 m_name(name), m_value(value), m_expires(0), m_secure(false)
00060 {}
00061 ~BTCookie() {}
00062
00066 const String& name() const { return m_name; }
00067
00071 const String& value() const { return m_value; }
00072
00076 const String& path() const { return m_path; }
00077
00081 const String& domain() const { return m_domain; }
00082
00086 const double expireDate() const { return m_expires; }
00087
00091 bool isDomain() const { return !m_domain.isEmpty(); }
00092
00096 bool isSecure() const { return m_secure; }
00097
00102 void initFromString(const String& cookie);
00103
00108 String createBackupStringFromCookie();
00109
00113 void initCookieFromBackupString(String cookie, String domain);
00114
00115 private:
00116 String extractValueIn(const char* name, const String& cookie);
00117 String m_name;
00118 String m_value;
00119 String m_domain;
00120 String m_path;
00121 double m_expires;
00122 bool m_secure;
00123 };
00124
00129 class BTCookieMap {
00130 public:
00131 BTCookieMap() : m_count(0) {}
00132 ~BTCookieMap() {}
00138 int add(const BTCookie& cookie);
00139
00140 String createBackupStringFromCookies();
00141
00145 String getNameValuePairs();
00146
00152 String getNameValuePairs(String path, bool siteIsSecure);
00153
00154 HashMap<String, BTCookie> getMap() { return m_cookieMap; }
00155
00156 private:
00158 HashMap<String, BTCookie> m_cookieMap;
00159
00161 unsigned short m_count;
00162 };
00163
00164 #endif // BTCOOKIE_H
00165
00166