diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-14 18:57:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-14 21:36:32 (GMT) |
commit | cb05f5a908e20006c954ce38755c2e422ecc2388 (patch) | |
tree | a793551a5fe279a57d4330119560e8542f745484 /Swiften/Parser | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Swiften/Parser')
134 files changed, 595 insertions, 596 deletions
diff --git a/Swiften/Parser/AttributeMap.h b/Swiften/Parser/AttributeMap.h index 5e6512e..c8b287b 100644 --- a/Swiften/Parser/AttributeMap.h +++ b/Swiften/Parser/AttributeMap.h @@ -9,14 +9,14 @@ #include <map> -#include "Swiften/Base/String.h" +#include <string> namespace Swift { - class AttributeMap : public std::map<String,String> { + class AttributeMap : public std::map<std::string,std::string> { public: AttributeMap() {} - String getAttribute(const String& attribute) const { + std::string getAttribute(const std::string& attribute) const { AttributeMap::const_iterator i = find(attribute); if (i == end()) { return ""; @@ -26,7 +26,7 @@ namespace Swift { } } - bool getBoolAttribute(const String& attribute, bool defaultValue = false) const { + bool getBoolAttribute(const std::string& attribute, bool defaultValue = false) const { AttributeMap::const_iterator i = find(attribute); if (i == end()) { return defaultValue; diff --git a/Swiften/Parser/AuthChallengeParser.cpp b/Swiften/Parser/AuthChallengeParser.cpp index 2a4d7dc..1e5e0c4 100644 --- a/Swiften/Parser/AuthChallengeParser.cpp +++ b/Swiften/Parser/AuthChallengeParser.cpp @@ -12,18 +12,18 @@ namespace Swift { AuthChallengeParser::AuthChallengeParser() : GenericElementParser<AuthChallenge>(), depth(0) { } -void AuthChallengeParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void AuthChallengeParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++depth; } -void AuthChallengeParser::handleEndElement(const String&, const String&) { +void AuthChallengeParser::handleEndElement(const std::string&, const std::string&) { --depth; if (depth == 0) { getElementGeneric()->setValue(Base64::decode(text)); } } -void AuthChallengeParser::handleCharacterData(const String& text) { +void AuthChallengeParser::handleCharacterData(const std::string& text) { this->text += text; } diff --git a/Swiften/Parser/AuthChallengeParser.h b/Swiften/Parser/AuthChallengeParser.h index 014d2f9..39f7c57 100644 --- a/Swiften/Parser/AuthChallengeParser.h +++ b/Swiften/Parser/AuthChallengeParser.h @@ -8,19 +8,19 @@ #include "Swiften/Parser/GenericElementParser.h" #include "Swiften/Elements/AuthChallenge.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class AuthChallengeParser : public GenericElementParser<AuthChallenge> { public: AuthChallengeParser(); - virtual void handleStartElement(const String&, const String& ns, const AttributeMap&); - virtual void handleEndElement(const String&, const String& ns); - virtual void handleCharacterData(const String&); + virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&); + virtual void handleEndElement(const std::string&, const std::string& ns); + virtual void handleCharacterData(const std::string&); private: int depth; - String text; + std::string text; }; } diff --git a/Swiften/Parser/AuthRequestParser.cpp b/Swiften/Parser/AuthRequestParser.cpp index 5d90826..38af047 100644 --- a/Swiften/Parser/AuthRequestParser.cpp +++ b/Swiften/Parser/AuthRequestParser.cpp @@ -12,21 +12,21 @@ namespace Swift { AuthRequestParser::AuthRequestParser() : GenericElementParser<AuthRequest>(), depth_(0) { } -void AuthRequestParser::handleStartElement(const String&, const String&, const AttributeMap& attribute) { +void AuthRequestParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attribute) { if (depth_ == 0) { getElementGeneric()->setMechanism(attribute.getAttribute("mechanism")); } ++depth_; } -void AuthRequestParser::handleEndElement(const String&, const String&) { +void AuthRequestParser::handleEndElement(const std::string&, const std::string&) { --depth_; if (depth_ == 0) { getElementGeneric()->setMessage(Base64::decode(text_)); } } -void AuthRequestParser::handleCharacterData(const String& text) { +void AuthRequestParser::handleCharacterData(const std::string& text) { text_ += text; } diff --git a/Swiften/Parser/AuthRequestParser.h b/Swiften/Parser/AuthRequestParser.h index 59fe3ec..5cc3694 100644 --- a/Swiften/Parser/AuthRequestParser.h +++ b/Swiften/Parser/AuthRequestParser.h @@ -9,19 +9,19 @@ #include "Swiften/Parser/GenericElementParser.h" #include "Swiften/Elements/AuthRequest.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class AuthRequestParser : public GenericElementParser<AuthRequest> { public: AuthRequestParser(); - virtual void handleStartElement(const String&, const String& ns, const AttributeMap&); - virtual void handleEndElement(const String&, const String& ns); - virtual void handleCharacterData(const String&); + virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&); + virtual void handleEndElement(const std::string&, const std::string& ns); + virtual void handleCharacterData(const std::string&); private: - String text_; + std::string text_; int depth_; }; } diff --git a/Swiften/Parser/AuthResponseParser.cpp b/Swiften/Parser/AuthResponseParser.cpp index 2a772db..0db6a2a 100644 --- a/Swiften/Parser/AuthResponseParser.cpp +++ b/Swiften/Parser/AuthResponseParser.cpp @@ -12,18 +12,18 @@ namespace Swift { AuthResponseParser::AuthResponseParser() : GenericElementParser<AuthResponse>(), depth(0) { } -void AuthResponseParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void AuthResponseParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++depth; } -void AuthResponseParser::handleEndElement(const String&, const String&) { +void AuthResponseParser::handleEndElement(const std::string&, const std::string&) { --depth; if (depth == 0) { getElementGeneric()->setValue(Base64::decode(text)); } } -void AuthResponseParser::handleCharacterData(const String& text) { +void AuthResponseParser::handleCharacterData(const std::string& text) { this->text += text; } diff --git a/Swiften/Parser/AuthResponseParser.h b/Swiften/Parser/AuthResponseParser.h index 045d4f9..aee2f9c 100644 --- a/Swiften/Parser/AuthResponseParser.h +++ b/Swiften/Parser/AuthResponseParser.h @@ -8,19 +8,19 @@ #include "Swiften/Parser/GenericElementParser.h" #include "Swiften/Elements/AuthResponse.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class AuthResponseParser : public GenericElementParser<AuthResponse> { public: AuthResponseParser(); - virtual void handleStartElement(const String&, const String& ns, const AttributeMap&); - virtual void handleEndElement(const String&, const String& ns); - virtual void handleCharacterData(const String&); + virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&); + virtual void handleEndElement(const std::string&, const std::string& ns); + virtual void handleCharacterData(const std::string&); private: int depth; - String text; + std::string text; }; } diff --git a/Swiften/Parser/AuthSuccessParser.cpp b/Swiften/Parser/AuthSuccessParser.cpp index 98855b5..0dee6ad 100644 --- a/Swiften/Parser/AuthSuccessParser.cpp +++ b/Swiften/Parser/AuthSuccessParser.cpp @@ -12,18 +12,18 @@ namespace Swift { AuthSuccessParser::AuthSuccessParser() : GenericElementParser<AuthSuccess>(), depth(0) { } -void AuthSuccessParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void AuthSuccessParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++depth; } -void AuthSuccessParser::handleEndElement(const String&, const String&) { +void AuthSuccessParser::handleEndElement(const std::string&, const std::string&) { --depth; if (depth == 0) { getElementGeneric()->setValue(Base64::decode(text)); } } -void AuthSuccessParser::handleCharacterData(const String& text) { +void AuthSuccessParser::handleCharacterData(const std::string& text) { this->text += text; } diff --git a/Swiften/Parser/AuthSuccessParser.h b/Swiften/Parser/AuthSuccessParser.h index 5aef18f..30c89d2 100644 --- a/Swiften/Parser/AuthSuccessParser.h +++ b/Swiften/Parser/AuthSuccessParser.h @@ -8,19 +8,19 @@ #include "Swiften/Parser/GenericElementParser.h" #include "Swiften/Elements/AuthSuccess.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class AuthSuccessParser : public GenericElementParser<AuthSuccess> { public: AuthSuccessParser(); - virtual void handleStartElement(const String&, const String& ns, const AttributeMap&); - virtual void handleEndElement(const String&, const String& ns); - virtual void handleCharacterData(const String&); + virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&); + virtual void handleEndElement(const std::string&, const std::string& ns); + virtual void handleCharacterData(const std::string&); private: int depth; - String text; + std::string text; }; } diff --git a/Swiften/Parser/ComponentHandshakeParser.cpp b/Swiften/Parser/ComponentHandshakeParser.cpp index e88adb3..4117a56 100644 --- a/Swiften/Parser/ComponentHandshakeParser.cpp +++ b/Swiften/Parser/ComponentHandshakeParser.cpp @@ -12,18 +12,18 @@ namespace Swift { ComponentHandshakeParser::ComponentHandshakeParser() : GenericElementParser<ComponentHandshake>(), depth(0) { } -void ComponentHandshakeParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void ComponentHandshakeParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++depth; } -void ComponentHandshakeParser::handleEndElement(const String&, const String&) { +void ComponentHandshakeParser::handleEndElement(const std::string&, const std::string&) { --depth; if (depth == 0) { getElementGeneric()->setData(text); } } -void ComponentHandshakeParser::handleCharacterData(const String& text) { +void ComponentHandshakeParser::handleCharacterData(const std::string& text) { this->text += text; } diff --git a/Swiften/Parser/ComponentHandshakeParser.h b/Swiften/Parser/ComponentHandshakeParser.h index de5b8e1..389bb6d 100644 --- a/Swiften/Parser/ComponentHandshakeParser.h +++ b/Swiften/Parser/ComponentHandshakeParser.h @@ -8,19 +8,19 @@ #include "Swiften/Parser/GenericElementParser.h" #include "Swiften/Elements/ComponentHandshake.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class ComponentHandshakeParser : public GenericElementParser<ComponentHandshake> { public: ComponentHandshakeParser(); - virtual void handleStartElement(const String&, const String& ns, const AttributeMap&); - virtual void handleEndElement(const String&, const String& ns); - virtual void handleCharacterData(const String&); + virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&); + virtual void handleEndElement(const std::string&, const std::string& ns); + virtual void handleCharacterData(const std::string&); private: int depth; - String text; + std::string text; }; } diff --git a/Swiften/Parser/CompressParser.cpp b/Swiften/Parser/CompressParser.cpp index 58ec091..5ce5204 100644 --- a/Swiften/Parser/CompressParser.cpp +++ b/Swiften/Parser/CompressParser.cpp @@ -11,7 +11,7 @@ namespace Swift { CompressParser::CompressParser() : GenericElementParser<CompressRequest>(), currentDepth_(0), inMethod_(false) { } -void CompressParser::handleStartElement(const String& element, const String&, const AttributeMap&) { +void CompressParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) { if (currentDepth_ == 1 && element == "method") { inMethod_ = true; currentText_ = ""; @@ -19,7 +19,7 @@ void CompressParser::handleStartElement(const String& element, const String&, co ++currentDepth_; } -void CompressParser::handleEndElement(const String&, const String&) { +void CompressParser::handleEndElement(const std::string&, const std::string&) { --currentDepth_; if (currentDepth_ == 1 && inMethod_) { getElementGeneric()->setMethod(currentText_); @@ -27,7 +27,7 @@ void CompressParser::handleEndElement(const String&, const String&) { } } -void CompressParser::handleCharacterData(const String& data) { +void CompressParser::handleCharacterData(const std::string& data) { currentText_ += data; } diff --git a/Swiften/Parser/CompressParser.h b/Swiften/Parser/CompressParser.h index 56b7e4b..54257b6 100644 --- a/Swiften/Parser/CompressParser.h +++ b/Swiften/Parser/CompressParser.h @@ -7,7 +7,7 @@ #ifndef SWIFTEN_CompressParser_H #define SWIFTEN_CompressParser_H -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/GenericElementParser.h" #include "Swiften/Elements/CompressRequest.h" @@ -17,13 +17,13 @@ namespace Swift { CompressParser(); private: - void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes); - void handleEndElement(const String& element, const String& ns); - void handleCharacterData(const String& data); + void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes); + void handleEndElement(const std::string& element, const std::string& ns); + void handleCharacterData(const std::string& data); private: int currentDepth_; - String currentText_; + std::string currentText_; bool inMethod_; }; } diff --git a/Swiften/Parser/ElementParser.h b/Swiften/Parser/ElementParser.h index 3224a91..60f2395 100644 --- a/Swiften/Parser/ElementParser.h +++ b/Swiften/Parser/ElementParser.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Element.h" #include "Swiften/Parser/AttributeMap.h" @@ -18,9 +18,9 @@ namespace Swift { public: virtual ~ElementParser(); - virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) = 0; - virtual void handleEndElement(const String& element, const String& ns) = 0; - virtual void handleCharacterData(const String& data) = 0; + virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0; + virtual void handleEndElement(const std::string& element, const std::string& ns) = 0; + virtual void handleCharacterData(const std::string& data) = 0; virtual boost::shared_ptr<Element> getElement() const = 0; }; diff --git a/Swiften/Parser/ExpatParser.cpp b/Swiften/Parser/ExpatParser.cpp index 00dbc9d..c972ef7 100644 --- a/Swiften/Parser/ExpatParser.cpp +++ b/Swiften/Parser/ExpatParser.cpp @@ -8,7 +8,7 @@ #include <iostream> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/XMLParserClient.h" namespace Swift { @@ -16,7 +16,7 @@ namespace Swift { static const char NAMESPACE_SEPARATOR = '\x01'; static void handleStartElement(void* client, const XML_Char* name, const XML_Char** attributes) { - std::pair<String,String> nsTagPair = String(name).getSplittedAtFirst(NAMESPACE_SEPARATOR); + std::pair<std::string,std::string> nsTagPair = std::string(name).getSplittedAtFirst(NAMESPACE_SEPARATOR); if (nsTagPair.second == "") { nsTagPair.second = nsTagPair.first; nsTagPair.first = ""; @@ -24,12 +24,12 @@ static void handleStartElement(void* client, const XML_Char* name, const XML_Cha AttributeMap attributeValues; const XML_Char** currentAttribute = attributes; while (*currentAttribute) { - std::pair<String,String> nsAttributePair = String(*currentAttribute).getSplittedAtFirst(NAMESPACE_SEPARATOR); + std::pair<std::string,std::string> nsAttributePair = std::string(*currentAttribute).getSplittedAtFirst(NAMESPACE_SEPARATOR); if (nsAttributePair.second == "") { nsAttributePair.second = nsAttributePair.first; nsAttributePair.first = ""; } - attributeValues[nsAttributePair.second] = String(*(currentAttribute+1)); + attributeValues[nsAttributePair.second] = std::string(*(currentAttribute+1)); currentAttribute += 2; } @@ -37,7 +37,7 @@ static void handleStartElement(void* client, const XML_Char* name, const XML_Cha } static void handleEndElement(void* client, const XML_Char* name) { - std::pair<String,String> nsTagPair = String(name).getSplittedAtFirst(NAMESPACE_SEPARATOR); + std::pair<std::string,std::string> nsTagPair = std::string(name).getSplittedAtFirst(NAMESPACE_SEPARATOR); if (nsTagPair.second == "") { nsTagPair.second = nsTagPair.first; nsTagPair.first = ""; @@ -46,7 +46,7 @@ static void handleEndElement(void* client, const XML_Char* name) { } static void handleCharacterData(void* client, const XML_Char* data, int len) { - static_cast<XMLParserClient*>(client)->handleCharacterData(String(data, len)); + static_cast<XMLParserClient*>(client)->handleCharacterData(std::string(data, len)); } static void handleXMLDeclaration(void*, const XML_Char*, const XML_Char*, int) { @@ -65,8 +65,8 @@ ExpatParser::~ExpatParser() { XML_ParserFree(parser_); } -bool ExpatParser::parse(const String& data) { - bool success = XML_Parse(parser_, data.getUTF8Data(), data.getUTF8Size(), false) == XML_STATUS_OK; +bool ExpatParser::parse(const std::string& data) { + bool success = XML_Parse(parser_, data.c_str(), data.size(), false) == XML_STATUS_OK; /*if (!success) { std::cout << "ERROR: " << XML_ErrorString(XML_GetErrorCode(parser_)) << " while parsing " << data << std::endl; }*/ diff --git a/Swiften/Parser/ExpatParser.h b/Swiften/Parser/ExpatParser.h index e23df11..f6faf17 100644 --- a/Swiften/Parser/ExpatParser.h +++ b/Swiften/Parser/ExpatParser.h @@ -18,7 +18,7 @@ namespace Swift { ExpatParser(XMLParserClient* client); ~ExpatParser(); - bool parse(const String& data); + bool parse(const std::string& data); private: XML_Parser parser_; diff --git a/Swiften/Parser/GenericElementParser.h b/Swiften/Parser/GenericElementParser.h index a0795f0..224c59e 100644 --- a/Swiften/Parser/GenericElementParser.h +++ b/Swiften/Parser/GenericElementParser.h @@ -12,7 +12,7 @@ #include <Swiften/Parser/ElementParser.h> namespace Swift { - class String; + class PayloadParserFactoryCollection; template<typename ElementType> @@ -31,13 +31,13 @@ namespace Swift { } private: - virtual void handleStartElement(const String&, const String&, const AttributeMap&) { + virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) { } - virtual void handleEndElement(const String&, const String&) { + virtual void handleEndElement(const std::string&, const std::string&) { } - virtual void handleCharacterData(const String&) { + virtual void handleCharacterData(const std::string&) { } private: diff --git a/Swiften/Parser/GenericPayloadParser.h b/Swiften/Parser/GenericPayloadParser.h index 3514541..572901b 100644 --- a/Swiften/Parser/GenericPayloadParser.h +++ b/Swiften/Parser/GenericPayloadParser.h @@ -12,7 +12,7 @@ #include <Swiften/Parser/PayloadParser.h> namespace Swift { - class String; + class FormParser; /** diff --git a/Swiften/Parser/GenericPayloadParserFactory.h b/Swiften/Parser/GenericPayloadParserFactory.h index a636dd7..9b108a0 100644 --- a/Swiften/Parser/GenericPayloadParserFactory.h +++ b/Swiften/Parser/GenericPayloadParserFactory.h @@ -7,7 +7,7 @@ #pragma once #include "Swiften/Parser/PayloadParserFactory.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { @@ -20,10 +20,10 @@ namespace Swift { /** * Construct a parser factory that can parse the given top-level tag in the given namespace. */ - GenericPayloadParserFactory(const String& tag, const String& xmlns = "") : tag_(tag), xmlns_(xmlns) {} + GenericPayloadParserFactory(const std::string& tag, const std::string& xmlns = "") : tag_(tag), xmlns_(xmlns) {} - virtual bool canParse(const String& element, const String& ns, const AttributeMap&) const { - return (tag_.isEmpty() ? true : element == tag_) && (xmlns_.isEmpty() ? true : xmlns_ == ns); + virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { + return (tag_.empty() ? true : element == tag_) && (xmlns_.empty() ? true : xmlns_ == ns); } virtual PayloadParser* createPayloadParser() { @@ -31,7 +31,7 @@ namespace Swift { } private: - String tag_; - String xmlns_; + std::string tag_; + std::string xmlns_; }; } diff --git a/Swiften/Parser/GenericStanzaParser.h b/Swiften/Parser/GenericStanzaParser.h index 9c274f5..c756c9a 100644 --- a/Swiften/Parser/GenericStanzaParser.h +++ b/Swiften/Parser/GenericStanzaParser.h @@ -12,7 +12,7 @@ #include <Swiften/Parser/StanzaParser.h> namespace Swift { - class String; + class PayloadParserFactoryCollection; template<typename STANZA_TYPE> diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp index 7fe13fe..34db4ca 100644 --- a/Swiften/Parser/LibXMLParser.cpp +++ b/Swiften/Parser/LibXMLParser.cpp @@ -10,7 +10,7 @@ #include <cassert> #include <cstring> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/XMLParserClient.h" namespace Swift { @@ -18,17 +18,17 @@ namespace Swift { static void handleStartElement(void *client, const xmlChar* name, const xmlChar*, const xmlChar* xmlns, int, const xmlChar**, int nbAttributes, int, const xmlChar ** attributes) { AttributeMap attributeValues; for (int i = 0; i < nbAttributes*5; i += 5) { - attributeValues[String(reinterpret_cast<const char*>(attributes[i]))] = String(reinterpret_cast<const char*>(attributes[i+3]), attributes[i+4]-attributes[i+3]); + attributeValues[std::string(reinterpret_cast<const char*>(attributes[i]))] = std::string(reinterpret_cast<const char*>(attributes[i+3]), attributes[i+4]-attributes[i+3]); } - static_cast<XMLParserClient*>(client)->handleStartElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : String()), attributeValues); + static_cast<XMLParserClient*>(client)->handleStartElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()), attributeValues); } static void handleEndElement(void *client, const xmlChar* name, const xmlChar*, const xmlChar* xmlns) { - static_cast<XMLParserClient*>(client)->handleEndElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : String())); + static_cast<XMLParserClient*>(client)->handleEndElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string())); } static void handleCharacterData(void* client, const xmlChar* data, int len) { - static_cast<XMLParserClient*>(client)->handleCharacterData(String(reinterpret_cast<const char*>(data), len)); + static_cast<XMLParserClient*>(client)->handleCharacterData(std::string(reinterpret_cast<const char*>(data), len)); } static void handleError(void*, const char* /*m*/, ... ) { @@ -64,8 +64,8 @@ LibXMLParser::~LibXMLParser() { } } -bool LibXMLParser::parse(const String& data) { - if (xmlParseChunk(context_, data.getUTF8Data(), data.getUTF8Size(), false) == XML_ERR_OK) { +bool LibXMLParser::parse(const std::string& data) { + if (xmlParseChunk(context_, data.c_str(), data.size(), false) == XML_ERR_OK) { return true; } xmlError* error = xmlCtxtGetLastError(context_); diff --git a/Swiften/Parser/LibXMLParser.h b/Swiften/Parser/LibXMLParser.h index 10fbe4e..d0dac8b 100644 --- a/Swiften/Parser/LibXMLParser.h +++ b/Swiften/Parser/LibXMLParser.h @@ -17,7 +17,7 @@ namespace Swift { LibXMLParser(XMLParserClient* client); ~LibXMLParser(); - bool parse(const String& data); + bool parse(const std::string& data); private: xmlSAXHandler handler_; diff --git a/Swiften/Parser/PayloadParser.h b/Swiften/Parser/PayloadParser.h index a5a9025..423a2bb 100644 --- a/Swiften/Parser/PayloadParser.h +++ b/Swiften/Parser/PayloadParser.h @@ -12,7 +12,7 @@ #include "Swiften/Elements/Payload.h" namespace Swift { - class String; + /** * A parser for XMPP stanza payloads. @@ -29,17 +29,17 @@ namespace Swift { /** * Handle the start of an XML element. */ - virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) = 0; + virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0; /** * Handle the end of an XML element. */ - virtual void handleEndElement(const String& element, const String& ns) = 0; + virtual void handleEndElement(const std::string& element, const std::string& ns) = 0; /** * Handle character data. */ - virtual void handleCharacterData(const String& data) = 0; + virtual void handleCharacterData(const std::string& data) = 0; /** * Retrieve a pointer to the payload. diff --git a/Swiften/Parser/PayloadParserFactory.h b/Swiften/Parser/PayloadParserFactory.h index 3d647c6..2baa2ad 100644 --- a/Swiften/Parser/PayloadParserFactory.h +++ b/Swiften/Parser/PayloadParserFactory.h @@ -9,7 +9,7 @@ #include "Swiften/Parser/AttributeMap.h" namespace Swift { - class String; + class PayloadParser; /** @@ -22,7 +22,7 @@ namespace Swift { /** * Checks whether this factory can parse the given top-level element in the given namespace (with the given attributes). */ - virtual bool canParse(const String& element, const String& ns, const AttributeMap& attributes) const = 0; + virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap& attributes) const = 0; /** * Creates a new payload parser. diff --git a/Swiften/Parser/PayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParserFactoryCollection.cpp index 2e41a5f..0080fbe 100644 --- a/Swiften/Parser/PayloadParserFactoryCollection.cpp +++ b/Swiften/Parser/PayloadParserFactoryCollection.cpp @@ -27,7 +27,7 @@ void PayloadParserFactoryCollection::setDefaultFactory(PayloadParserFactory* fac defaultFactory_ = factory; } -PayloadParserFactory* PayloadParserFactoryCollection::getPayloadParserFactory(const String& element, const String& ns, const AttributeMap& attributes) { +PayloadParserFactory* PayloadParserFactoryCollection::getPayloadParserFactory(const std::string& element, const std::string& ns, const AttributeMap& attributes) { std::vector<PayloadParserFactory*>::reverse_iterator i = std::find_if( factories_.rbegin(), factories_.rend(), boost::bind(&PayloadParserFactory::canParse, _1, element, ns, attributes)); diff --git a/Swiften/Parser/PayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParserFactoryCollection.h index fcfb047..9afb9b7 100644 --- a/Swiften/Parser/PayloadParserFactoryCollection.h +++ b/Swiften/Parser/PayloadParserFactoryCollection.h @@ -13,7 +13,7 @@ namespace Swift { class PayloadParserFactory; - class String; + class PayloadParserFactoryCollection { public: @@ -23,7 +23,7 @@ namespace Swift { void removeFactory(PayloadParserFactory* factory); void setDefaultFactory(PayloadParserFactory* factory); - PayloadParserFactory* getPayloadParserFactory(const String& element, const String& ns, const AttributeMap& attributes); + PayloadParserFactory* getPayloadParserFactory(const std::string& element, const std::string& ns, const AttributeMap& attributes); private: std::vector<PayloadParserFactory*> factories_; diff --git a/Swiften/Parser/PayloadParsers/BodyParser.cpp b/Swiften/Parser/PayloadParsers/BodyParser.cpp index 3f76101..d0f4e09 100644 --- a/Swiften/Parser/PayloadParsers/BodyParser.cpp +++ b/Swiften/Parser/PayloadParsers/BodyParser.cpp @@ -11,18 +11,18 @@ namespace Swift { BodyParser::BodyParser() : level_(0) { } -void BodyParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void BodyParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level_; } -void BodyParser::handleEndElement(const String&, const String&) { +void BodyParser::handleEndElement(const std::string&, const std::string&) { --level_; if (level_ == 0) { getPayloadInternal()->setText(text_); } } -void BodyParser::handleCharacterData(const String& data) { +void BodyParser::handleCharacterData(const std::string& data) { text_ += data; } diff --git a/Swiften/Parser/PayloadParsers/BodyParser.h b/Swiften/Parser/PayloadParsers/BodyParser.h index 4318614..f9e17e0 100644 --- a/Swiften/Parser/PayloadParsers/BodyParser.h +++ b/Swiften/Parser/PayloadParsers/BodyParser.h @@ -15,13 +15,13 @@ namespace Swift { public: BodyParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; - String text_; + std::string text_; }; } diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp index 154a925..35db9ec 100644 --- a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp +++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp @@ -18,7 +18,7 @@ BytestreamsParser::BytestreamsParser() : level(TopLevel) { BytestreamsParser::~BytestreamsParser() { } -void BytestreamsParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { +void BytestreamsParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level == TopLevel) { getPayloadInternal()->setStreamID(attributes.getAttribute("sid")); } @@ -37,11 +37,11 @@ void BytestreamsParser::handleStartElement(const String& element, const String&, ++level; } -void BytestreamsParser::handleEndElement(const String&, const String&) { +void BytestreamsParser::handleEndElement(const std::string&, const std::string&) { --level; } -void BytestreamsParser::handleCharacterData(const String&) { +void BytestreamsParser::handleCharacterData(const std::string&) { } diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.h b/Swiften/Parser/PayloadParsers/BytestreamsParser.h index a45baa4..2d67785 100644 --- a/Swiften/Parser/PayloadParsers/BytestreamsParser.h +++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.h @@ -17,9 +17,9 @@ namespace Swift { BytestreamsParser(); ~BytestreamsParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { diff --git a/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp b/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp index 6ccccd4..d7d9324 100644 --- a/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp +++ b/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp @@ -13,7 +13,7 @@ namespace Swift { CapsInfoParser::CapsInfoParser() : level(0) { } -void CapsInfoParser::handleStartElement(const String&, const String& /*ns*/, const AttributeMap& attributes) { +void CapsInfoParser::handleStartElement(const std::string&, const std::string& /*ns*/, const AttributeMap& attributes) { if (level == 0) { getPayloadInternal()->setHash(attributes.getAttribute("hash")); getPayloadInternal()->setNode(attributes.getAttribute("node")); @@ -22,11 +22,11 @@ void CapsInfoParser::handleStartElement(const String&, const String& /*ns*/, con ++level; } -void CapsInfoParser::handleEndElement(const String&, const String&) { +void CapsInfoParser::handleEndElement(const std::string&, const std::string&) { --level; } -void CapsInfoParser::handleCharacterData(const String&) { +void CapsInfoParser::handleCharacterData(const std::string&) { } diff --git a/Swiften/Parser/PayloadParsers/CapsInfoParser.h b/Swiften/Parser/PayloadParsers/CapsInfoParser.h index 6058837..590326d 100644 --- a/Swiften/Parser/PayloadParsers/CapsInfoParser.h +++ b/Swiften/Parser/PayloadParsers/CapsInfoParser.h @@ -14,9 +14,9 @@ namespace Swift { public: CapsInfoParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level; diff --git a/Swiften/Parser/PayloadParsers/ChatStateParser.cpp b/Swiften/Parser/PayloadParsers/ChatStateParser.cpp index db205dd..3a5ba3b 100644 --- a/Swiften/Parser/PayloadParsers/ChatStateParser.cpp +++ b/Swiften/Parser/PayloadParsers/ChatStateParser.cpp @@ -11,7 +11,7 @@ namespace Swift { ChatStateParser::ChatStateParser() : level_(0) { } -void ChatStateParser::handleStartElement(const String& element, const String&, const AttributeMap&) { +void ChatStateParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) { if (level_ == 0) { ChatState::ChatStateType state = ChatState::Active; if (element == "active") { @@ -30,11 +30,11 @@ void ChatStateParser::handleStartElement(const String& element, const String&, c ++level_; } -void ChatStateParser::handleEndElement(const String&, const String&) { +void ChatStateParser::handleEndElement(const std::string&, const std::string&) { --level_; } -void ChatStateParser::handleCharacterData(const String&) { +void ChatStateParser::handleCharacterData(const std::string&) { } diff --git a/Swiften/Parser/PayloadParsers/ChatStateParser.h b/Swiften/Parser/PayloadParsers/ChatStateParser.h index 2ae4e43..8d0e7f5 100644 --- a/Swiften/Parser/PayloadParsers/ChatStateParser.h +++ b/Swiften/Parser/PayloadParsers/ChatStateParser.h @@ -14,9 +14,9 @@ namespace Swift { public: ChatStateParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; diff --git a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h index 27d3c51..3dadda7 100644 --- a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h +++ b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h @@ -17,7 +17,7 @@ namespace Swift { ChatStateParserFactory() { } - virtual bool canParse(const String& element, const String& ns, const AttributeMap&) const { + virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { return ns == "http://jabber.org/protocol/chatstates" && (element == "active" || element == "composing" || element == "paused" || element == "inactive" || element == "gone"); diff --git a/Swiften/Parser/PayloadParsers/CommandParser.cpp b/Swiften/Parser/PayloadParsers/CommandParser.cpp index 76e4564..9422170 100644 --- a/Swiften/Parser/PayloadParsers/CommandParser.cpp +++ b/Swiften/Parser/PayloadParsers/CommandParser.cpp @@ -18,7 +18,7 @@ CommandParser::~CommandParser() { delete formParserFactory_; } -void CommandParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void CommandParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { ++level_; if (level_ == PayloadLevel) { boost::optional<Command::Action> action = parseAction(attributes.getAttribute("action")); @@ -26,7 +26,7 @@ void CommandParser::handleStartElement(const String& element, const String& ns, getPayloadInternal()->setAction(*action); } - String status = attributes.getAttribute("status"); + std::string status = attributes.getAttribute("status"); if (status == "executing") { getPayloadInternal()->setStatus(Command::Executing); } @@ -49,7 +49,7 @@ void CommandParser::handleStartElement(const String& element, const String& ns, else if (element == "note") { inNote_ = true; currentText_.clear(); - String noteType = attributes.getAttribute("type"); + std::string noteType = attributes.getAttribute("type"); if (noteType == "info") { noteType_ = Command::Note::Info; } @@ -79,7 +79,7 @@ void CommandParser::handleStartElement(const String& element, const String& ns, } } -void CommandParser::handleEndElement(const String& element, const String& ns) { +void CommandParser::handleEndElement(const std::string& element, const std::string& ns) { if (formParser_) { formParser_->handleEndElement(element, ns); } @@ -109,7 +109,7 @@ void CommandParser::handleEndElement(const String& element, const String& ns) { --level_; } -void CommandParser::handleCharacterData(const String& data) { +void CommandParser::handleCharacterData(const std::string& data) { if (formParser_) { formParser_->handleCharacterData(data); } @@ -118,7 +118,7 @@ void CommandParser::handleCharacterData(const String& data) { } } -boost::optional<Command::Action> CommandParser::parseAction(const String& action) { +boost::optional<Command::Action> CommandParser::parseAction(const std::string& action) { if (action == "execute") { return Command::Execute; } diff --git a/Swiften/Parser/PayloadParsers/CommandParser.h b/Swiften/Parser/PayloadParsers/CommandParser.h index a682a80..0415ba6 100644 --- a/Swiften/Parser/PayloadParsers/CommandParser.h +++ b/Swiften/Parser/PayloadParsers/CommandParser.h @@ -20,12 +20,12 @@ namespace Swift { CommandParser(); ~CommandParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: - static boost::optional<Command::Action> parseAction(const String& action); + static boost::optional<Command::Action> parseAction(const std::string& action); private: enum Level { @@ -40,6 +40,6 @@ namespace Swift { Command::Note::Type noteType_; FormParserFactory* formParserFactory_; FormParser* formParser_; - String currentText_; + std::string currentText_; }; } diff --git a/Swiften/Parser/PayloadParsers/CommandParserFactory.h b/Swiften/Parser/PayloadParsers/CommandParserFactory.h index da2f484..9eaaf62 100644 --- a/Swiften/Parser/PayloadParsers/CommandParserFactory.h +++ b/Swiften/Parser/PayloadParsers/CommandParserFactory.h @@ -17,7 +17,7 @@ namespace Swift { CommandParserFactory() { } - virtual bool canParse(const String& element, const String& ns, const AttributeMap&) const { + virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { return ns == "http://jabber.org/protocol/commands" && element == "command"; } diff --git a/Swiften/Parser/PayloadParsers/DelayParser.cpp b/Swiften/Parser/PayloadParsers/DelayParser.cpp index 8e8abff..3425b84 100644 --- a/Swiften/Parser/PayloadParsers/DelayParser.cpp +++ b/Swiften/Parser/PayloadParsers/DelayParser.cpp @@ -15,31 +15,31 @@ namespace Swift { DelayParser::DelayParser(const std::locale& locale) : locale(locale), level_(0) { } -boost::posix_time::ptime DelayParser::dateFromString(const String& string) { - std::istringstream stream(string.getUTF8String()); +boost::posix_time::ptime DelayParser::dateFromString(const std::string& string) { + std::istringstream stream(string); stream.imbue(locale); boost::posix_time::ptime result(boost::posix_time::not_a_date_time); stream >> result; return result; } -void DelayParser::handleStartElement(const String& /*element*/, const String& /*ns*/, const AttributeMap& attributes) { +void DelayParser::handleStartElement(const std::string& /*element*/, const std::string& /*ns*/, const AttributeMap& attributes) { if (level_ == 0) { boost::posix_time::ptime stamp = dateFromString(attributes.getAttribute("stamp")); getPayloadInternal()->setStamp(stamp); - if (!attributes.getAttribute("from").isEmpty()) { - String from = attributes.getAttribute("from"); + if (!attributes.getAttribute("from").empty()) { + std::string from = attributes.getAttribute("from"); getPayloadInternal()->setFrom(JID(from)); } } ++level_; } -void DelayParser::handleEndElement(const String&, const String&) { +void DelayParser::handleEndElement(const std::string&, const std::string&) { --level_; } -void DelayParser::handleCharacterData(const String&) { +void DelayParser::handleCharacterData(const std::string&) { } diff --git a/Swiften/Parser/PayloadParsers/DelayParser.h b/Swiften/Parser/PayloadParsers/DelayParser.h index b2fbdea..c2e2bb6 100644 --- a/Swiften/Parser/PayloadParsers/DelayParser.h +++ b/Swiften/Parser/PayloadParsers/DelayParser.h @@ -14,12 +14,12 @@ namespace Swift { public: DelayParser(const std::locale& locale); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: - boost::posix_time::ptime dateFromString(const String& string); + boost::posix_time::ptime dateFromString(const std::string& string); private: std::locale locale; diff --git a/Swiften/Parser/PayloadParsers/DelayParserFactory.h b/Swiften/Parser/PayloadParsers/DelayParserFactory.h index f3dd328..c150853 100644 --- a/Swiften/Parser/PayloadParsers/DelayParserFactory.h +++ b/Swiften/Parser/PayloadParsers/DelayParserFactory.h @@ -16,7 +16,7 @@ namespace Swift { public: DelayParserFactory(); - virtual bool canParse(const String& /*element*/, const String& ns, const AttributeMap&) const { + virtual bool canParse(const std::string& /*element*/, const std::string& ns, const AttributeMap&) const { return ns == "urn:xmpp:delay"; } diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp index c47c703..e1fcb20 100644 --- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp +++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp @@ -12,7 +12,7 @@ namespace Swift { DiscoInfoParser::DiscoInfoParser() : level_(TopLevel), formParser_(NULL) { } -void DiscoInfoParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void DiscoInfoParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level_ == PayloadLevel) { if (element == "identity") { getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang"))); @@ -31,7 +31,7 @@ void DiscoInfoParser::handleStartElement(const String& element, const String& ns ++level_; } -void DiscoInfoParser::handleEndElement(const String& element, const String& ns) { +void DiscoInfoParser::handleEndElement(const std::string& element, const std::string& ns) { --level_; if (formParser_) { formParser_->handleEndElement(element, ns); @@ -43,7 +43,7 @@ void DiscoInfoParser::handleEndElement(const String& element, const String& ns) } } -void DiscoInfoParser::handleCharacterData(const String& data) { +void DiscoInfoParser::handleCharacterData(const std::string& data) { if (formParser_) { formParser_->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h index d9bfb54..24a1d6f 100644 --- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h +++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h @@ -14,9 +14,9 @@ namespace Swift { public: DiscoInfoParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { diff --git a/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp b/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp index 0900354..7ff375b 100644 --- a/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp +++ b/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp @@ -11,7 +11,7 @@ namespace Swift { DiscoItemsParser::DiscoItemsParser() : level_(TopLevel) { } -void DiscoItemsParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { +void DiscoItemsParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level_ == PayloadLevel) { if (element == "item") { getPayloadInternal()->addItem(DiscoItems::Item(attributes.getAttribute("name"), JID(attributes.getAttribute("jid")), attributes.getAttribute("node"))); @@ -20,11 +20,11 @@ void DiscoItemsParser::handleStartElement(const String& element, const String&, ++level_; } -void DiscoItemsParser::handleEndElement(const String&, const String&) { +void DiscoItemsParser::handleEndElement(const std::string&, const std::string&) { --level_; } -void DiscoItemsParser::handleCharacterData(const String&) { +void DiscoItemsParser::handleCharacterData(const std::string&) { } } diff --git a/Swiften/Parser/PayloadParsers/DiscoItemsParser.h b/Swiften/Parser/PayloadParsers/DiscoItemsParser.h index e3da34e..0700df6 100644 --- a/Swiften/Parser/PayloadParsers/DiscoItemsParser.h +++ b/Swiften/Parser/PayloadParsers/DiscoItemsParser.h @@ -14,9 +14,9 @@ namespace Swift { public: DiscoItemsParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.cpp b/Swiften/Parser/PayloadParsers/ErrorParser.cpp index 7ef4176..4034cb5 100644 --- a/Swiften/Parser/PayloadParsers/ErrorParser.cpp +++ b/Swiften/Parser/PayloadParsers/ErrorParser.cpp @@ -11,9 +11,9 @@ namespace Swift { ErrorParser::ErrorParser() : level_(TopLevel) { } -void ErrorParser::handleStartElement(const String&, const String&, const AttributeMap& attributes) { +void ErrorParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) { if (level_ == TopLevel) { - String type = attributes.getAttribute("type"); + std::string type = attributes.getAttribute("type"); if (type == "continue") { getPayloadInternal()->setType(ErrorPayload::Continue); } @@ -33,7 +33,7 @@ void ErrorParser::handleStartElement(const String&, const String&, const Attribu ++level_; } -void ErrorParser::handleEndElement(const String& element, const String&) { +void ErrorParser::handleEndElement(const std::string& element, const std::string&) { --level_; if (level_ == PayloadLevel) { if (element == "text") { @@ -108,7 +108,7 @@ void ErrorParser::handleEndElement(const String& element, const String&) { } } -void ErrorParser::handleCharacterData(const String& data) { +void ErrorParser::handleCharacterData(const std::string& data) { currentText_ += data; } diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.h b/Swiften/Parser/PayloadParsers/ErrorParser.h index 7642910..4318a8c 100644 --- a/Swiften/Parser/PayloadParsers/ErrorParser.h +++ b/Swiften/Parser/PayloadParsers/ErrorParser.h @@ -15,9 +15,9 @@ namespace Swift { public: ErrorParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -25,7 +25,7 @@ namespace Swift { PayloadLevel = 1 }; int level_; - String currentText_; + std::string currentText_; }; } diff --git a/Swiften/Parser/PayloadParsers/FormParser.cpp b/Swiften/Parser/PayloadParsers/FormParser.cpp index dc15ece..f8e02a4 100644 --- a/Swiften/Parser/PayloadParsers/FormParser.cpp +++ b/Swiften/Parser/PayloadParsers/FormParser.cpp @@ -11,9 +11,9 @@ namespace Swift { FormParser::FormParser() : level_(TopLevel) { } -void FormParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { +void FormParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level_ == TopLevel) { - String type = attributes.getAttribute("type"); + std::string type = attributes.getAttribute("type"); if (type == "form") { getPayloadInternal()->setType(Form::FormType); } @@ -35,7 +35,7 @@ void FormParser::handleStartElement(const String& element, const String&, const currentText_.clear(); } else if (element == "field") { - String type = attributes.getAttribute("type"); + std::string type = attributes.getAttribute("type"); if (type == "boolean") { currentFieldParseHelper_ = BooleanFormFieldParseHelper::create(); } @@ -84,12 +84,12 @@ void FormParser::handleStartElement(const String& element, const String&, const ++level_; } -void FormParser::handleEndElement(const String& element, const String&) { +void FormParser::handleEndElement(const std::string& element, const std::string&) { --level_; if (level_ == PayloadLevel) { if (element == "title") { - String currentTitle = getPayloadInternal()->getTitle(); - if (currentTitle.isEmpty()) { + std::string currentTitle = getPayloadInternal()->getTitle(); + if (currentTitle.empty()) { getPayloadInternal()->setTitle(currentText_); } else { @@ -97,8 +97,8 @@ void FormParser::handleEndElement(const String& element, const String&) { } } else if (element == "instructions") { - String currentInstructions = getPayloadInternal()->getInstructions(); - if (currentInstructions.isEmpty()) { + std::string currentInstructions = getPayloadInternal()->getInstructions(); + if (currentInstructions.empty()) { getPayloadInternal()->setInstructions(currentText_); } else { @@ -128,7 +128,7 @@ void FormParser::handleEndElement(const String& element, const String&) { } } -void FormParser::handleCharacterData(const String& text) { +void FormParser::handleCharacterData(const std::string& text) { currentText_ += text; } diff --git a/Swiften/Parser/PayloadParsers/FormParser.h b/Swiften/Parser/PayloadParsers/FormParser.h index c41e27f..90a3550 100644 --- a/Swiften/Parser/PayloadParsers/FormParser.h +++ b/Swiften/Parser/PayloadParsers/FormParser.h @@ -14,15 +14,15 @@ namespace Swift { public: FormParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: class FieldParseHelper { public: virtual ~FieldParseHelper() {} - virtual void addValue(const String&) = 0; + virtual void addValue(const std::string&) = 0; virtual boost::shared_ptr<FormField> getField() const { return field; } @@ -30,15 +30,15 @@ namespace Swift { boost::shared_ptr<FormField> field; }; class BoolFieldParseHelper : public FieldParseHelper { - virtual void addValue(const String& s) { + virtual void addValue(const std::string& s) { boost::dynamic_pointer_cast< GenericFormField<bool> >(getField())->setValue(s == "1" || s == "true"); getField()->addRawValue(s); } }; class StringFieldParseHelper : public FieldParseHelper { - virtual void addValue(const String& s) { - boost::shared_ptr<GenericFormField<String> > field = boost::dynamic_pointer_cast< GenericFormField<String> >(getField()); - if (field->getValue().isEmpty()) { + virtual void addValue(const std::string& s) { + boost::shared_ptr<GenericFormField<std::string> > field = boost::dynamic_pointer_cast< GenericFormField<std::string> >(getField()); + if (field->getValue().empty()) { field->setValue(s); } else { @@ -48,22 +48,22 @@ namespace Swift { } }; class JIDFieldParseHelper : public FieldParseHelper { - virtual void addValue(const String& s) { + virtual void addValue(const std::string& s) { boost::dynamic_pointer_cast< GenericFormField<JID> >(getField())->setValue(JID(s)); } }; class StringListFieldParseHelper : public FieldParseHelper { - virtual void addValue(const String& s) { + virtual void addValue(const std::string& s) { // FIXME: Inefficient, but too much hassle to do efficiently - boost::shared_ptr<GenericFormField< std::vector<String> > > field = boost::dynamic_pointer_cast< GenericFormField<std::vector<String > > >(getField()); - std::vector<String> l = field->getValue(); + boost::shared_ptr<GenericFormField< std::vector<std::string> > > field = boost::dynamic_pointer_cast< GenericFormField<std::vector<std::string > > >(getField()); + std::vector<std::string> l = field->getValue(); l.push_back(s); field->setValue(l); getField()->addRawValue(s); } }; class JIDListFieldParseHelper : public FieldParseHelper { - virtual void addValue(const String& s) { + virtual void addValue(const std::string& s) { // FIXME: Inefficient, but too much hassle to do efficiently boost::shared_ptr< GenericFormField< std::vector<JID> > > field = boost::dynamic_pointer_cast< GenericFormField<std::vector<JID > > >(getField()); std::vector<JID> l = field->getValue(); @@ -104,8 +104,8 @@ namespace Swift { FieldLevel = 2 }; int level_; - String currentText_; - String currentOptionLabel_; + std::string currentText_; + std::string currentOptionLabel_; boost::shared_ptr<FieldParseHelper> currentFieldParseHelper_; }; } diff --git a/Swiften/Parser/PayloadParsers/FormParserFactory.h b/Swiften/Parser/PayloadParsers/FormParserFactory.h index 805b0f1..7c095a7 100644 --- a/Swiften/Parser/PayloadParsers/FormParserFactory.h +++ b/Swiften/Parser/PayloadParsers/FormParserFactory.h @@ -17,7 +17,7 @@ namespace Swift { FormParserFactory() { } - virtual bool canParse(const String& /*element*/, const String& ns, const AttributeMap&) const { + virtual bool canParse(const std::string& /*element*/, const std::string& ns, const AttributeMap&) const { return ns == "jabber:x:data"; } diff --git a/Swiften/Parser/PayloadParsers/IBBParser.cpp b/Swiften/Parser/PayloadParsers/IBBParser.cpp index b2b4929..f36dc43 100644 --- a/Swiften/Parser/PayloadParsers/IBBParser.cpp +++ b/Swiften/Parser/PayloadParsers/IBBParser.cpp @@ -19,7 +19,7 @@ IBBParser::IBBParser() : level(TopLevel) { IBBParser::~IBBParser() { } -void IBBParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { +void IBBParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level == TopLevel) { if (element == "data") { getPayloadInternal()->setAction(IBB::Data); @@ -53,23 +53,23 @@ void IBBParser::handleStartElement(const String& element, const String&, const A ++level; } -void IBBParser::handleEndElement(const String& element, const String&) { +void IBBParser::handleEndElement(const std::string& element, const std::string&) { --level; if (level == TopLevel) { if (element == "data") { std::vector<char> data; - for (size_t i = 0; i < currentText.getUTF8Size(); ++i) { + for (size_t i = 0; i < currentText.size(); ++i) { char c = currentText[i]; if (c >= 48 && c <= 122) { data.push_back(c); } } - getPayloadInternal()->setData(Base64::decode(String(&data[0], data.size()))); + getPayloadInternal()->setData(Base64::decode(std::string(&data[0], data.size()))); } } } -void IBBParser::handleCharacterData(const String& data) { +void IBBParser::handleCharacterData(const std::string& data) { currentText += data; } diff --git a/Swiften/Parser/PayloadParsers/IBBParser.h b/Swiften/Parser/PayloadParsers/IBBParser.h index 1fc062f..132e79d 100644 --- a/Swiften/Parser/PayloadParsers/IBBParser.h +++ b/Swiften/Parser/PayloadParsers/IBBParser.h @@ -17,15 +17,15 @@ namespace Swift { IBBParser(); ~IBBParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { TopLevel = 0, }; int level; - String currentText; + std::string currentText; }; } diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp index 5a9b3d8..2ec1916 100644 --- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp @@ -18,7 +18,7 @@ InBandRegistrationPayloadParser::~InBandRegistrationPayloadParser() { delete formParserFactory; } -void InBandRegistrationPayloadParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void InBandRegistrationPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level == TopLevel) { } else if (level == PayloadLevel) { @@ -38,7 +38,7 @@ void InBandRegistrationPayloadParser::handleStartElement(const String& element, ++level; } -void InBandRegistrationPayloadParser::handleEndElement(const String& element, const String& ns) { +void InBandRegistrationPayloadParser::handleEndElement(const std::string& element, const std::string& ns) { --level; if (formParser) { @@ -116,7 +116,7 @@ void InBandRegistrationPayloadParser::handleEndElement(const String& element, co } } -void InBandRegistrationPayloadParser::handleCharacterData(const String& data) { +void InBandRegistrationPayloadParser::handleCharacterData(const std::string& data) { if (formParser) { formParser->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h index d616e70..c0209c4 100644 --- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h @@ -20,9 +20,9 @@ namespace Swift { InBandRegistrationPayloadParser(); ~InBandRegistrationPayloadParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -32,6 +32,6 @@ namespace Swift { int level; FormParserFactory* formParserFactory; FormParser* formParser; - String currentText; + std::string currentText; }; } diff --git a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp index 65417a7..ec9e200 100644 --- a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp @@ -18,27 +18,27 @@ namespace Swift { MUCUserPayloadParser::MUCUserPayloadParser() : level(TopLevel) { } -void MUCUserPayloadParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { +void MUCUserPayloadParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level == ItemLevel) { if (element == "item") { MUCUserPayload::Item item; - String affiliation = attributes.getAttribute("affiliation"); - String role = attributes.getAttribute("role"); - String nick = attributes.getAttribute("nick"); - String jid = attributes.getAttribute("jid"); + std::string affiliation = attributes.getAttribute("affiliation"); + std::string role = attributes.getAttribute("role"); + std::string nick = attributes.getAttribute("nick"); + std::string jid = attributes.getAttribute("jid"); item.affiliation = parseAffiliation(affiliation); item.role = parseRole(role); - if (!jid.isEmpty()) { + if (!jid.empty()) { item.realJID = JID(jid); } - if (!nick.isEmpty()) { + if (!nick.empty()) { item.nick = nick; } getPayloadInternal()->addItem(item); } else if (element == "status") { MUCUserPayload::StatusCode status; try { - status.code = boost::lexical_cast<int>(attributes.getAttribute("code").getUTF8Data()); + status.code = boost::lexical_cast<int>(attributes.getAttribute("code").c_str()); getPayloadInternal()->addStatusCode(status); } catch (boost::bad_lexical_cast&) { } @@ -47,7 +47,7 @@ void MUCUserPayloadParser::handleStartElement(const String& element, const Strin ++level; } -MUCOccupant::Role MUCUserPayloadParser::parseRole(const String& roleString) const { +MUCOccupant::Role MUCUserPayloadParser::parseRole(const std::string& roleString) const { if (roleString == "moderator") { return MUCOccupant::Moderator; } @@ -63,7 +63,7 @@ MUCOccupant::Role MUCUserPayloadParser::parseRole(const String& roleString) cons return MUCOccupant::NoRole; } -MUCOccupant::Affiliation MUCUserPayloadParser::parseAffiliation(const String& affiliationString) const { +MUCOccupant::Affiliation MUCUserPayloadParser::parseAffiliation(const std::string& affiliationString) const { if (affiliationString == "owner") { return MUCOccupant::Owner; } @@ -83,11 +83,11 @@ MUCOccupant::Affiliation MUCUserPayloadParser::parseAffiliation(const String& af } -void MUCUserPayloadParser::handleEndElement(const String& /*element*/, const String&) { +void MUCUserPayloadParser::handleEndElement(const std::string& /*element*/, const std::string&) { --level; } -void MUCUserPayloadParser::handleCharacterData(const String& /*data*/) { +void MUCUserPayloadParser::handleCharacterData(const std::string& /*data*/) { } diff --git a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h index 01c7de1..384f0cd 100644 --- a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h @@ -16,11 +16,11 @@ namespace Swift { public: MUCUserPayloadParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); - MUCOccupant::Role parseRole(const String& itemString) const; - MUCOccupant::Affiliation parseAffiliation(const String& statusString) const; + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); + MUCOccupant::Role parseRole(const std::string& itemString) const; + MUCOccupant::Affiliation parseAffiliation(const std::string& statusString) const; private: enum Level { TopLevel = 0, diff --git a/Swiften/Parser/PayloadParsers/NicknameParser.cpp b/Swiften/Parser/PayloadParsers/NicknameParser.cpp index c60bc72..cd7ec27 100644 --- a/Swiften/Parser/PayloadParsers/NicknameParser.cpp +++ b/Swiften/Parser/PayloadParsers/NicknameParser.cpp @@ -11,18 +11,18 @@ namespace Swift { NicknameParser::NicknameParser() : level(0) { } -void NicknameParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void NicknameParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level; } -void NicknameParser::handleEndElement(const String&, const String&) { +void NicknameParser::handleEndElement(const std::string&, const std::string&) { --level; if (level == 0) { getPayloadInternal()->setNickname(text); } } -void NicknameParser::handleCharacterData(const String& data) { +void NicknameParser::handleCharacterData(const std::string& data) { text += data; } diff --git a/Swiften/Parser/PayloadParsers/NicknameParser.h b/Swiften/Parser/PayloadParsers/NicknameParser.h index 24003b8..6e723c8 100644 --- a/Swiften/Parser/PayloadParsers/NicknameParser.h +++ b/Swiften/Parser/PayloadParsers/NicknameParser.h @@ -14,12 +14,12 @@ namespace Swift { public: NicknameParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level; - String text; + std::string text; }; } diff --git a/Swiften/Parser/PayloadParsers/PriorityParser.cpp b/Swiften/Parser/PayloadParsers/PriorityParser.cpp index 8872977..bcbf67f 100644 --- a/Swiften/Parser/PayloadParsers/PriorityParser.cpp +++ b/Swiften/Parser/PayloadParsers/PriorityParser.cpp @@ -13,11 +13,11 @@ namespace Swift { PriorityParser::PriorityParser() : level_(0) { } -void PriorityParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void PriorityParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level_; } -void PriorityParser::handleEndElement(const String&, const String&) { +void PriorityParser::handleEndElement(const std::string&, const std::string&) { --level_; if (level_ == 0) { int priority = 0; @@ -30,7 +30,7 @@ void PriorityParser::handleEndElement(const String&, const String&) { } } -void PriorityParser::handleCharacterData(const String& data) { +void PriorityParser::handleCharacterData(const std::string& data) { text_ += data; } diff --git a/Swiften/Parser/PayloadParsers/PriorityParser.h b/Swiften/Parser/PayloadParsers/PriorityParser.h index e9ce592..1b02255 100644 --- a/Swiften/Parser/PayloadParsers/PriorityParser.h +++ b/Swiften/Parser/PayloadParsers/PriorityParser.h @@ -15,13 +15,13 @@ namespace Swift { public: PriorityParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; - String text_; + std::string text_; }; } diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp b/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp index 2cbe741..026da96 100644 --- a/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp +++ b/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp @@ -13,7 +13,7 @@ namespace Swift { PrivateStorageParser::PrivateStorageParser(PayloadParserFactoryCollection* factories) : factories(factories), level(0) { } -void PrivateStorageParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void PrivateStorageParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level == 1) { PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes); if (payloadParserFactory) { @@ -27,7 +27,7 @@ void PrivateStorageParser::handleStartElement(const String& element, const Strin ++level; } -void PrivateStorageParser::handleEndElement(const String& element, const String& ns) { +void PrivateStorageParser::handleEndElement(const std::string& element, const std::string& ns) { --level; if (currentPayloadParser.get()) { if (level >= 1) { @@ -40,7 +40,7 @@ void PrivateStorageParser::handleEndElement(const String& element, const String& } } -void PrivateStorageParser::handleCharacterData(const String& data) { +void PrivateStorageParser::handleCharacterData(const std::string& data) { if (level > 1 && currentPayloadParser.get()) { currentPayloadParser->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h b/Swiften/Parser/PayloadParsers/PrivateStorageParser.h index 1340ba1..f5f569a 100644 --- a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h +++ b/Swiften/Parser/PayloadParsers/PrivateStorageParser.h @@ -19,9 +19,9 @@ namespace Swift { PrivateStorageParser(PayloadParserFactoryCollection* factories); private: - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: PayloadParserFactoryCollection* factories; diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h b/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h index 53bb1ec..9399ace 100644 --- a/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h +++ b/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h @@ -17,7 +17,7 @@ namespace Swift { PrivateStorageParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) { } - virtual bool canParse(const String& element, const String& ns, const AttributeMap&) const { + virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const { return element == "query" && ns == "jabber:iq:private"; } diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp index 589e9d9..bc9b843 100644 --- a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp @@ -12,12 +12,12 @@ namespace Swift { RawXMLPayloadParser::RawXMLPayloadParser() : level_(0) { } -void RawXMLPayloadParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void RawXMLPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { ++level_; serializingParser_.handleStartElement(element, ns, attributes); } -void RawXMLPayloadParser::handleEndElement(const String& element, const String& ns) { +void RawXMLPayloadParser::handleEndElement(const std::string& element, const std::string& ns) { serializingParser_.handleEndElement(element, ns); --level_; if (level_ == 0) { @@ -25,7 +25,7 @@ void RawXMLPayloadParser::handleEndElement(const String& element, const String& } } -void RawXMLPayloadParser::handleCharacterData(const String& data) { +void RawXMLPayloadParser::handleCharacterData(const std::string& data) { serializingParser_.handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h index eedc85b..b5c887a 100644 --- a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h @@ -17,9 +17,9 @@ namespace Swift { public: RawXMLPayloadParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h b/Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h index 755fb08..b180e1e 100644 --- a/Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h +++ b/Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h @@ -8,14 +8,14 @@ #include "Swiften/Parser/PayloadParserFactory.h" #include "Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class RawXMLPayloadParserFactory : public PayloadParserFactory { public: RawXMLPayloadParserFactory() {} - virtual bool canParse(const String&, const String&, const AttributeMap&) const { + virtual bool canParse(const std::string&, const std::string&, const AttributeMap&) const { return true; } diff --git a/Swiften/Parser/PayloadParsers/ResourceBindParser.cpp b/Swiften/Parser/PayloadParsers/ResourceBindParser.cpp index 92929bf..5c3affb 100644 --- a/Swiften/Parser/PayloadParsers/ResourceBindParser.cpp +++ b/Swiften/Parser/PayloadParsers/ResourceBindParser.cpp @@ -11,7 +11,7 @@ namespace Swift { ResourceBindParser::ResourceBindParser() : level_(0), inJID_(false), inResource_(false) { } -void ResourceBindParser::handleStartElement(const String& element, const String&, const AttributeMap&) { +void ResourceBindParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) { if (level_ == 1) { text_ = ""; if (element == "resource") { @@ -24,7 +24,7 @@ void ResourceBindParser::handleStartElement(const String& element, const String& ++level_; } -void ResourceBindParser::handleEndElement(const String&, const String&) { +void ResourceBindParser::handleEndElement(const std::string&, const std::string&) { --level_; if (level_ == 1) { if (inJID_) { @@ -36,7 +36,7 @@ void ResourceBindParser::handleEndElement(const String&, const String&) { } } -void ResourceBindParser::handleCharacterData(const String& data) { +void ResourceBindParser::handleCharacterData(const std::string& data) { text_ += data; } diff --git a/Swiften/Parser/PayloadParsers/ResourceBindParser.h b/Swiften/Parser/PayloadParsers/ResourceBindParser.h index 890f28a..875b5f4 100644 --- a/Swiften/Parser/PayloadParsers/ResourceBindParser.h +++ b/Swiften/Parser/PayloadParsers/ResourceBindParser.h @@ -15,15 +15,15 @@ namespace Swift { public: ResourceBindParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; bool inJID_; bool inResource_; - String text_; + std::string text_; }; } diff --git a/Swiften/Parser/PayloadParsers/RosterParser.cpp b/Swiften/Parser/PayloadParsers/RosterParser.cpp index a8dd63e..ba19fbf 100644 --- a/Swiften/Parser/PayloadParsers/RosterParser.cpp +++ b/Swiften/Parser/PayloadParsers/RosterParser.cpp @@ -12,7 +12,7 @@ namespace Swift { RosterParser::RosterParser() : level_(TopLevel), inItem_(false), unknownContentParser_(0) { } -void RosterParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void RosterParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level_ == PayloadLevel) { if (element == "item") { inItem_ = true; @@ -21,7 +21,7 @@ void RosterParser::handleStartElement(const String& element, const String& ns, c currentItem_.setJID(JID(attributes.getAttribute("jid"))); currentItem_.setName(attributes.getAttribute("name")); - String subscription = attributes.getAttribute("subscription"); + std::string subscription = attributes.getAttribute("subscription"); if (subscription == "both") { currentItem_.setSubscription(RosterItemPayload::Both); } @@ -59,7 +59,7 @@ void RosterParser::handleStartElement(const String& element, const String& ns, c ++level_; } -void RosterParser::handleEndElement(const String& element, const String& ns) { +void RosterParser::handleEndElement(const std::string& element, const std::string& ns) { --level_; if (level_ == PayloadLevel) { if (inItem_) { @@ -83,7 +83,7 @@ void RosterParser::handleEndElement(const String& element, const String& ns) { } } -void RosterParser::handleCharacterData(const String& data) { +void RosterParser::handleCharacterData(const std::string& data) { if (unknownContentParser_) { unknownContentParser_->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/RosterParser.h b/Swiften/Parser/PayloadParsers/RosterParser.h index 4a28618..ac72696 100644 --- a/Swiften/Parser/PayloadParsers/RosterParser.h +++ b/Swiften/Parser/PayloadParsers/RosterParser.h @@ -17,9 +17,9 @@ namespace Swift { public: RosterParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -30,7 +30,7 @@ namespace Swift { int level_; bool inItem_; RosterItemPayload currentItem_; - String currentText_; + std::string currentText_; SerializingParser* unknownContentParser_; }; } diff --git a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp index f2cf1dd..7c8752c 100644 --- a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp @@ -18,7 +18,7 @@ SearchPayloadParser::~SearchPayloadParser() { delete formParserFactory; } -void SearchPayloadParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void SearchPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level == TopLevel) { } else if (level == PayloadLevel) { @@ -46,7 +46,7 @@ void SearchPayloadParser::handleStartElement(const String& element, const String ++level; } -void SearchPayloadParser::handleEndElement(const String& element, const String& ns) { +void SearchPayloadParser::handleEndElement(const std::string& element, const std::string& ns) { --level; if (formParser) { @@ -98,7 +98,7 @@ void SearchPayloadParser::handleEndElement(const String& element, const String& } } -void SearchPayloadParser::handleCharacterData(const String& data) { +void SearchPayloadParser::handleCharacterData(const std::string& data) { if (formParser) { formParser->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/SearchPayloadParser.h b/Swiften/Parser/PayloadParsers/SearchPayloadParser.h index 55177b0..01441e8 100644 --- a/Swiften/Parser/PayloadParsers/SearchPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/SearchPayloadParser.h @@ -20,9 +20,9 @@ namespace Swift { SearchPayloadParser(); ~SearchPayloadParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -33,7 +33,7 @@ namespace Swift { int level; FormParserFactory* formParserFactory; FormParser* formParser; - String currentText; + std::string currentText; boost::optional<SearchPayload::Item> currentItem; }; } diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp index eac297b..bf134d7 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp @@ -12,7 +12,7 @@ namespace Swift { SecurityLabelParser::SecurityLabelParser() : level_(TopLevel), labelParser_(0) { } -void SecurityLabelParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void SecurityLabelParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { ++level_; if (level_ == DisplayMarkingOrLabelLevel) { if (element == "displaymarking") { @@ -30,7 +30,7 @@ void SecurityLabelParser::handleStartElement(const String& element, const String } } -void SecurityLabelParser::handleEndElement(const String& element, const String& ns) { +void SecurityLabelParser::handleEndElement(const std::string& element, const std::string& ns) { if (level_ == DisplayMarkingOrLabelLevel) { if (element == "displaymarking") { getPayloadInternal()->setDisplayMarking(currentText_); @@ -53,7 +53,7 @@ void SecurityLabelParser::handleEndElement(const String& element, const String& } -void SecurityLabelParser::handleCharacterData(const String& data) { +void SecurityLabelParser::handleCharacterData(const std::string& data) { if (labelParser_) { labelParser_->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelParser.h index cc62e10..bd80921 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h +++ b/Swiften/Parser/PayloadParsers/SecurityLabelParser.h @@ -17,9 +17,9 @@ namespace Swift { public: SecurityLabelParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -30,7 +30,7 @@ namespace Swift { }; int level_; SerializingParser* labelParser_; - String currentText_; + std::string currentText_; }; } diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp index abe392f..1f2a6bc 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp @@ -18,7 +18,7 @@ SecurityLabelsCatalogParser::~SecurityLabelsCatalogParser() { delete labelParserFactory_; } -void SecurityLabelsCatalogParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void SecurityLabelsCatalogParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { ++level_; if (level_ == PayloadLevel) { getPayloadInternal()->setTo(JID(attributes.getAttribute("to"))); @@ -38,7 +38,7 @@ void SecurityLabelsCatalogParser::handleStartElement(const String& element, cons } } -void SecurityLabelsCatalogParser::handleEndElement(const String& element, const String& ns) { +void SecurityLabelsCatalogParser::handleEndElement(const std::string& element, const std::string& ns) { if (labelParser_) { labelParser_->handleEndElement(element, ns); } @@ -52,7 +52,7 @@ void SecurityLabelsCatalogParser::handleEndElement(const String& element, const --level_; } -void SecurityLabelsCatalogParser::handleCharacterData(const String& data) { +void SecurityLabelsCatalogParser::handleCharacterData(const std::string& data) { if (labelParser_) { labelParser_->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h index 36a54cb..2222117 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h @@ -19,9 +19,9 @@ namespace Swift { SecurityLabelsCatalogParser(); ~SecurityLabelsCatalogParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { diff --git a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp b/Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp index 95d29a7..f8e61c7 100644 --- a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp +++ b/Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp @@ -11,11 +11,11 @@ namespace Swift { SoftwareVersionParser::SoftwareVersionParser() : level_(TopLevel) { } -void SoftwareVersionParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void SoftwareVersionParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level_; } -void SoftwareVersionParser::handleEndElement(const String& element, const String&) { +void SoftwareVersionParser::handleEndElement(const std::string& element, const std::string&) { --level_; if (level_ == PayloadLevel) { if (element == "name") { @@ -31,7 +31,7 @@ void SoftwareVersionParser::handleEndElement(const String& element, const String } } -void SoftwareVersionParser::handleCharacterData(const String& data) { +void SoftwareVersionParser::handleCharacterData(const std::string& data) { currentText_ += data; } diff --git a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.h b/Swiften/Parser/PayloadParsers/SoftwareVersionParser.h index de9a47c..4272e5a 100644 --- a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.h +++ b/Swiften/Parser/PayloadParsers/SoftwareVersionParser.h @@ -15,9 +15,9 @@ namespace Swift { public: SoftwareVersionParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -25,7 +25,7 @@ namespace Swift { PayloadLevel = 1 }; int level_; - String currentText_; + std::string currentText_; }; } diff --git a/Swiften/Parser/PayloadParsers/StartSessionParser.h b/Swiften/Parser/PayloadParsers/StartSessionParser.h index 42090ad..ba6e3c8 100644 --- a/Swiften/Parser/PayloadParsers/StartSessionParser.h +++ b/Swiften/Parser/PayloadParsers/StartSessionParser.h @@ -15,9 +15,9 @@ namespace Swift { public: StartSessionParser() {} - virtual void handleStartElement(const String&, const String&, const AttributeMap&) {} - virtual void handleEndElement(const String&, const String&) {} - virtual void handleCharacterData(const String&) {} + virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) {} + virtual void handleEndElement(const std::string&, const std::string&) {} + virtual void handleCharacterData(const std::string&) {} }; } diff --git a/Swiften/Parser/PayloadParsers/StatusParser.cpp b/Swiften/Parser/PayloadParsers/StatusParser.cpp index 7188fb3..a5d00de 100644 --- a/Swiften/Parser/PayloadParsers/StatusParser.cpp +++ b/Swiften/Parser/PayloadParsers/StatusParser.cpp @@ -11,18 +11,18 @@ namespace Swift { StatusParser::StatusParser() : level_(0) { } -void StatusParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void StatusParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level_; } -void StatusParser::handleEndElement(const String&, const String&) { +void StatusParser::handleEndElement(const std::string&, const std::string&) { --level_; if (level_ == 0) { getPayloadInternal()->setText(text_); } } -void StatusParser::handleCharacterData(const String& data) { +void StatusParser::handleCharacterData(const std::string& data) { text_ += data; } diff --git a/Swiften/Parser/PayloadParsers/StatusParser.h b/Swiften/Parser/PayloadParsers/StatusParser.h index 87e118e..4c6f4ac 100644 --- a/Swiften/Parser/PayloadParsers/StatusParser.h +++ b/Swiften/Parser/PayloadParsers/StatusParser.h @@ -15,13 +15,13 @@ namespace Swift { public: StatusParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; - String text_; + std::string text_; }; } diff --git a/Swiften/Parser/PayloadParsers/StatusShowParser.cpp b/Swiften/Parser/PayloadParsers/StatusShowParser.cpp index 0fd4dd8..774f27d 100644 --- a/Swiften/Parser/PayloadParsers/StatusShowParser.cpp +++ b/Swiften/Parser/PayloadParsers/StatusShowParser.cpp @@ -11,11 +11,11 @@ namespace Swift { StatusShowParser::StatusShowParser() : level_(0) { } -void StatusShowParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void StatusShowParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level_; } -void StatusShowParser::handleEndElement(const String&, const String&) { +void StatusShowParser::handleEndElement(const std::string&, const std::string&) { --level_; if (level_ == 0) { if (text_ == "away") { @@ -36,7 +36,7 @@ void StatusShowParser::handleEndElement(const String&, const String&) { } } -void StatusShowParser::handleCharacterData(const String& data) { +void StatusShowParser::handleCharacterData(const std::string& data) { text_ += data; } diff --git a/Swiften/Parser/PayloadParsers/StatusShowParser.h b/Swiften/Parser/PayloadParsers/StatusShowParser.h index f6563a4..b4100a3 100644 --- a/Swiften/Parser/PayloadParsers/StatusShowParser.h +++ b/Swiften/Parser/PayloadParsers/StatusShowParser.h @@ -15,13 +15,13 @@ namespace Swift { public: StatusShowParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; - String text_; + std::string text_; }; } diff --git a/Swiften/Parser/PayloadParsers/StorageParser.cpp b/Swiften/Parser/PayloadParsers/StorageParser.cpp index c82b82c..94cd0ce 100644 --- a/Swiften/Parser/PayloadParsers/StorageParser.cpp +++ b/Swiften/Parser/PayloadParsers/StorageParser.cpp @@ -13,7 +13,7 @@ namespace Swift { StorageParser::StorageParser() : level(TopLevel) { } -void StorageParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { +void StorageParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level == BookmarkLevel) { if (element == "conference") { assert(!room); @@ -35,7 +35,7 @@ void StorageParser::handleStartElement(const String& element, const String&, con ++level; } -void StorageParser::handleEndElement(const String& element, const String&) { +void StorageParser::handleEndElement(const std::string& element, const std::string&) { --level; if (level == BookmarkLevel) { if (element == "conference") { @@ -59,7 +59,7 @@ void StorageParser::handleEndElement(const String& element, const String&) { } } -void StorageParser::handleCharacterData(const String& data) { +void StorageParser::handleCharacterData(const std::string& data) { currentText += data; } diff --git a/Swiften/Parser/PayloadParsers/StorageParser.h b/Swiften/Parser/PayloadParsers/StorageParser.h index a8bd4a2..16fd869 100644 --- a/Swiften/Parser/PayloadParsers/StorageParser.h +++ b/Swiften/Parser/PayloadParsers/StorageParser.h @@ -16,9 +16,9 @@ namespace Swift { public: StorageParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -27,7 +27,7 @@ namespace Swift { DetailLevel = 2 }; int level; - String currentText; + std::string currentText; boost::optional<Storage::Room> room; boost::optional<Storage::URL> url; }; diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp index bf36321..28c5cf5 100644 --- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp +++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp @@ -26,10 +26,10 @@ StreamInitiationParser::~StreamInitiationParser() { delete formParserFactory; } -void StreamInitiationParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void StreamInitiationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level == TopLevel) { getPayloadInternal()->setID(attributes.getAttribute("id")); - if (!attributes.getAttribute("profile").isEmpty()) { + if (!attributes.getAttribute("profile").empty()) { getPayloadInternal()->setIsFileTransfer(attributes.getAttribute("profile") == FILE_TRANSFER_NS); } } @@ -64,7 +64,7 @@ void StreamInitiationParser::handleStartElement(const String& element, const Str ++level; } -void StreamInitiationParser::handleEndElement(const String& element, const String& ns) { +void StreamInitiationParser::handleEndElement(const std::string& element, const std::string& ns) { --level; if (formParser) { formParser->handleEndElement(element, ns); @@ -107,7 +107,7 @@ void StreamInitiationParser::handleEndElement(const String& element, const Strin } } -void StreamInitiationParser::handleCharacterData(const String& data) { +void StreamInitiationParser::handleCharacterData(const std::string& data) { if (formParser) { formParser->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.h b/Swiften/Parser/PayloadParsers/StreamInitiationParser.h index 7a44651..46f5b2f 100644 --- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.h +++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.h @@ -20,9 +20,9 @@ namespace Swift { StreamInitiationParser(); ~StreamInitiationParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -37,6 +37,6 @@ namespace Swift { bool inFile; bool inFeature; StreamInitiationFileInfo currentFile; - String currentText; + std::string currentText; }; } diff --git a/Swiften/Parser/PayloadParsers/SubjectParser.cpp b/Swiften/Parser/PayloadParsers/SubjectParser.cpp index d28fb7d..d7d9af8 100644 --- a/Swiften/Parser/PayloadParsers/SubjectParser.cpp +++ b/Swiften/Parser/PayloadParsers/SubjectParser.cpp @@ -11,18 +11,18 @@ namespace Swift { SubjectParser::SubjectParser() : level_(0) { } -void SubjectParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void SubjectParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level_; } -void SubjectParser::handleEndElement(const String&, const String&) { +void SubjectParser::handleEndElement(const std::string&, const std::string&) { --level_; if (level_ == 0) { getPayloadInternal()->setText(text_); } } -void SubjectParser::handleCharacterData(const String& data) { +void SubjectParser::handleCharacterData(const std::string& data) { text_ += data; } diff --git a/Swiften/Parser/PayloadParsers/SubjectParser.h b/Swiften/Parser/PayloadParsers/SubjectParser.h index a7b8a89..78e5a9e 100644 --- a/Swiften/Parser/PayloadParsers/SubjectParser.h +++ b/Swiften/Parser/PayloadParsers/SubjectParser.h @@ -14,12 +14,12 @@ namespace Swift { public: SubjectParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: int level_; - String text_; + std::string text_; }; } diff --git a/Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp index b03a418..bb53586 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp @@ -27,7 +27,7 @@ class BodyParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse("<body>foo<baz>bar</baz>fum</body>")); Body* payload = dynamic_cast<Body*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("foobarfum"), payload->getText()); + CPPUNIT_ASSERT_EQUAL(std::string("foobarfum"), payload->getText()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/CommandParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/CommandParserTest.cpp index 5f11718..7ebcbac 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/CommandParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/CommandParserTest.cpp @@ -29,8 +29,8 @@ class CommandParserTest : public CppUnit::TestFixture { Command::ref payload = parser.getPayload<Command>(); CPPUNIT_ASSERT_EQUAL(Command::Prev, payload->getAction()); - CPPUNIT_ASSERT_EQUAL(String("list"), payload->getNode()); - CPPUNIT_ASSERT_EQUAL(String("myid"), payload->getSessionID()); + CPPUNIT_ASSERT_EQUAL(std::string("list"), payload->getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), payload->getSessionID()); } void testParse_Result() { @@ -52,9 +52,9 @@ class CommandParserTest : public CppUnit::TestFixture { std::vector<Command::Note> notes = payload->getNotes(); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(notes.size())); CPPUNIT_ASSERT_EQUAL(Command::Note::Warn, notes[0].type); - CPPUNIT_ASSERT_EQUAL(String("Service 'httpd' has been configured."), notes[0].note); + CPPUNIT_ASSERT_EQUAL(std::string("Service 'httpd' has been configured."), notes[0].note); CPPUNIT_ASSERT_EQUAL(Command::Note::Error, notes[1].type); - CPPUNIT_ASSERT_EQUAL(String("I lied."), notes[1].note); + CPPUNIT_ASSERT_EQUAL(std::string("I lied."), notes[1].note); std::vector<Command::Action> actions = payload->getAvailableActions(); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(actions.size())); CPPUNIT_ASSERT_EQUAL(Command::Prev, actions[0]); @@ -77,8 +77,8 @@ class CommandParserTest : public CppUnit::TestFixture { Command::ref payload = parser.getPayload<Command>(); Form::ref form = payload->getForm(); - CPPUNIT_ASSERT_EQUAL(String("Bot Configuration"), form->getTitle()); - CPPUNIT_ASSERT_EQUAL(String("Hello!\nFill out this form to configure your new bot!"), form->getInstructions()); + CPPUNIT_ASSERT_EQUAL(std::string("Bot Configuration"), form->getTitle()); + CPPUNIT_ASSERT_EQUAL(std::string("Hello!\nFill out this form to configure your new bot!"), form->getInstructions()); CPPUNIT_ASSERT_EQUAL(Form::ResultType, form->getType()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp index 5d9e365..793e0c2 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp @@ -33,18 +33,18 @@ class DiscoInfoParserTest : public CppUnit::TestFixture { DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getIdentities().size())); - CPPUNIT_ASSERT_EQUAL(String("Swift"), payload->getIdentities()[0].getName()); - CPPUNIT_ASSERT_EQUAL(String("pc"), payload->getIdentities()[0].getType()); - CPPUNIT_ASSERT_EQUAL(String("client"), payload->getIdentities()[0].getCategory()); - CPPUNIT_ASSERT_EQUAL(String("en"), payload->getIdentities()[0].getLanguage()); - CPPUNIT_ASSERT_EQUAL(String("Vlug"), payload->getIdentities()[1].getName()); - CPPUNIT_ASSERT_EQUAL(String("pc"), payload->getIdentities()[1].getType()); - CPPUNIT_ASSERT_EQUAL(String("client"), payload->getIdentities()[1].getCategory()); - CPPUNIT_ASSERT_EQUAL(String("nl"), payload->getIdentities()[1].getLanguage()); + CPPUNIT_ASSERT_EQUAL(std::string("Swift"), payload->getIdentities()[0].getName()); + CPPUNIT_ASSERT_EQUAL(std::string("pc"), payload->getIdentities()[0].getType()); + CPPUNIT_ASSERT_EQUAL(std::string("client"), payload->getIdentities()[0].getCategory()); + CPPUNIT_ASSERT_EQUAL(std::string("en"), payload->getIdentities()[0].getLanguage()); + CPPUNIT_ASSERT_EQUAL(std::string("Vlug"), payload->getIdentities()[1].getName()); + CPPUNIT_ASSERT_EQUAL(std::string("pc"), payload->getIdentities()[1].getType()); + CPPUNIT_ASSERT_EQUAL(std::string("client"), payload->getIdentities()[1].getCategory()); + CPPUNIT_ASSERT_EQUAL(std::string("nl"), payload->getIdentities()[1].getLanguage()); CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(payload->getFeatures().size())); - CPPUNIT_ASSERT_EQUAL(String("foo-feature"), payload->getFeatures()[0]); - CPPUNIT_ASSERT_EQUAL(String("bar-feature"), payload->getFeatures()[1]); - CPPUNIT_ASSERT_EQUAL(String("baz-feature"), payload->getFeatures()[2]); + CPPUNIT_ASSERT_EQUAL(std::string("foo-feature"), payload->getFeatures()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("bar-feature"), payload->getFeatures()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("baz-feature"), payload->getFeatures()[2]); } void testParse_Form() { @@ -62,10 +62,10 @@ class DiscoInfoParserTest : public CppUnit::TestFixture { DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(payload->getExtensions().size())); - CPPUNIT_ASSERT_EQUAL(String("Bot Configuration"), payload->getExtensions()[0]->getTitle()); + CPPUNIT_ASSERT_EQUAL(std::string("Bot Configuration"), payload->getExtensions()[0]->getTitle()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getFeatures().size())); - CPPUNIT_ASSERT_EQUAL(String("foo-feature"), payload->getFeatures()[0]); - CPPUNIT_ASSERT_EQUAL(String("bar-feature"), payload->getFeatures()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("foo-feature"), payload->getFeatures()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("bar-feature"), payload->getFeatures()[1]); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp index 618ce6d..02c2f7d 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp @@ -30,7 +30,7 @@ class ErrorParserTest : public CppUnit::TestFixture { ErrorPayload::ref payload = boost::dynamic_pointer_cast<ErrorPayload>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, payload->getCondition()); CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, payload->getType()); - CPPUNIT_ASSERT_EQUAL(String("boo"), payload->getText()); + CPPUNIT_ASSERT_EQUAL(std::string("boo"), payload->getText()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp index aede75d..6ec825b 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp @@ -31,8 +31,8 @@ class FormParserTest : public CppUnit::TestFixture { )); Form* payload = dynamic_cast<Form*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("Bot Configuration"), payload->getTitle()); - CPPUNIT_ASSERT_EQUAL(String("Hello!\nFill out this form to configure your new bot!"), payload->getInstructions()); + CPPUNIT_ASSERT_EQUAL(std::string("Bot Configuration"), payload->getTitle()); + CPPUNIT_ASSERT_EQUAL(std::string("Hello!\nFill out this form to configure your new bot!"), payload->getInstructions()); CPPUNIT_ASSERT_EQUAL(Form::SubmitType, payload->getType()); } @@ -84,38 +84,38 @@ class FormParserTest : public CppUnit::TestFixture { Form* payload = dynamic_cast<Form*>(parser.getPayload().get()); CPPUNIT_ASSERT_EQUAL(10, static_cast<int>(payload->getFields().size())); - CPPUNIT_ASSERT_EQUAL(String("jabber:bot"), boost::dynamic_pointer_cast<HiddenFormField>(payload->getFields()[0])->getValue()); - CPPUNIT_ASSERT_EQUAL(String("FORM_TYPE"), payload->getFields()[0]->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:bot"), boost::dynamic_pointer_cast<HiddenFormField>(payload->getFields()[0])->getValue()); + CPPUNIT_ASSERT_EQUAL(std::string("FORM_TYPE"), payload->getFields()[0]->getName()); CPPUNIT_ASSERT(!payload->getFields()[0]->getRequired()); - CPPUNIT_ASSERT_EQUAL(String("Section 1: Bot Info"), boost::dynamic_pointer_cast<FixedFormField>(payload->getFields()[1])->getValue()); + CPPUNIT_ASSERT_EQUAL(std::string("Section 1: Bot Info"), boost::dynamic_pointer_cast<FixedFormField>(payload->getFields()[1])->getValue()); - CPPUNIT_ASSERT_EQUAL(String("The name of your bot"), payload->getFields()[2]->getLabel()); + CPPUNIT_ASSERT_EQUAL(std::string("The name of your bot"), payload->getFields()[2]->getLabel()); - CPPUNIT_ASSERT_EQUAL(String("This is a bot.\nA quite good one actually"), boost::dynamic_pointer_cast<TextMultiFormField>(payload->getFields()[3])->getValue()); + CPPUNIT_ASSERT_EQUAL(std::string("This is a bot.\nA quite good one actually"), boost::dynamic_pointer_cast<TextMultiFormField>(payload->getFields()[3])->getValue()); CPPUNIT_ASSERT_EQUAL(true, boost::dynamic_pointer_cast<BooleanFormField>(payload->getFields()[4])->getValue()); CPPUNIT_ASSERT(payload->getFields()[4]->getRequired()); - CPPUNIT_ASSERT_EQUAL(String("1"), boost::dynamic_pointer_cast<BooleanFormField>(payload->getFields()[4])->getRawValues()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("1"), boost::dynamic_pointer_cast<BooleanFormField>(payload->getFields()[4])->getRawValues()[0]); - CPPUNIT_ASSERT_EQUAL(String("news"), boost::dynamic_pointer_cast<ListMultiFormField>(payload->getFields()[6])->getValue()[0]); - CPPUNIT_ASSERT_EQUAL(String("news"), payload->getFields()[6]->getRawValues()[0]); - CPPUNIT_ASSERT_EQUAL(String("search"), boost::dynamic_pointer_cast<ListMultiFormField>(payload->getFields()[6])->getValue()[1]); - CPPUNIT_ASSERT_EQUAL(String("search"), payload->getFields()[6]->getRawValues()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("news"), boost::dynamic_pointer_cast<ListMultiFormField>(payload->getFields()[6])->getValue()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("news"), payload->getFields()[6]->getRawValues()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("search"), boost::dynamic_pointer_cast<ListMultiFormField>(payload->getFields()[6])->getValue()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("search"), payload->getFields()[6]->getRawValues()[1]); CPPUNIT_ASSERT_EQUAL(5, static_cast<int>(payload->getFields()[6]->getOptions().size())); - CPPUNIT_ASSERT_EQUAL(String("Contests"), payload->getFields()[6]->getOptions()[0].label); - CPPUNIT_ASSERT_EQUAL(String("contests"), payload->getFields()[6]->getOptions()[0].value); - CPPUNIT_ASSERT_EQUAL(String("News"), payload->getFields()[6]->getOptions()[1].label); - CPPUNIT_ASSERT_EQUAL(String("news"), payload->getFields()[6]->getOptions()[1].value); + CPPUNIT_ASSERT_EQUAL(std::string("Contests"), payload->getFields()[6]->getOptions()[0].label); + CPPUNIT_ASSERT_EQUAL(std::string("contests"), payload->getFields()[6]->getOptions()[0].value); + CPPUNIT_ASSERT_EQUAL(std::string("News"), payload->getFields()[6]->getOptions()[1].label); + CPPUNIT_ASSERT_EQUAL(std::string("news"), payload->getFields()[6]->getOptions()[1].value); - CPPUNIT_ASSERT_EQUAL(String("20"), boost::dynamic_pointer_cast<ListSingleFormField>(payload->getFields()[7])->getValue()); + CPPUNIT_ASSERT_EQUAL(std::string("20"), boost::dynamic_pointer_cast<ListSingleFormField>(payload->getFields()[7])->getValue()); CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com"), boost::dynamic_pointer_cast<JIDMultiFormField>(payload->getFields()[8])->getValue()[0]); CPPUNIT_ASSERT_EQUAL(JID("baz@fum.org"), boost::dynamic_pointer_cast<JIDMultiFormField>(payload->getFields()[8])->getValue()[1]); - CPPUNIT_ASSERT_EQUAL(String("Tell all your friends about your new bot!"), payload->getFields()[8]->getDescription()); + CPPUNIT_ASSERT_EQUAL(std::string("Tell all your friends about your new bot!"), payload->getFields()[8]->getDescription()); - CPPUNIT_ASSERT_EQUAL(String("foo"), boost::dynamic_pointer_cast<UntypedFormField>(payload->getFields()[9])->getValue()[0]); - CPPUNIT_ASSERT_EQUAL(String("baz"), boost::dynamic_pointer_cast<UntypedFormField>(payload->getFields()[9])->getValue()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), boost::dynamic_pointer_cast<UntypedFormField>(payload->getFields()[9])->getValue()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("baz"), boost::dynamic_pointer_cast<UntypedFormField>(payload->getFields()[9])->getValue()[1]); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h index ee64181..2c88955 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h +++ b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h @@ -26,11 +26,11 @@ namespace Swift { delete xmlParser; } - bool parse(const String& data) { + bool parse(const std::string& data) { return xmlParser->parse(data); } - virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { + virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level == 0) { CPPUNIT_ASSERT(!payloadParser.get()); PayloadParserFactory* payloadParserFactory = factories.getPayloadParserFactory(element, ns, attributes); @@ -41,12 +41,12 @@ namespace Swift { level++; } - virtual void handleEndElement(const String& element, const String& ns) { + virtual void handleEndElement(const std::string& element, const std::string& ns) { level--; payloadParser->handleEndElement(element, ns); } - virtual void handleCharacterData(const String& data) { + virtual void handleCharacterData(const std::string& data) { payloadParser->handleCharacterData(data); } diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp index 0fe58e0..867b25f 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp @@ -40,7 +40,7 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(payload); boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload()); CPPUNIT_ASSERT(storage); - CPPUNIT_ASSERT_EQUAL(String("Alice"), storage->getRooms()[0].nick); + CPPUNIT_ASSERT_EQUAL(std::string("Alice"), storage->getRooms()[0].nick); CPPUNIT_ASSERT_EQUAL(JID("swift@rooms.swift.im"), storage->getRooms()[0].jid); } @@ -75,7 +75,7 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(payload); boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload()); CPPUNIT_ASSERT(storage); - CPPUNIT_ASSERT_EQUAL(String("Rabbit"), storage->getRooms()[0].nick); + CPPUNIT_ASSERT_EQUAL(std::string("Rabbit"), storage->getRooms()[0].nick); } void testParse_UnsupportedPayload() { diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp index bb21f05..8885974 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp @@ -25,7 +25,7 @@ class RawXMLPayloadParserTest : public CppUnit::TestFixture RawXMLPayloadParser testling; PayloadParserTester parser(&testling); - String xml = + std::string xml = "<foo foo-attr=\"foo-val\" xmlns=\"ns:foo\">" "<bar bar-attr=\"bar-val\" xmlns=\"ns:bar\"/>" "<baz baz-attr=\"baz-val\" xmlns=\"ns:baz\"/>" diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp index 18b194e..026ef2c 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp @@ -37,7 +37,7 @@ class ResourceBindParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse("<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>someresource</resource></bind>")); ResourceBind* payload = dynamic_cast<ResourceBind*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("someresource"), payload->getResource()); + CPPUNIT_ASSERT_EQUAL(std::string("someresource"), payload->getResource()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp index b55a340..1bcea0e 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp @@ -37,15 +37,15 @@ class RosterParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), items.size()); CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com"), items[0].getJID()); - CPPUNIT_ASSERT_EQUAL(String("Foo @ Bar"), items[0].getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Foo @ Bar"), items[0].getName()); CPPUNIT_ASSERT_EQUAL(RosterItemPayload::From, items[0].getSubscription()); CPPUNIT_ASSERT(items[0].getSubscriptionRequested()); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), items[0].getGroups().size()); - CPPUNIT_ASSERT_EQUAL(String("Group 1"), items[0].getGroups()[0]); - CPPUNIT_ASSERT_EQUAL(String("Group 2"), items[0].getGroups()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("Group 1"), items[0].getGroups()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("Group 2"), items[0].getGroups()[1]); CPPUNIT_ASSERT_EQUAL(JID("baz@blo.com"), items[1].getJID()); - CPPUNIT_ASSERT_EQUAL(String("Baz"), items[1].getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Baz"), items[1].getName()); CPPUNIT_ASSERT_EQUAL(RosterItemPayload::None, items[1].getSubscription()); CPPUNIT_ASSERT(!items[1].getSubscriptionRequested()); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), items[1].getGroups().size()); @@ -67,9 +67,9 @@ class RosterParserTest : public CppUnit::TestFixture const RosterPayload::RosterItemPayloads& items = payload->getItems(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), items.size()); - CPPUNIT_ASSERT_EQUAL(String("Group 1"), items[0].getGroups()[0]); - CPPUNIT_ASSERT_EQUAL(String("Group 2"), items[0].getGroups()[1]); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string("Group 1"), items[0].getGroups()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("Group 2"), items[0].getGroups()[1]); + CPPUNIT_ASSERT_EQUAL(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>" ), items[0].getUnknownContent()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SearchPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SearchPayloadParserTest.cpp index 1d94c15..3d3bc7b 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/SearchPayloadParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/SearchPayloadParserTest.cpp @@ -31,7 +31,7 @@ class SearchPayloadParserTest : public CppUnit::TestFixture { )); SearchPayload::ref payload = parser.getPayload<SearchPayload>(); - CPPUNIT_ASSERT_EQUAL(String("Foo"), *payload->getInstructions()); + CPPUNIT_ASSERT_EQUAL(std::string("Foo"), *payload->getInstructions()); CPPUNIT_ASSERT(payload->getFirst()); CPPUNIT_ASSERT(payload->getLast()); CPPUNIT_ASSERT(!payload->getNick()); @@ -60,10 +60,10 @@ class SearchPayloadParserTest : public CppUnit::TestFixture { SearchPayload::ref payload = parser.getPayload<SearchPayload>(); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getItems().size())); CPPUNIT_ASSERT_EQUAL(JID("juliet@capulet.com"), payload->getItems()[0].jid); - CPPUNIT_ASSERT_EQUAL(String("Juliet"), payload->getItems()[0].first); - CPPUNIT_ASSERT_EQUAL(String("Capulet"), payload->getItems()[0].last); - CPPUNIT_ASSERT_EQUAL(String("JuliC"), payload->getItems()[0].nick); - CPPUNIT_ASSERT_EQUAL(String("juliet@shakespeare.lit"), payload->getItems()[0].email); + CPPUNIT_ASSERT_EQUAL(std::string("Juliet"), payload->getItems()[0].first); + CPPUNIT_ASSERT_EQUAL(std::string("Capulet"), payload->getItems()[0].last); + CPPUNIT_ASSERT_EQUAL(std::string("JuliC"), payload->getItems()[0].nick); + CPPUNIT_ASSERT_EQUAL(std::string("juliet@shakespeare.lit"), payload->getItems()[0].email); CPPUNIT_ASSERT_EQUAL(JID("tybalt@shakespeare.lit"), payload->getItems()[1].jid); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp index 9891330..0812c6b 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp @@ -39,12 +39,12 @@ class SecurityLabelParserTest : public CppUnit::TestFixture "</securitylabel>")); SecurityLabel* payload = dynamic_cast<SecurityLabel*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("SECRET"), payload->getDisplayMarking()); - CPPUNIT_ASSERT_EQUAL(String("black"), payload->getForegroundColor()); - CPPUNIT_ASSERT_EQUAL(String("red"), payload->getBackgroundColor()); - CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"), payload->getLabel()); - CPPUNIT_ASSERT_EQUAL(String("<icismlabel classification=\"S\" disseminationControls=\"FOUO\" ownerProducer=\"USA\" xmlns=\"http://example.gov/IC-ISM/0\"/>"), payload->getEquivalentLabels()[0]); - CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>"), payload->getEquivalentLabels()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("SECRET"), payload->getDisplayMarking()); + CPPUNIT_ASSERT_EQUAL(std::string("black"), payload->getForegroundColor()); + CPPUNIT_ASSERT_EQUAL(std::string("red"), payload->getBackgroundColor()); + CPPUNIT_ASSERT_EQUAL(std::string("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"), payload->getLabel()); + CPPUNIT_ASSERT_EQUAL(std::string("<icismlabel classification=\"S\" disseminationControls=\"FOUO\" ownerProducer=\"USA\" xmlns=\"http://example.gov/IC-ISM/0\"/>"), payload->getEquivalentLabels()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>"), payload->getEquivalentLabels()[1]); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp index b9eedb3..9925e34 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp @@ -37,14 +37,14 @@ class SecurityLabelsCatalogParserTest : public CppUnit::TestFixture "</catalog>")); SecurityLabelsCatalog* payload = dynamic_cast<SecurityLabelsCatalog*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("Default"), payload->getName()); - CPPUNIT_ASSERT_EQUAL(String("an example set of labels"), payload->getDescription()); + CPPUNIT_ASSERT_EQUAL(std::string("Default"), payload->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("an example set of labels"), payload->getDescription()); CPPUNIT_ASSERT_EQUAL(JID("example.com"), payload->getTo()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getLabels().size())); - CPPUNIT_ASSERT_EQUAL(String("SECRET"), payload->getLabels()[0].getDisplayMarking()); - CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"), payload->getLabels()[0].getLabel()); - CPPUNIT_ASSERT_EQUAL(String("CONFIDENTIAL"), payload->getLabels()[1].getDisplayMarking()); - CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel>"), payload->getLabels()[1].getLabel()); + CPPUNIT_ASSERT_EQUAL(std::string("SECRET"), payload->getLabels()[0].getDisplayMarking()); + CPPUNIT_ASSERT_EQUAL(std::string("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"), payload->getLabels()[0].getLabel()); + CPPUNIT_ASSERT_EQUAL(std::string("CONFIDENTIAL"), payload->getLabels()[1].getDisplayMarking()); + CPPUNIT_ASSERT_EQUAL(std::string("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel>"), payload->getLabels()[1].getLabel()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp index ae1bbb6..3689f10 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp @@ -32,9 +32,9 @@ class SoftwareVersionParserTest : public CppUnit::TestFixture "</query>")); SoftwareVersion* payload = dynamic_cast<SoftwareVersion*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("myclient"), payload->getName()); - CPPUNIT_ASSERT_EQUAL(String("1.0"), payload->getVersion()); - CPPUNIT_ASSERT_EQUAL(String("Mac OS X"), payload->getOS()); + CPPUNIT_ASSERT_EQUAL(std::string("myclient"), payload->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("1.0"), payload->getVersion()); + CPPUNIT_ASSERT_EQUAL(std::string("Mac OS X"), payload->getOS()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp index a0d3ae7..7791f5f 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp @@ -27,7 +27,7 @@ class StatusParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse("<status>foo<baz>bar</baz>fum</status>")); Status* payload = dynamic_cast<Status*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("foobarfum"), payload->getText()); + CPPUNIT_ASSERT_EQUAL(std::string("foobarfum"), payload->getText()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp index cad3b5c..88730b7 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp @@ -38,11 +38,11 @@ class StorageParserTest : public CppUnit::TestFixture { Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); std::vector<Storage::Room> rooms = payload->getRooms(); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(rooms.size())); - CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), rooms[0].name); + CPPUNIT_ASSERT_EQUAL(std::string("Council of Oberon"), rooms[0].name); CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), rooms[0].jid); CPPUNIT_ASSERT(rooms[0].autoJoin); - CPPUNIT_ASSERT_EQUAL(String("Puck"), rooms[0].nick); - CPPUNIT_ASSERT_EQUAL(String("MyPass"), rooms[0].password); + CPPUNIT_ASSERT_EQUAL(std::string("Puck"), rooms[0].nick); + CPPUNIT_ASSERT_EQUAL(std::string("MyPass"), rooms[0].password); } void testParse_MultipleRooms() { @@ -61,9 +61,9 @@ class StorageParserTest : public CppUnit::TestFixture { Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); std::vector<Storage::Room> rooms = payload->getRooms(); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(rooms.size())); - CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), rooms[0].name); + CPPUNIT_ASSERT_EQUAL(std::string("Council of Oberon"), rooms[0].name); CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), rooms[0].jid); - CPPUNIT_ASSERT_EQUAL(String("Tea party"), rooms[1].name); + CPPUNIT_ASSERT_EQUAL(std::string("Tea party"), rooms[1].name); CPPUNIT_ASSERT_EQUAL(JID("teaparty@wonderland.lit"), rooms[1].jid); } @@ -78,8 +78,8 @@ class StorageParserTest : public CppUnit::TestFixture { Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); std::vector<Storage::URL> urls = payload->getURLs(); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(urls.size())); - CPPUNIT_ASSERT_EQUAL(String("Complete Works of Shakespeare"), urls[0].name); - CPPUNIT_ASSERT_EQUAL(String("http://the-tech.mit.edu/Shakespeare/"), urls[0].url); + CPPUNIT_ASSERT_EQUAL(std::string("Complete Works of Shakespeare"), urls[0].name); + CPPUNIT_ASSERT_EQUAL(std::string("http://the-tech.mit.edu/Shakespeare/"), urls[0].url); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StreamInitiationParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StreamInitiationParserTest.cpp index ca8e353..8001487 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/StreamInitiationParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/StreamInitiationParserTest.cpp @@ -42,13 +42,13 @@ class StreamInitiationParserTest : public CppUnit::TestFixture { StreamInitiation::ref si = parser.getPayload<StreamInitiation>(); CPPUNIT_ASSERT(si->getIsFileTransfer()); CPPUNIT_ASSERT(si->getFileInfo()); - CPPUNIT_ASSERT_EQUAL(String("test.txt"), si->getFileInfo()->name); + CPPUNIT_ASSERT_EQUAL(std::string("test.txt"), si->getFileInfo()->name); CPPUNIT_ASSERT_EQUAL(1022, si->getFileInfo()->size); - CPPUNIT_ASSERT_EQUAL(String("This is info about the file."), si->getFileInfo()->description); + CPPUNIT_ASSERT_EQUAL(std::string("This is info about the file."), si->getFileInfo()->description); CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(si->getProvidedMethods().size())); - CPPUNIT_ASSERT_EQUAL(String("http://jabber.org/protocol/bytestreams"), si->getProvidedMethods()[0]); - CPPUNIT_ASSERT_EQUAL(String("jabber:iq:oob"), si->getProvidedMethods()[1]); - CPPUNIT_ASSERT_EQUAL(String("http://jabber.org/protocol/ibb"), si->getProvidedMethods()[2]); + CPPUNIT_ASSERT_EQUAL(std::string("http://jabber.org/protocol/bytestreams"), si->getProvidedMethods()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:oob"), si->getProvidedMethods()[1]); + CPPUNIT_ASSERT_EQUAL(std::string("http://jabber.org/protocol/ibb"), si->getProvidedMethods()[2]); } void testParse_Response() { @@ -68,7 +68,7 @@ class StreamInitiationParserTest : public CppUnit::TestFixture { StreamInitiation::ref si = parser.getPayload<StreamInitiation>(); CPPUNIT_ASSERT(si->getIsFileTransfer()); - CPPUNIT_ASSERT_EQUAL(String("http://jabber.org/protocol/bytestreams"), si->getRequestedMethod()); + CPPUNIT_ASSERT_EQUAL(std::string("http://jabber.org/protocol/bytestreams"), si->getRequestedMethod()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp index aed04bc..909401d 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp @@ -53,23 +53,23 @@ class VCardParserTest : public CppUnit::TestFixture { "</vCard>")); boost::shared_ptr<VCard> payload = boost::dynamic_pointer_cast<VCard>(parser.getPayload()); - CPPUNIT_ASSERT_EQUAL(String("2.0"), payload->getVersion()); - CPPUNIT_ASSERT_EQUAL(String("Alice In Wonderland"), payload->getFullName()); - CPPUNIT_ASSERT_EQUAL(String("Alice"), payload->getGivenName()); - CPPUNIT_ASSERT_EQUAL(String("In"), payload->getMiddleName()); - CPPUNIT_ASSERT_EQUAL(String("Wonderland"), payload->getFamilyName()); - CPPUNIT_ASSERT_EQUAL(String("Mrs"), payload->getPrefix()); - CPPUNIT_ASSERT_EQUAL(String("PhD"), payload->getSuffix()); - CPPUNIT_ASSERT_EQUAL(String("DreamGirl"), payload->getNickname()); - CPPUNIT_ASSERT_EQUAL(String("<BDAY xmlns=\"vcard-temp\">1234</BDAY><MAILER xmlns=\"vcard-temp\">mutt</MAILER>"), payload->getUnknownContent()); + CPPUNIT_ASSERT_EQUAL(std::string("2.0"), payload->getVersion()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice In Wonderland"), payload->getFullName()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice"), payload->getGivenName()); + CPPUNIT_ASSERT_EQUAL(std::string("In"), payload->getMiddleName()); + CPPUNIT_ASSERT_EQUAL(std::string("Wonderland"), payload->getFamilyName()); + CPPUNIT_ASSERT_EQUAL(std::string("Mrs"), payload->getPrefix()); + CPPUNIT_ASSERT_EQUAL(std::string("PhD"), payload->getSuffix()); + CPPUNIT_ASSERT_EQUAL(std::string("DreamGirl"), payload->getNickname()); + CPPUNIT_ASSERT_EQUAL(std::string("<BDAY xmlns=\"vcard-temp\">1234</BDAY><MAILER xmlns=\"vcard-temp\">mutt</MAILER>"), payload->getUnknownContent()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getEMailAddresses().size())); - CPPUNIT_ASSERT_EQUAL(String("alice@wonderland.lit"), payload->getEMailAddresses()[0].address); + CPPUNIT_ASSERT_EQUAL(std::string("alice@wonderland.lit"), payload->getEMailAddresses()[0].address); CPPUNIT_ASSERT(payload->getEMailAddresses()[0].isHome); CPPUNIT_ASSERT(payload->getEMailAddresses()[0].isInternet); CPPUNIT_ASSERT(payload->getEMailAddresses()[0].isPreferred); CPPUNIT_ASSERT(!payload->getEMailAddresses()[0].isWork); CPPUNIT_ASSERT(!payload->getEMailAddresses()[0].isX400); - CPPUNIT_ASSERT_EQUAL(String("alice@teaparty.lit"), payload->getEMailAddresses()[1].address); + CPPUNIT_ASSERT_EQUAL(std::string("alice@teaparty.lit"), payload->getEMailAddresses()[1].address); CPPUNIT_ASSERT(!payload->getEMailAddresses()[1].isHome); CPPUNIT_ASSERT(!payload->getEMailAddresses()[1].isInternet); CPPUNIT_ASSERT(!payload->getEMailAddresses()[1].isPreferred); @@ -92,7 +92,7 @@ class VCardParserTest : public CppUnit::TestFixture { "</vCard>")); VCard* payload = dynamic_cast<VCard*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), payload->getPhotoType()); + CPPUNIT_ASSERT_EQUAL(std::string("image/jpeg"), payload->getPhotoType()); CPPUNIT_ASSERT_EQUAL(ByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"), payload->getPhoto()); } @@ -105,7 +105,7 @@ class VCardParserTest : public CppUnit::TestFixture { "</vCard>")); VCard* payload = dynamic_cast<VCard*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("mynick"), payload->getNickname()); + CPPUNIT_ASSERT_EQUAL(std::string("mynick"), payload->getNickname()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp index 79df412..b8ea4fb 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp @@ -30,7 +30,7 @@ class VCardUpdateParserTest : public CppUnit::TestFixture "</x>")); VCardUpdate* payload = dynamic_cast<VCardUpdate*>(parser.getPayload().get()); - CPPUNIT_ASSERT_EQUAL(String("sha1-hash-of-image"), payload->getPhotoHash()); + CPPUNIT_ASSERT_EQUAL(std::string("sha1-hash-of-image"), payload->getPhotoHash()); } }; diff --git a/Swiften/Parser/PayloadParsers/VCardParser.cpp b/Swiften/Parser/PayloadParsers/VCardParser.cpp index 2f1f8dc..61af0ba 100644 --- a/Swiften/Parser/PayloadParsers/VCardParser.cpp +++ b/Swiften/Parser/PayloadParsers/VCardParser.cpp @@ -14,9 +14,9 @@ namespace Swift { VCardParser::VCardParser() : unknownContentParser_(NULL) { } -void VCardParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void VCardParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { elementStack_.push_back(element); - String elementHierarchy = getElementHierarchy(); + std::string elementHierarchy = getElementHierarchy(); if (elementHierarchy == "/vCard/EMAIL") { currentEMailAddress_ = VCard::EMailAddress(); } @@ -32,12 +32,12 @@ void VCardParser::handleStartElement(const String& element, const String& ns, co currentText_ = ""; } -void VCardParser::handleEndElement(const String& element, const String& ns) { +void VCardParser::handleEndElement(const std::string& element, const std::string& ns) { if (unknownContentParser_) { unknownContentParser_->handleEndElement(element, ns); } - String elementHierarchy = getElementHierarchy(); + std::string elementHierarchy = getElementHierarchy(); if (elementHierarchy == "/vCard/VERSION") { getPayloadInternal()->setVersion(currentText_); } @@ -104,16 +104,16 @@ void VCardParser::handleEndElement(const String& element, const String& ns) { elementStack_.pop_back(); } -void VCardParser::handleCharacterData(const String& text) { +void VCardParser::handleCharacterData(const std::string& text) { if (unknownContentParser_) { unknownContentParser_->handleCharacterData(text); } currentText_ += text; } -String VCardParser::getElementHierarchy() const { - String result; - foreach(const String& element, elementStack_) { +std::string VCardParser::getElementHierarchy() const { + std::string result; + foreach(const std::string& element, elementStack_) { result += "/" + element; } return result; diff --git a/Swiften/Parser/PayloadParsers/VCardParser.h b/Swiften/Parser/PayloadParsers/VCardParser.h index f912ff1..c858e61 100644 --- a/Swiften/Parser/PayloadParsers/VCardParser.h +++ b/Swiften/Parser/PayloadParsers/VCardParser.h @@ -16,17 +16,17 @@ namespace Swift { public: VCardParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: - String getElementHierarchy() const; + std::string getElementHierarchy() const; private: - std::vector<String> elementStack_; + std::vector<std::string> elementStack_; VCard::EMailAddress currentEMailAddress_; SerializingParser* unknownContentParser_; - String currentText_; + std::string currentText_; }; } diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp b/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp index 08d2d35..2218d75 100644 --- a/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp +++ b/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp @@ -11,21 +11,21 @@ namespace Swift { VCardUpdateParser::VCardUpdateParser() : level_(TopLevel) { } -void VCardUpdateParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void VCardUpdateParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { if (level_ == PayloadLevel) { currentText_ = ""; } ++level_; } -void VCardUpdateParser::handleEndElement(const String& element, const String&) { +void VCardUpdateParser::handleEndElement(const std::string& element, const std::string&) { --level_; if (level_ == PayloadLevel && element == "photo") { getPayloadInternal()->setPhotoHash(currentText_); } } -void VCardUpdateParser::handleCharacterData(const String& text) { +void VCardUpdateParser::handleCharacterData(const std::string& text) { currentText_ += text; } diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h b/Swiften/Parser/PayloadParsers/VCardUpdateParser.h index df86123..b91c17b 100644 --- a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h +++ b/Swiften/Parser/PayloadParsers/VCardUpdateParser.h @@ -16,9 +16,9 @@ namespace Swift { public: VCardUpdateParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -26,6 +26,6 @@ namespace Swift { PayloadLevel = 1 }; int level_; - String currentText_; + std::string currentText_; }; } diff --git a/Swiften/Parser/SerializingParser.cpp b/Swiften/Parser/SerializingParser.cpp index c25b07f..43dfc51 100644 --- a/Swiften/Parser/SerializingParser.cpp +++ b/Swiften/Parser/SerializingParser.cpp @@ -14,7 +14,7 @@ namespace Swift { SerializingParser::SerializingParser() { } -void SerializingParser::handleStartElement(const String& tag, const String& ns, const AttributeMap& attributes) { +void SerializingParser::handleStartElement(const std::string& tag, const std::string& ns, const AttributeMap& attributes) { boost::shared_ptr<XMLElement> element(new XMLElement(tag, ns)); for (AttributeMap::const_iterator i = attributes.begin(); i != attributes.end(); ++i) { element->setAttribute((*i).first, (*i).second); @@ -29,18 +29,18 @@ void SerializingParser::handleStartElement(const String& tag, const String& ns, elementStack_.push_back(element); } -void SerializingParser::handleEndElement(const String&, const String&) { +void SerializingParser::handleEndElement(const std::string&, const std::string&) { assert(!elementStack_.empty()); elementStack_.pop_back(); } -void SerializingParser::handleCharacterData(const String& data) { +void SerializingParser::handleCharacterData(const std::string& data) { if (!elementStack_.empty()) { (*(elementStack_.end()-1))->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(data))); } } -String SerializingParser::getResult() const { +std::string SerializingParser::getResult() const { return (rootElement_ ? rootElement_->serialize() : ""); } diff --git a/Swiften/Parser/SerializingParser.h b/Swiften/Parser/SerializingParser.h index 4927677..6276ea0 100644 --- a/Swiften/Parser/SerializingParser.h +++ b/Swiften/Parser/SerializingParser.h @@ -7,7 +7,7 @@ #ifndef SWIFTEN_SerializingParser_H #define SWIFTEN_SerializingParser_H -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/AttributeMap.h" #include "Swiften/Serializer/XML/XMLElement.h" @@ -16,11 +16,11 @@ namespace Swift { public: SerializingParser(); - void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes); - void handleEndElement(const String& element, const String& ns); - void handleCharacterData(const String& data); + void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes); + void handleEndElement(const std::string& element, const std::string& ns); + void handleCharacterData(const std::string& data); - String getResult() const; + std::string getResult() const; private: std::vector< boost::shared_ptr<XMLElement> > elementStack_; diff --git a/Swiften/Parser/StanzaAckParser.cpp b/Swiften/Parser/StanzaAckParser.cpp index d85eb9b..9d029cc 100644 --- a/Swiften/Parser/StanzaAckParser.cpp +++ b/Swiften/Parser/StanzaAckParser.cpp @@ -13,11 +13,11 @@ namespace Swift { StanzaAckParser::StanzaAckParser() : GenericElementParser<StanzaAck>(), depth(0) { } -void StanzaAckParser::handleStartElement(const String&, const String&, const AttributeMap& attributes) { +void StanzaAckParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) { if (depth == 0) { - String handledStanzasString = attributes.getAttribute("h"); + std::string handledStanzasString = attributes.getAttribute("h"); try { - getElementGeneric()->setHandledStanzasCount(boost::lexical_cast<int>(handledStanzasString.getUTF8String())); + getElementGeneric()->setHandledStanzasCount(boost::lexical_cast<int>(handledStanzasString)); } catch (const boost::bad_lexical_cast &) { } @@ -25,7 +25,7 @@ void StanzaAckParser::handleStartElement(const String&, const String&, const Att ++depth; } -void StanzaAckParser::handleEndElement(const String&, const String&) { +void StanzaAckParser::handleEndElement(const std::string&, const std::string&) { --depth; } diff --git a/Swiften/Parser/StanzaAckParser.h b/Swiften/Parser/StanzaAckParser.h index fa9644f..4078dc1 100644 --- a/Swiften/Parser/StanzaAckParser.h +++ b/Swiften/Parser/StanzaAckParser.h @@ -14,8 +14,8 @@ namespace Swift { public: StanzaAckParser(); - virtual void handleStartElement(const String&, const String& ns, const AttributeMap&); - virtual void handleEndElement(const String&, const String& ns); + virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&); + virtual void handleEndElement(const std::string&, const std::string& ns); private: int depth; diff --git a/Swiften/Parser/StanzaParser.cpp b/Swiften/Parser/StanzaParser.cpp index 637b45a..64c4901 100644 --- a/Swiften/Parser/StanzaParser.cpp +++ b/Swiften/Parser/StanzaParser.cpp @@ -23,7 +23,7 @@ StanzaParser::StanzaParser(PayloadParserFactoryCollection* factories) : StanzaParser::~StanzaParser() { } -void StanzaParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void StanzaParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (inStanza()) { if (!inPayload()) { assert(!currentPayloadParser_.get()); @@ -56,7 +56,7 @@ void StanzaParser::handleStartElement(const String& element, const String& ns, c ++currentDepth_; } -void StanzaParser::handleEndElement(const String& element, const String& ns) { +void StanzaParser::handleEndElement(const std::string& element, const std::string& ns) { assert(inStanza()); if (inPayload()) { assert(currentPayloadParser_.get()); @@ -75,7 +75,7 @@ void StanzaParser::handleEndElement(const String& element, const String& ns) { } } -void StanzaParser::handleCharacterData(const String& data) { +void StanzaParser::handleCharacterData(const std::string& data) { if (currentPayloadParser_.get()) { currentPayloadParser_->handleCharacterData(data); } diff --git a/Swiften/Parser/StanzaParser.h b/Swiften/Parser/StanzaParser.h index 60ddafc..df01943 100644 --- a/Swiften/Parser/StanzaParser.h +++ b/Swiften/Parser/StanzaParser.h @@ -9,7 +9,7 @@ #include <boost/noncopyable.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Stanza.h" #include "Swiften/Parser/ElementParser.h" #include "Swiften/Parser/AttributeMap.h" @@ -23,9 +23,9 @@ namespace Swift { StanzaParser(PayloadParserFactoryCollection* factories); ~StanzaParser(); - void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes); - void handleEndElement(const String& element, const String& ns); - void handleCharacterData(const String& data); + void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes); + void handleEndElement(const std::string& element, const std::string& ns); + void handleCharacterData(const std::string& data); virtual boost::shared_ptr<Element> getElement() const = 0; virtual void handleStanzaAttributes(const AttributeMap&) {} diff --git a/Swiften/Parser/StreamErrorParser.cpp b/Swiften/Parser/StreamErrorParser.cpp index d222c40..f4530f9 100644 --- a/Swiften/Parser/StreamErrorParser.cpp +++ b/Swiften/Parser/StreamErrorParser.cpp @@ -11,11 +11,11 @@ namespace Swift { StreamErrorParser::StreamErrorParser() : level(TopLevel) { } -void StreamErrorParser::handleStartElement(const String&, const String&, const AttributeMap&) { +void StreamErrorParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) { ++level; } -void StreamErrorParser::handleEndElement(const String& element, const String& ns) { +void StreamErrorParser::handleEndElement(const std::string& element, const std::string& ns) { --level; if (level == ElementLevel && ns == "urn:ietf:params:xml:ns:xmpp-streams") { if (element == "text") { @@ -102,7 +102,7 @@ void StreamErrorParser::handleEndElement(const String& element, const String& ns } } -void StreamErrorParser::handleCharacterData(const String& data) { +void StreamErrorParser::handleCharacterData(const std::string& data) { currentText += data; } diff --git a/Swiften/Parser/StreamErrorParser.h b/Swiften/Parser/StreamErrorParser.h index a2aaa67..61c8c12 100644 --- a/Swiften/Parser/StreamErrorParser.h +++ b/Swiften/Parser/StreamErrorParser.h @@ -14,9 +14,9 @@ namespace Swift { public: StreamErrorParser(); - virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String&); - virtual void handleCharacterData(const String& data); + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); private: enum Level { @@ -24,6 +24,6 @@ namespace Swift { ElementLevel = 1 }; int level; - String currentText; + std::string currentText; }; } diff --git a/Swiften/Parser/StreamFeaturesParser.cpp b/Swiften/Parser/StreamFeaturesParser.cpp index 02e70be..377f215 100644 --- a/Swiften/Parser/StreamFeaturesParser.cpp +++ b/Swiften/Parser/StreamFeaturesParser.cpp @@ -11,7 +11,7 @@ namespace Swift { StreamFeaturesParser::StreamFeaturesParser() : GenericElementParser<StreamFeatures>(), currentDepth_(0), inMechanisms_(false), inMechanism_(false), inCompression_(false), inCompressionMethod_(false) { } -void StreamFeaturesParser::handleStartElement(const String& element, const String& ns, const AttributeMap&) { +void StreamFeaturesParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap&) { if (currentDepth_ == 1) { if (element == "starttls" && ns == "urn:ietf:params:xml:ns:xmpp-tls") { getElementGeneric()->setHasStartTLS(); @@ -45,7 +45,7 @@ void StreamFeaturesParser::handleStartElement(const String& element, const Strin ++currentDepth_; } -void StreamFeaturesParser::handleEndElement(const String&, const String&) { +void StreamFeaturesParser::handleEndElement(const std::string&, const std::string&) { --currentDepth_; if (currentDepth_ == 1) { inCompression_ = false; @@ -63,7 +63,7 @@ void StreamFeaturesParser::handleEndElement(const String&, const String&) { } } -void StreamFeaturesParser::handleCharacterData(const String& data) { +void StreamFeaturesParser::handleCharacterData(const std::string& data) { currentText_ += data; } diff --git a/Swiften/Parser/StreamFeaturesParser.h b/Swiften/Parser/StreamFeaturesParser.h index a12644d..ee65a2a 100644 --- a/Swiften/Parser/StreamFeaturesParser.h +++ b/Swiften/Parser/StreamFeaturesParser.h @@ -7,7 +7,7 @@ #ifndef SWIFTEN_STREAMFEATURESPARSER_H #define SWIFTEN_STREAMFEATURESPARSER_H -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/GenericElementParser.h" #include "Swiften/Elements/StreamFeatures.h" @@ -17,13 +17,13 @@ namespace Swift { StreamFeaturesParser(); private: - void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes); - void handleEndElement(const String& element, const String& ns); - void handleCharacterData(const String& data); + void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes); + void handleEndElement(const std::string& element, const std::string& ns); + void handleCharacterData(const std::string& data); private: int currentDepth_; - String currentText_; + std::string currentText_; bool inMechanisms_; bool inMechanism_; bool inCompression_; diff --git a/Swiften/Parser/UnitTest/ParserTester.h b/Swiften/Parser/UnitTest/ParserTester.h index bdb9291..970c1be 100644 --- a/Swiften/Parser/UnitTest/ParserTester.h +++ b/Swiften/Parser/UnitTest/ParserTester.h @@ -25,19 +25,19 @@ namespace Swift { delete xmlParser_; } - bool parse(const String& data) { + bool parse(const std::string& data) { return xmlParser_->parse(data); } - virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { + virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { parser_->handleStartElement(element, ns, attributes); } - virtual void handleEndElement(const String& element, const String& ns) { + virtual void handleEndElement(const std::string& element, const std::string& ns) { parser_->handleEndElement(element, ns); } - virtual void handleCharacterData(const String& data) { + virtual void handleCharacterData(const std::string& data) { parser_->handleCharacterData(data); } diff --git a/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp b/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp index 668846f..8e49764 100644 --- a/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp +++ b/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp @@ -91,12 +91,12 @@ class PayloadParserFactoryCollectionTest : public CppUnit::TestFixture private: struct DummyFactory : public PayloadParserFactory { - DummyFactory(const String& element = "") : element(element) {} - virtual bool canParse(const String& e, const String&, const AttributeMap&) const { - return element.isEmpty() ? true : element == e; + DummyFactory(const std::string& element = "") : element(element) {} + virtual bool canParse(const std::string& e, const std::string&, const AttributeMap&) const { + return element.empty() ? true : element == e; } virtual PayloadParser* createPayloadParser() { return NULL; } - String element; + std::string element; }; }; diff --git a/Swiften/Parser/UnitTest/SerializingParserTest.cpp b/Swiften/Parser/UnitTest/SerializingParserTest.cpp index e7018a2..c0af493 100644 --- a/Swiften/Parser/UnitTest/SerializingParserTest.cpp +++ b/Swiften/Parser/UnitTest/SerializingParserTest.cpp @@ -35,7 +35,7 @@ class SerializingParserTest : public CppUnit::TestFixture "</html>" "</message>")); - CPPUNIT_ASSERT_EQUAL(String( + CPPUNIT_ASSERT_EQUAL(std::string( "<message to=\"me@foo.com\" type=\"chat\">" "<body>Hello<&World</body>" "<html xmlns=\"http://www.w3.org/1999/xhtml\">foo<b xmlns=\"http://www.w3.org/1999/xhtml\">bar</b>baz</html>" @@ -45,7 +45,7 @@ class SerializingParserTest : public CppUnit::TestFixture void testParse_Empty() { SerializingParser testling; - CPPUNIT_ASSERT_EQUAL(String(""), testling.getResult()); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getResult()); } void testParse_ToplevelCharacterData() { @@ -57,7 +57,7 @@ class SerializingParserTest : public CppUnit::TestFixture testling.handleEndElement("message", ""); testling.handleCharacterData("bar"); - CPPUNIT_ASSERT_EQUAL(String("<message/>"), testling.getResult()); + CPPUNIT_ASSERT_EQUAL(std::string("<message/>"), testling.getResult()); } }; diff --git a/Swiften/Parser/UnitTest/StanzaParserTest.cpp b/Swiften/Parser/UnitTest/StanzaParserTest.cpp index 48d24da..d57f798 100644 --- a/Swiften/Parser/UnitTest/StanzaParserTest.cpp +++ b/Swiften/Parser/UnitTest/StanzaParserTest.cpp @@ -115,7 +115,7 @@ class StanzaParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(JID("foo@example.com/blo"), testling.getStanza()->getTo()); CPPUNIT_ASSERT_EQUAL(JID("bar@example.com/baz"), testling.getStanza()->getFrom()); - CPPUNIT_ASSERT_EQUAL(String("id-123"), testling.getStanza()->getID()); + CPPUNIT_ASSERT_EQUAL(std::string("id-123"), testling.getStanza()->getID()); } private: @@ -132,14 +132,14 @@ class StanzaParserTest : public CppUnit::TestFixture { public: MyPayload1Parser() {} - virtual void handleStartElement(const String& element, const String&, const AttributeMap&) { + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap&) { if (element != "mypayload1") { getPayloadInternal()->hasChild = true; } } - virtual void handleEndElement(const String&, const String&) {} - virtual void handleCharacterData(const String&) {} + virtual void handleEndElement(const std::string&, const std::string&) {} + virtual void handleCharacterData(const std::string&) {} }; class MyPayload1ParserFactory : public PayloadParserFactory @@ -149,7 +149,7 @@ class StanzaParserTest : public CppUnit::TestFixture { PayloadParser* createPayloadParser() { return new MyPayload1Parser(); } - bool canParse(const String& element, const String&, const AttributeMap&) const { + bool canParse(const std::string& element, const std::string&, const AttributeMap&) const { return element == "mypayload1"; } }; @@ -165,9 +165,9 @@ class StanzaParserTest : public CppUnit::TestFixture { public: MyPayload2Parser() {} - virtual void handleStartElement(const String&, const String&, const AttributeMap&) {} - virtual void handleEndElement(const String&, const String&) {} - virtual void handleCharacterData(const String&) {} + virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) {} + virtual void handleEndElement(const std::string&, const std::string&) {} + virtual void handleCharacterData(const std::string&) {} }; @@ -177,7 +177,7 @@ class StanzaParserTest : public CppUnit::TestFixture { MyPayload2ParserFactory() {} PayloadParser* createPayloadParser() { return new MyPayload2Parser(); } - bool canParse(const String& element, const String&, const AttributeMap&) const { + bool canParse(const std::string& element, const std::string&, const AttributeMap&) const { return element == "mypayload2"; } }; diff --git a/Swiften/Parser/UnitTest/XMLParserTest.cpp b/Swiften/Parser/UnitTest/XMLParserTest.cpp index 2aae4cd..426b7a0 100644 --- a/Swiften/Parser/UnitTest/XMLParserTest.cpp +++ b/Swiften/Parser/UnitTest/XMLParserTest.cpp @@ -8,7 +8,7 @@ #include <cppunit/extensions/TestFactoryRegistry.h> #include <vector> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/XMLParserClient.h" #ifdef HAVE_EXPAT #include "Swiften/Parser/ExpatParser.h" @@ -45,23 +45,23 @@ class XMLParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), client_.events.size()); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[0].data); + CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[0].data); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), client_.events[0].attributes.size()); - CPPUNIT_ASSERT_EQUAL(String("get"), client_.events[0].attributes["type"]); - CPPUNIT_ASSERT_EQUAL(String(), client_.events[0].ns); + CPPUNIT_ASSERT_EQUAL(std::string("get"), client_.events[0].attributes["type"]); + CPPUNIT_ASSERT_EQUAL(std::string(), client_.events[0].ns); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type); - CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[1].data); + CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[1].data); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), client_.events[1].attributes.size()); - CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[1].ns); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[1].ns); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[2].type); - CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[2].data); - CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[2].ns); + CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[2].data); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[2].ns); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[3].type); - CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[3].data); - CPPUNIT_ASSERT_EQUAL(String(), client_.events[3].ns); + CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[3].data); + CPPUNIT_ASSERT_EQUAL(std::string(), client_.events[3].ns); } void testParse_ElementInNamespacedElement() { @@ -75,24 +75,24 @@ class XMLParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), client_.events.size()); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[0].data); + CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[0].data); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), client_.events[0].attributes.size()); - CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[0].ns); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[0].ns); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type); - CPPUNIT_ASSERT_EQUAL(String("name"), client_.events[1].data); - CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[1].ns); + CPPUNIT_ASSERT_EQUAL(std::string("name"), client_.events[1].data); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[1].ns); CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[2].type); - CPPUNIT_ASSERT_EQUAL(String("Swift"), client_.events[2].data); + CPPUNIT_ASSERT_EQUAL(std::string("Swift"), client_.events[2].data); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[3].type); - CPPUNIT_ASSERT_EQUAL(String("name"), client_.events[3].data); - CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[3].ns); + CPPUNIT_ASSERT_EQUAL(std::string("name"), client_.events[3].data); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[3].ns); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[4].type); - CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[4].data); - CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[4].ns); + CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[4].data); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[4].ns); } void testParse_CharacterData() { @@ -103,25 +103,25 @@ class XMLParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(7), client_.events.size()); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("html"), client_.events[0].data); + CPPUNIT_ASSERT_EQUAL(std::string("html"), client_.events[0].data); CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[1].type); - CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[1].data); + CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[1].data); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[2].type); - CPPUNIT_ASSERT_EQUAL(String("i"), client_.events[2].data); + CPPUNIT_ASSERT_EQUAL(std::string("i"), client_.events[2].data); CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[3].type); - CPPUNIT_ASSERT_EQUAL(String("bli"), client_.events[3].data); + CPPUNIT_ASSERT_EQUAL(std::string("bli"), client_.events[3].data); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[4].type); - CPPUNIT_ASSERT_EQUAL(String("i"), client_.events[4].data); + CPPUNIT_ASSERT_EQUAL(std::string("i"), client_.events[4].data); CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[5].type); - CPPUNIT_ASSERT_EQUAL(String("blo"), client_.events[5].data); + CPPUNIT_ASSERT_EQUAL(std::string("blo"), client_.events[5].data); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[6].type); - CPPUNIT_ASSERT_EQUAL(String("html"), client_.events[6].data); + CPPUNIT_ASSERT_EQUAL(std::string("html"), client_.events[6].data); } void testParse_NamespacePrefix() { @@ -132,20 +132,20 @@ class XMLParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), client_.events.size()); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("x"), client_.events[0].data); - CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[0].ns); + CPPUNIT_ASSERT_EQUAL(std::string("x"), client_.events[0].data); + CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[0].ns); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type); - CPPUNIT_ASSERT_EQUAL(String("y"), client_.events[1].data); - CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[1].ns); + CPPUNIT_ASSERT_EQUAL(std::string("y"), client_.events[1].data); + CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[1].ns); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[2].type); - CPPUNIT_ASSERT_EQUAL(String("y"), client_.events[2].data); - CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[2].ns); + CPPUNIT_ASSERT_EQUAL(std::string("y"), client_.events[2].data); + CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[2].ns); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[3].type); - CPPUNIT_ASSERT_EQUAL(String("x"), client_.events[3].data); - CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[3].ns); + CPPUNIT_ASSERT_EQUAL(std::string("x"), client_.events[3].data); + CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[3].ns); } void testParse_UnhandledXML() { @@ -156,10 +156,10 @@ class XMLParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), client_.events.size()); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[0].data); + CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[0].data); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[1].type); - CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[1].data); + CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[1].data); } void testParse_InvalidXML() { @@ -184,10 +184,10 @@ class XMLParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), client_.events.size()); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[0].data); + CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[0].data); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[1].type); - CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[1].data); + CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[1].data); } void testParse_WhitespaceInAttribute() { @@ -199,11 +199,11 @@ class XMLParserTest : public CppUnit::TestFixture { "<presence/>")); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), client_.events.size()); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[0].data); + CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[0].data); CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type); - CPPUNIT_ASSERT_EQUAL(String("presence"), client_.events[1].data); + CPPUNIT_ASSERT_EQUAL(std::string("presence"), client_.events[1].data); CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[2].type); - CPPUNIT_ASSERT_EQUAL(String("presence"), client_.events[2].data); + CPPUNIT_ASSERT_EQUAL(std::string("presence"), client_.events[2].data); } private: @@ -213,30 +213,30 @@ class XMLParserTest : public CppUnit::TestFixture { struct Event { Event( Type type, - const String& data, - const String& ns, + const std::string& data, + const std::string& ns, const AttributeMap& attributes) : type(type), data(data), ns(ns), attributes(attributes) {} - Event(Type type, const String& data, const String& ns = String()) + Event(Type type, const std::string& data, const std::string& ns = std::string()) : type(type), data(data), ns(ns) {} Type type; - String data; - String ns; + std::string data; + std::string ns; AttributeMap attributes; }; Client() {} - virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { + virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { events.push_back(Event(StartElement, element, ns, attributes)); } - virtual void handleEndElement(const String& element, const String& ns) { + virtual void handleEndElement(const std::string& element, const std::string& ns) { events.push_back(Event(EndElement, element, ns)); } - virtual void handleCharacterData(const String& data) { + virtual void handleCharacterData(const std::string& data) { events.push_back(Event(CharacterData, data)); } diff --git a/Swiften/Parser/UnitTest/XMPPParserTest.cpp b/Swiften/Parser/UnitTest/XMPPParserTest.cpp index 1eaa798..8ce96d8 100644 --- a/Swiften/Parser/UnitTest/XMPPParserTest.cpp +++ b/Swiften/Parser/UnitTest/XMPPParserTest.cpp @@ -9,7 +9,7 @@ #include <vector> #include "Swiften/Elements/ProtocolHeader.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/XMPPParser.h" #include "Swiften/Parser/ElementParser.h" #include "Swiften/Parser/XMPPParserClient.h" @@ -49,7 +49,7 @@ class XMPPParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(5, static_cast<int>(client_.events.size())); CPPUNIT_ASSERT_EQUAL(Client::StreamStart, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].header->getTo()); + CPPUNIT_ASSERT_EQUAL(std::string("example.com"), client_.events[0].header->getTo()); CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[1].type); CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[2].type); CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[3].type); @@ -64,8 +64,8 @@ class XMPPParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(client_.events.size())); CPPUNIT_ASSERT_EQUAL(Client::StreamStart, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].header->getFrom()); - CPPUNIT_ASSERT_EQUAL(String("aeab"), client_.events[0].header->getID()); + CPPUNIT_ASSERT_EQUAL(std::string("example.com"), client_.events[0].header->getFrom()); + CPPUNIT_ASSERT_EQUAL(std::string("aeab"), client_.events[0].header->getID()); } diff --git a/Swiften/Parser/UnknownPayloadParser.h b/Swiften/Parser/UnknownPayloadParser.h index c652cf1..8750f22 100644 --- a/Swiften/Parser/UnknownPayloadParser.h +++ b/Swiften/Parser/UnknownPayloadParser.h @@ -12,15 +12,15 @@ #include "Swiften/Parser/PayloadParser.h" namespace Swift { - class String; + class UnknownPayloadParser : public PayloadParser { public: UnknownPayloadParser() {} - virtual void handleStartElement(const String&, const String&, const AttributeMap&) {} - virtual void handleEndElement(const String&, const String&) {} - virtual void handleCharacterData(const String&) {} + virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) {} + virtual void handleEndElement(const std::string&, const std::string&) {} + virtual void handleCharacterData(const std::string&) {} virtual boost::shared_ptr<Payload> getPayload() const { return boost::shared_ptr<Payload>(); diff --git a/Swiften/Parser/XMLParser.h b/Swiften/Parser/XMLParser.h index 80d23f4..69a6ecf 100644 --- a/Swiften/Parser/XMLParser.h +++ b/Swiften/Parser/XMLParser.h @@ -4,11 +4,12 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_XMLParser_H -#define SWIFTEN_XMLParser_H +#pragma once + +#include <string> namespace Swift { - class String; + class XMLParserClient; class XMLParser { @@ -16,7 +17,7 @@ namespace Swift { XMLParser(XMLParserClient* client); virtual ~XMLParser(); - virtual bool parse(const String& data) = 0; + virtual bool parse(const std::string& data) = 0; protected: XMLParserClient* getClient() const { @@ -27,5 +28,3 @@ namespace Swift { XMLParserClient* client_; }; } - -#endif diff --git a/Swiften/Parser/XMLParserClient.h b/Swiften/Parser/XMLParserClient.h index 9c2df6f..089ef35 100644 --- a/Swiften/Parser/XMLParserClient.h +++ b/Swiften/Parser/XMLParserClient.h @@ -10,15 +10,15 @@ #include "Swiften/Parser/AttributeMap.h" namespace Swift { - class String; + class XMLParserClient { public: virtual ~XMLParserClient(); - virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) = 0; - virtual void handleEndElement(const String& element, const String& ns) = 0; - virtual void handleCharacterData(const String& data) = 0; + virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0; + virtual void handleEndElement(const std::string& element, const std::string& ns) = 0; + virtual void handleCharacterData(const std::string& data) = 0; }; } diff --git a/Swiften/Parser/XMPPParser.cpp b/Swiften/Parser/XMPPParser.cpp index b274c94..1fb7682 100644 --- a/Swiften/Parser/XMPPParser.cpp +++ b/Swiften/Parser/XMPPParser.cpp @@ -10,7 +10,7 @@ #include <cassert> #include "Swiften/Elements/ProtocolHeader.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/XMLParser.h" #include "Swiften/Parser/PlatformXMLParserFactory.h" #include "Swiften/Parser/XMPPParserClient.h" @@ -62,12 +62,12 @@ XMPPParser::~XMPPParser() { delete xmlParser_; } -bool XMPPParser::parse(const String& data) { +bool XMPPParser::parse(const std::string& data) { bool xmlParseResult = xmlParser_->parse(data); return xmlParseResult && !parseErrorOccurred_; } -void XMPPParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { +void XMPPParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (!parseErrorOccurred_) { if (level_ == TopLevel) { if (element == "stream" && ns == "http://etherx.jabber.org/streams") { @@ -93,7 +93,7 @@ void XMPPParser::handleStartElement(const String& element, const String& ns, con ++level_; } -void XMPPParser::handleEndElement(const String& element, const String& ns) { +void XMPPParser::handleEndElement(const std::string& element, const std::string& ns) { assert(level_ > TopLevel); --level_; if (!parseErrorOccurred_) { @@ -113,7 +113,7 @@ void XMPPParser::handleEndElement(const String& element, const String& ns) { } } -void XMPPParser::handleCharacterData(const String& data) { +void XMPPParser::handleCharacterData(const std::string& data) { if (!parseErrorOccurred_) { if (currentElementParser_) { currentElementParser_->handleCharacterData(data); @@ -124,7 +124,7 @@ void XMPPParser::handleCharacterData(const String& data) { } } -ElementParser* XMPPParser::createElementParser(const String& element, const String& ns) { +ElementParser* XMPPParser::createElementParser(const std::string& element, const std::string& ns) { if (element == "presence") { return new PresenceParser(payloadParserFactories_); } diff --git a/Swiften/Parser/XMPPParser.h b/Swiften/Parser/XMPPParser.h index c1a9323..8a00995 100644 --- a/Swiften/Parser/XMPPParser.h +++ b/Swiften/Parser/XMPPParser.h @@ -16,7 +16,7 @@ namespace Swift { class XMLParser; class XMPPParserClient; - class String; + class ElementParser; class PayloadParserFactoryCollection; @@ -27,17 +27,17 @@ namespace Swift { PayloadParserFactoryCollection* payloadParserFactories); ~XMPPParser(); - bool parse(const String&); + bool parse(const std::string&); private: virtual void handleStartElement( - const String& element, - const String& ns, + const std::string& element, + const std::string& ns, const AttributeMap& attributes); - virtual void handleEndElement(const String& element, const String& ns); - virtual void handleCharacterData(const String& data); + virtual void handleEndElement(const std::string& element, const std::string& ns); + virtual void handleCharacterData(const std::string& data); - ElementParser* createElementParser(const String& element, const String& xmlns); + ElementParser* createElementParser(const std::string& element, const std::string& xmlns); private: XMLParser* xmlParser_; diff --git a/Swiften/Parser/XMPPParserClient.h b/Swiften/Parser/XMPPParserClient.h index 24b78e2..1ddb86d 100644 --- a/Swiften/Parser/XMPPParserClient.h +++ b/Swiften/Parser/XMPPParserClient.h @@ -11,7 +11,7 @@ #include "Swiften/Elements/Element.h" namespace Swift { - class String; + class ProtocolHeader; class XMPPParserClient { |