Skip to content

Commit

Permalink
2010-11-20 Tatsuhiro Tsujikawa <[email protected]>
Browse files Browse the repository at this point in the history
	Added CookieStorage::DomainEntry::swap(). Also added non-member
	swap for it.
	* src/CookieStorage.cc
	* src/CookieStorage.h
  • Loading branch information
tatsuhiro-t committed Nov 20, 2010
1 parent c552842 commit 4ed364d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2010-11-20 Tatsuhiro Tsujikawa <[email protected]>

Added CookieStorage::DomainEntry::swap(). Also added non-member
swap for it.
* src/CookieStorage.cc
* src/CookieStorage.h

2010-11-20 Tatsuhiro Tsujikawa <[email protected]>

Made LogFactory::logger_ as SharedHandle<Logger> to make dtor of
Expand Down
24 changes: 24 additions & 0 deletions src/CookieStorage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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

11 changes: 11 additions & 0 deletions src/CookieStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class CookieStorage {
DomainEntry(const DomainEntry& c);
~DomainEntry();

void swap(DomainEntry& c);

DomainEntry& operator=(const DomainEntry& c);

const std::string& getKey() const
Expand Down Expand Up @@ -183,6 +185,15 @@ class CookieStorage {
}
};

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

0 comments on commit 4ed364d

Please sign in to comment.