diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
80 files changed, 192 insertions, 189 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/BodySerializer.h b/Swiften/Serializer/PayloadSerializers/BodySerializer.h index c73f0c4..6fc6e6d 100644 --- a/Swiften/Serializer/PayloadSerializers/BodySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/BodySerializer.h @@ -16,7 +16,7 @@ namespace Swift { public: BodySerializer() : GenericPayloadSerializer<Body>() {} - virtual String serializePayload(boost::shared_ptr<Body> body) const { + virtual std::string serializePayload(boost::shared_ptr<Body> body) const { XMLTextNode textNode(body->getText()); return "<body>" + textNode.serialize() + "</body>"; } diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp index 9acabee..f9b89f3 100644 --- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp @@ -19,7 +19,7 @@ namespace Swift { BytestreamsSerializer::BytestreamsSerializer() { } -String BytestreamsSerializer::serializePayload(boost::shared_ptr<Bytestreams> bytestreams) const { +std::string BytestreamsSerializer::serializePayload(boost::shared_ptr<Bytestreams> bytestreams) const { XMLElement queryElement("query", "http://jabber.org/protocol/bytestreams"); queryElement.setAttribute("sid", bytestreams->getStreamID()); foreach(const Bytestreams::StreamHost& streamHost, bytestreams->getStreamHosts()) { diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h index 50d58c2..d9b14db 100644 --- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h @@ -16,6 +16,6 @@ namespace Swift { public: BytestreamsSerializer(); - virtual String serializePayload(boost::shared_ptr<Bytestreams>) const; + virtual std::string serializePayload(boost::shared_ptr<Bytestreams>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp index c7b17bd..ced0d62 100644 --- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp @@ -15,7 +15,7 @@ namespace Swift { CapsInfoSerializer::CapsInfoSerializer() : GenericPayloadSerializer<CapsInfo>() { } -String CapsInfoSerializer::serializePayload(boost::shared_ptr<CapsInfo> capsInfo) const { +std::string CapsInfoSerializer::serializePayload(boost::shared_ptr<CapsInfo> capsInfo) const { XMLElement capsElement("c", "http://jabber.org/protocol/caps"); capsElement.setAttribute("node", capsInfo->getNode()); capsElement.setAttribute("hash", capsInfo->getHash()); diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h index a94916b..de0a871 100644 --- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: CapsInfoSerializer(); - virtual String serializePayload(boost::shared_ptr<CapsInfo>) const; + virtual std::string serializePayload(boost::shared_ptr<CapsInfo>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp index 9f0fe0d..3e877eb 100644 --- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp @@ -11,8 +11,8 @@ namespace Swift { ChatStateSerializer::ChatStateSerializer() : GenericPayloadSerializer<ChatState>() { } -String ChatStateSerializer::serializePayload(boost::shared_ptr<ChatState> chatState) const { - String result("<"); +std::string ChatStateSerializer::serializePayload(boost::shared_ptr<ChatState> chatState) const { + std::string result("<"); switch (chatState->getChatState()) { case ChatState::Active: result += "active"; break; case ChatState::Composing: result += "composing"; break; diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h index 724f4a1..a786901 100644 --- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h @@ -14,6 +14,6 @@ namespace Swift { public: ChatStateSerializer(); - virtual String serializePayload(boost::shared_ptr<ChatState> error) const; + virtual std::string serializePayload(boost::shared_ptr<ChatState> error) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp index b29a634..0fa45ce 100644 --- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp @@ -20,34 +20,34 @@ namespace Swift { CommandSerializer::CommandSerializer() { } -String CommandSerializer::serializePayload(boost::shared_ptr<Command> command) const { +std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> command) const { XMLElement commandElement("command", "http://jabber.org/protocol/comands"); commandElement.setAttribute("node", command->getNode()); - if (!command->getSessionID().isEmpty()) { + if (!command->getSessionID().empty()) { commandElement.setAttribute("sessionid", command->getSessionID()); } - String action = actionToString(command->getAction()); - if (!action.isEmpty()) { + std::string action = actionToString(command->getAction()); + if (!action.empty()) { commandElement.setAttribute("action", action); } - String status; + std::string status; switch (command->getStatus()) { case Command::Executing: status = "executing";break; case Command::Completed: status = "completed";break; case Command::Canceled: status = "canceled";break; case Command::NoStatus: break; } - if (!status.isEmpty()) { + if (!status.empty()) { commandElement.setAttribute("status", status); } if (command->getAvailableActions().size() > 0) { - String actions = "<actions"; - String executeAction = actionToString(command->getExecuteAction()); - if (!executeAction.isEmpty()) { + std::string actions = "<actions"; + std::string executeAction = actionToString(command->getExecuteAction()); + if (!executeAction.empty()) { actions += " execute='" + executeAction + "'"; } actions += ">"; @@ -60,13 +60,13 @@ String CommandSerializer::serializePayload(boost::shared_ptr<Command> command) c foreach (Command::Note note, command->getNotes()) { boost::shared_ptr<XMLElement> noteElement(new XMLElement("note")); - String type; + std::string type; switch (note.type) { case Command::Note::Info: type = "info"; break; case Command::Note::Warn: type = "warn"; break; case Command::Note::Error: type = "error"; break; } - if (!type.isEmpty()) { + if (!type.empty()) { noteElement->setAttribute("type", type); } noteElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(note.note))); @@ -80,8 +80,8 @@ String CommandSerializer::serializePayload(boost::shared_ptr<Command> command) c return commandElement.serialize(); } -String CommandSerializer::actionToString(Command::Action action) const { - String string; +std::string CommandSerializer::actionToString(Command::Action action) const { + std::string string; switch (action) { case Command::Cancel: string = "cancel"; break; case Command::Execute: string = "execute"; break; diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.h b/Swiften/Serializer/PayloadSerializers/CommandSerializer.h index 4b71aea..b1db825 100644 --- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.h @@ -16,9 +16,9 @@ namespace Swift { public: CommandSerializer(); - virtual String serializePayload(boost::shared_ptr<Command>) const; + virtual std::string serializePayload(boost::shared_ptr<Command>) const; private: - String actionToString(Command::Action action) const; + std::string actionToString(Command::Action action) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp index a54cf9e..4922042 100644 --- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp @@ -8,6 +8,7 @@ #include <boost/shared_ptr.hpp> +#include <Swiften/Base/String.h> #include "Swiften/Serializer/XML/XMLElement.h" namespace Swift { @@ -15,19 +16,19 @@ namespace Swift { DelaySerializer::DelaySerializer() : GenericPayloadSerializer<Delay>() { } -String DelaySerializer::serializePayload(boost::shared_ptr<Delay> delay) const { +std::string DelaySerializer::serializePayload(boost::shared_ptr<Delay> delay) const { XMLElement delayElement("delay", "urn:xmpp:delay"); if (delay->getFrom()) { delayElement.setAttribute("from", delay->getFrom()->toString()); } - String stampString = boostPTimeToXEP0082(delay->getStamp()); + std::string stampString = boostPTimeToXEP0082(delay->getStamp()); delayElement.setAttribute("stamp", stampString); return delayElement.serialize(); } -String DelaySerializer::boostPTimeToXEP0082(const boost::posix_time::ptime& time) { - String stampString = String(boost::posix_time::to_iso_extended_string(time)); - stampString.replaceAll(',', "."); +std::string DelaySerializer::boostPTimeToXEP0082(const boost::posix_time::ptime& time) { + std::string stampString = std::string(boost::posix_time::to_iso_extended_string(time)); + String::replaceAll(stampString, ',', "."); stampString += "Z"; return stampString; } diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h index eb33c9f..c37dc02 100644 --- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h @@ -14,8 +14,8 @@ namespace Swift { public: DelaySerializer(); - virtual String serializePayload(boost::shared_ptr<Delay>) const; - static String boostPTimeToXEP0082(const boost::posix_time::ptime& time); + virtual std::string serializePayload(boost::shared_ptr<Delay>) const; + static std::string boostPTimeToXEP0082(const boost::posix_time::ptime& time); }; } diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp index f5923dc..65b0a38 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp @@ -18,14 +18,14 @@ namespace Swift { DiscoInfoSerializer::DiscoInfoSerializer() : GenericPayloadSerializer<DiscoInfo>() { } -String DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> discoInfo) const { +std::string DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> discoInfo) const { XMLElement queryElement("query", "http://jabber.org/protocol/disco#info"); - if (!discoInfo->getNode().isEmpty()) { + if (!discoInfo->getNode().empty()) { queryElement.setAttribute("node", discoInfo->getNode()); } foreach(const DiscoInfo::Identity& identity, discoInfo->getIdentities()) { boost::shared_ptr<XMLElement> identityElement(new XMLElement("identity")); - if (!identity.getLanguage().isEmpty()) { + if (!identity.getLanguage().empty()) { identityElement->setAttribute("xml:lang", identity.getLanguage()); } identityElement->setAttribute("category", identity.getCategory()); @@ -33,7 +33,7 @@ String DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> discoI identityElement->setAttribute("type", identity.getType()); queryElement.addNode(identityElement); } - foreach(const String& feature, discoInfo->getFeatures()) { + foreach(const std::string& feature, discoInfo->getFeatures()) { boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature")); featureElement->setAttribute("var", feature); queryElement.addNode(featureElement); diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h index 63047d1..46e7ce2 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: DiscoInfoSerializer(); - virtual String serializePayload(boost::shared_ptr<DiscoInfo>) const; + virtual std::string serializePayload(boost::shared_ptr<DiscoInfo>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp index 056c515..cb1b7c1 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp @@ -16,16 +16,16 @@ namespace Swift { DiscoItemsSerializer::DiscoItemsSerializer() : GenericPayloadSerializer<DiscoItems>() { } -String DiscoItemsSerializer::serializePayload(boost::shared_ptr<DiscoItems> discoItems) const { +std::string DiscoItemsSerializer::serializePayload(boost::shared_ptr<DiscoItems> discoItems) const { XMLElement queryElement("query", "http://jabber.org/protocol/disco#items"); - if (!discoItems->getNode().isEmpty()) { + if (!discoItems->getNode().empty()) { queryElement.setAttribute("node", discoItems->getNode()); } foreach(const DiscoItems::Item& item, discoItems->getItems()) { boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); itemElement->setAttribute("name", item.getName()); itemElement->setAttribute("jid", item.getJID()); - if (!item.getNode().isEmpty()) { + if (!item.getNode().empty()) { itemElement->setAttribute("node", item.getNode()); } queryElement.addNode(itemElement); diff --git a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h index 8116e9b..3b00a17 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h @@ -14,7 +14,7 @@ namespace Swift { public: DiscoItemsSerializer(); - virtual String serializePayload(boost::shared_ptr<DiscoItems>) const; + virtual std::string serializePayload(boost::shared_ptr<DiscoItems>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp index d041f6e..15d13d7 100644 --- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp @@ -12,8 +12,8 @@ namespace Swift { ErrorSerializer::ErrorSerializer() : GenericPayloadSerializer<ErrorPayload>() { } -String ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) const { - String result("<error type=\""); +std::string ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) const { + std::string result("<error type=\""); switch (error->getType()) { case ErrorPayload::Continue: result += "continue"; break; case ErrorPayload::Modify: result += "modify"; break; @@ -23,7 +23,7 @@ String ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) } result += "\">"; - String conditionElement; + std::string conditionElement; switch (error->getCondition()) { case ErrorPayload::BadRequest: conditionElement = "bad-request"; break; case ErrorPayload::Conflict: conditionElement = "conflict"; break; @@ -50,7 +50,7 @@ String ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) } result += "<" + conditionElement + " xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"; - if (!error->getText().isEmpty()) { + if (!error->getText().empty()) { XMLTextNode textNode(error->getText()); result += "<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">" + textNode.serialize() + "</text>"; } diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h index ee32279..7fc4dad 100644 --- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: ErrorSerializer(); - virtual String serializePayload(boost::shared_ptr<ErrorPayload> error) const; + virtual std::string serializePayload(boost::shared_ptr<ErrorPayload> error) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp index 77c2fd4..53b4241 100644 --- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp @@ -8,9 +8,10 @@ #include <boost/shared_ptr.hpp> #include <iostream> +#include <string> -#include "Swiften/Base/foreach.h" #include "Swiften/Base/String.h" +#include "Swiften/Base/foreach.h" #include "Swiften/Serializer/XML/XMLTextNode.h" #include "Swiften/Serializer/XML/XMLRawTextNode.h" @@ -18,8 +19,8 @@ using namespace Swift; namespace { template<typename T> void serializeValueAsString(boost::shared_ptr<FormField> field, boost::shared_ptr<XMLElement> parent) { - String value = boost::dynamic_pointer_cast<T>(field)->getValue(); - if (!value.isEmpty()) { + std::string value = boost::dynamic_pointer_cast<T>(field)->getValue(); + if (!value.empty()) { boost::shared_ptr<XMLElement> valueElement(new XMLElement("value")); valueElement->addNode(XMLTextNode::create(value)); parent->addNode(valueElement); @@ -33,9 +34,9 @@ namespace Swift { FormSerializer::FormSerializer() : GenericPayloadSerializer<Form>() { } -String FormSerializer::serializePayload(boost::shared_ptr<Form> form) const { +std::string FormSerializer::serializePayload(boost::shared_ptr<Form> form) const { boost::shared_ptr<XMLElement> formElement(new XMLElement("x", "jabber:x:data")); - String type; + std::string type; switch (form->getType()) { case Form::FormType: type = "form"; break; case Form::SubmitType: type = "submit"; break; @@ -43,10 +44,10 @@ String FormSerializer::serializePayload(boost::shared_ptr<Form> form) const { case Form::ResultType: type = "result"; break; } formElement->setAttribute("type", type); - if (!form->getTitle().isEmpty()) { + if (!form->getTitle().empty()) { multiLineify(form->getTitle(), "title", formElement); } - if (!form->getInstructions().isEmpty()) { + if (!form->getInstructions().empty()) { multiLineify(form->getInstructions(), "instructions", formElement); } foreach(boost::shared_ptr<FormField> field, form->getFields()) { @@ -57,23 +58,23 @@ String FormSerializer::serializePayload(boost::shared_ptr<Form> form) const { boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormField> field) const { boost::shared_ptr<XMLElement> fieldElement(new XMLElement("field")); - if (!field->getName().isEmpty()) { + if (!field->getName().empty()) { fieldElement->setAttribute("var", field->getName()); } - if (!field->getLabel().isEmpty()) { + if (!field->getLabel().empty()) { fieldElement->setAttribute("label", field->getLabel()); } if (field->getRequired()) { fieldElement->addNode(boost::shared_ptr<XMLElement>(new XMLElement("required"))); } - if (!field->getDescription().isEmpty()) { + if (!field->getDescription().empty()) { boost::shared_ptr<XMLElement> descriptionElement(new XMLElement("desc")); descriptionElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(field->getDescription()))); fieldElement->addNode(descriptionElement); } // Set the value and type - String fieldType; + std::string fieldType; if (boost::dynamic_pointer_cast<BooleanFormField>(field)) { fieldType = "boolean"; boost::shared_ptr<XMLElement> valueElement(new XMLElement("value")); @@ -117,8 +118,8 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF } else if (boost::dynamic_pointer_cast<ListMultiFormField>(field)) { fieldType = "list-multi"; - std::vector<String> lines = boost::dynamic_pointer_cast<ListMultiFormField>(field)->getValue(); - foreach(const String& line, lines) { + std::vector<std::string> lines = boost::dynamic_pointer_cast<ListMultiFormField>(field)->getValue(); + foreach(const std::string& line, lines) { boost::shared_ptr<XMLElement> valueElement(new XMLElement("value")); valueElement->addNode(XMLTextNode::create(line)); fieldElement->addNode(valueElement); @@ -129,8 +130,8 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF multiLineify(boost::dynamic_pointer_cast<TextMultiFormField>(field)->getValue(), "value", fieldElement); } else if (boost::dynamic_pointer_cast<UntypedFormField>(field)) { - std::vector<String> lines = boost::dynamic_pointer_cast<UntypedFormField>(field)->getValue(); - foreach(const String& line, lines) { + std::vector<std::string> lines = boost::dynamic_pointer_cast<UntypedFormField>(field)->getValue(); + foreach(const std::string& line, lines) { boost::shared_ptr<XMLElement> valueElement(new XMLElement("value")); valueElement->addNode(XMLTextNode::create(line)); fieldElement->addNode(valueElement); @@ -139,13 +140,13 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF else { assert(false); } - if (!fieldType.isEmpty()) { + if (!fieldType.empty()) { fieldElement->setAttribute("type", fieldType); } foreach (const FormField::Option& option, field->getOptions()) { boost::shared_ptr<XMLElement> optionElement(new XMLElement("option")); - if (!option.label.isEmpty()) { + if (!option.label.empty()) { optionElement->setAttribute("label", option.label); } @@ -159,11 +160,11 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF return fieldElement; } -void FormSerializer::multiLineify(const String& text, const String& elementName, boost::shared_ptr<XMLElement> element) const { - String unRdText(text); - unRdText.removeAll('\r'); - std::vector<String> lines = unRdText.split('\n'); - foreach (String line, lines) { +void FormSerializer::multiLineify(const std::string& text, const std::string& elementName, boost::shared_ptr<XMLElement> element) const { + std::string unRdText(text); + unRdText.erase(std::remove(unRdText.begin(), unRdText.end(), '\r'), unRdText.end()); + std::vector<std::string> lines = String::split(unRdText, '\n'); + foreach (std::string line, lines) { boost::shared_ptr<XMLElement> lineElement(new XMLElement(elementName)); lineElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(line))); element->addNode(lineElement); diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.h b/Swiften/Serializer/PayloadSerializers/FormSerializer.h index 1cdc7f2..86c8dee 100644 --- a/Swiften/Serializer/PayloadSerializers/FormSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.h @@ -16,11 +16,11 @@ namespace Swift { public: FormSerializer(); - virtual String serializePayload(boost::shared_ptr<Form>) const; + virtual std::string serializePayload(boost::shared_ptr<Form>) const; private: boost::shared_ptr<XMLElement> fieldToXML(boost::shared_ptr<FormField> field) const; - void multiLineify(const String& text, const String& elementName, boost::shared_ptr<XMLElement> parent) const; + void multiLineify(const std::string& text, const std::string& elementName, boost::shared_ptr<XMLElement> parent) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp index 5e52145..7ac4103 100644 --- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp @@ -20,7 +20,7 @@ namespace Swift { IBBSerializer::IBBSerializer() { } -String IBBSerializer::serializePayload(boost::shared_ptr<IBB> ibb) const { +std::string IBBSerializer::serializePayload(boost::shared_ptr<IBB> ibb) const { switch(ibb->getAction()) { case IBB::Data: { XMLElement ibbElement("data", "http://jabber.org/protocol/ibb"); diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.h b/Swiften/Serializer/PayloadSerializers/IBBSerializer.h index 71b1c80..d750f6f 100644 --- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.h @@ -16,6 +16,6 @@ namespace Swift { public: IBBSerializer(); - virtual String serializePayload(boost::shared_ptr<IBB>) const; + virtual std::string serializePayload(boost::shared_ptr<IBB>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp index 5729df6..e4ae11f 100644 --- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp @@ -18,7 +18,7 @@ namespace Swift { InBandRegistrationPayloadSerializer::InBandRegistrationPayloadSerializer() { } -String InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ptr<InBandRegistrationPayload> registration) const { +std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ptr<InBandRegistrationPayload> registration) const { XMLElement registerElement("query", "jabber:iq:register"); if (registration->isRegistered()) { diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h index 168aa3a..45d49ea 100644 --- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h @@ -17,6 +17,6 @@ namespace Swift { public: InBandRegistrationPayloadSerializer(); - virtual String serializePayload(boost::shared_ptr<InBandRegistrationPayload>) const; + virtual std::string serializePayload(boost::shared_ptr<InBandRegistrationPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp index dbf79d4..db28514 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp @@ -15,7 +15,7 @@ namespace Swift { MUCOwnerPayloadSerializer::MUCOwnerPayloadSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<MUCOwnerPayload>(), serializers(serializers) { } -String MUCOwnerPayloadSerializer::serializePayload(boost::shared_ptr<MUCOwnerPayload> mucOwner) const { +std::string MUCOwnerPayloadSerializer::serializePayload(boost::shared_ptr<MUCOwnerPayload> mucOwner) const { XMLElement mucElement("query", "http://jabber.org/protocol/muc#owner"); boost::shared_ptr<Payload> payload = mucOwner->getPayload(); if (payload) { diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h index 862cfce..4808744 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h @@ -14,7 +14,7 @@ namespace Swift { class MUCOwnerPayloadSerializer : public GenericPayloadSerializer<MUCOwnerPayload> { public: MUCOwnerPayloadSerializer(PayloadSerializerCollection* serializers); - virtual String serializePayload(boost::shared_ptr<MUCOwnerPayload> version) const; + virtual std::string serializePayload(boost::shared_ptr<MUCOwnerPayload> version) const; private: PayloadSerializerCollection* serializers; }; diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp index 087dece..d7e1613 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp @@ -7,13 +7,14 @@ #include "Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h" #include "Swiften/Serializer/XML/XMLElement.h" +#include <Swiften/Base/String.h> namespace Swift { MUCPayloadSerializer::MUCPayloadSerializer() : GenericPayloadSerializer<MUCPayload>() { } -String MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload> muc) const { +std::string MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload> muc) const { XMLElement mucElement("x", "http://jabber.org/protocol/muc"); boost::shared_ptr<XMLElement> historyElement(new XMLElement("history")); bool history = false; @@ -30,8 +31,8 @@ String MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload> muc) history = true; } if (muc->getSince() != boost::posix_time::not_a_date_time) { - String sinceString = String(boost::posix_time::to_iso_extended_string(muc->getSince())); - sinceString.replaceAll(',', "."); + std::string sinceString = std::string(boost::posix_time::to_iso_extended_string(muc->getSince())); + String::replaceAll(sinceString, ',', "."); sinceString += "Z"; historyElement->setAttribute("since", sinceString); history = true; diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h index cd7f107..7038e6e 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h @@ -13,7 +13,7 @@ namespace Swift { class MUCPayloadSerializer : public GenericPayloadSerializer<MUCPayload> { public: MUCPayloadSerializer(); - virtual String serializePayload(boost::shared_ptr<MUCPayload> version) const; + virtual std::string serializePayload(boost::shared_ptr<MUCPayload> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp index f4732ea..50746a9 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp @@ -20,7 +20,7 @@ namespace Swift { MUCUserPayloadSerializer::MUCUserPayloadSerializer() : GenericPayloadSerializer<MUCUserPayload>() { } -String MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUserPayload> payload) const { +std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUserPayload> payload) const { XMLElement mucElement("x", "http://jabber.org/protocol/muc"); foreach (const MUCUserPayload::StatusCode statusCode, payload->getStatusCodes()) { boost::shared_ptr<XMLElement> statusElement(new XMLElement("status")); @@ -44,8 +44,8 @@ String MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUserPaylo return mucElement.serialize(); } -String MUCUserPayloadSerializer::affiliationToString(MUCOccupant::Affiliation affiliation) const { - String result; +std::string MUCUserPayloadSerializer::affiliationToString(MUCOccupant::Affiliation affiliation) const { + std::string result; switch (affiliation) { case MUCOccupant::Owner: result = "owner"; break; case MUCOccupant::Admin: result = "admin"; break; @@ -57,8 +57,8 @@ String MUCUserPayloadSerializer::affiliationToString(MUCOccupant::Affiliation af return result; } -String MUCUserPayloadSerializer::roleToString(MUCOccupant::Role role) const { - String result; +std::string MUCUserPayloadSerializer::roleToString(MUCOccupant::Role role) const { + std::string result; switch (role) { case MUCOccupant::Moderator: result = "moderator"; break; case MUCOccupant::NoRole: result = "none"; break; diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h index bad21c9..54e6aff 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h @@ -13,10 +13,10 @@ namespace Swift { class MUCUserPayloadSerializer : public GenericPayloadSerializer<MUCUserPayload> { public: MUCUserPayloadSerializer(); - String affiliationToString(MUCOccupant::Affiliation affiliation) const; - String roleToString(MUCOccupant::Role role) const; + std::string affiliationToString(MUCOccupant::Affiliation affiliation) const; + std::string roleToString(MUCOccupant::Role role) const; - virtual String serializePayload(boost::shared_ptr<MUCUserPayload> version) const; + virtual std::string serializePayload(boost::shared_ptr<MUCUserPayload> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp index 55d5bb6..23d2c25 100644 --- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp @@ -16,7 +16,7 @@ namespace Swift { NicknameSerializer::NicknameSerializer() : GenericPayloadSerializer<Nickname>() { } -String NicknameSerializer::serializePayload(boost::shared_ptr<Nickname> nick) const { +std::string NicknameSerializer::serializePayload(boost::shared_ptr<Nickname> nick) const { XMLElement nickElement("nick", "http://jabber.org/protocol/nick"); nickElement.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(nick->getNickname()))); return nickElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h index e296ffd..e07767b 100644 --- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h @@ -14,7 +14,7 @@ namespace Swift { public: NicknameSerializer(); - virtual String serializePayload(boost::shared_ptr<Nickname>) const; + virtual std::string serializePayload(boost::shared_ptr<Nickname>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h index a242215..cc96ce7 100644 --- a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h @@ -17,7 +17,7 @@ namespace Swift { public: PrioritySerializer() : GenericPayloadSerializer<Priority>() {} - virtual String serializePayload(boost::shared_ptr<Priority> priority) const { + virtual std::string serializePayload(boost::shared_ptr<Priority> priority) const { return "<priority>" + boost::lexical_cast<std::string>(priority->getPriority()) + "</priority>"; } }; diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp index 1964d96..6e1d74d 100644 --- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp @@ -19,7 +19,7 @@ namespace Swift { PrivateStorageSerializer::PrivateStorageSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { } -String PrivateStorageSerializer::serializePayload(boost::shared_ptr<PrivateStorage> storage) const { +std::string PrivateStorageSerializer::serializePayload(boost::shared_ptr<PrivateStorage> storage) const { XMLElement storageElement("query", "jabber:iq:private"); boost::shared_ptr<Payload> payload = storage->getPayload(); if (payload) { diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h index 03448be..7b46136 100644 --- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h @@ -16,7 +16,7 @@ namespace Swift { public: PrivateStorageSerializer(PayloadSerializerCollection* serializers); - virtual String serializePayload(boost::shared_ptr<PrivateStorage>) const; + virtual std::string serializePayload(boost::shared_ptr<PrivateStorage>) const; private: PayloadSerializerCollection* serializers; diff --git a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h index 725a5cd..6874569 100644 --- a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h @@ -14,7 +14,7 @@ namespace Swift { public: RawXMLPayloadSerializer() : GenericPayloadSerializer<RawXMLPayload>() {} - virtual String serializePayload(boost::shared_ptr<RawXMLPayload> p) const { + virtual std::string serializePayload(boost::shared_ptr<RawXMLPayload> p) const { return p->getRawXML(); } }; diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp index cdc5764..cfb3a90 100644 --- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp @@ -16,14 +16,14 @@ namespace Swift { ResourceBindSerializer::ResourceBindSerializer() : GenericPayloadSerializer<ResourceBind>() { } -String ResourceBindSerializer::serializePayload(boost::shared_ptr<ResourceBind> resourceBind) const { +std::string ResourceBindSerializer::serializePayload(boost::shared_ptr<ResourceBind> resourceBind) const { XMLElement bindElement("bind", "urn:ietf:params:xml:ns:xmpp-bind"); if (resourceBind->getJID().isValid()) { boost::shared_ptr<XMLElement> jidNode(new XMLElement("jid")); jidNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getJID().toString()))); bindElement.addNode(jidNode); } - else if (!resourceBind->getResource().isEmpty()) { + else if (!resourceBind->getResource().empty()) { boost::shared_ptr<XMLElement> resourceNode(new XMLElement("resource")); resourceNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getResource()))); bindElement.addNode(resourceNode); diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h index 7248863..d259555 100644 --- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: ResourceBindSerializer(); - virtual String serializePayload(boost::shared_ptr<ResourceBind>) const; + virtual std::string serializePayload(boost::shared_ptr<ResourceBind>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp index b56f404..40faf73 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp @@ -18,7 +18,7 @@ namespace Swift { RosterSerializer::RosterSerializer() : GenericPayloadSerializer<RosterPayload>() { } -String RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload> roster) const { +std::string RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload> roster) const { XMLElement queryElement("query", "jabber:iq:roster"); foreach(const RosterItemPayload& item, roster->getItems()) { boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); @@ -37,13 +37,13 @@ String RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload> roste itemElement->setAttribute("ask", "subscribe"); } - foreach(const String& group, item.getGroups()) { + foreach(const std::string& group, item.getGroups()) { boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group))); itemElement->addNode(groupElement); } - if (!item.getUnknownContent().isEmpty()) { + if (!item.getUnknownContent().empty()) { itemElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(item.getUnknownContent()))); } diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h index ce73670..49e194b 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: RosterSerializer(); - virtual String serializePayload(boost::shared_ptr<RosterPayload>) const; + virtual std::string serializePayload(boost::shared_ptr<RosterPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp index 5d71fd3..a7a9fda 100644 --- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp @@ -18,7 +18,7 @@ namespace Swift { SearchPayloadSerializer::SearchPayloadSerializer() { } -String SearchPayloadSerializer::serializePayload(boost::shared_ptr<SearchPayload> searchPayload) const { +std::string SearchPayloadSerializer::serializePayload(boost::shared_ptr<SearchPayload> searchPayload) const { XMLElement searchElement("query", "jabber:iq:search"); if (searchPayload->getInstructions()) { diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h index b64749b..2d8ec85 100644 --- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h @@ -17,6 +17,6 @@ namespace Swift { public: SearchPayloadSerializer(); - virtual String serializePayload(boost::shared_ptr<SearchPayload>) const; + virtual std::string serializePayload(boost::shared_ptr<SearchPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp index 841cb0a..b9ec55e 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp @@ -15,14 +15,14 @@ namespace Swift { SecurityLabelSerializer::SecurityLabelSerializer() : GenericPayloadSerializer<SecurityLabel>() { } -String SecurityLabelSerializer::serializePayload(boost::shared_ptr<SecurityLabel> label) const { +std::string SecurityLabelSerializer::serializePayload(boost::shared_ptr<SecurityLabel> label) const { XMLElement element("securitylabel", "urn:xmpp:sec-label:0"); - if (!label->getDisplayMarking().isEmpty()) { + if (!label->getDisplayMarking().empty()) { boost::shared_ptr<XMLElement> displayMarking(new XMLElement("displaymarking")); - if (!label->getForegroundColor().isEmpty()) { + if (!label->getForegroundColor().empty()) { displayMarking->setAttribute("fgcolor", label->getForegroundColor()); } - if (!label->getBackgroundColor().isEmpty()) { + if (!label->getBackgroundColor().empty()) { displayMarking->setAttribute("bgcolor", label->getBackgroundColor()); } displayMarking->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(label->getDisplayMarking()))); @@ -33,7 +33,7 @@ String SecurityLabelSerializer::serializePayload(boost::shared_ptr<SecurityLabel labelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(label->getLabel()))); element.addNode(labelElement); - foreach(const String& equivalentLabel, label->getEquivalentLabels()) { + foreach(const std::string& equivalentLabel, label->getEquivalentLabels()) { boost::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel")); equivalentLabelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(equivalentLabel))); element.addNode(equivalentLabelElement); diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h index 513655e..a02aeb9 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: SecurityLabelSerializer(); - virtual String serializePayload(boost::shared_ptr<SecurityLabel> version) const; + virtual std::string serializePayload(boost::shared_ptr<SecurityLabel> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp index e44e30e..5e4d8e4 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp @@ -15,19 +15,19 @@ namespace Swift { SecurityLabelsCatalogSerializer::SecurityLabelsCatalogSerializer() : GenericPayloadSerializer<SecurityLabelsCatalog>() { } -String SecurityLabelsCatalogSerializer::serializePayload(boost::shared_ptr<SecurityLabelsCatalog> catalog) const { +std::string SecurityLabelsCatalogSerializer::serializePayload(boost::shared_ptr<SecurityLabelsCatalog> catalog) const { XMLElement element("catalog", "urn:xmpp:sec-label:catalog:0"); - if (!catalog->getName().isEmpty()) { + if (!catalog->getName().empty()) { element.setAttribute("name", catalog->getName()); } if (catalog->getTo().isValid()) { element.setAttribute("to", catalog->getTo()); } - if (!catalog->getDescription().isEmpty()) { + if (!catalog->getDescription().empty()) { element.setAttribute("desc", catalog->getDescription()); } foreach (const SecurityLabel& label, catalog->getLabels()) { - String serializedLabel = SecurityLabelSerializer().serialize(boost::shared_ptr<SecurityLabel>(new SecurityLabel(label))); + std::string serializedLabel = SecurityLabelSerializer().serialize(boost::shared_ptr<SecurityLabel>(new SecurityLabel(label))); element.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializedLabel))); } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h index 2379ec1..88a1541 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: SecurityLabelsCatalogSerializer(); - virtual String serializePayload(boost::shared_ptr<SecurityLabelsCatalog> version) const; + virtual std::string serializePayload(boost::shared_ptr<SecurityLabelsCatalog> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp index f38b2fd..b2eb1ed 100644 --- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp @@ -11,15 +11,15 @@ namespace Swift { SoftwareVersionSerializer::SoftwareVersionSerializer() : GenericPayloadSerializer<SoftwareVersion>() { } -String SoftwareVersionSerializer::serializePayload(boost::shared_ptr<SoftwareVersion> version) const { - String result("<query xmlns=\"jabber:iq:version\">"); - if (!version->getName().isEmpty()) { +std::string SoftwareVersionSerializer::serializePayload(boost::shared_ptr<SoftwareVersion> version) const { + std::string result("<query xmlns=\"jabber:iq:version\">"); + if (!version->getName().empty()) { result += "<name>" + version->getName() + "</name>"; } - if (!version->getVersion().isEmpty()) { + if (!version->getVersion().empty()) { result += "<version>" + version->getVersion() + "</version>"; } - if (!version->getOS().isEmpty()) { + if (!version->getOS().empty()) { result += "<os>" + version->getOS() + "</os>"; } result += "</query>"; diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h index 7f01b12..72f4afd 100644 --- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: SoftwareVersionSerializer(); - virtual String serializePayload(boost::shared_ptr<SoftwareVersion> version) const; + virtual std::string serializePayload(boost::shared_ptr<SoftwareVersion> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h b/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h index 58930b4..dd9ba97 100644 --- a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h @@ -17,7 +17,7 @@ namespace Swift { public: StartSessionSerializer() : GenericPayloadSerializer<StartSession>() {} - virtual String serializePayload(boost::shared_ptr<StartSession>) const { + virtual std::string serializePayload(boost::shared_ptr<StartSession>) const { return XMLElement("session", "urn:ietf:params:xml:ns:xmpp-session").serialize(); } }; diff --git a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h index 8de7040..565d554 100644 --- a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h @@ -17,7 +17,7 @@ namespace Swift { public: StatusSerializer() : GenericPayloadSerializer<Status>() {} - virtual String serializePayload(boost::shared_ptr<Status> status) const { + virtual std::string serializePayload(boost::shared_ptr<Status> status) const { XMLElement element("status"); element.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(status->getText()))); return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h index 9102fde..e797e81 100644 --- a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h @@ -15,12 +15,12 @@ namespace Swift { public: StatusShowSerializer() : GenericPayloadSerializer<StatusShow>() {} - virtual String serializePayload(boost::shared_ptr<StatusShow> statusShow) const { + virtual std::string serializePayload(boost::shared_ptr<StatusShow> statusShow) const { if (statusShow->getType () == StatusShow::Online || statusShow->getType() == StatusShow::None) { return ""; } else { - String result("<show>"); + std::string result("<show>"); switch (statusShow->getType()) { case StatusShow::Away: result += "away"; break; case StatusShow::XA: result += "xa"; break; diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp index 0de75e5..049c797 100644 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp @@ -17,7 +17,7 @@ namespace Swift { StorageSerializer::StorageSerializer() : GenericPayloadSerializer<Storage>() { } -String StorageSerializer::serializePayload(boost::shared_ptr<Storage> storage) const { +std::string StorageSerializer::serializePayload(boost::shared_ptr<Storage> storage) const { XMLElement storageElement("storage", "storage:bookmarks"); foreach(const Storage::Room& room, storage->getRooms()) { @@ -25,12 +25,12 @@ String StorageSerializer::serializePayload(boost::shared_ptr<Storage> storage) c conferenceElement->setAttribute("name", room.name); conferenceElement->setAttribute("jid", room.jid); conferenceElement->setAttribute("autojoin", room.autoJoin ? "1" : "0"); - if (!room.nick.isEmpty()) { + if (!room.nick.empty()) { boost::shared_ptr<XMLElement> nickElement(new XMLElement("nick")); nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(room.nick))); conferenceElement->addNode(nickElement); } - if (!room.password.isEmpty()) { + if (!room.password.empty()) { boost::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); passwordElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(room.password))); conferenceElement->addNode(passwordElement); diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h b/Swiften/Serializer/PayloadSerializers/StorageSerializer.h index c045234..bc682a6 100644 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.h @@ -14,6 +14,6 @@ namespace Swift { public: StorageSerializer(); - virtual String serializePayload(boost::shared_ptr<Storage>) const; + virtual std::string serializePayload(boost::shared_ptr<Storage>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp index 0c7f593..70fb2ac 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp @@ -25,11 +25,11 @@ namespace Swift { StreamInitiationSerializer::StreamInitiationSerializer() { } -String StreamInitiationSerializer::serializePayload(boost::shared_ptr<StreamInitiation> streamInitiation) const { +std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<StreamInitiation> streamInitiation) const { assert(streamInitiation->getIsFileTransfer()); XMLElement siElement("si", "http://jabber.org/protocol/si"); - if (!streamInitiation->getID().isEmpty()) { + if (!streamInitiation->getID().empty()) { siElement.setAttribute("id", streamInitiation->getID()); } siElement.setAttribute("profile", FILE_TRANSFER_NS); @@ -41,7 +41,7 @@ String StreamInitiationSerializer::serializePayload(boost::shared_ptr<StreamInit if (file.size != -1) { fileElement->setAttribute("size", boost::lexical_cast<std::string>(file.size)); } - if (!file.description.isEmpty()) { + if (!file.description.empty()) { boost::shared_ptr<XMLElement> descElement(new XMLElement("desc")); descElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(file.description))); fileElement->addNode(descElement); @@ -54,13 +54,13 @@ String StreamInitiationSerializer::serializePayload(boost::shared_ptr<StreamInit Form::ref form(new Form(Form::FormType)); ListSingleFormField::ref field = ListSingleFormField::create(); field->setName("stream-method"); - foreach(const String& method, streamInitiation->getProvidedMethods()) { + foreach(const std::string& method, streamInitiation->getProvidedMethods()) { field->addOption(FormField::Option("", method)); } form->addField(field); featureElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(FormSerializer().serialize(form)))); } - else if (!streamInitiation->getRequestedMethod().isEmpty()) { + else if (!streamInitiation->getRequestedMethod().empty()) { Form::ref form(new Form(Form::SubmitType)); ListSingleFormField::ref field = ListSingleFormField::create(streamInitiation->getRequestedMethod()); field->setName("stream-method"); diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h index 35c71b9..0b51519 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h @@ -16,6 +16,6 @@ namespace Swift { public: StreamInitiationSerializer(); - virtual String serializePayload(boost::shared_ptr<StreamInitiation>) const; + virtual std::string serializePayload(boost::shared_ptr<StreamInitiation>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h b/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h index fcd82a5..cf78ddd 100644 --- a/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: SubjectSerializer() : GenericPayloadSerializer<Subject>() {} - virtual String serializePayload(boost::shared_ptr<Subject> subject) const { + virtual std::string serializePayload(boost::shared_ptr<Subject> subject) const { XMLTextNode textNode(subject->getText()); return "<subject>" + textNode.serialize() + "</subject>"; } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp index 87c5f9d..2604331 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp @@ -24,7 +24,7 @@ class CapsInfoSerializerTest : public CppUnit::TestFixture CapsInfoSerializer testling; boost::shared_ptr<CapsInfo> priority(new CapsInfo("http://swift.im", "myversion", "sha-1")); - CPPUNIT_ASSERT_EQUAL(String("<c hash=\"sha-1\" node=\"http://swift.im\" ver=\"myversion\" xmlns=\"http://jabber.org/protocol/caps\"/>"), testling.serialize(priority)); + CPPUNIT_ASSERT_EQUAL(std::string("<c hash=\"sha-1\" node=\"http://swift.im\" ver=\"myversion\" xmlns=\"http://jabber.org/protocol/caps\"/>"), testling.serialize(priority)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp index c67fcdb..3875efd 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp @@ -30,7 +30,7 @@ class DiscoInfoSerializerTest : public CppUnit::TestFixture discoInfo->addFeature("http://jabber.org/protocol/disco#info"); discoInfo->setNode("http://swift.im#bla"); - String expectedResult = + std::string expectedResult = "<query node=\"http://swift.im#bla\" xmlns=\"http://jabber.org/protocol/disco#info\">" "<identity category=\"client\" name=\"Swift\" type=\"pc\"/>" "<identity category=\"client\" name=\"Vlug\" type=\"pc\" xml:lang=\"nl\"/>" @@ -50,7 +50,7 @@ class DiscoInfoSerializerTest : public CppUnit::TestFixture form->setTitle("Bot Configuration"); discoInfo->addExtension(form); - String expectedResult = + std::string expectedResult = "<query xmlns=\"http://jabber.org/protocol/disco#info\">" "<feature var=\"http://jabber.org/protocol/caps\"/>" "<feature var=\"http://jabber.org/protocol/disco#info\"/>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp index 2d392b0..dd06244 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp @@ -24,7 +24,7 @@ class ErrorSerializerTest : public CppUnit::TestFixture ErrorSerializer testling; boost::shared_ptr<ErrorPayload> error(new ErrorPayload(ErrorPayload::BadRequest, ErrorPayload::Cancel, "My Error")); - CPPUNIT_ASSERT_EQUAL(String("<error type=\"cancel\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">My Error</text></error>"), testling.serialize(error)); + CPPUNIT_ASSERT_EQUAL(std::string("<error type=\"cancel\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">My Error</text></error>"), testling.serialize(error)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp index 4ed3ba9..e4a6661 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp @@ -24,7 +24,7 @@ class FormSerializerTest : public CppUnit::TestFixture { form->setTitle("Bot Configuration"); form->setInstructions("Hello!\nFill out this form to configure your new bot!"); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<x type=\"form\" xmlns=\"jabber:x:data\">" "<title>Bot Configuration</title>" "<instructions>Hello!</instructions>" @@ -63,7 +63,7 @@ class FormSerializerTest : public CppUnit::TestFixture { field->setLabel("Password for special access"); form->addField(field); - std::vector<String> values; + std::vector<std::string> values; values.push_back("news"); values.push_back("search"); field = ListMultiFormField::create(values); @@ -96,14 +96,14 @@ class FormSerializerTest : public CppUnit::TestFixture { field->setDescription("Tell all your friends about your new bot!"); form->addField(field); - std::vector<String> values2; + std::vector<std::string> values2; values2.push_back("foo"); values2.push_back("bar"); field = UntypedFormField::create(values2); field->setName("fum"); form->addField(field); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<x type=\"form\" xmlns=\"jabber:x:data\">" "<field type=\"hidden\" var=\"FORM_TYPE\">" "<value>jabber:bot</value>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp index 1654abc..7020537 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp @@ -23,7 +23,7 @@ class InBandRegistrationPayloadSerializerTest : public CppUnit::TestFixture { boost::shared_ptr<InBandRegistrationPayload> registration(new InBandRegistrationPayload()); registration->setRegistered(true); - String expectedResult = + std::string expectedResult = "<query xmlns=\"jabber:iq:register\">" "<registered/>" "</query>"; @@ -43,7 +43,7 @@ class InBandRegistrationPayloadSerializerTest : public CppUnit::TestFixture { form->addField(field); registration->setForm(form); - String expectedResult = + std::string expectedResult = "<query xmlns=\"jabber:iq:register\">" "<instructions>Use the enclosed form to register.</instructions>" "<x type=\"form\" xmlns=\"jabber:x:data\">" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp index d1dbba9..481d9c2 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp @@ -12,7 +12,7 @@ namespace Swift { -String PayloadsSerializer::serialize(boost::shared_ptr<Payload> payload) { +std::string PayloadsSerializer::serialize(boost::shared_ptr<Payload> payload) { PayloadSerializer* serializer = serializers.getPayloadSerializer(payload); if (serializer) { return serializer->serialize(payload); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h index 066c481..038b616 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h @@ -9,13 +9,13 @@ #include <boost/shared_ptr.hpp> #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" namespace Swift { class PayloadsSerializer { public: - String serialize(boost::shared_ptr<Payload> payload); + std::string serialize(boost::shared_ptr<Payload> payload); private: FullPayloadSerializerCollection serializers; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp index 12d9359..c976b12 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp @@ -24,7 +24,7 @@ class PrioritySerializerTest : public CppUnit::TestFixture PrioritySerializer testling; boost::shared_ptr<Priority> priority(new Priority(-113)); - CPPUNIT_ASSERT_EQUAL(String("<priority>-113</priority>"), testling.serialize(priority)); + CPPUNIT_ASSERT_EQUAL(std::string("<priority>-113</priority>"), testling.serialize(priority)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp index 59df665..b0f4084 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp @@ -33,7 +33,7 @@ class PrivateStorageSerializerTest : public CppUnit::TestFixture { storage->addRoom(room); privateStorage->setPayload(storage); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<query xmlns=\"jabber:iq:private\">" "<storage xmlns=\"storage:bookmarks\">" "<conference " diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp index 83b75a9..c7872fe 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp @@ -27,7 +27,7 @@ class ResourceBindSerializerTest : public CppUnit::TestFixture boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); resourceBind->setJID(JID("somenode@example.com/someresource")); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" "<jid>somenode@example.com/someresource</jid>" "</bind>"), testling.serialize(resourceBind)); @@ -38,7 +38,7 @@ class ResourceBindSerializerTest : public CppUnit::TestFixture boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); resourceBind->setResource("someresource"); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" "<resource>someresource</resource>" "</bind>"), testling.serialize(resourceBind)); @@ -48,7 +48,7 @@ class ResourceBindSerializerTest : public CppUnit::TestFixture ResourceBindSerializer testling; boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - CPPUNIT_ASSERT_EQUAL(String("<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"), testling.serialize(resourceBind)); + CPPUNIT_ASSERT_EQUAL(std::string("<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"), testling.serialize(resourceBind)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp index bf30db8..b8ceac3 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp @@ -39,7 +39,7 @@ class RosterSerializerTest : public CppUnit::TestFixture item2.setName("Baz"); roster->addItem(item2); - String expectedResult = + std::string expectedResult = "<query xmlns=\"jabber:iq:roster\">" "<item ask=\"subscribe\" jid=\"foo@bar.com\" name=\"Foo @ Bar\" subscription=\"from\">" "<group>Group 1</group>" @@ -60,12 +60,12 @@ class RosterSerializerTest : public CppUnit::TestFixture item.setName("Baz"); item.addGroup("Group 1"); item.addGroup("Group 2"); - item.addUnknownContent(String( + item.addUnknownContent(std::string( "<foo xmlns=\"http://example.com\"><bar xmlns=\"http://example.com\">Baz</bar></foo>" "<baz xmlns=\"jabber:iq:roster\"><fum xmlns=\"jabber:iq:roster\">foo</fum></baz>")); roster->addItem(item); - String expectedResult = + std::string expectedResult = "<query xmlns=\"jabber:iq:roster\">" "<item jid=\"baz@blo.com\" name=\"Baz\" subscription=\"none\">" "<group>Group 1</group>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp index 40951ec..e8328b8 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp @@ -25,7 +25,7 @@ class SearchPayloadSerializerTest : public CppUnit::TestFixture { payload->setFirst("Juliet"); payload->setLast("Capulet"); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<query xmlns=\"jabber:iq:search\">" "<first>Juliet</first>" "<last>Capulet</last>" @@ -53,7 +53,7 @@ class SearchPayloadSerializerTest : public CppUnit::TestFixture { item2.email = "tybalt@shakespeare.lit"; payload->addItem(item2); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<query xmlns=\"jabber:iq:search\">" "<item jid=\"juliet@capulet.com\">" "<first>Juliet</first>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp index bf2139e..03bad89 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp @@ -28,7 +28,7 @@ class SecurityLabelSerializerTest : public CppUnit::TestFixture { securityLabel->addEquivalentLabel("<icismlabel xmlns=\"http://example.gov/IC-ISM/0\" classification=\"S\" ownerProducer=\"USA\" disseminationControls=\"FOUO\"/>"); securityLabel->addEquivalentLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>"); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" "<displaymarking bgcolor=\"red\" fgcolor=\"black\">SECRET</displaymarking>" "<label>" @@ -49,7 +49,7 @@ class SecurityLabelSerializerTest : public CppUnit::TestFixture { securityLabel->setDisplayMarking("SECRET"); securityLabel->setLabel(""); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" "<displaymarking>SECRET</displaymarking>" "<label></label>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp index 9d471d1..928f209 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp @@ -41,7 +41,7 @@ class SecurityLabelsCatalogSerializerTest : public CppUnit::TestFixture securityLabel2.setLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel>"); catalog->addLabel(securityLabel2); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<catalog desc=\"an example set of labels\" name=\"Default\" to=\"example.com\" xmlns=\"urn:xmpp:sec-label:catalog:0\">" "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" "<displaymarking bgcolor=\"red\" fgcolor=\"black\">SECRET</displaymarking>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp index 963df9f..6fac094 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp @@ -24,7 +24,7 @@ class SoftwareVersionSerializerTest : public CppUnit::TestFixture SoftwareVersionSerializer testling; boost::shared_ptr<SoftwareVersion> softwareVersion(new SoftwareVersion("Swift", "0.1", "Mac OS X")); - CPPUNIT_ASSERT_EQUAL(String("<query xmlns=\"jabber:iq:version\"><name>Swift</name><version>0.1</version><os>Mac OS X</os></query>"), testling.serialize(softwareVersion)); + CPPUNIT_ASSERT_EQUAL(std::string("<query xmlns=\"jabber:iq:version\"><name>Swift</name><version>0.1</version><os>Mac OS X</os></query>"), testling.serialize(softwareVersion)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp index 9a8c9d9..c0b1dc2 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp @@ -24,7 +24,7 @@ class StatusSerializerTest : public CppUnit::TestFixture StatusSerializer testling; boost::shared_ptr<Status> status(new Status("I am away")); - CPPUNIT_ASSERT_EQUAL(String("<status>I am away</status>"), testling.serialize(status)); + CPPUNIT_ASSERT_EQUAL(std::string("<status>I am away</status>"), testling.serialize(status)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp index f165f1c..2fee152 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp @@ -27,37 +27,37 @@ class StatusShowSerializerTest : public CppUnit::TestFixture void testSerialize_Online() { StatusShowSerializer testling; boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Online)); - CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow)); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.serialize(statusShow)); } void testSerialize_Away() { StatusShowSerializer testling; boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Away)); - CPPUNIT_ASSERT_EQUAL(String("<show>away</show>"), testling.serialize(statusShow)); + CPPUNIT_ASSERT_EQUAL(std::string("<show>away</show>"), testling.serialize(statusShow)); } void testSerialize_FFC() { StatusShowSerializer testling; boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::FFC)); - CPPUNIT_ASSERT_EQUAL(String("<show>chat</show>"), testling.serialize(statusShow)); + CPPUNIT_ASSERT_EQUAL(std::string("<show>chat</show>"), testling.serialize(statusShow)); } void testSerialize_XA() { StatusShowSerializer testling; boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::XA)); - CPPUNIT_ASSERT_EQUAL(String("<show>xa</show>"), testling.serialize(statusShow)); + CPPUNIT_ASSERT_EQUAL(std::string("<show>xa</show>"), testling.serialize(statusShow)); } void testSerialize_DND() { StatusShowSerializer testling; boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::DND)); - CPPUNIT_ASSERT_EQUAL(String("<show>dnd</show>"), testling.serialize(statusShow)); + CPPUNIT_ASSERT_EQUAL(std::string("<show>dnd</show>"), testling.serialize(statusShow)); } void testSerialize_None() { StatusShowSerializer testling; boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::None)); - CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow)); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.serialize(statusShow)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp index 8add953..01899a9 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp @@ -36,7 +36,7 @@ class StorageSerializerTest : public CppUnit::TestFixture { url.url = "http://the-tech.mit.edu/Shakespeare/"; storage->addURL(url); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<storage xmlns=\"storage:bookmarks\">" "<conference " "autojoin=\"1\" " @@ -58,7 +58,7 @@ class StorageSerializerTest : public CppUnit::TestFixture { room.jid = JID("council@conference.underhill.org"); storage->addRoom(room); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<storage xmlns=\"storage:bookmarks\">" "<conference " "autojoin=\"1\" " diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp index e1a13b8..d05fdba 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp @@ -28,7 +28,7 @@ class StreamInitiationSerializerTest : public CppUnit::TestFixture{ streamInitiation->addProvidedMethod("jabber:iq:oob"); streamInitiation->addProvidedMethod("http://jabber.org/protocol/ibb"); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<si id=\"a0\" profile=\"http://jabber.org/protocol/si/profile/file-transfer\" xmlns=\"http://jabber.org/protocol/si\">" "<file name=\"test.txt\" size=\"1022\" xmlns=\"http://jabber.org/protocol/si/profile/file-transfer\">" "<desc>This is info about the file.</desc>" @@ -51,7 +51,7 @@ class StreamInitiationSerializerTest : public CppUnit::TestFixture{ boost::shared_ptr<StreamInitiation> streamInitiation(new StreamInitiation()); streamInitiation->setRequestedMethod("http://jabber.org/protocol/bytestreams"); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<si profile=\"http://jabber.org/protocol/si/profile/file-transfer\" xmlns=\"http://jabber.org/protocol/si\">" "<feature xmlns=\"http://jabber.org/protocol/feature-neg\">" "<x type=\"submit\" xmlns=\"jabber:x:data\">" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp index 82a3ec8..8a9a615 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp @@ -46,7 +46,7 @@ class VCardSerializerTest : public CppUnit::TestFixture address2.isX400 = true; vcard->addEMailAddress(address2); - String expectedResult = + std::string expectedResult = "<vCard xmlns=\"vcard-temp\">" "<VERSION>2.0</VERSION>" "<FN>Alice In Wonderland</FN>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp index a926142..6f37d61 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp @@ -25,7 +25,7 @@ class VCardUpdateSerializerTest : public CppUnit::TestFixture boost::shared_ptr<VCardUpdate> update(new VCardUpdate()); update->setPhotoHash("sha1-hash-of-image"); - String expectedResult = + std::string expectedResult = "<x xmlns=\"vcard-temp:x:update\">" "<photo>sha1-hash-of-image</photo>" "</x>"; diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp index bb09469..79e543e 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp @@ -19,41 +19,41 @@ namespace Swift { VCardSerializer::VCardSerializer() : GenericPayloadSerializer<VCard>() { } -String VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const { +std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const { XMLElement queryElement("vCard", "vcard-temp"); - if (!vcard->getVersion().isEmpty()) { + if (!vcard->getVersion().empty()) { boost::shared_ptr<XMLElement> versionElement(new XMLElement("VERSION")); versionElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getVersion()))); queryElement.addNode(versionElement); } - if (!vcard->getFullName().isEmpty()) { + if (!vcard->getFullName().empty()) { boost::shared_ptr<XMLElement> fullNameElement(new XMLElement("FN")); fullNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFullName()))); queryElement.addNode(fullNameElement); } - if (!vcard->getGivenName().isEmpty() || !vcard->getFamilyName().isEmpty() || !vcard->getMiddleName().isEmpty() || !vcard->getPrefix().isEmpty() || !vcard->getSuffix().isEmpty()) { + 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().isEmpty()) { + if (!vcard->getFamilyName().empty()) { boost::shared_ptr<XMLElement> familyNameElement(new XMLElement("FAMILY")); familyNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFamilyName()))); nameElement->addNode(familyNameElement); } - if (!vcard->getGivenName().isEmpty()) { + if (!vcard->getGivenName().empty()) { boost::shared_ptr<XMLElement> givenNameElement(new XMLElement("GIVEN")); givenNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getGivenName()))); nameElement->addNode(givenNameElement); } - if (!vcard->getMiddleName().isEmpty()) { + if (!vcard->getMiddleName().empty()) { boost::shared_ptr<XMLElement> middleNameElement(new XMLElement("MIDDLE")); middleNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getMiddleName()))); nameElement->addNode(middleNameElement); } - if (!vcard->getPrefix().isEmpty()) { + if (!vcard->getPrefix().empty()) { boost::shared_ptr<XMLElement> prefixElement(new XMLElement("PREFIX")); prefixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getPrefix()))); nameElement->addNode(prefixElement); } - if (!vcard->getSuffix().isEmpty()) { + if (!vcard->getSuffix().empty()) { boost::shared_ptr<XMLElement> suffixElement(new XMLElement("SUFFIX")); suffixElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getSuffix()))); nameElement->addNode(suffixElement); @@ -82,14 +82,14 @@ String VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const } queryElement.addNode(emailElement); } - if (!vcard->getNickname().isEmpty()) { + if (!vcard->getNickname().empty()) { boost::shared_ptr<XMLElement> nickElement(new XMLElement("NICKNAME")); nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname()))); queryElement.addNode(nickElement); } - if (!vcard->getPhoto().isEmpty() || !vcard->getPhotoType().isEmpty()) { + if (!vcard->getPhoto().isEmpty() || !vcard->getPhotoType().empty()) { XMLElement::ref photoElement(new XMLElement("PHOTO")); - if (!vcard->getPhotoType().isEmpty()) { + if (!vcard->getPhotoType().empty()) { XMLElement::ref typeElement(new XMLElement("TYPE")); typeElement->addNode(XMLTextNode::ref(new XMLTextNode(vcard->getPhotoType()))); photoElement->addNode(typeElement); @@ -101,7 +101,7 @@ String VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const } queryElement.addNode(photoElement); } - if (!vcard->getUnknownContent().isEmpty()) { + if (!vcard->getUnknownContent().empty()) { queryElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(vcard->getUnknownContent()))); } return queryElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h index 79f0524..7b9a8a9 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h @@ -14,6 +14,6 @@ namespace Swift { public: VCardSerializer(); - virtual String serializePayload(boost::shared_ptr<VCard>) const; + virtual std::string serializePayload(boost::shared_ptr<VCard>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp index f95995d..e315bc3 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp @@ -16,7 +16,7 @@ namespace Swift { VCardUpdateSerializer::VCardUpdateSerializer() : GenericPayloadSerializer<VCardUpdate>() { } -String VCardUpdateSerializer::serializePayload(boost::shared_ptr<VCardUpdate> vcardUpdate) const { +std::string VCardUpdateSerializer::serializePayload(boost::shared_ptr<VCardUpdate> vcardUpdate) const { XMLElement updateElement("x", "vcard-temp:x:update"); boost::shared_ptr<XMLElement> photoElement(new XMLElement("photo")); photoElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcardUpdate->getPhotoHash()))); diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h index 19610eb..46ca154 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h @@ -14,6 +14,6 @@ namespace Swift { public: VCardUpdateSerializer(); - virtual String serializePayload(boost::shared_ptr<VCardUpdate>) const; + virtual std::string serializePayload(boost::shared_ptr<VCardUpdate>) const; }; } |