本文整理汇总了C++中Cookie::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Cookie::getName方法的具体用法?C++ Cookie::getName怎么用?C++ Cookie::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie::getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assertTrue
TEST(CookieDecoderTest, testDecodingCommaSeparatedClientSideCookies) {
String source =
"$Version=\"1\"; session_id=\"1234\", " +
"$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";
Set<Cookie> cookies = CookieDecoder.decode(source);
Iterator<Cookie> it = cookies.iterator();
Cookie c;
assertTrue(it.hasNext());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("session_id", c.getName());
assertEquals("1234", c.getValue());
assertNull(c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertTrue(it.hasNext());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("session_id", c.getName());
assertEquals("1111", c.getValue());
assertEquals(".cracker.edu", c.getDomain());
assertNull(c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertFalse(it.hasNext());
}
示例2: assertEquals
TEST(CookieDecoderTest, testDecodingClientSideCookies) {
String source = "$Version=\"1\"; " +
"Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
Set<Cookie> cookies = CookieDecoder.decode(source);
Iterator<Cookie> it = cookies.iterator();
Cookie c;
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("Part_Number", c.getName());
assertEquals("Rocket_Launcher_0001", c.getValue());
assertEquals("/acme", c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("Part_Number", c.getName());
assertEquals("Riding_Rocket_0023", c.getValue());
assertEquals("/acme/ammo", c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertFalse(it.hasNext());
}
示例3: addCookie
CGI* CGI::addCookie(QString strName, QString strValue, QDateTime qdtExpiration, QString strDomain, QString strPath, bool bHttpOnly, bool bSecure) {
// Iterate over the existing new cookies
for (int intCookie = 0; intCookie < this->mNewCookies.size(); ++intCookie) {
// Localize the cookie
Cookie structNewCookie = this->mNewCookies.at(intCookie);
// Check the name
if (structNewCookie.getName() == strName) {
// Delete the cookie
this->mNewCookies.removeAt(intCookie);
// We're done
break;
}
}
// Create the new structure
Cookie structNewCookie(strName, strValue, qdtExpiration, strDomain, strPath, bHttpOnly, bSecure);
// Add the cookie to the instance
this->mNewCookies.append(structNewCookie);
// Return the instance
return this;
}
示例4: escapeCookies
string CookieList::escapeCookies() const
{
string cookie_parameter("");
bool first = true;
auto it = cookie_list_.cbegin();
while(it != cookie_list_.cend())
{
if(first == true)
{
first = false;
}
else
{
cookie_parameter += ";";
}
Cookie cookie = (*it);
cookie_parameter += (cookie.getName() + "=" + cookie.getValue());
++it;
}
return cookie_parameter;
}
示例5: clear
void Cookies::clear(Cookie & cookie)
{
cookie.setValue("deleted");
cookie.setExpires(QDateTime::fromTime_t(0));
m_cookies[cookie.getName()] = cookie;
}
示例6: set
void Cookies::set(const Cookie & cookie)
{
m_cookies[cookie.getName()] = cookie;
}