diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
commit | a7a285eb61dd83afc892bc1d64ffe14b9f1426a3 (patch) | |
tree | 08d2efcaec46e5f5702d9e336a0e8ba7e636aff9 /src/Common/Backends | |
parent | b40ba0cf91603b695f1f2380cbd39966a458f22f (diff) | |
download | mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.tar mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.zip |
Completely migrate to Unicode String class
Diffstat (limited to 'src/Common/Backends')
-rw-r--r-- | src/Common/Backends/NetworkUserBackend.cpp | 75 |
1 files changed, 30 insertions, 45 deletions
diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp index 87d9b4f..f46f588 100644 --- a/src/Common/Backends/NetworkUserBackend.cpp +++ b/src/Common/Backends/NetworkUserBackend.cpp @@ -31,9 +31,7 @@ const Core::String NetworkUserBackend::name("NetworkUserBackend"); void NetworkUserBackend::SimpleUserRequest::sendRequest() { XmlData packet; packet.setType(type); - - if(!timestamp.is_not_a_date_time()) - packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); + packet.set("timestamp", timestamp); sendPacket(packet); } @@ -42,9 +40,7 @@ void NetworkUserBackend::IdUserRequest::sendRequest() { XmlData packet; packet.setType(type); packet.set(idType, id); - - if(!timestamp.is_not_a_date_time()) - packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); + packet.set("timestamp", timestamp); sendPacket(packet); } @@ -53,9 +49,7 @@ void NetworkUserBackend::NameUserRequest::sendRequest() { XmlData packet; packet.setType(type); packet.set("name", name); - - if(!timestamp.is_not_a_date_time()) - packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); + packet.set("timestamp", timestamp); sendPacket(packet); } @@ -137,10 +131,9 @@ boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend:: throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *users = result.first->getList("users"); @@ -173,10 +166,9 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfo(unsigned long throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long uid2 = result.first->get<unsigned long>("uid"); @@ -205,10 +197,9 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const Co throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long uid = result.first->get<unsigned long>("uid"); @@ -237,10 +228,9 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getUserGro throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *groups = result.first->getList("groups"); @@ -269,10 +259,9 @@ boost::shared_ptr<const std::map<unsigned long, GroupInfo> > NetworkUserBackend: throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *groups = result.first->getList("groups"); @@ -302,10 +291,9 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfo(unsigned lon throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long gid2 = result.first->get<unsigned long>("gid"); @@ -328,10 +316,9 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long gid = result.first->get<unsigned long>("gid"); @@ -354,10 +341,9 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *users = result.first->getList("users"); @@ -386,10 +372,9 @@ boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUse throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *list = result.first->getList("userGroupList"); |