summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Backends/NetworkUserBackend.cpp78
-rw-r--r--src/Common/CMakeLists.txt2
-rw-r--r--src/Common/Connection.cpp8
-rw-r--r--src/Common/Connection.h8
-rw-r--r--src/Common/Request.cpp2
-rw-r--r--src/Common/Request.h20
-rw-r--r--src/Common/RequestHandler.cpp2
-rw-r--r--src/Common/RequestHandler.h6
-rw-r--r--src/Common/RequestHandlers/DisconnectRequestHandler.cpp6
-rw-r--r--src/Common/RequestHandlers/DisconnectRequestHandler.h2
-rw-r--r--src/Common/RequestHandlers/FSInfoRequestHandler.cpp6
-rw-r--r--src/Common/RequestHandlers/FSInfoRequestHandler.h2
-rw-r--r--src/Common/RequestHandlers/SimpleRequestHandler.cpp6
-rw-r--r--src/Common/RequestHandlers/SimpleRequestHandler.h6
-rw-r--r--src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp8
-rw-r--r--src/Common/RequestHandlers/SimpleRequestHandlerGroup.h10
-rw-r--r--src/Common/RequestHandlers/StatusRequestHandler.cpp2
-rw-r--r--src/Common/RequestHandlers/StatusRequestHandler.h2
-rw-r--r--src/Common/RequestManager.cpp4
-rw-r--r--src/Common/RequestManager.h2
-rw-r--r--src/Common/Requests/DisconnectRequest.cpp4
-rw-r--r--src/Common/Requests/DisconnectRequest.h2
-rw-r--r--src/Common/Requests/IdentifyRequest.cpp2
-rw-r--r--src/Common/Requests/SimpleRequest.cpp2
-rw-r--r--src/Common/XmlData.cpp (renamed from src/Common/XmlPacket.cpp)56
-rw-r--r--src/Common/XmlData.h (renamed from src/Common/XmlPacket.h)34
26 files changed, 141 insertions, 141 deletions
diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp
index 00bd378..1b528ab 100644
--- a/src/Common/Backends/NetworkUserBackend.cpp
+++ b/src/Common/Backends/NetworkUserBackend.cpp
@@ -29,7 +29,7 @@ namespace Backends {
const std::string NetworkUserBackend::name("NetworkUserBackend");
void NetworkUserBackend::SimpleUserRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType(type);
if(!timestamp.is_not_a_date_time())
@@ -39,7 +39,7 @@ void NetworkUserBackend::SimpleUserRequest::sendRequest() {
}
void NetworkUserBackend::IdUserRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType(type);
packet.set(idType, id);
@@ -50,7 +50,7 @@ void NetworkUserBackend::IdUserRequest::sendRequest() {
}
void NetworkUserBackend::NameUserRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType(type);
packet.set("name", name);
@@ -61,7 +61,7 @@ void NetworkUserBackend::NameUserRequest::sendRequest() {
}
void NetworkUserBackend::UserAddRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType(check ? "CheckUserInfo" : "AddUser");
packet.set("uid", userInfo.getUid());
@@ -73,7 +73,7 @@ void NetworkUserBackend::UserAddRequest::sendRequest() {
}
void NetworkUserBackend::UserUpdateRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType("UpdateUser");
packet.set("origUid", uid);
@@ -86,7 +86,7 @@ void NetworkUserBackend::UserUpdateRequest::sendRequest() {
}
void NetworkUserBackend::GroupAddRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType(check ? "CheckGroupInfo" : "AddGroup");
packet.set("gid", groupInfo.getGid());
@@ -96,7 +96,7 @@ void NetworkUserBackend::GroupAddRequest::sendRequest() {
}
void NetworkUserBackend::GroupUpdateRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType("UpdateGroup");
packet.set("origGid", gid);
@@ -107,7 +107,7 @@ void NetworkUserBackend::GroupUpdateRequest::sendRequest() {
}
void NetworkUserBackend::UserGroupRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType(type);
packet.set("uid", uid);
packet.set("gid", gid);
@@ -116,7 +116,7 @@ void NetworkUserBackend::UserGroupRequest::sendRequest() {
}
void NetworkUserBackend::PasswordRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType("SetPassword");
packet.set("uid", uid);
packet.set("password", password);
@@ -132,7 +132,7 @@ boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend::
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -143,11 +143,11 @@ boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend::
catch(...) {}
}
- const XmlPacket::List *users = result.first->getList("users");
+ const XmlData::List *users = result.first->getList("users");
if(users) {
boost::shared_ptr<std::map<unsigned long, UserInfo> > userList(new std::map<unsigned long, UserInfo>);
- for(XmlPacket::List::const_iterator user = users->begin(); user != users->end(); ++user) {
+ 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.setGid(user->get<unsigned long>("gid"));
userInfo.setFullName(user->get<const std::string&>("fullName"));
@@ -168,7 +168,7 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfo(unsigned long
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -200,7 +200,7 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const st
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -232,7 +232,7 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getUserGro
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -243,12 +243,12 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getUserGro
catch(...) {}
}
- const XmlPacket::List *groups = result.first->getList("groups");
+ const XmlData::List *groups = result.first->getList("groups");
if(groups) {
boost::shared_ptr<std::set<unsigned long> > groupList(new std::set<unsigned long>);
- for(XmlPacket::List::const_iterator group = groups->begin(); group != groups->end(); ++group)
+ for(XmlData::List::const_iterator group = groups->begin(); group != groups->end(); ++group)
groupList->insert(group->get<unsigned long>("gid"));
return groupList;
@@ -264,7 +264,7 @@ boost::shared_ptr<const std::map<unsigned long, GroupInfo> > NetworkUserBackend:
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -275,11 +275,11 @@ boost::shared_ptr<const std::map<unsigned long, GroupInfo> > NetworkUserBackend:
catch(...) {}
}
- const XmlPacket::List *groups = result.first->getList("groups");
+ const XmlData::List *groups = result.first->getList("groups");
if(groups) {
boost::shared_ptr<std::map<unsigned long, GroupInfo> > groupList(new std::map<unsigned long, GroupInfo>);
- for(XmlPacket::List::const_iterator group = groups->begin(); group != groups->end(); ++group) {
+ 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"));
groupList->insert(std::make_pair(groupInfo.getGid(), groupInfo));
}
@@ -297,7 +297,7 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfo(unsigned lon
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -323,7 +323,7 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -349,7 +349,7 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -360,11 +360,11 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs
catch(...) {}
}
- const XmlPacket::List *users = result.first->getList("users");
+ const XmlData::List *users = result.first->getList("users");
if(users) {
boost::shared_ptr<std::set<unsigned long> > userList(new std::set<unsigned long>);
- for(XmlPacket::List::const_iterator user = users->begin(); user != users->end(); ++user) {
+ for(XmlData::List::const_iterator user = users->begin(); user != users->end(); ++user) {
userList->insert(user->get<unsigned long>("uid"));
}
@@ -381,7 +381,7 @@ boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUse
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
@@ -392,11 +392,11 @@ boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUse
catch(...) {}
}
- const XmlPacket::List *list = result.first->getList("userGroupList");
+ const XmlData::List *list = result.first->getList("userGroupList");
if(list) {
boost::shared_ptr<std::multimap<unsigned long, unsigned long> > ret(new std::multimap<unsigned long, unsigned long>);
- for(XmlPacket::List::const_iterator entry = list->begin(); entry != list->end(); ++entry)
+ for(XmlData::List::const_iterator entry = list->begin(); entry != list->end(); ++entry)
ret->insert(std::make_pair(entry->get<unsigned long>("uid"), entry->get<unsigned long>("gid")));
return ret;
@@ -413,7 +413,7 @@ void NetworkUserBackend::checkUserInfo(const UserInfo &userInfo) throw(Core::Exc
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -425,7 +425,7 @@ void NetworkUserBackend::addUser(const UserInfo &userInfo) throw(Core::Exception
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -437,7 +437,7 @@ void NetworkUserBackend::updateUser(unsigned long uid, const Common::UserInfo &u
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -449,7 +449,7 @@ void NetworkUserBackend::deleteUser(unsigned long uid) throw(Core::Exception) {
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -462,7 +462,7 @@ void NetworkUserBackend::checkGroupInfo(const GroupInfo &groupInfo) throw(Core::
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -474,7 +474,7 @@ void NetworkUserBackend::addGroup(const GroupInfo &groupInfo) throw(Core::Except
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -486,7 +486,7 @@ void NetworkUserBackend::updateGroup(unsigned long gid, const GroupInfo &groupIn
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -498,7 +498,7 @@ void NetworkUserBackend::deleteGroup(unsigned long gid) throw(Core::Exception) {
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -511,7 +511,7 @@ void NetworkUserBackend::addUserToGroup(unsigned long uid, unsigned long gid) th
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -523,7 +523,7 @@ void NetworkUserBackend::deleteUserFromGroup(unsigned long uid, unsigned long gi
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
@@ -536,7 +536,7 @@ void NetworkUserBackend::setPassword(unsigned long uid, const std::string &passw
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
}
diff --git a/src/Common/CMakeLists.txt b/src/Common/CMakeLists.txt
index a92648b..493081d 100644
--- a/src/Common/CMakeLists.txt
+++ b/src/Common/CMakeLists.txt
@@ -42,6 +42,6 @@ mad_library(Common
UserCache.cpp UserCache.h
UserInfo.h
UserManager.cpp UserManager.h
- XmlPacket.cpp XmlPacket.h
+ XmlData.cpp XmlData.h
)
target_link_libraries(Common Net Core modules ${LIBXML2_LIBRARIES} ${MHASH_LIBRARY} ${DL_LIBRARY})
diff --git a/src/Common/Connection.cpp b/src/Common/Connection.cpp
index b2bb835..c8b2bb1 100644
--- a/src/Common/Connection.cpp
+++ b/src/Common/Connection.cpp
@@ -18,17 +18,17 @@
*/
#include "Connection.h"
-#include "XmlPacket.h"
+#include "XmlData.h"
namespace Mad {
namespace Common {
void Connection::receive(boost::shared_ptr<Net::Packet> packet) {
- signalReceive.emit(boost::shared_ptr<XmlPacket>(new XmlPacket(*packet)), packet->getRequestId());
+ signalReceive.emit(boost::shared_ptr<XmlData>(new XmlData(*packet)), packet->getRequestId());
}
-bool Connection::sendPacket(const XmlPacket &packet, boost::uint16_t requestId) {
- return send(packet.encode(requestId));
+bool Connection::sendPacket(const XmlData &packet, boost::uint16_t requestId) {
+ return send(packet.toPacket(requestId));
}
}
diff --git a/src/Common/Connection.h b/src/Common/Connection.h
index 2a04de0..b19e0b9 100644
--- a/src/Common/Connection.h
+++ b/src/Common/Connection.h
@@ -35,11 +35,11 @@ class Packet;
namespace Common {
-class XmlPacket;
+class XmlData;
class MAD_COMMON_EXPORT Connection : private boost::noncopyable {
private:
- Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, boost::uint16_t> signalReceive;
+ Core::Signals::Signal2<boost::shared_ptr<const XmlData>, boost::uint16_t> signalReceive;
protected:
Connection(Core::Application *application) : signalReceive(application) {}
@@ -51,9 +51,9 @@ class MAD_COMMON_EXPORT Connection : private boost::noncopyable {
public:
virtual ~Connection() {}
- bool sendPacket(const XmlPacket &packet, boost::uint16_t requestId);
+ bool sendPacket(const XmlData &packet, boost::uint16_t requestId);
- Core::Signals::Connection connectSignalReceive(const Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, boost::uint16_t>::slot_type &slot) {
+ Core::Signals::Connection connectSignalReceive(const Core::Signals::Signal2<boost::shared_ptr<const XmlData>, boost::uint16_t>::slot_type &slot) {
return signalReceive.connect(slot);
}
void disconnectSignalReceive(const Core::Signals::Connection &con) {
diff --git a/src/Common/Request.cpp b/src/Common/Request.cpp
index 9325d46..0edfcfd 100644
--- a/src/Common/Request.cpp
+++ b/src/Common/Request.cpp
@@ -22,7 +22,7 @@
namespace Mad {
namespace Common {
-void Request::handlePacket(boost::shared_ptr<const XmlPacket> packet) {
+void Request::handlePacket(boost::shared_ptr<const XmlData> packet) {
if(packet->getType() == "Error") {
signalFinished(Core::Exception(packet->get<const std::string&>("Where"), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")),
packet->get<long>("SubCode"), packet->get<long>("SubSubCode")));
diff --git a/src/Common/Request.h b/src/Common/Request.h
index 268a196..d46e1b7 100644
--- a/src/Common/Request.h
+++ b/src/Common/Request.h
@@ -43,15 +43,15 @@ class MAD_COMMON_EXPORT Request : public RequestHandler {
boost::condition_variable finishCond;
bool isFinished;
- boost::shared_ptr<const XmlPacket> packet;
+ boost::shared_ptr<const XmlData> packet;
Core::Exception exception;
- Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, Core::Exception> finished;
+ Core::Signals::Signal2<boost::shared_ptr<const XmlData>, Core::Exception> finished;
protected:
Request(Application *application) : RequestHandler(application), isFinished(false), finished(application) {}
- void signalFinished(boost::shared_ptr<const XmlPacket> pkt, Core::Exception exp) {
+ void signalFinished(boost::shared_ptr<const XmlData> pkt, Core::Exception exp) {
{
boost::lock_guard<boost::mutex> lock(mutex);
@@ -66,23 +66,23 @@ class MAD_COMMON_EXPORT Request : public RequestHandler {
RequestHandler::signalFinished();
}
- void signalFinished(boost::shared_ptr<const XmlPacket> packet) {
+ void signalFinished(boost::shared_ptr<const XmlData> packet) {
signalFinished(packet, Core::Exception());
}
void signalFinished(Core::Exception exp) {
- signalFinished(boost::shared_ptr<const XmlPacket>(), exp);
+ signalFinished(boost::shared_ptr<const XmlData>(), exp);
}
void signalFinished() {
- signalFinished(boost::shared_ptr<const XmlPacket>(), Core::Exception());
+ signalFinished(boost::shared_ptr<const XmlData>(), Core::Exception());
}
virtual void sendRequest() = 0;
- virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet);
+ virtual void handlePacket(boost::shared_ptr<const XmlData> packet);
public:
- Core::Signals::Connection connectSignalFinished(const Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, Core::Exception>::slot_type &slot) {
+ Core::Signals::Connection connectSignalFinished(const Core::Signals::Signal2<boost::shared_ptr<const XmlData>, Core::Exception>::slot_type &slot) {
return finished.connect(slot);
}
void disconnectSignalFinished(const Core::Signals::Connection &con) {
@@ -96,11 +96,11 @@ class MAD_COMMON_EXPORT Request : public RequestHandler {
finishCond.wait(lock);
}
- std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> getResult() {
+ std::pair<boost::shared_ptr<const XmlData>, Core::Exception> getResult() {
boost::lock_guard<boost::mutex> lock(mutex);
if(!isFinished)
- return std::make_pair(boost::shared_ptr<const XmlPacket>(), Core::Exception(Core::Exception::NOT_FINISHED));
+ return std::make_pair(boost::shared_ptr<const XmlData>(), Core::Exception(Core::Exception::NOT_FINISHED));
else
return std::make_pair(packet, exception);
}
diff --git a/src/Common/RequestHandler.cpp b/src/Common/RequestHandler.cpp
index 3469448..50c8f11 100644
--- a/src/Common/RequestHandler.cpp
+++ b/src/Common/RequestHandler.cpp
@@ -29,7 +29,7 @@ Connection* RequestHandler::getConnection() const {
return getRequestManager()->requestMap.getRequestInfo(this).first;
}
-void RequestHandler::sendPacket(const XmlPacket &packet) {
+void RequestHandler::sendPacket(const XmlData &packet) {
std::pair<Connection*, boost::uint16_t> requestInfo = getRequestManager()->requestMap.getRequestInfo(this);
if(!requestInfo.first)
diff --git a/src/Common/RequestHandler.h b/src/Common/RequestHandler.h
index 6d15c09..6fcbd3a 100644
--- a/src/Common/RequestHandler.h
+++ b/src/Common/RequestHandler.h
@@ -24,7 +24,7 @@
#include "Application.h"
#include "Connection.h"
-#include "XmlPacket.h"
+#include "XmlData.h"
#include <Core/Signals.h>
@@ -55,9 +55,9 @@ class MAD_COMMON_EXPORT RequestHandler : private boost::noncopyable {
Connection* getConnection() const;
- void sendPacket(const XmlPacket &packet);
+ void sendPacket(const XmlData &packet);
- virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet) = 0;
+ virtual void handlePacket(boost::shared_ptr<const XmlData> packet) = 0;
public:
virtual ~RequestHandler() {}
diff --git a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp
index d6b3449..90c976c 100644
--- a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp
+++ b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp
@@ -24,11 +24,11 @@ namespace Mad {
namespace Common {
namespace RequestHandlers {
-void DisconnectRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packet) {
+void DisconnectRequestHandler::handlePacket(boost::shared_ptr<const XmlData> packet) {
if(packet->getType() != "Disconnect") {
getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet.");
- XmlPacket ret;
+ XmlData ret;
ret.setType("Error");
ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
@@ -38,7 +38,7 @@ void DisconnectRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> p
return;
}
- XmlPacket ret;
+ XmlData ret;
ret.setType("OK");
sendPacket(ret);
diff --git a/src/Common/RequestHandlers/DisconnectRequestHandler.h b/src/Common/RequestHandlers/DisconnectRequestHandler.h
index f4bc827..f3a1fce 100644
--- a/src/Common/RequestHandlers/DisconnectRequestHandler.h
+++ b/src/Common/RequestHandlers/DisconnectRequestHandler.h
@@ -30,7 +30,7 @@ namespace RequestHandlers {
class MAD_COMMON_EXPORT DisconnectRequestHandler : public RequestHandler {
protected:
- virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet);
+ virtual void handlePacket(boost::shared_ptr<const XmlData> packet);
public:
DisconnectRequestHandler(Application *application) : RequestHandler(application) {}
diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp
index a416af4..af4bf50 100644
--- a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp
+++ b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp
@@ -24,7 +24,7 @@ namespace Mad {
namespace Common {
namespace RequestHandlers {
-void FSInfoRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> /*packet*/, Common::XmlPacket *ret) {
+void FSInfoRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret) {
if(!getConnection()->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
@@ -32,10 +32,10 @@ void FSInfoRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPack
getApplication()->getSystemManager()->getFSInfo(&fsInfo);
ret->setType("OK");
- XmlPacket::List *list = ret->createList("filesystems");
+ XmlData::List *list = ret->createList("filesystems");
for(std::vector<SystemManager::FSInfo>::const_iterator fs = fsInfo.begin(); fs != fsInfo.end(); ++fs) {
- XmlPacket::List::iterator entry = list->addEntry();
+ XmlData::List::iterator entry = list->addEntry();
entry->set("name", fs->fsName);
entry->set("mountedOn", fs->mountedOn);
diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.h b/src/Common/RequestHandlers/FSInfoRequestHandler.h
index 17c1d8e..745eaae 100644
--- a/src/Common/RequestHandlers/FSInfoRequestHandler.h
+++ b/src/Common/RequestHandlers/FSInfoRequestHandler.h
@@ -30,7 +30,7 @@ namespace RequestHandlers {
class MAD_COMMON_EXPORT FSInfoRequestHandler : public SimpleRequestHandler {
private:
- void handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret);
+ void handleRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret);
public:
FSInfoRequestHandler(Application *application) : SimpleRequestHandler(application, "FSInfo", boost::bind(&FSInfoRequestHandler::handleRequest, this, _1, _2)) {}
diff --git a/src/Common/RequestHandlers/SimpleRequestHandler.cpp b/src/Common/RequestHandlers/SimpleRequestHandler.cpp
index 33dfd5a..86edca6 100644
--- a/src/Common/RequestHandlers/SimpleRequestHandler.cpp
+++ b/src/Common/RequestHandlers/SimpleRequestHandler.cpp
@@ -25,11 +25,11 @@ namespace Mad {
namespace Common {
namespace RequestHandlers {
-void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packet) {
+void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlData> packet) {
if(packet->getType() != type) {
getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet.");
- XmlPacket ret;
+ XmlData ret;
ret.setType("Error");
ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
@@ -39,7 +39,7 @@ void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packe
return;
}
- XmlPacket ret;
+ XmlData ret;
try {
handler(packet, &ret);
diff --git a/src/Common/RequestHandlers/SimpleRequestHandler.h b/src/Common/RequestHandlers/SimpleRequestHandler.h
index 3cf0f52..85cbd4c 100644
--- a/src/Common/RequestHandlers/SimpleRequestHandler.h
+++ b/src/Common/RequestHandlers/SimpleRequestHandler.h
@@ -31,12 +31,12 @@ namespace RequestHandlers {
class MAD_COMMON_EXPORT SimpleRequestHandler : public RequestHandler {
private:
std::string type;
- boost::function2<void, boost::shared_ptr<const XmlPacket>, XmlPacket*> handler;
+ boost::function2<void, boost::shared_ptr<const XmlData>, XmlData*> handler;
protected:
- virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet);
+ virtual void handlePacket(boost::shared_ptr<const XmlData> packet);
- SimpleRequestHandler(Application *application, const std::string &type0, const boost::function2<void, boost::shared_ptr<const XmlPacket>, XmlPacket*> &handler0)
+ SimpleRequestHandler(Application *application, const std::string &type0, const boost::function2<void, boost::shared_ptr<const XmlData>, XmlData*> &handler0)
: RequestHandler(application), type(type0), handler(handler0) {}
};
diff --git a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp
index 4d6a0e4..a7debc3 100644
--- a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp
+++ b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp
@@ -26,11 +26,11 @@ namespace Mad {
namespace Common {
namespace RequestHandlers {
-void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packet) {
+void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_ptr<const XmlData> packet) {
if(packet->getType() != type) {
getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet.");
- XmlPacket ret;
+ XmlData ret;
ret.setType("Error");
ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
@@ -40,7 +40,7 @@ void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_
return;
}
- XmlPacket ret;
+ XmlData ret;
try {
handler(packet, &ret, getConnection());
@@ -58,7 +58,7 @@ void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_
}
boost::shared_ptr<RequestHandler> SimpleRequestHandlerGroup::createRequestHandler(Application *application, const std::string &type) {
- std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> >::iterator handler = handlers.find(type);
+ std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> >::iterator handler = handlers.find(type);
if(handler == handlers.end())
return boost::shared_ptr<RequestHandler>();
diff --git a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h
index 0a702f8..2022705 100644
--- a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h
+++ b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h
@@ -33,21 +33,21 @@ class MAD_COMMON_EXPORT SimpleRequestHandlerGroup : public RequestHandlerGroup {
class MAD_COMMON_EXPORT GroupRequestHandler : public RequestHandler {
private:
std::string type;
- boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> handler;
+ boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> handler;
protected:
- virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet);
+ virtual void handlePacket(boost::shared_ptr<const XmlData> packet);
public:
- GroupRequestHandler(Application *application, const std::string &type0, const boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> &handler0)
+ GroupRequestHandler(Application *application, const std::string &type0, const boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> &handler0)
: RequestHandler(application), type(type0), handler(handler0) {}
};
std::set<std::string> types;
- std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> > handlers;
+ std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> > handlers;
protected:
- void registerHandler(const std::string &type, const boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> &handler) {
+ void registerHandler(const std::string &type, const boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> &handler) {
types.insert(type);
handlers.insert(std::make_pair(type, handler));
}
diff --git a/src/Common/RequestHandlers/StatusRequestHandler.cpp b/src/Common/RequestHandlers/StatusRequestHandler.cpp
index e5d87da..20b49e0 100644
--- a/src/Common/RequestHandlers/StatusRequestHandler.cpp
+++ b/src/Common/RequestHandlers/StatusRequestHandler.cpp
@@ -24,7 +24,7 @@ namespace Mad {
namespace Common {
namespace RequestHandlers {
-void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> /*packet*/, Common::XmlPacket *ret) {
+void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret) {
if(!getConnection()->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
diff --git a/src/Common/RequestHandlers/StatusRequestHandler.h b/src/Common/RequestHandlers/StatusRequestHandler.h
index 4e79da8..e5301fa 100644
--- a/src/Common/RequestHandlers/StatusRequestHandler.h
+++ b/src/Common/RequestHandlers/StatusRequestHandler.h
@@ -30,7 +30,7 @@ namespace RequestHandlers {
class MAD_COMMON_EXPORT StatusRequestHandler : public SimpleRequestHandler {
private:
- void handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret);
+ void handleRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret);
public:
StatusRequestHandler(Application *application) : SimpleRequestHandler(application, "GetStatus", boost::bind(&StatusRequestHandler::handleRequest, this, _1, _2)) {}
diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp
index 82ecd00..12134e0 100644
--- a/src/Common/RequestManager.cpp
+++ b/src/Common/RequestManager.cpp
@@ -86,7 +86,7 @@ std::pair<Connection*, boost::uint16_t> RequestManager::RequestMap::getRequestIn
}
-void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr<const XmlPacket> packet, boost::uint16_t requestId) {
+void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr<const XmlData> packet, boost::uint16_t requestId) {
boost::upgrade_lock<boost::shared_mutex> lock(mutex);
boost::shared_ptr<RequestHandler> request = requestMap.findRequest(connection, requestId);
@@ -126,7 +126,7 @@ void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr<co
lock.unlock();
- XmlPacket ret;
+ XmlData ret;
ret.setType("Error");
ret.set("ErrorCode", Core::Exception::NOT_IMPLEMENTED);
diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h
index 3b16ec6..4704a0f 100644
--- a/src/Common/RequestManager.h
+++ b/src/Common/RequestManager.h
@@ -102,7 +102,7 @@ class MAD_COMMON_EXPORT RequestManager : private boost::noncopyable {
return lastRequestId+=2;
}
- void receiveHandler(Connection *connection, boost::shared_ptr<const XmlPacket> packet, boost::uint16_t requestId);
+ void receiveHandler(Connection *connection, boost::shared_ptr<const XmlData> packet, boost::uint16_t requestId);
void handleRequestFinished(Connection *con, boost::uint16_t requestId) {
boost::lock_guard<boost::shared_mutex> lock(mutex);
diff --git a/src/Common/Requests/DisconnectRequest.cpp b/src/Common/Requests/DisconnectRequest.cpp
index 523ef2a..c2b7b71 100644
--- a/src/Common/Requests/DisconnectRequest.cpp
+++ b/src/Common/Requests/DisconnectRequest.cpp
@@ -24,13 +24,13 @@ namespace Common {
namespace Requests {
void DisconnectRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType("Disconnect");
sendPacket(packet);
}
-void DisconnectRequest::handlePacket(boost::shared_ptr<const XmlPacket> packet) {
+void DisconnectRequest::handlePacket(boost::shared_ptr<const XmlData> packet) {
if(packet->getType() == "Error") {
signalFinished(Core::Exception(packet->get<const std::string&>("Where"), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")),
packet->get<long>("SubCode"), packet->get<long>("SubSubCode")));
diff --git a/src/Common/Requests/DisconnectRequest.h b/src/Common/Requests/DisconnectRequest.h
index a92c7e7..a905a56 100644
--- a/src/Common/Requests/DisconnectRequest.h
+++ b/src/Common/Requests/DisconnectRequest.h
@@ -31,7 +31,7 @@ namespace Requests {
class MAD_COMMON_EXPORT DisconnectRequest : public Request {
protected:
virtual void sendRequest();
- virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet);
+ virtual void handlePacket(boost::shared_ptr<const XmlData> packet);
public:
DisconnectRequest(Application *application) : Request(application) {}
diff --git a/src/Common/Requests/IdentifyRequest.cpp b/src/Common/Requests/IdentifyRequest.cpp
index fc31c3f..98868ef 100644
--- a/src/Common/Requests/IdentifyRequest.cpp
+++ b/src/Common/Requests/IdentifyRequest.cpp
@@ -24,7 +24,7 @@ namespace Common {
namespace Requests {
void IdentifyRequest::sendRequest() {
- Common::XmlPacket packet;
+ Common::XmlData packet;
packet.setType("Identify");
if(!hostname.empty())
diff --git a/src/Common/Requests/SimpleRequest.cpp b/src/Common/Requests/SimpleRequest.cpp
index a16e1d4..452b6da 100644
--- a/src/Common/Requests/SimpleRequest.cpp
+++ b/src/Common/Requests/SimpleRequest.cpp
@@ -24,7 +24,7 @@ namespace Common {
namespace Requests {
void SimpleRequest::sendRequest() {
- XmlPacket packet;
+ XmlData packet;
packet.setType(type);
sendPacket(packet);
diff --git a/src/Common/XmlPacket.cpp b/src/Common/XmlData.cpp
index ff8ca6a..d3c948b 100644
--- a/src/Common/XmlPacket.cpp
+++ b/src/Common/XmlData.cpp
@@ -1,5 +1,5 @@
/*
- * XmlProcessor.cpp
+ * XmlData.cpp
*
* Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
*
@@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "XmlPacket.h"
+#include "XmlData.h"
#include "Base64Encoder.h"
#include <cstdlib>
#include <cstring>
@@ -27,7 +27,7 @@
namespace Mad {
namespace Common {
-void XmlPacket::Element::updateStr() {
+void XmlData::Element::updateStr() {
std::string typeStr;
if(type == NONE) {
@@ -86,7 +86,7 @@ void XmlPacket::Element::updateStr() {
xmlSetProp(elementNode, (xmlChar*)"type", (xmlChar*)typeStr.c_str());
}
-XmlPacket::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) {
+XmlData::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) {
if(!node)
return;
@@ -168,7 +168,7 @@ XmlPacket::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) {
updateStr();
}
-XmlPacket::Entry::Entry(xmlNodePtr node) : entryNode(node) {
+XmlData::Entry::Entry(xmlNodePtr node) : entryNode(node) {
if(!node)
return;
@@ -190,7 +190,7 @@ XmlPacket::Entry::Entry(xmlNodePtr node) : entryNode(node) {
template <>
-std::string XmlPacket::Entry::get<std::string>(const std::string &name) const {
+std::string XmlData::Entry::get<std::string>(const std::string &name) const {
Element *element = getElement(name);
if(!element)
return std::string();
@@ -199,7 +199,7 @@ std::string XmlPacket::Entry::get<std::string>(const std::string &name) const {
}
template <>
-const std::string& XmlPacket::Entry::get<const std::string&>(const std::string &name) const {
+const std::string& XmlData::Entry::get<const std::string&>(const std::string &name) const {
static std::string empty;
Element *element = getElement(name);
@@ -210,7 +210,7 @@ const std::string& XmlPacket::Entry::get<const std::string&>(const std::string &
}
template <>
-std::vector<boost::uint8_t> XmlPacket::Entry::get<std::vector<unsigned char> >(const std::string &name) const {
+std::vector<boost::uint8_t> XmlData::Entry::get<std::vector<unsigned char> >(const std::string &name) const {
Element *element = getElement(name);
if(!element)
return std::vector<boost::uint8_t>();
@@ -224,7 +224,7 @@ std::vector<boost::uint8_t> XmlPacket::Entry::get<std::vector<unsigned char> >(c
}
template <>
-const std::vector<boost::uint8_t>& XmlPacket::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const {
+const std::vector<boost::uint8_t>& XmlData::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const {
static std::vector<boost::uint8_t> empty;
Element *element = getElement(name);
@@ -239,7 +239,7 @@ const std::vector<boost::uint8_t>& XmlPacket::Entry::get<const std::vector<unsig
}
}
-XmlPacket::List::List(xmlNodePtr node) : elementNode(node) {
+XmlData::List::List(xmlNodePtr node) : elementNode(node) {
for(xmlNodePtr entry = node->children; entry != 0; entry = entry->next) {
if(entry->type != XML_ELEMENT_NODE || xmlStrcmp(entry->name, (xmlChar*)"entry"))
continue;
@@ -248,40 +248,40 @@ XmlPacket::List::List(xmlNodePtr node) : elementNode(node) {
}
}
-XmlPacket::XmlPacket() {
+XmlData::XmlData() {
doc = xmlNewDoc((xmlChar*)"1.0");
- packetNode = xmlNewNode(0, (xmlChar*)"packet");
- xmlDocSetRootElement(doc, packetNode);
+ rootNode = xmlNewNode(0, (xmlChar*)"mad");
+ xmlDocSetRootElement(doc, rootNode);
- entry = new Entry(packetNode);
+ entry = new Entry(rootNode);
}
-XmlPacket::XmlPacket(const XmlPacket &o) {
+XmlData::XmlData(const XmlData &o) {
doc = xmlCopyDoc(o.doc, 1);
- packetNode = xmlDocGetRootElement(doc);
- entry = new Entry(packetNode);
+ rootNode = xmlDocGetRootElement(doc);
+ entry = new Entry(rootNode);
}
-XmlPacket::XmlPacket(const Net::Packet &packet) {
+XmlData::XmlData(const Net::Packet &packet) {
doc = xmlParseMemory((const char*)packet.getData(), packet.getLength());
- packetNode = xmlDocGetRootElement(doc);
- entry = new Entry(packetNode);
+ rootNode = xmlDocGetRootElement(doc);
+ entry = new Entry(rootNode);
}
-XmlPacket& XmlPacket::operator=(const XmlPacket &o) {
+XmlData& XmlData::operator=(const XmlData &o) {
delete entry;
xmlFreeDoc(doc);
doc = xmlCopyDoc(o.doc, 1);
- packetNode = xmlDocGetRootElement(doc);
- entry = new Entry(packetNode);
+ rootNode = xmlDocGetRootElement(doc);
+ entry = new Entry(rootNode);
return *this;
}
-std::string XmlPacket::getType() const {
- xmlChar *type = xmlGetProp(packetNode, (xmlChar*)"type");
+std::string XmlData::getType() const {
+ xmlChar *type = xmlGetProp(rootNode, (xmlChar*)"type");
std::string ret(type ? (char*)type : "");
@@ -290,11 +290,11 @@ std::string XmlPacket::getType() const {
return ret;
}
-void XmlPacket::setType(const std::string &type) {
- xmlSetProp(packetNode, (xmlChar*)"type", (xmlChar*)type.c_str());
+void XmlData::setType(const std::string &type) {
+ xmlSetProp(rootNode, (xmlChar*)"type", (xmlChar*)type.c_str());
}
-Net::Packet XmlPacket::encode(boost::uint16_t requestId) const {
+Net::Packet XmlData::toPacket(boost::uint16_t requestId) const {
xmlChar *buf;
int length;
diff --git a/src/Common/XmlPacket.h b/src/Common/XmlData.h
index 1902f82..216b0f1 100644
--- a/src/Common/XmlPacket.h
+++ b/src/Common/XmlData.h
@@ -1,5 +1,5 @@
/*
- * XmlProcessor.h
+ * XmlData.h
*
* Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
*
@@ -17,8 +17,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_COMMON_XMLPACKET_H_
-#define MAD_COMMON_XMLPACKET_H_
+#ifndef MAD_COMMON_XMLDATA_H_
+#define MAD_COMMON_XMLDATA_H_
#include "export.h"
@@ -42,14 +42,14 @@
namespace Mad {
namespace Common {
-class MAD_COMMON_EXPORT XmlPacket {
+class MAD_COMMON_EXPORT XmlData {
public:
class Entry;
class List;
private:
xmlDocPtr doc;
- xmlNodePtr packetNode;
+ xmlNodePtr rootNode;
Entry *entry;
class MAD_COMMON_EXPORT Element : private boost::noncopyable {
@@ -135,7 +135,7 @@ class MAD_COMMON_EXPORT XmlPacket {
class MAD_COMMON_EXPORT Entry : private boost::noncopyable {
private:
friend class List;
- friend class XmlPacket;
+ friend class XmlData;
xmlNodePtr entryNode;
@@ -437,13 +437,13 @@ class MAD_COMMON_EXPORT XmlPacket {
}
};
- XmlPacket();
- XmlPacket(const XmlPacket &o);
- XmlPacket(const Net::Packet &packet);
+ XmlData();
+ XmlData(const XmlData &o);
+ XmlData(const Net::Packet &packet);
- XmlPacket& operator=(const XmlPacket &o);
+ XmlData& operator=(const XmlData &o);
- virtual ~XmlPacket() {
+ virtual ~XmlData() {
delete entry;
xmlFreeDoc(doc);
@@ -478,16 +478,16 @@ class MAD_COMMON_EXPORT XmlPacket {
entry->unset(name);
}
- Net::Packet encode(boost::uint16_t requestId) const;
+ Net::Packet toPacket(boost::uint16_t requestId) const;
};
-template <> MAD_COMMON_EXPORT std::string XmlPacket::Entry::get<std::string>(const std::string &name) const;
-template <> MAD_COMMON_EXPORT const std::string& XmlPacket::Entry::get<const std::string&>(const std::string &name) const;
+template <> MAD_COMMON_EXPORT std::string XmlData::Entry::get<std::string>(const std::string &name) const;
+template <> MAD_COMMON_EXPORT const std::string& XmlData::Entry::get<const std::string&>(const std::string &name) const;
-template <> MAD_COMMON_EXPORT std::vector<boost::uint8_t> XmlPacket::Entry::get<std::vector<unsigned char> >(const std::string &name) const;
-template <> MAD_COMMON_EXPORT const std::vector<boost::uint8_t>& XmlPacket::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const;
+template <> MAD_COMMON_EXPORT std::vector<boost::uint8_t> XmlData::Entry::get<std::vector<unsigned char> >(const std::string &name) const;
+template <> MAD_COMMON_EXPORT const std::vector<boost::uint8_t>& XmlData::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const;
}
}
-#endif /* MAD_COMMON_XMLPACKET_H_ */
+#endif /* MAD_COMMON_XMLDATA_H_ */