2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added CookieStorage::DomainEntry::swap(). Also added non-member
	swap for it.
	* src/CookieStorage.cc
	* src/CookieStorage.h
pull/1/head
Tatsuhiro Tsujikawa 2010-11-20 14:05:58 +00:00
parent c552842505
commit 4ed364d772
3 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added CookieStorage::DomainEntry::swap(). Also added non-member
swap for it.
* src/CookieStorage.cc
* src/CookieStorage.h
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Made LogFactory::logger_ as SharedHandle<Logger> to make dtor of

View File

@ -79,6 +79,19 @@ CookieStorage::DomainEntry& CookieStorage::DomainEntry::operator=
return *this;
}
void CookieStorage::DomainEntry::swap(CookieStorage::DomainEntry& c)
{
using std::swap;
swap(key_, c.key_);
swap(lastAccessTime_, c.lastAccessTime_);
swap(cookies_, c.cookies_);
}
void swap(CookieStorage::DomainEntry& a, CookieStorage::DomainEntry& b)
{
a.swap(b);
}
bool CookieStorage::DomainEntry::addCookie(const Cookie& cookie, time_t now)
{
setLastAccessTime(now);
@ -395,3 +408,14 @@ bool CookieStorage::saveNsFormat(const std::string& filename)
}
} // namespace aria2
namespace std {
template<>
void swap<aria2::CookieStorage::DomainEntry>
(aria2::CookieStorage::DomainEntry& a,
aria2::CookieStorage::DomainEntry& b)
{
a.swap(b);
}
} // namespace std

View File

@ -67,6 +67,8 @@ public:
DomainEntry(const DomainEntry& c);
~DomainEntry();
void swap(DomainEntry& c);
DomainEntry& operator=(const DomainEntry& c);
const std::string& getKey() const
@ -183,6 +185,15 @@ public:
}
};
void swap(CookieStorage::DomainEntry& a, CookieStorage::DomainEntry& b);
} // namespace aria2
namespace std {
template<>
void swap<aria2::CookieStorage::DomainEntry>
(aria2::CookieStorage::DomainEntry& a,
aria2::CookieStorage::DomainEntry& b);
} // namespace std
#endif // D_COOKIE_STORAGE_H