summaryrefslogtreecommitdiffstats
path: root/src/Common/Backends
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-09-27 19:58:24 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-09-27 19:58:24 +0200
commitb40ba0cf91603b695f1f2380cbd39966a458f22f (patch)
tree1fec48ddc59eb1392fac38495b230e4b2cbf7528 /src/Common/Backends
parente1d8490f0654a3da0b900407d80d91d8d0da68c8 (diff)
downloadmad-b40ba0cf91603b695f1f2380cbd39966a458f22f.tar
mad-b40ba0cf91603b695f1f2380cbd39966a458f22f.zip
Use Unicode-aware String class instead of std::string
Diffstat (limited to 'src/Common/Backends')
-rw-r--r--src/Common/Backends/NetworkUserBackend.cpp50
-rw-r--r--src/Common/Backends/NetworkUserBackend.h34
2 files changed, 42 insertions, 42 deletions
diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp
index 1b528ab..87d9b4f 100644
--- a/src/Common/Backends/NetworkUserBackend.cpp
+++ b/src/Common/Backends/NetworkUserBackend.cpp
@@ -26,14 +26,14 @@ namespace Mad {
namespace Common {
namespace Backends {
-const std::string NetworkUserBackend::name("NetworkUserBackend");
+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));
+ packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
sendPacket(packet);
}
@@ -44,7 +44,7 @@ void NetworkUserBackend::IdUserRequest::sendRequest() {
packet.set(idType, id);
if(!timestamp.is_not_a_date_time())
- packet.set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
sendPacket(packet);
}
@@ -55,7 +55,7 @@ void NetworkUserBackend::NameUserRequest::sendRequest() {
packet.set("name", name);
if(!timestamp.is_not_a_date_time())
- packet.set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
sendPacket(packet);
}
@@ -138,7 +138,7 @@ boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend::
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -148,9 +148,9 @@ boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend::
boost::shared_ptr<std::map<unsigned long, UserInfo> > userList(new std::map<unsigned long, UserInfo>);
for(XmlData::List::const_iterator user = users->begin(); user != users->end(); ++user) {
- UserInfo userInfo(user->get<unsigned long>("uid"), user->get<const std::string&>("username"));
+ UserInfo userInfo(user->get<unsigned long>("uid"), user->get<const Core::String&>("username"));
userInfo.setGid(user->get<unsigned long>("gid"));
- userInfo.setFullName(user->get<const std::string&>("fullName"));
+ userInfo.setFullName(user->get<const Core::String&>("fullName"));
userList->insert(std::make_pair(userInfo.getUid(), userInfo));
}
@@ -174,7 +174,7 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfo(unsigned long
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -182,10 +182,10 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfo(unsigned long
unsigned long uid2 = result.first->get<unsigned long>("uid");
if(uid2) {
- boost::shared_ptr<UserInfo> userInfo(new UserInfo(uid2, result.first->get<const std::string&>("username")));
+ boost::shared_ptr<UserInfo> userInfo(new UserInfo(uid2, result.first->get<const Core::String&>("username")));
userInfo->setGid(result.first->get<unsigned long>("gid"));
- userInfo->setFullName(result.first->get<const std::string&>("fullName"));
+ userInfo->setFullName(result.first->get<const Core::String&>("fullName"));
return userInfo;
}
@@ -193,7 +193,7 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfo(unsigned long
return boost::shared_ptr<const UserInfo>();
}
-boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const std::string &name, boost::posix_time::ptime *timestamp) throw(Core::Exception) {
+boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const Core::String &name, boost::posix_time::ptime *timestamp) throw(Core::Exception) {
application->getThreadManager()->detach();
boost::shared_ptr<NameUserRequest> request(new NameUserRequest(application, "GetUserInfo", name, timestamp));
@@ -206,7 +206,7 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const st
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -214,10 +214,10 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const st
unsigned long uid = result.first->get<unsigned long>("uid");
if(uid) {
- boost::shared_ptr<UserInfo> userInfo(new UserInfo(uid, result.first->get<const std::string&>("username")));
+ boost::shared_ptr<UserInfo> userInfo(new UserInfo(uid, result.first->get<const Core::String&>("username")));
userInfo->setGid(result.first->get<unsigned long>("gid"));
- userInfo->setFullName(result.first->get<const std::string&>("fullName"));
+ userInfo->setFullName(result.first->get<const Core::String&>("fullName"));
return userInfo;
}
@@ -238,7 +238,7 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getUserGro
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -270,7 +270,7 @@ boost::shared_ptr<const std::map<unsigned long, GroupInfo> > NetworkUserBackend:
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -280,7 +280,7 @@ boost::shared_ptr<const std::map<unsigned long, GroupInfo> > NetworkUserBackend:
boost::shared_ptr<std::map<unsigned long, GroupInfo> > groupList(new std::map<unsigned long, GroupInfo>);
for(XmlData::List::const_iterator group = groups->begin(); group != groups->end(); ++group) {
- GroupInfo groupInfo(group->get<unsigned long>("gid"), group->get<const std::string&>("name"));
+ GroupInfo groupInfo(group->get<unsigned long>("gid"), group->get<const Core::String&>("name"));
groupList->insert(std::make_pair(groupInfo.getGid(), groupInfo));
}
@@ -303,7 +303,7 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfo(unsigned lon
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -311,12 +311,12 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfo(unsigned lon
unsigned long gid2 = result.first->get<unsigned long>("gid");
if(gid2)
- return boost::shared_ptr<GroupInfo>(new GroupInfo(gid2, result.first->get<const std::string&>("name")));
+ return boost::shared_ptr<GroupInfo>(new GroupInfo(gid2, result.first->get<const Core::String&>("name")));
return boost::shared_ptr<const GroupInfo>();
}
-boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const std::string &name, boost::posix_time::ptime *timestamp) throw(Core::Exception) {
+boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const Core::String &name, boost::posix_time::ptime *timestamp) throw(Core::Exception) {
application->getThreadManager()->detach();
boost::shared_ptr<NameUserRequest> request(new NameUserRequest(application, "GetGroupInfo", name, timestamp));
@@ -329,7 +329,7 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -337,7 +337,7 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const
unsigned long gid = result.first->get<unsigned long>("gid");
if(gid)
- return boost::shared_ptr<GroupInfo>(new GroupInfo(gid, result.first->get<const std::string&>("name")));
+ return boost::shared_ptr<GroupInfo>(new GroupInfo(gid, result.first->get<const Core::String&>("name")));
return boost::shared_ptr<const GroupInfo>();
}
@@ -355,7 +355,7 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -387,7 +387,7 @@ boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUse
if(timestamp) {
try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const std::string&>("timestamp"));
+ *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
}
catch(...) {}
}
@@ -529,7 +529,7 @@ void NetworkUserBackend::deleteUserFromGroup(unsigned long uid, unsigned long gi
}
-void NetworkUserBackend::setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) {
+void NetworkUserBackend::setPassword(unsigned long uid, const Core::String &password) throw(Core::Exception) {
application->getThreadManager()->detach();
boost::shared_ptr<PasswordRequest> request(new PasswordRequest(application, uid, password));
diff --git a/src/Common/Backends/NetworkUserBackend.h b/src/Common/Backends/NetworkUserBackend.h
index 6ae9747..9b52443 100644
--- a/src/Common/Backends/NetworkUserBackend.h
+++ b/src/Common/Backends/NetworkUserBackend.h
@@ -33,21 +33,21 @@ class MAD_COMMON_EXPORT NetworkUserBackend : public UserDBBackend {
private:
class MAD_COMMON_EXPORT SimpleUserRequest : public Request {
private:
- std::string type;
+ Core::String type;
boost::posix_time::ptime timestamp;
protected:
virtual void sendRequest();
public:
- SimpleUserRequest(Application *application, const std::string &type0, boost::posix_time::ptime *timestamp0)
+ SimpleUserRequest(Application *application, const Core::String &type0, boost::posix_time::ptime *timestamp0)
: Request(application), type(type0), timestamp(timestamp0 ? *timestamp0 : boost::posix_time::not_a_date_time) {}
};
class MAD_COMMON_EXPORT IdUserRequest : public Request {
private:
- std::string type;
- std::string idType;
+ Core::String type;
+ Core::String idType;
unsigned long id;
boost::posix_time::ptime timestamp;
@@ -55,21 +55,21 @@ class MAD_COMMON_EXPORT NetworkUserBackend : public UserDBBackend {
virtual void sendRequest();
public:
- IdUserRequest(Application *application, const std::string &type0, const std::string &idType0, unsigned long id0, boost::posix_time::ptime *timestamp0 = 0)
+ IdUserRequest(Application *application, const Core::String &type0, const Core::String &idType0, unsigned long id0, boost::posix_time::ptime *timestamp0 = 0)
: Request(application), type(type0), idType(idType0), id(id0), timestamp(timestamp0 ? *timestamp0 : boost::posix_time::not_a_date_time) {}
};
class MAD_COMMON_EXPORT NameUserRequest : public Request {
private:
- std::string type;
- std::string name;
+ Core::String type;
+ Core::String name;
boost::posix_time::ptime timestamp;
protected:
virtual void sendRequest();
public:
- NameUserRequest(Application *application, const std::string &type0, const std::string &name0, boost::posix_time::ptime *timestamp0)
+ NameUserRequest(Application *application, const Core::String &type0, const Core::String &name0, boost::posix_time::ptime *timestamp0)
: Request(application), type(type0), name(name0), timestamp(timestamp0 ? *timestamp0 : boost::posix_time::not_a_date_time) {}
};
@@ -127,7 +127,7 @@ class MAD_COMMON_EXPORT NetworkUserBackend : public UserDBBackend {
class MAD_COMMON_EXPORT UserGroupRequest : public Request {
private:
- std::string type;
+ Core::String type;
unsigned long uid;
unsigned long gid;
@@ -135,24 +135,24 @@ class MAD_COMMON_EXPORT NetworkUserBackend : public UserDBBackend {
virtual void sendRequest();
public:
- UserGroupRequest(Application *application, const std::string &type0, unsigned long uid0, unsigned long gid0)
+ UserGroupRequest(Application *application, const Core::String &type0, unsigned long uid0, unsigned long gid0)
: Request(application), type(type0), uid(uid0), gid(gid0) {}
};
class MAD_COMMON_EXPORT PasswordRequest : public Request {
private:
unsigned long uid;
- std::string password;
+ Core::String password;
protected:
virtual void sendRequest();
public:
- PasswordRequest(Application *application, unsigned long uid0, const std::string &password0)
+ PasswordRequest(Application *application, unsigned long uid0, const Core::String &password0)
: Request(application), uid(uid0), password(password0) {}
};
- static const std::string name;
+ static const Core::String name;
Application *application;
Connection *connection;
@@ -160,12 +160,12 @@ class MAD_COMMON_EXPORT NetworkUserBackend : public UserDBBackend {
protected:
virtual boost::shared_ptr<const std::map<unsigned long, Common::UserInfo> > getUserList(boost::posix_time::ptime *timestamp) throw(Core::Exception);
virtual boost::shared_ptr<const Common::UserInfo> getUserInfo(unsigned long uid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
- virtual boost::shared_ptr<const Common::UserInfo> getUserInfoByName(const std::string &name, boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const Common::UserInfo> getUserInfoByName(const Core::String &name, boost::posix_time::ptime *timestamp) throw(Core::Exception);
virtual boost::shared_ptr<const std::set<unsigned long> > getUserGroupList(unsigned long uid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
virtual boost::shared_ptr<const std::map<unsigned long, Common::GroupInfo> > getGroupList(boost::posix_time::ptime *timestamp) throw(Core::Exception);
virtual boost::shared_ptr<const Common::GroupInfo> getGroupInfo(unsigned long gid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
- virtual boost::shared_ptr<const Common::GroupInfo> getGroupInfoByName(const std::string &name, boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const Common::GroupInfo> getGroupInfoByName(const Core::String &name, boost::posix_time::ptime *timestamp) throw(Core::Exception);
virtual boost::shared_ptr<const std::set<unsigned long> > getGroupUserList(unsigned long gid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
virtual boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > getFullUserGroupList(boost::posix_time::ptime *timestamp) throw(Core::Exception);
@@ -183,12 +183,12 @@ class MAD_COMMON_EXPORT NetworkUserBackend : public UserDBBackend {
virtual void addUserToGroup(unsigned long uid, unsigned long gid) throw(Core::Exception);
virtual void deleteUserFromGroup(unsigned long uid, unsigned long gid) throw(Core::Exception);
- virtual void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception);
+ virtual void setPassword(unsigned long uid, const Core::String &password) throw(Core::Exception);
public:
NetworkUserBackend(Application *application0, Connection *connection0) : application(application0), connection(connection0) {}
- virtual const std::string& getName() {
+ virtual const Core::String& getName() {
return name;
}
};