summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
index 17a6b49..1512c6c 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
@@ -7,6 +7,7 @@
#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
@@ -23,39 +24,39 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) c
XMLElement queryElement("vCard", "vcard-temp");
if (!vcard->getVersion().empty()) {
boost::shared_ptr<XMLElement> versionElement(new XMLElement("VERSION"));
- versionElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getVersion())));
+ versionElement->addNode(boost::make_shared<XMLTextNode>(vcard->getVersion()));
queryElement.addNode(versionElement);
}
if (!vcard->getFullName().empty()) {
boost::shared_ptr<XMLElement> fullNameElement(new XMLElement("FN"));
- fullNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFullName())));
+ fullNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getFullName()));
queryElement.addNode(fullNameElement);
}
if (!vcard->getGivenName().empty() || !vcard->getFamilyName().empty() || !vcard->getMiddleName().empty() || !vcard->getPrefix().empty() || !vcard->getSuffix().empty()) {
boost::shared_ptr<XMLElement> nameElement(new XMLElement("N"));
if (!vcard->getFamilyName().empty()) {
boost::shared_ptr<XMLElement> familyNameElement(new XMLElement("FAMILY"));
- familyNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFamilyName())));
+ familyNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getFamilyName()));
nameElement->addNode(familyNameElement);
}
if (!vcard->getGivenName().empty()) {
boost::shared_ptr<XMLElement> givenNameElement(new XMLElement("GIVEN"));
- givenNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getGivenName())));
+ givenNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getGivenName()));
nameElement->addNode(givenNameElement);
}
if (!vcard->getMiddleName().empty()) {
boost::shared_ptr<XMLElement> middleNameElement(new XMLElement("MIDDLE"));
- middleNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getMiddleName())));
+ middleNameElement->addNode(boost::make_shared<XMLTextNode>(vcard->getMiddleName()));
nameElement->addNode(middleNameElement);
}
if (!vcard->getPrefix().empty()) {
boost::shared_ptr<XMLElement> prefixElement(new XMLElement("PREFIX"));
- prefixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getPrefix())));
+ prefixElement->addNode(boost::make_shared<XMLTextNode>(vcard->getPrefix()));
nameElement->addNode(prefixElement);
}
if (!vcard->getSuffix().empty()) {
boost::shared_ptr<XMLElement> suffixElement(new XMLElement("SUFFIX"));
- suffixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getSuffix())));
+ suffixElement->addNode(boost::make_shared<XMLTextNode>(vcard->getSuffix()));
nameElement->addNode(suffixElement);
}
queryElement.addNode(nameElement);
@@ -63,28 +64,28 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) c
foreach(const VCard::EMailAddress& emailAddress, vcard->getEMailAddresses()) {
boost::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL"));
boost::shared_ptr<XMLElement> userIDElement(new XMLElement("USERID"));
- userIDElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(emailAddress.address)));
+ userIDElement->addNode(boost::make_shared<XMLTextNode>(emailAddress.address));
emailElement->addNode(userIDElement);
if (emailAddress.isHome) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("HOME")));
+ emailElement->addNode(boost::make_shared<XMLElement>("HOME"));
}
if (emailAddress.isWork) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("WORK")));
+ emailElement->addNode(boost::make_shared<XMLElement>("WORK"));
}
if (emailAddress.isInternet) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("INTERNET")));
+ emailElement->addNode(boost::make_shared<XMLElement>("INTERNET"));
}
if (emailAddress.isPreferred) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("PREF")));
+ emailElement->addNode(boost::make_shared<XMLElement>("PREF"));
}
if (emailAddress.isX400) {
- emailElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("X400")));
+ emailElement->addNode(boost::make_shared<XMLElement>("X400"));
}
queryElement.addNode(emailElement);
}
if (!vcard->getNickname().empty()) {
boost::shared_ptr<XMLElement> nickElement(new XMLElement("NICKNAME"));
- nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname())));
+ nickElement->addNode(boost::make_shared<XMLTextNode>(vcard->getNickname()));
queryElement.addNode(nickElement);
}
if (!vcard->getPhoto().empty() || !vcard->getPhotoType().empty()) {
@@ -102,7 +103,7 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) c
queryElement.addNode(photoElement);
}
if (!vcard->getUnknownContent().empty()) {
- queryElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(vcard->getUnknownContent())));
+ queryElement.addNode(boost::make_shared<XMLRawTextNode>(vcard->getUnknownContent()));
}
return queryElement.serialize();
}