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 | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Swiften')
572 files changed, 2497 insertions, 2654 deletions
diff --git a/Swiften/Avatars/AvatarFileStorage.cpp b/Swiften/Avatars/AvatarFileStorage.cpp index f76adee..046ac16 100644 --- a/Swiften/Avatars/AvatarFileStorage.cpp +++ b/Swiften/Avatars/AvatarFileStorage.cpp @@ -14,11 +14,11 @@ namespace Swift { AvatarFileStorage::AvatarFileStorage(const boost::filesystem::path& path) : path_(path) { } -bool AvatarFileStorage::hasAvatar(const String& hash) const { +bool AvatarFileStorage::hasAvatar(const std::string& hash) const { return boost::filesystem::exists(getAvatarPath(hash)); } -void AvatarFileStorage::addAvatar(const String& hash, const ByteArray& avatar) { +void AvatarFileStorage::addAvatar(const std::string& hash, const ByteArray& avatar) { boost::filesystem::path avatarPath = getAvatarPath(hash); if (!boost::filesystem::exists(avatarPath.parent_path())) { try { @@ -33,11 +33,11 @@ void AvatarFileStorage::addAvatar(const String& hash, const ByteArray& avatar) { file.close(); } -boost::filesystem::path AvatarFileStorage::getAvatarPath(const String& hash) const { - return path_ / hash.getUTF8String(); +boost::filesystem::path AvatarFileStorage::getAvatarPath(const std::string& hash) const { + return path_ / hash; } -ByteArray AvatarFileStorage::getAvatar(const String& hash) const { +ByteArray AvatarFileStorage::getAvatar(const std::string& hash) const { ByteArray data; data.readFromFile(getAvatarPath(hash).string()); return data; diff --git a/Swiften/Avatars/AvatarFileStorage.h b/Swiften/Avatars/AvatarFileStorage.h index 5ade779..e803430 100644 --- a/Swiften/Avatars/AvatarFileStorage.h +++ b/Swiften/Avatars/AvatarFileStorage.h @@ -9,7 +9,7 @@ #include <map> #include <boost/filesystem.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/Avatars/AvatarStorage.h" @@ -18,11 +18,11 @@ namespace Swift { public: AvatarFileStorage(const boost::filesystem::path& path); - virtual bool hasAvatar(const String& hash) const; - virtual void addAvatar(const String& hash, const ByteArray& avatar); - virtual ByteArray getAvatar(const String& hash) const; + virtual bool hasAvatar(const std::string& hash) const; + virtual void addAvatar(const std::string& hash, const ByteArray& avatar); + virtual ByteArray getAvatar(const std::string& hash) const; - virtual boost::filesystem::path getAvatarPath(const String& hash) const; + virtual boost::filesystem::path getAvatarPath(const std::string& hash) const; private: boost::filesystem::path path_; diff --git a/Swiften/Avatars/AvatarManagerImpl.cpp b/Swiften/Avatars/AvatarManagerImpl.cpp index 9813aed..6b77f8d 100644 --- a/Swiften/Avatars/AvatarManagerImpl.cpp +++ b/Swiften/Avatars/AvatarManagerImpl.cpp @@ -33,16 +33,16 @@ AvatarManagerImpl::~AvatarManagerImpl() { } boost::filesystem::path AvatarManagerImpl::getAvatarPath(const JID& jid) const { - String hash = combinedAvatarProvider.getAvatarHash(jid); - if (!hash.isEmpty()) { + std::string hash = combinedAvatarProvider.getAvatarHash(jid); + if (!hash.empty()) { return avatarStorage->getAvatarPath(hash); } return boost::filesystem::path(); } ByteArray AvatarManagerImpl::getAvatar(const JID& jid) const { - String hash = combinedAvatarProvider.getAvatarHash(jid); - if (!hash.isEmpty()) { + std::string hash = combinedAvatarProvider.getAvatarHash(jid); + if (!hash.empty()) { return avatarStorage->getAvatar(hash); } return ByteArray(); diff --git a/Swiften/Avatars/AvatarMemoryStorage.h b/Swiften/Avatars/AvatarMemoryStorage.h index 6f1ba49..3fa770a 100644 --- a/Swiften/Avatars/AvatarMemoryStorage.h +++ b/Swiften/Avatars/AvatarMemoryStorage.h @@ -8,25 +8,25 @@ #include <map> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/Avatars/AvatarStorage.h" namespace Swift { class AvatarMemoryStorage : public AvatarStorage { public: - virtual bool hasAvatar(const String& hash) const { return avatars.find(hash) != avatars.end(); } - virtual void addAvatar(const String& hash, const ByteArray& avatar) { avatars[hash] = avatar; } - virtual ByteArray getAvatar(const String& hash) const { - std::map<String, ByteArray>::const_iterator i = avatars.find(hash); + virtual bool hasAvatar(const std::string& hash) const { return avatars.find(hash) != avatars.end(); } + virtual void addAvatar(const std::string& hash, const ByteArray& avatar) { avatars[hash] = avatar; } + virtual ByteArray getAvatar(const std::string& hash) const { + std::map<std::string, ByteArray>::const_iterator i = avatars.find(hash); return i == avatars.end() ? ByteArray() : i->second; } - virtual boost::filesystem::path getAvatarPath(const String& hash) const { - return boost::filesystem::path("/avatars") / hash.getUTF8String(); + virtual boost::filesystem::path getAvatarPath(const std::string& hash) const { + return boost::filesystem::path("/avatars") / hash; } private: - std::map<String, ByteArray> avatars; + std::map<std::string, ByteArray> avatars; }; } diff --git a/Swiften/Avatars/AvatarProvider.h b/Swiften/Avatars/AvatarProvider.h index b953ad3..0f66904 100644 --- a/Swiften/Avatars/AvatarProvider.h +++ b/Swiften/Avatars/AvatarProvider.h @@ -7,7 +7,7 @@ #pragma once #include "Swiften/Base/boost_bsignals.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class JID; @@ -16,7 +16,7 @@ namespace Swift { public: virtual ~AvatarProvider(); - virtual String getAvatarHash(const JID&) const = 0; + virtual std::string getAvatarHash(const JID&) const = 0; boost::signal<void (const JID&)> onAvatarChanged; }; diff --git a/Swiften/Avatars/AvatarStorage.h b/Swiften/Avatars/AvatarStorage.h index d699f40..826a648 100644 --- a/Swiften/Avatars/AvatarStorage.h +++ b/Swiften/Avatars/AvatarStorage.h @@ -9,17 +9,17 @@ #include <boost/filesystem.hpp> namespace Swift { - class String; + class ByteArray; class AvatarStorage { public: virtual ~AvatarStorage(); - virtual bool hasAvatar(const String& hash) const = 0; - virtual void addAvatar(const String& hash, const ByteArray& avatar) = 0; - virtual ByteArray getAvatar(const String& hash) const = 0; - virtual boost::filesystem::path getAvatarPath(const String& hash) const = 0; + virtual bool hasAvatar(const std::string& hash) const = 0; + virtual void addAvatar(const std::string& hash, const ByteArray& avatar) = 0; + virtual ByteArray getAvatar(const std::string& hash) const = 0; + virtual boost::filesystem::path getAvatarPath(const std::string& hash) const = 0; }; } diff --git a/Swiften/Avatars/CombinedAvatarProvider.cpp b/Swiften/Avatars/CombinedAvatarProvider.cpp index 4f0b04a..6ac31e3 100644 --- a/Swiften/Avatars/CombinedAvatarProvider.cpp +++ b/Swiften/Avatars/CombinedAvatarProvider.cpp @@ -11,14 +11,14 @@ namespace Swift { -String CombinedAvatarProvider::getAvatarHash(const JID& jid) const { +std::string CombinedAvatarProvider::getAvatarHash(const JID& jid) const { for (size_t i = 0; i < providers.size(); ++i) { - String hash = providers[i]->getAvatarHash(jid); - if (!hash.isEmpty()) { + std::string hash = providers[i]->getAvatarHash(jid); + if (!hash.empty()) { return hash; } } - return String(); + return std::string(); } void CombinedAvatarProvider::addProvider(AvatarProvider* provider) { @@ -35,11 +35,11 @@ void CombinedAvatarProvider::removeProvider(AvatarProvider* provider) { } void CombinedAvatarProvider::handleAvatarChanged(const JID& jid) { - String hash = getAvatarHash(jid); - std::map<JID, String>::iterator i = avatars.find(jid); + std::string hash = getAvatarHash(jid); + std::map<JID, std::string>::iterator i = avatars.find(jid); if (i != avatars.end()) { if (i->second != hash) { - if (hash.isEmpty()) { + if (hash.empty()) { avatars.erase(i); } else { @@ -48,7 +48,7 @@ void CombinedAvatarProvider::handleAvatarChanged(const JID& jid) { onAvatarChanged(jid); } } - else if (!hash.isEmpty()) { + else if (!hash.empty()) { avatars.insert(std::make_pair(jid, hash)); onAvatarChanged(jid); } diff --git a/Swiften/Avatars/CombinedAvatarProvider.h b/Swiften/Avatars/CombinedAvatarProvider.h index fbd6ce7..9c83732 100644 --- a/Swiften/Avatars/CombinedAvatarProvider.h +++ b/Swiften/Avatars/CombinedAvatarProvider.h @@ -15,7 +15,7 @@ namespace Swift { class CombinedAvatarProvider : public AvatarProvider { public: - virtual String getAvatarHash(const JID&) const; + virtual std::string getAvatarHash(const JID&) const; void addProvider(AvatarProvider*); void removeProvider(AvatarProvider*); @@ -25,6 +25,6 @@ namespace Swift { private: std::vector<AvatarProvider*> providers; - std::map<JID, String> avatars; + std::map<JID, std::string> avatars; }; } diff --git a/Swiften/Avatars/DummyAvatarManager.h b/Swiften/Avatars/DummyAvatarManager.h index 12bbe42..e73c61e 100644 --- a/Swiften/Avatars/DummyAvatarManager.h +++ b/Swiften/Avatars/DummyAvatarManager.h @@ -15,7 +15,7 @@ namespace Swift { class DummyAvatarManager : public AvatarManager { public: virtual boost::filesystem::path getAvatarPath(const JID& j) const { - return boost::filesystem::path("/avatars") / j.toString().getUTF8String(); + return boost::filesystem::path("/avatars") / j.toString(); } virtual ByteArray getAvatar(const JID& jid) const { diff --git a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp index ad3a0f1..6153d29 100644 --- a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp +++ b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp @@ -9,7 +9,7 @@ #include <boost/bind.hpp> #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Avatars/CombinedAvatarProvider.h" using namespace Swift; @@ -47,7 +47,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { void testGetAvatarWithNoAvatarProviderReturnsEmpty() { std::auto_ptr<CombinedAvatarProvider> testling(createProvider()); - CPPUNIT_ASSERT(testling->getAvatarHash(user1).isEmpty()); + CPPUNIT_ASSERT(testling->getAvatarHash(user1).empty()); } void testGetAvatarWithSingleAvatarProvider() { @@ -168,26 +168,26 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { private: struct DummyAvatarProvider : public AvatarProvider { - String getAvatarHash(const JID& jid) const { - std::map<JID, String>::const_iterator i = avatars.find(jid); + std::string getAvatarHash(const JID& jid) const { + std::map<JID, std::string>::const_iterator i = avatars.find(jid); if (i != avatars.end()) { return i->second; } else { - return String(); + return std::string(); } } - std::map<JID, String> avatars; + std::map<JID, std::string> avatars; }; DummyAvatarProvider* avatarProvider1; DummyAvatarProvider* avatarProvider2; JID user1; JID user2; - String avatarHash1; - String avatarHash2; - String avatarHash3; + std::string avatarHash1; + std::string avatarHash2; + std::string avatarHash3; std::vector<JID> changes; }; diff --git a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp index 8cb9ccb..be5eaea 100644 --- a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp @@ -62,7 +62,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { storeVCardWithPhoto(user1.toBare(), avatar1); avatarStorage->addAvatar(avatar1Hash, avatar1); - String result = testling->getAvatarHash(user1); + std::string result = testling->getAvatarHash(user1); CPPUNIT_ASSERT_EQUAL(avatar1Hash, result); } @@ -71,16 +71,16 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { std::auto_ptr<VCardAvatarManager> testling = createManager(); storeEmptyVCard(user1.toBare()); - String result = testling->getAvatarHash(user1); + std::string result = testling->getAvatarHash(user1); - CPPUNIT_ASSERT_EQUAL(String(), result); + CPPUNIT_ASSERT_EQUAL(std::string(), result); } void testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar() { std::auto_ptr<VCardAvatarManager> testling = createManager(); storeVCardWithPhoto(user1.toBare(), avatar1); - String result = testling->getAvatarHash(user1); + std::string result = testling->getAvatarHash(user1); CPPUNIT_ASSERT_EQUAL(avatar1Hash, result); CPPUNIT_ASSERT(avatarStorage->hasAvatar(avatar1Hash)); @@ -90,9 +90,9 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { void testGetAvatarHashUnknownAvatarUnknownVCard() { std::auto_ptr<VCardAvatarManager> testling = createManager(); - String result = testling->getAvatarHash(user1); + std::string result = testling->getAvatarHash(user1); - CPPUNIT_ASSERT_EQUAL(String(), result); + CPPUNIT_ASSERT_EQUAL(std::string(), result); } void testVCardUpdateTriggersUpdate() { @@ -145,7 +145,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { VCardManager* vcardManager; VCardMemoryStorage* vcardStorage; ByteArray avatar1; - String avatar1Hash; + std::string avatar1Hash; std::vector<JID> changes; JID user1; JID user2; diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp index a928ced..cde4a45 100644 --- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp @@ -113,7 +113,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { stanzaChannel->onIQReceived(createVCardResult(ByteArray())); CPPUNIT_ASSERT(!avatarStorage->hasAvatar(Hexify::hexify(SHA1::getHash(ByteArray())))); - CPPUNIT_ASSERT_EQUAL(String(), testling->getAvatarHash(JID("foo@bar.com"))); + CPPUNIT_ASSERT_EQUAL(std::string(), testling->getAvatarHash(JID("foo@bar.com"))); } void testStanzaChannelReset_ClearsHash() { @@ -128,7 +128,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size())); CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]); - CPPUNIT_ASSERT_EQUAL(String(""), testling->getAvatarHash(user1.toBare())); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling->getAvatarHash(user1.toBare())); } void testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash() { @@ -154,7 +154,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { return result; } - boost::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const String& hash) { + boost::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) { boost::shared_ptr<Presence> presence(new Presence()); presence->setFrom(jid); presence->addPayload(boost::shared_ptr<VCardUpdate>(new VCardUpdate(hash))); @@ -187,7 +187,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { VCardManager* vcardManager; VCardMemoryStorage* vcardStorage; ByteArray avatar1; - String avatar1Hash; + std::string avatar1Hash; std::vector<JID> changes; JID user1; JID user2; diff --git a/Swiften/Avatars/VCardAvatarManager.cpp b/Swiften/Avatars/VCardAvatarManager.cpp index 244a73e..ce732db 100644 --- a/Swiften/Avatars/VCardAvatarManager.cpp +++ b/Swiften/Avatars/VCardAvatarManager.cpp @@ -28,10 +28,10 @@ void VCardAvatarManager::handleVCardChanged(const JID& from) { onAvatarChanged(from); } -String VCardAvatarManager::getAvatarHash(const JID& jid) const { +std::string VCardAvatarManager::getAvatarHash(const JID& jid) const { VCard::ref vCard = vcardManager_->getVCard(getAvatarJID(jid)); if (vCard && !vCard->getPhoto().isEmpty()) { - String hash = Hexify::hexify(SHA1::getHash(vCard->getPhoto())); + std::string hash = Hexify::hexify(SHA1::getHash(vCard->getPhoto())); if (!avatarStorage_->hasAvatar(hash)) { avatarStorage_->addAvatar(hash, vCard->getPhoto()); } diff --git a/Swiften/Avatars/VCardAvatarManager.h b/Swiften/Avatars/VCardAvatarManager.h index 069f938..3f99dad 100644 --- a/Swiften/Avatars/VCardAvatarManager.h +++ b/Swiften/Avatars/VCardAvatarManager.h @@ -21,7 +21,7 @@ namespace Swift { public: VCardAvatarManager(VCardManager*, AvatarStorage*, MUCRegistry* = NULL); - String getAvatarHash(const JID&) const; + std::string getAvatarHash(const JID&) const; private: void handleVCardChanged(const JID& from); diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.cpp b/Swiften/Avatars/VCardUpdateAvatarManager.cpp index 879846e..08d026b 100644 --- a/Swiften/Avatars/VCardUpdateAvatarManager.cpp +++ b/Swiften/Avatars/VCardUpdateAvatarManager.cpp @@ -52,7 +52,7 @@ void VCardUpdateAvatarManager::handleVCardChanged(const JID& from, VCard::ref vC setAvatarHash(from, ""); } else { - String hash = Hexify::hexify(SHA1::getHash(vCard->getPhoto())); + std::string hash = Hexify::hexify(SHA1::getHash(vCard->getPhoto())); if (!avatarStorage_->hasAvatar(hash)) { avatarStorage_->addAvatar(hash, vCard->getPhoto()); } @@ -60,21 +60,21 @@ void VCardUpdateAvatarManager::handleVCardChanged(const JID& from, VCard::ref vC } } -void VCardUpdateAvatarManager::setAvatarHash(const JID& from, const String& hash) { +void VCardUpdateAvatarManager::setAvatarHash(const JID& from, const std::string& hash) { avatarHashes_[from] = hash; onAvatarChanged(from); } /* void VCardUpdateAvatarManager::setAvatar(const JID& jid, const ByteArray& avatar) { - String hash = Hexify::hexify(SHA1::getHash(avatar)); + std::string hash = Hexify::hexify(SHA1::getHash(avatar)); avatarStorage_->addAvatar(hash, avatar); setAvatarHash(getAvatarJID(jid), hash); } */ -String VCardUpdateAvatarManager::getAvatarHash(const JID& jid) const { - std::map<JID, String>::const_iterator i = avatarHashes_.find(getAvatarJID(jid)); +std::string VCardUpdateAvatarManager::getAvatarHash(const JID& jid) const { + std::map<JID, std::string>::const_iterator i = avatarHashes_.find(getAvatarJID(jid)); if (i != avatarHashes_.end()) { return i->second; } @@ -90,9 +90,9 @@ JID VCardUpdateAvatarManager::getAvatarJID(const JID& jid) const { void VCardUpdateAvatarManager::handleStanzaChannelAvailableChanged(bool available) { if (available) { - std::map<JID, String> oldAvatarHashes; + std::map<JID, std::string> oldAvatarHashes; avatarHashes_.swap(oldAvatarHashes); - for(std::map<JID, String>::const_iterator i = oldAvatarHashes.begin(); i != oldAvatarHashes.end(); ++i) { + for(std::map<JID, std::string>::const_iterator i = oldAvatarHashes.begin(); i != oldAvatarHashes.end(); ++i) { onAvatarChanged(i->first); } } diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.h b/Swiften/Avatars/VCardUpdateAvatarManager.h index 8827ab7..1f03898 100644 --- a/Swiften/Avatars/VCardUpdateAvatarManager.h +++ b/Swiften/Avatars/VCardUpdateAvatarManager.h @@ -25,13 +25,13 @@ namespace Swift { public: VCardUpdateAvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, MUCRegistry* = NULL); - String getAvatarHash(const JID&) const; + std::string getAvatarHash(const JID&) const; private: void handlePresenceReceived(boost::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); void handleVCardChanged(const JID& from, VCard::ref); - void setAvatarHash(const JID& from, const String& hash); + void setAvatarHash(const JID& from, const std::string& hash); JID getAvatarJID(const JID& o) const; private: @@ -39,6 +39,6 @@ namespace Swift { StanzaChannel* stanzaChannel_; AvatarStorage* avatarStorage_; MUCRegistry* mucRegistry_; - std::map<JID, String> avatarHashes_; + std::map<JID, std::string> avatarHashes_; }; } diff --git a/Swiften/Base/ByteArray.cpp b/Swiften/Base/ByteArray.cpp index 36cc19c..7701268 100644 --- a/Swiften/Base/ByteArray.cpp +++ b/Swiften/Base/ByteArray.cpp @@ -26,8 +26,8 @@ namespace Swift { static const int BUFFER_SIZE = 4096; -void ByteArray::readFromFile(const String& file) { - std::ifstream input(file.getUTF8Data(), std::ios_base::in|std::ios_base::binary); +void ByteArray::readFromFile(const std::string& file) { + std::ifstream input(file.c_str(), std::ios_base::in|std::ios_base::binary); while (input.good()) { size_t oldSize = data_.size(); data_.resize(oldSize + BUFFER_SIZE); diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h index b5cbfb0..90a4907 100644 --- a/Swiften/Base/ByteArray.h +++ b/Swiften/Base/ByteArray.h @@ -10,7 +10,7 @@ #include <vector> #include <iostream> -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class ByteArray @@ -20,7 +20,7 @@ namespace Swift { ByteArray() : data_() {} - ByteArray(const String& s) : data_(s.getUTF8String().begin(), s.getUTF8String().end()) {} + ByteArray(const std::string& s) : data_(s.begin(), s.end()) {} ByteArray(const char* c) { while (*c) { @@ -107,11 +107,11 @@ namespace Swift { return data_.end(); } - String toString() const { - return String(getData(), getSize()); + std::string toString() const { + return std::string(getData(), getSize()); } - void readFromFile(const String& file); + void readFromFile(const std::string& file); void clear() { data_.clear(); diff --git a/Swiften/Base/IDGenerator.cpp b/Swiften/Base/IDGenerator.cpp index b620de7..74a0f65 100644 --- a/Swiften/Base/IDGenerator.cpp +++ b/Swiften/Base/IDGenerator.cpp @@ -11,16 +11,16 @@ namespace Swift { IDGenerator::IDGenerator() { } -String IDGenerator::generateID() { +std::string IDGenerator::generateID() { bool carry = true; size_t i = 0; - while (carry && i < currentID_.getUTF8Size()) { - char c = currentID_.getUTF8String()[i]; + while (carry && i < currentID_.size()) { + char c = currentID_[i]; if (c >= 'z') { - currentID_.getUTF8String()[i] = 'a'; + currentID_[i] = 'a'; } else { - currentID_.getUTF8String()[i] = c+1; + currentID_[i] = c+1; carry = false; } ++i; diff --git a/Swiften/Base/IDGenerator.h b/Swiften/Base/IDGenerator.h index 2089658..4b6289b 100644 --- a/Swiften/Base/IDGenerator.h +++ b/Swiften/Base/IDGenerator.h @@ -7,17 +7,17 @@ #ifndef SWIFTEN_IDGenerator_H #define SWIFTEN_IDGenerator_H -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class IDGenerator { public: IDGenerator(); - String generateID(); + std::string generateID(); private: - String currentID_; + std::string currentID_; }; } diff --git a/Swiften/Base/Paths.cpp b/Swiften/Base/Paths.cpp index c1dbef2..0e69b61 100644 --- a/Swiften/Base/Paths.cpp +++ b/Swiften/Base/Paths.cpp @@ -25,7 +25,7 @@ boost::filesystem::path Paths::getExecutablePath() { uint32_t size = 4096; path.resize(size); if (_NSGetExecutablePath(path.getData(), &size) == 0) { - return boost::filesystem::path(path.toString().getUTF8Data()).parent_path(); + return boost::filesystem::path(path.toString().c_str()).parent_path(); } #elif defined(SWIFTEN_PLATFORM_LINUX) ByteArray path; @@ -33,13 +33,13 @@ boost::filesystem::path Paths::getExecutablePath() { size_t size = readlink("/proc/self/exe", path.getData(), path.getSize()); if (size > 0) { path.resize(size); - return boost::filesystem::path(path.toString().getUTF8Data()).parent_path(); + return boost::filesystem::path(path.toString().c_str()).parent_path(); } #elif defined(SWIFTEN_PLATFORM_WINDOWS) ByteArray data; data.resize(2048); GetModuleFileName(NULL, data.getData(), data.getSize()); - return boost::filesystem::path(data.toString().getUTF8Data()).parent_path(); + return boost::filesystem::path(data.toString().c_str()).parent_path(); #endif return boost::filesystem::path(); } diff --git a/Swiften/Base/SConscript b/Swiften/Base/SConscript index 9c7b8dc..ca22044 100644 --- a/Swiften/Base/SConscript +++ b/Swiften/Base/SConscript @@ -5,8 +5,8 @@ objects = swiften_env.StaticObject([ "Error.cpp", "Log.cpp", "Paths.cpp", - "IDGenerator.cpp", "String.cpp", + "IDGenerator.cpp", "sleep.cpp", ]) swiften_env.Append(SWIFTEN_OBJECTS = [objects]) diff --git a/Swiften/Base/String.cpp b/Swiften/Base/String.cpp index 460df36..7ddf614 100644 --- a/Swiften/Base/String.cpp +++ b/Swiften/Base/String.cpp @@ -7,7 +7,7 @@ #include <cassert> #include <algorithm> -#include "Swiften/Base/String.h" +#include <Swiften/Base/String.h> namespace Swift { @@ -34,11 +34,11 @@ static inline size_t sequenceLength(char firstByte) { return 1; } -std::vector<unsigned int> String::getUnicodeCodePoints() const { +std::vector<unsigned int> String::getUnicodeCodePoints(const std::string& s) { std::vector<unsigned int> result; - for (size_t i = 0; i < data_.size();) { + for (size_t i = 0; i < s.size();) { unsigned int codePoint = 0; - char firstChar = data_[i]; + char firstChar = s[i]; size_t length = sequenceLength(firstChar); // First character is special @@ -49,7 +49,7 @@ std::vector<unsigned int> String::getUnicodeCodePoints() const { codePoint = firstChar & ((1<<(firstCharBitSize+1)) - 1); for (size_t j = 1; j < length; ++j) { - codePoint = (codePoint<<6) | (data_[i+j] & 0x3F); + codePoint = (codePoint<<6) | (s[i+j] & 0x3F); } result.push_back(codePoint); i += length; @@ -58,37 +58,37 @@ std::vector<unsigned int> String::getUnicodeCodePoints() const { } -std::pair<String,String> String::getSplittedAtFirst(char c) const { +std::pair<std::string,std::string> String::getSplittedAtFirst(const std::string& s, char c) { assert((c & 0x80) == 0); - size_t firstMatch = data_.find(c); - if (firstMatch != data_.npos) { - return std::make_pair(data_.substr(0,firstMatch),data_.substr(firstMatch+1,data_.npos)); + size_t firstMatch = s.find(c); + if (firstMatch != s.npos) { + return std::make_pair(s.substr(0,firstMatch),s.substr(firstMatch+1,s.npos)); } else { - return std::make_pair(*this, ""); + return std::make_pair(s, ""); } } -void String::replaceAll(char c, const String& s) { +void String::replaceAll(std::string& src, char c, const std::string& s) { size_t lastPos = 0; size_t matchingIndex = 0; - while ((matchingIndex = data_.find(c, lastPos)) != data_.npos) { - data_.replace(matchingIndex, 1, s.data_); - lastPos = matchingIndex + s.data_.size(); + while ((matchingIndex = src.find(c, lastPos)) != src.npos) { + src.replace(matchingIndex, 1, s); + lastPos = matchingIndex + s.size(); } } -std::vector<String> String::split(char c) const { +std::vector<std::string> String::split(const std::string& s, char c) { assert((c & 0x80) == 0); - std::vector<String> result; - String accumulator; - for (size_t i = 0; i < data_.size(); ++i) { - if (data_[i] == c) { + std::vector<std::string> result; + std::string accumulator; + for (size_t i = 0; i < s.size(); ++i) { + if (s[i] == c) { result.push_back(accumulator); accumulator = ""; } else { - accumulator += data_[i]; + accumulator += s[i]; } } result.push_back(accumulator); diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h index 7d2f928..192d53b 100644 --- a/Swiften/Base/String.h +++ b/Swiften/Base/String.h @@ -6,141 +6,24 @@ #pragma once -#include <boost/algorithm/string.hpp> - -#include <ostream> +#include <map> #include <string> -#include <utility> #include <vector> -#include <cassert> -#include <algorithm> #define SWIFTEN_STRING_TO_CFSTRING(a) \ - CFStringCreateWithBytes(NULL, reinterpret_cast<const UInt8*>(a.getUTF8Data()), a.getUTF8Size(), kCFStringEncodingUTF8, false) + CFStringCreateWithBytes(NULL, reinterpret_cast<const UInt8*>(a.c_str()), a.size(), kCFStringEncodingUTF8, false) namespace Swift { - class ByteArray; - - class String { - friend class ByteArray; - - public: - String() {} - String(const char* data) : data_(data) {} - String(const char* data, size_t len) : data_(data, len) {} - String(const std::string& data) : data_(data) {} - - bool isEmpty() const { return data_.empty(); } - - const char* getUTF8Data() const { return data_.c_str(); } - const std::string& getUTF8String() const { return data_; } - std::string& getUTF8String() { return data_; } - size_t getUTF8Size() const { return data_.size(); } - std::vector<unsigned int> getUnicodeCodePoints() const; - - void clear() { data_.clear(); } - - /** - * Returns the part before and after 'c'. - * If the given splitter does not occur in the string, the second - * component is the empty string. - */ - std::pair<String,String> getSplittedAtFirst(char c) const; - - std::vector<String> split(char c) const; - - String getLowerCase() const { - return boost::to_lower_copy(data_); - } - - void removeAll(char c) { - data_.erase(std::remove(data_.begin(), data_.end(), c), data_.end()); - } - - void replaceAll(char c, const String& s); - - bool beginsWith(char c) const { - return data_.size() > 0 && data_[0] == c; - } - - bool beginsWith(const String& s) const { - return boost::starts_with(data_, s.data_); - } - - bool endsWith(char c) const { - return data_.size() > 0 && data_[data_.size()-1] == c; - } - - bool endsWith(const String& s) const { - return boost::ends_with(data_, s.data_); - } - - String getSubstring(size_t begin, size_t end) const { - return String(data_.substr(begin, end)); - } - - size_t find(char c) const { - assert((c & 0x80) == 0); - return data_.find(c); - } - - size_t npos() const { - return data_.npos; - } - - friend String operator+(const String& a, const String& b) { - return String(a.data_ + b.data_); + namespace String { + std::vector<unsigned int> getUnicodeCodePoints(const std::string&); + std::pair<std::string, std::string> getSplittedAtFirst(const std::string&, char c); + std::vector<std::string> split(const std::string&, char c); + void replaceAll(std::string&, char c, const std::string& s); + inline bool beginsWith(const std::string& s, char c) { + return s.size() > 0 && s[0] == c; } - - friend String operator+(const String& a, char b) { - return String(a.data_ + b); + inline bool endsWith(const std::string& s, char c) { + return s.size() > 0 && s[s.size()-1] == c; } - - String& operator+=(const String& o) { - data_ += o.data_; - return *this; - } - - String& operator+=(char c) { - data_ += c; - return *this; - } - - String& operator=(const String& o) { - data_ = o.data_; - return *this; - } - - bool contains(const String& o) { - return data_.find(o.data_) != std::string::npos; - } - - char operator[](size_t i) const { - return data_[i]; - } - - friend bool operator>(const String& a, const String& b) { - return a.data_ > b.data_; - } - - friend bool operator<(const String& a, const String& b) { - return a.data_ < b.data_; - } - - friend bool operator!=(const String& a, const String& b) { - return a.data_ != b.data_; - } - - friend bool operator==(const String& a, const String& b) { - return a.data_ == b.data_; - } - - friend std::ostream& operator<<(std::ostream& os, const String& s) { - os << s.data_; - return os; - } - - private: - std::string data_; }; } diff --git a/Swiften/Base/UnitTest/IDGeneratorTest.cpp b/Swiften/Base/UnitTest/IDGeneratorTest.cpp index 4a6b29c..4874684 100644 --- a/Swiften/Base/UnitTest/IDGeneratorTest.cpp +++ b/Swiften/Base/UnitTest/IDGeneratorTest.cpp @@ -28,13 +28,13 @@ class IDGeneratorTest : public CppUnit::TestFixture void testGenerate() { IDGenerator testling; for (unsigned int i = 0; i < 26*4; ++i) { - String id = testling.generateID(); + std::string id = testling.generateID(); CPPUNIT_ASSERT(generatedIDs_.insert(id).second); } } private: - std::set<String> generatedIDs_; + std::set<std::string> generatedIDs_; }; CPPUNIT_TEST_SUITE_REGISTRATION(IDGeneratorTest); diff --git a/Swiften/Base/UnitTest/StringTest.cpp b/Swiften/Base/UnitTest/StringTest.cpp index 161b4f1..884bbee 100644 --- a/Swiften/Base/UnitTest/StringTest.cpp +++ b/Swiften/Base/UnitTest/StringTest.cpp @@ -6,38 +6,29 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> +#include <string> -#include "Swiften/Base/String.h" +#include <Swiften/Base/String.h> using namespace Swift; -class StringTest : public CppUnit::TestFixture -{ +class StringTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StringTest); CPPUNIT_TEST(testGetUnicodeCodePoints); CPPUNIT_TEST(testGetSplittedAtFirst); CPPUNIT_TEST(testGetSplittedAtFirst_CharacterAtEnd); CPPUNIT_TEST(testGetSplittedAtFirst_NoSuchCharacter); - CPPUNIT_TEST(testRemoveAll); - CPPUNIT_TEST(testRemoveAll_LastChar); - CPPUNIT_TEST(testRemoveAll_ConsecutiveChars); CPPUNIT_TEST(testReplaceAll); CPPUNIT_TEST(testReplaceAll_LastChar); CPPUNIT_TEST(testReplaceAll_ConsecutiveChars); CPPUNIT_TEST(testReplaceAll_MatchingReplace); - CPPUNIT_TEST(testGetLowerCase); CPPUNIT_TEST(testSplit); - CPPUNIT_TEST(testContains); - CPPUNIT_TEST(testContainsFalse); - CPPUNIT_TEST(testContainsExact); - CPPUNIT_TEST(testEndsWith); - CPPUNIT_TEST(testEndsWith_DoesNotEndWith); CPPUNIT_TEST_SUITE_END(); public: void testGetUnicodeCodePoints() { - String testling("$\xc2\xa2\xe2\x82\xac\xf4\x8a\xaf\x8d"); - std::vector<unsigned int> points = testling.getUnicodeCodePoints(); + std::string testling("$\xc2\xa2\xe2\x82\xac\xf4\x8a\xaf\x8d"); + std::vector<unsigned int> points = String::getUnicodeCodePoints(testling); CPPUNIT_ASSERT_EQUAL(0x24U, points[0]); CPPUNIT_ASSERT_EQUAL(0xA2U, points[1]); @@ -46,120 +37,69 @@ class StringTest : public CppUnit::TestFixture } void testGetSplittedAtFirst() { - String testling("ab@cd@ef"); + std::string testling("ab@cd@ef"); - std::pair<String,String> result = testling.getSplittedAtFirst('@'); - CPPUNIT_ASSERT_EQUAL(String("ab"), result.first); - CPPUNIT_ASSERT_EQUAL(String("cd@ef"), result.second); + std::pair<std::string,std::string> result = String::getSplittedAtFirst(testling, '@'); + CPPUNIT_ASSERT_EQUAL(std::string("ab"), result.first); + CPPUNIT_ASSERT_EQUAL(std::string("cd@ef"), result.second); } void testGetSplittedAtFirst_CharacterAtEnd() { - String testling("ab@"); + std::string testling("ab@"); - std::pair<String,String> result = testling.getSplittedAtFirst('@'); - CPPUNIT_ASSERT_EQUAL(String("ab"), result.first); - CPPUNIT_ASSERT(result.second.isEmpty()); + std::pair<std::string,std::string> result = String::getSplittedAtFirst(testling, '@'); + CPPUNIT_ASSERT_EQUAL(std::string("ab"), result.first); + CPPUNIT_ASSERT(result.second.empty()); } void testGetSplittedAtFirst_NoSuchCharacter() { - String testling("ab"); + std::string testling("ab"); - std::pair<String,String> result = testling.getSplittedAtFirst('@'); - CPPUNIT_ASSERT_EQUAL(String("ab"), result.first); - CPPUNIT_ASSERT(result.second.isEmpty()); - } - - void testRemoveAll() { - String testling("ab c de"); - - testling.removeAll(' '); - - CPPUNIT_ASSERT_EQUAL(String("abcde"), testling); - } - - void testRemoveAll_LastChar() { - String testling("abcde "); - - testling.removeAll(' '); - - CPPUNIT_ASSERT_EQUAL(String("abcde"), testling); - } - - void testRemoveAll_ConsecutiveChars() { - String testling("ab cde"); - - testling.removeAll(' '); - - CPPUNIT_ASSERT_EQUAL(String("abcde"), testling); + std::pair<std::string,std::string> result = String::getSplittedAtFirst(testling, '@'); + CPPUNIT_ASSERT_EQUAL(std::string("ab"), result.first); + CPPUNIT_ASSERT(result.second.empty()); } void testReplaceAll() { - String testling("abcbd"); + std::string testling("abcbd"); - testling.replaceAll('b', "xyz"); + String::replaceAll(testling, 'b', "xyz"); - CPPUNIT_ASSERT_EQUAL(String("axyzcxyzd"), testling); + CPPUNIT_ASSERT_EQUAL(std::string("axyzcxyzd"), testling); } void testReplaceAll_LastChar() { - String testling("abc"); + std::string testling("abc"); - testling.replaceAll('c', "xyz"); + String::replaceAll(testling, 'c', "xyz"); - CPPUNIT_ASSERT_EQUAL(String("abxyz"), testling); + CPPUNIT_ASSERT_EQUAL(std::string("abxyz"), testling); } void testReplaceAll_ConsecutiveChars() { - String testling("abbc"); + std::string testling("abbc"); - testling.replaceAll('b',"xyz"); + String::replaceAll(testling, 'b',"xyz"); - CPPUNIT_ASSERT_EQUAL(String("axyzxyzc"), testling); + CPPUNIT_ASSERT_EQUAL(std::string("axyzxyzc"), testling); } void testReplaceAll_MatchingReplace() { - String testling("abc"); + std::string testling("abc"); - testling.replaceAll('b',"bbb"); + String::replaceAll(testling, 'b',"bbb"); - CPPUNIT_ASSERT_EQUAL(String("abbbc"), testling); - } - - void testGetLowerCase() { - String testling("aBcD e"); - - CPPUNIT_ASSERT_EQUAL(String("abcd e"), testling.getLowerCase()); + CPPUNIT_ASSERT_EQUAL(std::string("abbbc"), testling); } void testSplit() { - std::vector<String> result = String("abc def ghi").split(' '); + std::vector<std::string> result = String::split("abc def ghi", ' '); CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(result.size())); - CPPUNIT_ASSERT_EQUAL(String("abc"), result[0]); - CPPUNIT_ASSERT_EQUAL(String("def"), result[1]); - CPPUNIT_ASSERT_EQUAL(String("ghi"), result[2]); - } - - void testContains() { - CPPUNIT_ASSERT(String("abcde").contains(String("bcd"))); + CPPUNIT_ASSERT_EQUAL(std::string("abc"), result[0]); + CPPUNIT_ASSERT_EQUAL(std::string("def"), result[1]); + CPPUNIT_ASSERT_EQUAL(std::string("ghi"), result[2]); } - - void testContainsFalse() { - CPPUNIT_ASSERT(!String("abcde").contains(String("abcdef"))); - } - - void testContainsExact() { - CPPUNIT_ASSERT(String("abcde").contains(String("abcde"))); - } - - void testEndsWith() { - CPPUNIT_ASSERT(String("abcdef").endsWith("cdef")); - } - - void testEndsWith_DoesNotEndWith() { - CPPUNIT_ASSERT(!String("abcdef").endsWith("ddef")); - } - }; CPPUNIT_TEST_SUITE_REGISTRATION(StringTest); diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp index 168c357..904f722 100644 --- a/Swiften/Client/Client.cpp +++ b/Swiften/Client/Client.cpp @@ -28,7 +28,7 @@ namespace Swift { -Client::Client(const JID& jid, const String& password, NetworkFactories* networkFactories, Storages* storages) : CoreClient(jid, password, networkFactories), storages(storages) { +Client::Client(const JID& jid, const std::string& password, NetworkFactories* networkFactories, Storages* storages) : CoreClient(jid, password, networkFactories), storages(storages) { memoryStorages = new MemoryStorages(); softwareVersionResponder = new SoftwareVersionResponder(getIQRouter()); @@ -93,7 +93,7 @@ XMPPRoster* Client::getRoster() const { return roster; } -void Client::setSoftwareVersion(const String& name, const String& version) { +void Client::setSoftwareVersion(const std::string& name, const std::string& version) { softwareVersionResponder->setVersion(name, version); } diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h index 4725d50..868c9c4 100644 --- a/Swiften/Client/Client.h +++ b/Swiften/Client/Client.h @@ -47,7 +47,7 @@ namespace Swift { * this is NULL, * all data will be stored in memory (and be lost on shutdown) */ - Client(const JID& jid, const String& password, NetworkFactories* networkFactories, Storages* storages = NULL); + Client(const JID& jid, const std::string& password, NetworkFactories* networkFactories, Storages* storages = NULL); ~Client(); @@ -56,7 +56,7 @@ namespace Swift { * * This will be used to respond to version queries from other entities. */ - void setSoftwareVersion(const String& name, const String& version); + void setSoftwareVersion(const std::string& name, const std::string& version); /** * Returns a representation of the roster. diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index 49334a3..98e3065 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -304,7 +304,7 @@ void ClientSession::continueSessionInitialization() { if (needResourceBind) { state = BindingResource; boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - if (!localJID.getResource().isEmpty()) { + if (!localJID.getResource().empty()) { resourceBind->setResource(localJID.getResource()); } sendStanza(IQ::createRequest(IQ::Set, JID(), "session-bind", resourceBind)); @@ -331,7 +331,7 @@ bool ClientSession::checkState(State state) { return true; } -void ClientSession::sendCredentials(const String& password) { +void ClientSession::sendCredentials(const std::string& password) { assert(WaitingForCredentials); state = Authenticating; authenticator->setCredentials(localJID.getNode(), password); diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index be0f89e..e15a707 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -12,7 +12,7 @@ #include "Swiften/Base/Error.h" #include "Swiften/Session/SessionStream.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/Elements/Element.h" #include "Swiften/StreamManagement/StanzaAckRequester.h" @@ -86,7 +86,7 @@ namespace Swift { return getState() == Finished; } - void sendCredentials(const String& password); + void sendCredentials(const std::string& password); void sendStanza(boost::shared_ptr<Stanza>); void setCertificateTrustChecker(CertificateTrustChecker* checker) { diff --git a/Swiften/Client/ClientSessionStanzaChannel.cpp b/Swiften/Client/ClientSessionStanzaChannel.cpp index 996196b..6b32b3d 100644 --- a/Swiften/Client/ClientSessionStanzaChannel.cpp +++ b/Swiften/Client/ClientSessionStanzaChannel.cpp @@ -31,7 +31,7 @@ void ClientSessionStanzaChannel::sendPresence(boost::shared_ptr<Presence> presen send(presence); } -String ClientSessionStanzaChannel::getNewIQID() { +std::string ClientSessionStanzaChannel::getNewIQID() { return idGenerator.generateID(); } diff --git a/Swiften/Client/ClientSessionStanzaChannel.h b/Swiften/Client/ClientSessionStanzaChannel.h index d3fd093..8a56301 100644 --- a/Swiften/Client/ClientSessionStanzaChannel.h +++ b/Swiften/Client/ClientSessionStanzaChannel.h @@ -33,7 +33,7 @@ namespace Swift { } private: - String getNewIQID(); + std::string getNewIQID(); void send(boost::shared_ptr<Stanza> stanza); void handleSessionFinished(boost::shared_ptr<Error> error); void handleStanza(boost::shared_ptr<Stanza> stanza); diff --git a/Swiften/Client/ClientXMLTracer.h b/Swiften/Client/ClientXMLTracer.h index 43fdda3..bca2a54 100644 --- a/Swiften/Client/ClientXMLTracer.h +++ b/Swiften/Client/ClientXMLTracer.h @@ -19,7 +19,7 @@ namespace Swift { } private: - static void printData(char direction, const String& data) { + static void printData(char direction, const std::string& data) { printLine(direction); std::cerr << data << std::endl; } diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index 2bd22c8..edb7643 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -22,7 +22,7 @@ namespace Swift { -CoreClient::CoreClient(const JID& jid, const String& password, NetworkFactories* networkFactories) : jid_(jid), password_(password), networkFactories(networkFactories), disconnectRequested_(false), certificateTrustChecker(NULL) { +CoreClient::CoreClient(const JID& jid, const std::string& password, NetworkFactories* networkFactories) : jid_(jid), password_(password), networkFactories(networkFactories), disconnectRequested_(false), certificateTrustChecker(NULL) { stanzaChannel_ = new ClientSessionStanzaChannel(); stanzaChannel_->onMessageReceived.connect(boost::bind(&CoreClient::handleMessageReceived, this, _1)); stanzaChannel_->onPresenceReceived.connect(boost::bind(&CoreClient::handlePresenceReceived, this, _1)); @@ -52,7 +52,7 @@ void CoreClient::connect() { connect(jid_.getDomain()); } -void CoreClient::connect(const String& host) { +void CoreClient::connect(const std::string& host) { SWIFT_LOG(debug) << "Connecting to host " << host << std::endl; disconnectRequested_ = false; assert(!connector_); @@ -74,7 +74,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio assert(!sessionStream_); sessionStream_ = boost::shared_ptr<BasicSessionStream>(new BasicSessionStream(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), tlsFactories->getTLSContextFactory(), networkFactories->getTimerFactory())); - if (!certificate_.isEmpty()) { + if (!certificate_.empty()) { sessionStream_->setTLSCertificate(PKCS12Certificate(certificate_, password_)); } sessionStream_->onDataRead.connect(boost::bind(&CoreClient::handleDataRead, this, _1)); @@ -101,7 +101,7 @@ void CoreClient::disconnect() { } } -void CoreClient::setCertificate(const String& certificate) { +void CoreClient::setCertificate(const std::string& certificate) { certificate_ = certificate; } @@ -219,11 +219,11 @@ void CoreClient::handleNeedCredentials() { session_->sendCredentials(password_); } -void CoreClient::handleDataRead(const String& data) { +void CoreClient::handleDataRead(const std::string& data) { onDataRead(data); } -void CoreClient::handleDataWritten(const String& data) { +void CoreClient::handleDataWritten(const std::string& data) { onDataWritten(data); } diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index 5ecf2c9..92cd197 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -17,7 +17,7 @@ #include "Swiften/Elements/Presence.h" #include "Swiften/Elements/Message.h" #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Client/StanzaChannel.h" #include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h" #include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" @@ -52,10 +52,10 @@ namespace Swift { * Constructs a client for the given JID with the given password. * The given eventLoop will be used to post events to. */ - CoreClient(const JID& jid, const String& password, NetworkFactories* networkFactories); + CoreClient(const JID& jid, const std::string& password, NetworkFactories* networkFactories); ~CoreClient(); - void setCertificate(const String& certificate); + void setCertificate(const std::string& certificate); /** * Connects the client to the server. @@ -70,7 +70,7 @@ namespace Swift { */ void disconnect(); - void connect(const String& host); + void connect(const std::string& host); /** * Sends a message. @@ -164,7 +164,7 @@ namespace Swift { * This signal is emitted before the XML data is parsed, * so this data is unformatted. */ - boost::signal<void (const String&)> onDataRead; + boost::signal<void (const std::string&)> onDataRead; /** * Emitted when the client sends data. @@ -172,7 +172,7 @@ namespace Swift { * This signal is emitted after the XML was serialized, and * is unformatted. */ - boost::signal<void (const String&)> onDataWritten; + boost::signal<void (const std::string&)> onDataWritten; /** * Emitted when a message is received. @@ -197,15 +197,15 @@ namespace Swift { void handleStanzaChannelAvailableChanged(bool available); void handleSessionFinished(boost::shared_ptr<Error>); void handleNeedCredentials(); - void handleDataRead(const String&); - void handleDataWritten(const String&); + void handleDataRead(const std::string&); + void handleDataWritten(const std::string&); void handlePresenceReceived(Presence::ref); void handleMessageReceived(Message::ref); void handleStanzaAcked(Stanza::ref); private: JID jid_; - String password_; + std::string password_; NetworkFactories* networkFactories; ClientSessionStanzaChannel* stanzaChannel_; IQRouter* iqRouter_; @@ -214,7 +214,7 @@ namespace Swift { boost::shared_ptr<Connection> connection_; boost::shared_ptr<BasicSessionStream> sessionStream_; boost::shared_ptr<ClientSession> session_; - String certificate_; + std::string certificate_; bool disconnectRequested_; CertificateTrustChecker* certificateTrustChecker; }; diff --git a/Swiften/Client/DummyNickManager.h b/Swiften/Client/DummyNickManager.h index b746f88..0e3ff50 100644 --- a/Swiften/Client/DummyNickManager.h +++ b/Swiften/Client/DummyNickManager.h @@ -13,11 +13,11 @@ namespace Swift { class DummyNickManager : public NickManager { public: - String getOwnNick() const { + std::string getOwnNick() const { return ""; } - void setOwnNick(const String&) { + void setOwnNick(const std::string&) { } }; } diff --git a/Swiften/Client/DummyStanzaChannel.h b/Swiften/Client/DummyStanzaChannel.h index 5784788..b9f05c3 100644 --- a/Swiften/Client/DummyStanzaChannel.h +++ b/Swiften/Client/DummyStanzaChannel.h @@ -36,7 +36,7 @@ namespace Swift { sentStanzas.push_back(presence); } - virtual String getNewIQID() { + virtual std::string getNewIQID() { return "test-id"; } diff --git a/Swiften/Client/FileStorages.cpp b/Swiften/Client/FileStorages.cpp index 9f2dda0..ad8b130 100644 --- a/Swiften/Client/FileStorages.cpp +++ b/Swiften/Client/FileStorages.cpp @@ -12,8 +12,8 @@ namespace Swift { FileStorages::FileStorages(const boost::filesystem::path& baseDir, const JID& jid) { - String profile = jid.toBare(); - vcardStorage = new VCardFileStorage(baseDir / profile.getUTF8String() / "vcards"); + std::string profile = jid.toBare(); + vcardStorage = new VCardFileStorage(baseDir / profile / "vcards"); capsStorage = new CapsFileStorage(baseDir / "caps"); avatarStorage = new AvatarFileStorage(baseDir / "avatars"); } diff --git a/Swiften/Client/NickManager.h b/Swiften/Client/NickManager.h index e918b07..288aa7b 100644 --- a/Swiften/Client/NickManager.h +++ b/Swiften/Client/NickManager.h @@ -7,16 +7,16 @@ #pragma once #include <Swiften/Base/boost_bsignals.h> -#include <Swiften/Base/String.h> +#include <string> namespace Swift { class NickManager { public: virtual ~NickManager(); - virtual String getOwnNick() const = 0; - virtual void setOwnNick(const String& nick) = 0; + virtual std::string getOwnNick() const = 0; + virtual void setOwnNick(const std::string& nick) = 0; - boost::signal<void (const String&)> onOwnNickChanged; + boost::signal<void (const std::string&)> onOwnNickChanged; }; } diff --git a/Swiften/Client/NickManagerImpl.cpp b/Swiften/Client/NickManagerImpl.cpp index fd37222..b9ebcde 100644 --- a/Swiften/Client/NickManagerImpl.cpp +++ b/Swiften/Client/NickManagerImpl.cpp @@ -22,11 +22,11 @@ NickManagerImpl::~NickManagerImpl() { vcardManager->onVCardChanged.disconnect(boost::bind(&NickManagerImpl::handleVCardReceived, this, _1, _2)); } -String NickManagerImpl::getOwnNick() const { +std::string NickManagerImpl::getOwnNick() const { return ownNick; } -void NickManagerImpl::setOwnNick(const String&) { +void NickManagerImpl::setOwnNick(const std::string&) { } void NickManagerImpl::handleVCardReceived(const JID& jid, VCard::ref vcard) { @@ -37,8 +37,8 @@ void NickManagerImpl::handleVCardReceived(const JID& jid, VCard::ref vcard) { } void NickManagerImpl::updateOwnNickFromVCard(VCard::ref vcard) { - String nick; - if (vcard && !vcard->getNickname().isEmpty()) { + std::string nick; + if (vcard && !vcard->getNickname().empty()) { nick = vcard->getNickname(); } if (ownNick != nick) { diff --git a/Swiften/Client/NickManagerImpl.h b/Swiften/Client/NickManagerImpl.h index 8796dbe..d732987 100644 --- a/Swiften/Client/NickManagerImpl.h +++ b/Swiften/Client/NickManagerImpl.h @@ -9,7 +9,7 @@ #include <Swiften/Client/NickManager.h> #include <Swiften/Elements/VCard.h> #include <Swiften/JID/JID.h> -#include <Swiften/Base/String.h> +#include <string> namespace Swift { class VCardManager; @@ -19,8 +19,8 @@ namespace Swift { NickManagerImpl(const JID& ownJID, VCardManager* vcardManager); ~NickManagerImpl(); - String getOwnNick() const; - void setOwnNick(const String& nick); + std::string getOwnNick() const; + void setOwnNick(const std::string& nick); private: void handleVCardReceived(const JID& jid, VCard::ref vCard); @@ -29,6 +29,6 @@ namespace Swift { private: JID ownJID; VCardManager* vcardManager; - String ownNick; + std::string ownNick; }; } diff --git a/Swiften/Client/NickResolver.cpp b/Swiften/Client/NickResolver.cpp index 3e1ae8e..6d5e742 100644 --- a/Swiften/Client/NickResolver.cpp +++ b/Swiften/Client/NickResolver.cpp @@ -31,28 +31,28 @@ NickResolver::NickResolver(const JID& ownJID, XMPPRoster* xmppRoster, VCardManag xmppRoster_->onJIDAdded.connect(boost::bind(&NickResolver::handleJIDAdded, this, _1)); } -void NickResolver::handleJIDUpdated(const JID& jid, const String& previousNick, const std::vector<String>& /*groups*/) { +void NickResolver::handleJIDUpdated(const JID& jid, const std::string& previousNick, const std::vector<std::string>& /*groups*/) { onNickChanged(jid, previousNick); } void NickResolver::handleJIDAdded(const JID& jid) { - String oldNick(jidToNick(jid)); + std::string oldNick(jidToNick(jid)); onNickChanged(jid, oldNick); } -String NickResolver::jidToNick(const JID& jid) { +std::string NickResolver::jidToNick(const JID& jid) { if (jid.toBare() == ownJID_) { - if (!ownNick_.isEmpty()) { + if (!ownNick_.empty()) { return ownNick_; } } - String nick; + std::string nick; if (mucRegistry_ && mucRegistry_->isMUC(jid.toBare()) ) { - return jid.getResource().isEmpty() ? jid.toBare().toString() : jid.getResource(); + return jid.getResource().empty() ? jid.toBare().toString() : jid.getResource(); } - if (xmppRoster_->containsJID(jid) && !xmppRoster_->getNameForJID(jid).isEmpty()) { + if (xmppRoster_->containsJID(jid) && !xmppRoster_->getNameForJID(jid).empty()) { return xmppRoster_->getNameForJID(jid); } @@ -63,14 +63,14 @@ void NickResolver::handleVCardReceived(const JID& jid, VCard::ref ownVCard) { if (!jid.equals(ownJID_, JID::WithoutResource)) { return; } - String initialNick = ownNick_; + std::string initialNick = ownNick_; ownNick_ = ownJID_.toString(); if (ownVCard) { - if (!ownVCard->getNickname().isEmpty()) { + if (!ownVCard->getNickname().empty()) { ownNick_ = ownVCard->getNickname(); - } else if (!ownVCard->getGivenName().isEmpty()) { + } else if (!ownVCard->getGivenName().empty()) { ownNick_ = ownVCard->getGivenName(); - } else if (!ownVCard->getFullName().isEmpty()) { + } else if (!ownVCard->getFullName().empty()) { ownNick_ = ownVCard->getFullName(); } } diff --git a/Swiften/Client/NickResolver.h b/Swiften/Client/NickResolver.h index 697409f..881362a 100644 --- a/Swiften/Client/NickResolver.h +++ b/Swiften/Client/NickResolver.h @@ -8,7 +8,7 @@ #include <boost/signals.hpp> #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/Elements/VCard.h" @@ -20,18 +20,18 @@ namespace Swift { public: NickResolver(const JID& ownJID, XMPPRoster* xmppRoster, VCardManager* vcardManager, MUCRegistry* mucRegistry); - String jidToNick(const JID& jid); + std::string jidToNick(const JID& jid); - boost::signal<void (const JID&, const String& /*previousNick*/)> onNickChanged; + boost::signal<void (const JID&, const std::string& /*previousNick*/)> onNickChanged; private: void handleVCardReceived(const JID& jid, VCard::ref vCard); - void handleJIDUpdated(const JID& jid, const String& previousNick, const std::vector<String>& groups); + void handleJIDUpdated(const JID& jid, const std::string& previousNick, const std::vector<std::string>& groups); void handleJIDAdded(const JID& jid); private: JID ownJID_; - String ownNick_; + std::string ownNick_; XMPPRoster* xmppRoster_; MUCRegistry* mucRegistry_; VCardManager* vcardManager_; diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp index af8a4c3..21c0ffb 100644 --- a/Swiften/Client/UnitTest/ClientSessionTest.cpp +++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp @@ -455,7 +455,7 @@ class ClientSessionTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(boost::dynamic_pointer_cast<StartTLSRequest>(event.element)); } - void receiveAuthRequest(const String& mech) { + void receiveAuthRequest(const std::string& mech) { Event event = popEvent(); CPPUNIT_ASSERT(event.element); boost::shared_ptr<AuthRequest> request(boost::dynamic_pointer_cast<AuthRequest>(event.element)); @@ -490,7 +490,7 @@ class ClientSessionTest : public CppUnit::TestFixture { bool tlsEncrypted; bool compressed; bool whitespacePingEnabled; - String bindID; + std::string bindID; int resetCount; std::deque<Event> receivedEvents; }; diff --git a/Swiften/Client/UnitTest/NickResolverTest.cpp b/Swiften/Client/UnitTest/NickResolverTest.cpp index 0c5c91b..bd778d4 100644 --- a/Swiften/Client/UnitTest/NickResolverTest.cpp +++ b/Swiften/Client/UnitTest/NickResolverTest.cpp @@ -58,34 +58,34 @@ class NickResolverTest : public CppUnit::TestFixture { registry_->addMUC(JID("foo@bar")); JID testJID("foo@bar/baz"); - CPPUNIT_ASSERT_EQUAL(String("baz"), resolver_->jidToNick(testJID)); + CPPUNIT_ASSERT_EQUAL(std::string("baz"), resolver_->jidToNick(testJID)); } void testMUCNoNick() { registry_->addMUC(JID("foo@bar")); JID testJID("foo@bar"); - CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver_->jidToNick(testJID)); + CPPUNIT_ASSERT_EQUAL(std::string("foo@bar"), resolver_->jidToNick(testJID)); } void testNoMatch() { JID testJID("foo@bar/baz"); - CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver_->jidToNick(testJID)); + CPPUNIT_ASSERT_EQUAL(std::string("foo@bar"), resolver_->jidToNick(testJID)); } void testZeroLengthMatch() { JID testJID("foo@bar/baz"); xmppRoster_->addContact(testJID, "", groups_, RosterItemPayload::Both); - CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver_->jidToNick(testJID)); + CPPUNIT_ASSERT_EQUAL(std::string("foo@bar"), resolver_->jidToNick(testJID)); } void testMatch() { JID testJID("foo@bar/baz"); xmppRoster_->addContact(testJID, "Test", groups_, RosterItemPayload::Both); - CPPUNIT_ASSERT_EQUAL(String("Test"), resolver_->jidToNick(testJID)); + CPPUNIT_ASSERT_EQUAL(std::string("Test"), resolver_->jidToNick(testJID)); } void testOverwrittenMatch() { @@ -93,40 +93,40 @@ class NickResolverTest : public CppUnit::TestFixture { xmppRoster_->addContact(testJID, "FailTest", groups_, RosterItemPayload::Both); xmppRoster_->addContact(testJID, "Test", groups_, RosterItemPayload::Both); - CPPUNIT_ASSERT_EQUAL(String("Test"), resolver_->jidToNick(testJID)); + CPPUNIT_ASSERT_EQUAL(std::string("Test"), resolver_->jidToNick(testJID)); } void testRemovedMatch() { JID testJID("foo@bar/baz"); xmppRoster_->addContact(testJID, "FailTest", groups_, RosterItemPayload::Both); xmppRoster_->removeContact(testJID); - CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver_->jidToNick(testJID)); + CPPUNIT_ASSERT_EQUAL(std::string("foo@bar"), resolver_->jidToNick(testJID)); } void testOwnNickFullOnly() { populateOwnVCard("", "", "Kevin Smith"); - CPPUNIT_ASSERT_EQUAL(String("Kevin Smith"), resolver_->jidToNick(ownJID_)); + CPPUNIT_ASSERT_EQUAL(std::string("Kevin Smith"), resolver_->jidToNick(ownJID_)); } void testOwnNickGivenAndFull() { populateOwnVCard("", "Kevin", "Kevin Smith"); - CPPUNIT_ASSERT_EQUAL(String("Kevin"), resolver_->jidToNick(ownJID_)); + CPPUNIT_ASSERT_EQUAL(std::string("Kevin"), resolver_->jidToNick(ownJID_)); } void testOwnNickNickEtAl() { populateOwnVCard("Kev", "Kevin", "Kevin Smith"); - CPPUNIT_ASSERT_EQUAL(String("Kev"), resolver_->jidToNick(ownJID_)); + CPPUNIT_ASSERT_EQUAL(std::string("Kev"), resolver_->jidToNick(ownJID_)); } - void populateOwnVCard(const String& nick, const String& given, const String& full) { + void populateOwnVCard(const std::string& nick, const std::string& given, const std::string& full) { VCard::ref vcard(new VCard()); - if (!nick.isEmpty()) { + if (!nick.empty()) { vcard->setNickname(nick); } - if (!given.isEmpty()) { + if (!given.empty()) { vcard->setGivenName(given); } - if (!full.isEmpty()) { + if (!full.empty()) { vcard->setFullName(full); } vCardManager_->requestVCard(ownJID_); @@ -135,7 +135,7 @@ class NickResolverTest : public CppUnit::TestFixture { } private: - std::vector<String> groups_; + std::vector<std::string> groups_; XMPPRosterImpl* xmppRoster_; VCardStorage* vCardStorage_; IQRouter* iqRouter_; diff --git a/Swiften/Component/Component.cpp b/Swiften/Component/Component.cpp index f3e2b81..fb4ba4c 100644 --- a/Swiften/Component/Component.cpp +++ b/Swiften/Component/Component.cpp @@ -10,7 +10,7 @@ namespace Swift { -Component::Component(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const String& secret) : CoreComponent(eventLoop, networkFactories, jid, secret) { +Component::Component(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret) : CoreComponent(eventLoop, networkFactories, jid, secret) { softwareVersionResponder = new SoftwareVersionResponder(getIQRouter()); softwareVersionResponder->start(); } @@ -20,7 +20,7 @@ Component::~Component() { delete softwareVersionResponder; } -void Component::setSoftwareVersion(const String& name, const String& version) { +void Component::setSoftwareVersion(const std::string& name, const std::string& version) { softwareVersionResponder->setVersion(name, version); } diff --git a/Swiften/Component/Component.h b/Swiften/Component/Component.h index 1a04272..0119db0 100644 --- a/Swiften/Component/Component.h +++ b/Swiften/Component/Component.h @@ -19,7 +19,7 @@ namespace Swift { */ class Component : public CoreComponent { public: - Component(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const String& secret); + Component(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret); ~Component(); /** @@ -27,7 +27,7 @@ namespace Swift { * * This will be used to respond to version queries from other entities. */ - void setSoftwareVersion(const String& name, const String& version); + void setSoftwareVersion(const std::string& name, const std::string& version); private: SoftwareVersionResponder* softwareVersionResponder; diff --git a/Swiften/Component/ComponentConnector.cpp b/Swiften/Component/ComponentConnector.cpp index e764138..2af45f6 100644 --- a/Swiften/Component/ComponentConnector.cpp +++ b/Swiften/Component/ComponentConnector.cpp @@ -16,7 +16,7 @@ namespace Swift { -ComponentConnector::ComponentConnector(const String& hostname, int port, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), port(port), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0) { +ComponentConnector::ComponentConnector(const std::string& hostname, int port, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), port(port), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0) { } void ComponentConnector::setTimeoutMilliseconds(int milliseconds) { diff --git a/Swiften/Component/ComponentConnector.h b/Swiften/Component/ComponentConnector.h index a84d8ba..c5e8f80 100644 --- a/Swiften/Component/ComponentConnector.h +++ b/Swiften/Component/ComponentConnector.h @@ -13,7 +13,7 @@ #include "Swiften/Network/Connection.h" #include "Swiften/Network/Timer.h" #include "Swiften/Network/HostAddressPort.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Network/DomainNameResolveError.h" namespace Swift { @@ -26,7 +26,7 @@ namespace Swift { public: typedef boost::shared_ptr<ComponentConnector> ref; - static ComponentConnector::ref create(const String& hostname, int port, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) { + static ComponentConnector::ref create(const std::string& hostname, int port, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) { return ComponentConnector::ref(new ComponentConnector(hostname, port, resolver, connectionFactory, timerFactory)); } @@ -38,7 +38,7 @@ namespace Swift { boost::signal<void (boost::shared_ptr<Connection>)> onConnectFinished; private: - ComponentConnector(const String& hostname, int port, DomainNameResolver*, ConnectionFactory*, TimerFactory*); + ComponentConnector(const std::string& hostname, int port, DomainNameResolver*, ConnectionFactory*, TimerFactory*); void handleAddressQueryResult(const std::vector<HostAddress>& address, boost::optional<DomainNameResolveError> error); void tryNextAddress(); @@ -50,7 +50,7 @@ namespace Swift { private: - String hostname; + std::string hostname; int port; DomainNameResolver* resolver; ConnectionFactory* connectionFactory; diff --git a/Swiften/Component/ComponentHandshakeGenerator.cpp b/Swiften/Component/ComponentHandshakeGenerator.cpp index 422f986..4081420 100644 --- a/Swiften/Component/ComponentHandshakeGenerator.cpp +++ b/Swiften/Component/ComponentHandshakeGenerator.cpp @@ -7,16 +7,17 @@ #include "Swiften/Component/ComponentHandshakeGenerator.h" #include "Swiften/StringCodecs/Hexify.h" #include "Swiften/StringCodecs/SHA1.h" +#include <Swiften/Base/String.h> namespace Swift { -String ComponentHandshakeGenerator::getHandshake(const String& streamID, const String& secret) { - String concatenatedString = streamID + secret; - concatenatedString.replaceAll('&', "&"); - concatenatedString.replaceAll('<', "<"); - concatenatedString.replaceAll('>', ">"); - concatenatedString.replaceAll('\'', "'"); - concatenatedString.replaceAll('"', """); +std::string ComponentHandshakeGenerator::getHandshake(const std::string& streamID, const std::string& secret) { + std::string concatenatedString = streamID + secret; + String::replaceAll(concatenatedString, '&', "&"); + String::replaceAll(concatenatedString, '<', "<"); + String::replaceAll(concatenatedString, '>', ">"); + String::replaceAll(concatenatedString, '\'', "'"); + String::replaceAll(concatenatedString, '"', """); return Hexify::hexify(SHA1::getHash(ByteArray(concatenatedString))); } diff --git a/Swiften/Component/ComponentHandshakeGenerator.h b/Swiften/Component/ComponentHandshakeGenerator.h index d71a664..4181d3c 100644 --- a/Swiften/Component/ComponentHandshakeGenerator.h +++ b/Swiften/Component/ComponentHandshakeGenerator.h @@ -6,12 +6,12 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class ComponentHandshakeGenerator { public: - static String getHandshake(const String& streamID, const String& secret); + static std::string getHandshake(const std::string& streamID, const std::string& secret); }; } diff --git a/Swiften/Component/ComponentSession.cpp b/Swiften/Component/ComponentSession.cpp index c45f663..17e0dfd 100644 --- a/Swiften/Component/ComponentSession.cpp +++ b/Swiften/Component/ComponentSession.cpp @@ -15,7 +15,7 @@ namespace Swift { -ComponentSession::ComponentSession(const JID& jid, const String& secret, boost::shared_ptr<SessionStream> stream) : jid(jid), secret(secret), stream(stream), state(Initial) { +ComponentSession::ComponentSession(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream> stream) : jid(jid), secret(secret), stream(stream), state(Initial) { } ComponentSession::~ComponentSession() { diff --git a/Swiften/Component/ComponentSession.h b/Swiften/Component/ComponentSession.h index dbe6e27..168e618 100644 --- a/Swiften/Component/ComponentSession.h +++ b/Swiften/Component/ComponentSession.h @@ -12,7 +12,7 @@ #include "Swiften/JID/JID.h" #include "Swiften/Base/boost_bsignals.h" #include "Swiften/Base/Error.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Element.h" #include "Swiften/Elements/Stanza.h" #include "Swiften/Session/SessionStream.h" @@ -41,7 +41,7 @@ namespace Swift { ~ComponentSession(); - static boost::shared_ptr<ComponentSession> create(const JID& jid, const String& secret, boost::shared_ptr<SessionStream> stream) { + static boost::shared_ptr<ComponentSession> create(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream> stream) { return boost::shared_ptr<ComponentSession>(new ComponentSession(jid, secret, stream)); } @@ -60,7 +60,7 @@ namespace Swift { boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived; private: - ComponentSession(const JID& jid, const String& secret, boost::shared_ptr<SessionStream>); + ComponentSession(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream>); void finishSession(Error::Type error); void finishSession(boost::shared_ptr<Swift::Error> error); @@ -75,7 +75,7 @@ namespace Swift { private: JID jid; - String secret; + std::string secret; boost::shared_ptr<SessionStream> stream; boost::shared_ptr<Swift::Error> error; State state; diff --git a/Swiften/Component/ComponentSessionStanzaChannel.cpp b/Swiften/Component/ComponentSessionStanzaChannel.cpp index 9f4dc2e..b9fecb2 100644 --- a/Swiften/Component/ComponentSessionStanzaChannel.cpp +++ b/Swiften/Component/ComponentSessionStanzaChannel.cpp @@ -30,7 +30,7 @@ void ComponentSessionStanzaChannel::sendPresence(boost::shared_ptr<Presence> pre send(presence); } -String ComponentSessionStanzaChannel::getNewIQID() { +std::string ComponentSessionStanzaChannel::getNewIQID() { return idGenerator.generateID(); } diff --git a/Swiften/Component/ComponentSessionStanzaChannel.h b/Swiften/Component/ComponentSessionStanzaChannel.h index 856031f..605c8dc 100644 --- a/Swiften/Component/ComponentSessionStanzaChannel.h +++ b/Swiften/Component/ComponentSessionStanzaChannel.h @@ -36,7 +36,7 @@ namespace Swift { } private: - String getNewIQID(); + std::string getNewIQID(); void send(boost::shared_ptr<Stanza> stanza); void handleSessionFinished(boost::shared_ptr<Error> error); void handleStanza(boost::shared_ptr<Stanza> stanza); diff --git a/Swiften/Component/ComponentXMLTracer.h b/Swiften/Component/ComponentXMLTracer.h index 512e69c..70a617b 100644 --- a/Swiften/Component/ComponentXMLTracer.h +++ b/Swiften/Component/ComponentXMLTracer.h @@ -19,7 +19,7 @@ namespace Swift { } private: - static void printData(char direction, const String& data) { + static void printData(char direction, const std::string& data) { printLine(direction); std::cerr << data << std::endl; } diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp index eabe62d..e79d735 100644 --- a/Swiften/Component/CoreComponent.cpp +++ b/Swiften/Component/CoreComponent.cpp @@ -19,7 +19,7 @@ namespace Swift { -CoreComponent::CoreComponent(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const String& secret) : eventLoop(eventLoop), networkFactories(networkFactories), resolver_(eventLoop), jid_(jid), secret_(secret), disconnectRequested_(false) { +CoreComponent::CoreComponent(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret) : eventLoop(eventLoop), networkFactories(networkFactories), resolver_(eventLoop), jid_(jid), secret_(secret), disconnectRequested_(false) { stanzaChannel_ = new ComponentSessionStanzaChannel(); stanzaChannel_->onMessageReceived.connect(boost::ref(onMessageReceived)); stanzaChannel_->onPresenceReceived.connect(boost::ref(onPresenceReceived)); @@ -41,7 +41,7 @@ CoreComponent::~CoreComponent() { delete stanzaChannel_; } -void CoreComponent::connect(const String& host, int port) { +void CoreComponent::connect(const std::string& host, int port) { assert(!connector_); connector_ = ComponentConnector::create(host, port, &resolver_, networkFactories->getConnectionFactory(), networkFactories->getTimerFactory()); connector_->onConnectFinished.connect(boost::bind(&CoreComponent::handleConnectorFinished, this, _1)); @@ -138,11 +138,11 @@ void CoreComponent::handleSessionFinished(boost::shared_ptr<Error> error) { } } -void CoreComponent::handleDataRead(const String& data) { +void CoreComponent::handleDataRead(const std::string& data) { onDataRead(data); } -void CoreComponent::handleDataWritten(const String& data) { +void CoreComponent::handleDataWritten(const std::string& data) { onDataWritten(data); } diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h index 8ebf80f..64c9071 100644 --- a/Swiften/Component/CoreComponent.h +++ b/Swiften/Component/CoreComponent.h @@ -17,7 +17,7 @@ #include "Swiften/Elements/Presence.h" #include "Swiften/Elements/Message.h" #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h" #include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" #include "Swiften/Component/ComponentSessionStanzaChannel.h" @@ -41,10 +41,10 @@ namespace Swift { */ class CoreComponent : public Entity { public: - CoreComponent(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const String& secret); + CoreComponent(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const std::string& secret); ~CoreComponent(); - void connect(const String& host, int port); + void connect(const std::string& host, int port); void disconnect(); void sendMessage(boost::shared_ptr<Message>); @@ -72,8 +72,8 @@ namespace Swift { public: boost::signal<void (const ComponentError&)> onError; boost::signal<void ()> onConnected; - boost::signal<void (const String&)> onDataRead; - boost::signal<void (const String&)> onDataWritten; + boost::signal<void (const std::string&)> onDataRead; + boost::signal<void (const std::string&)> onDataWritten; boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived; boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived; @@ -82,15 +82,15 @@ namespace Swift { void handleConnectorFinished(boost::shared_ptr<Connection>); void handleStanzaChannelAvailableChanged(bool available); void handleSessionFinished(boost::shared_ptr<Error>); - void handleDataRead(const String&); - void handleDataWritten(const String&); + void handleDataRead(const std::string&); + void handleDataWritten(const std::string&); private: EventLoop* eventLoop; NetworkFactories* networkFactories; PlatformDomainNameResolver resolver_; JID jid_; - String secret_; + std::string secret_; ComponentSessionStanzaChannel* stanzaChannel_; IQRouter* iqRouter_; ComponentConnector::ref connector_; diff --git a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp b/Swiften/Component/UnitTest/ComponentConnectorTest.cpp index bfa2cb2..052b5de 100644 --- a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp +++ b/Swiften/Component/UnitTest/ComponentConnectorTest.cpp @@ -146,7 +146,7 @@ class ComponentConnectorTest : public CppUnit::TestFixture { } private: - ComponentConnector::ref createConnector(const String& hostname, int port) { + ComponentConnector::ref createConnector(const std::string& hostname, int port) { ComponentConnector::ref connector = ComponentConnector::create(hostname, port, resolver, connectionFactory, timerFactory); connector->onConnectFinished.connect(boost::bind(&ComponentConnectorTest::handleConnectorFinished, this, _1)); return connector; diff --git a/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp b/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp index e72dbea..5366478 100644 --- a/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp +++ b/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp @@ -19,13 +19,13 @@ class ComponentHandshakeGeneratorTest : public CppUnit::TestFixture { public: void testGetHandshake() { - String result = ComponentHandshakeGenerator::getHandshake("myid", "mysecret"); - CPPUNIT_ASSERT_EQUAL(String("4011cd31f9b99ac089a0cd7ce297da7323fa2525"), result); + std::string result = ComponentHandshakeGenerator::getHandshake("myid", "mysecret"); + CPPUNIT_ASSERT_EQUAL(std::string("4011cd31f9b99ac089a0cd7ce297da7323fa2525"), result); } void testGetHandshake_SpecialChars() { - String result = ComponentHandshakeGenerator::getHandshake("&<", ">'\""); - CPPUNIT_ASSERT_EQUAL(String("33631b3e0aaeb2a11c4994c917919324028873fe"), result); + std::string result = ComponentHandshakeGenerator::getHandshake("&<", ">'\""); + CPPUNIT_ASSERT_EQUAL(std::string("33631b3e0aaeb2a11c4994c917919324028873fe"), result); } }; diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp index 86776e8..af8962a 100644 --- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp +++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp @@ -180,7 +180,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(event.element); ComponentHandshake::ref handshake(boost::dynamic_pointer_cast<ComponentHandshake>(event.element)); CPPUNIT_ASSERT(handshake); - CPPUNIT_ASSERT_EQUAL(String("4c4f8a41141722c8bbfbdd92d827f7b2fc0a542b"), handshake->getData()); + CPPUNIT_ASSERT_EQUAL(std::string("4c4f8a41141722c8bbfbdd92d827f7b2fc0a542b"), handshake->getData()); } Event popEvent() { @@ -192,7 +192,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { bool available; bool whitespacePingEnabled; - String bindID; + std::string bindID; int resetCount; std::deque<Event> receivedEvents; }; diff --git a/Swiften/Config/swiften-config.cpp b/Swiften/Config/swiften-config.cpp index 4f4016e..d381faa 100644 --- a/Swiften/Config/swiften-config.cpp +++ b/Swiften/Config/swiften-config.cpp @@ -10,17 +10,18 @@ #include <boost/program_options/variables_map.hpp> #include <boost/program_options.hpp> #include <boost/version.hpp> +#include <string> -#include <Swiften/Base/String.h> #include <Swiften/Base/foreach.h> #include <Swiften/Base/Platform.h> #include <Swiften/Base/Paths.h> +#include <Swiften/Base/String.h> #include "swiften-config.h" using namespace Swift; -void printFlags(const std::vector<String>& flags) { +void printFlags(const std::vector<std::string>& flags) { for (size_t i = 0; i < flags.size(); ++i) { if (i > 0) { std::cout << " "; @@ -60,11 +61,11 @@ int main(int argc, char* argv[]) { } // Read in all variables - std::vector<String> libs; + std::vector<std::string> libs; for (size_t i = 0; LIBFLAGS[i]; ++i) { libs.push_back(LIBFLAGS[i]); } - std::vector<String> cflags; + std::vector<std::string> cflags; for (size_t i = 0; CPPFLAGS[i]; ++i) { cflags.push_back(CPPFLAGS[i]); } @@ -77,8 +78,8 @@ int main(int argc, char* argv[]) { // Replace "#" variables with the correct path for(size_t i = 0; i < libs.size(); ++i) { if (inPlace) { - String lib = libs[i]; - lib.replaceAll('#', topPath.string()); + std::string lib = libs[i]; + String::replaceAll(lib, '#', topPath.string()); libs[i] = lib; } else { @@ -87,8 +88,8 @@ int main(int argc, char* argv[]) { } for(size_t i = 0; i < cflags.size(); ++i) { if (inPlace) { - String cflag = cflags[i]; - cflag.replaceAll('#', topPath.string()); + std::string cflag = cflags[i]; + String::replaceAll(cflag, '#', topPath.string()); cflags[i] = cflag; } else { diff --git a/Swiften/Disco/CapsFileStorage.cpp b/Swiften/Disco/CapsFileStorage.cpp index 107cf28..2334acf 100644 --- a/Swiften/Disco/CapsFileStorage.cpp +++ b/Swiften/Disco/CapsFileStorage.cpp @@ -21,7 +21,7 @@ namespace Swift { CapsFileStorage::CapsFileStorage(const boost::filesystem::path& path) : path(path) { } -DiscoInfo::ref CapsFileStorage::getDiscoInfo(const String& hash) const { +DiscoInfo::ref CapsFileStorage::getDiscoInfo(const std::string& hash) const { boost::filesystem::path capsPath(getCapsPath(hash)); if (boost::filesystem::exists(capsPath)) { ByteArray data; @@ -29,7 +29,7 @@ DiscoInfo::ref CapsFileStorage::getDiscoInfo(const String& hash) const { DiscoInfoParser parser; PayloadParserTester tester(&parser); - tester.parse(String(data.getData(), data.getSize())); + tester.parse(std::string(data.getData(), data.getSize())); return boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); } else { @@ -37,7 +37,7 @@ DiscoInfo::ref CapsFileStorage::getDiscoInfo(const String& hash) const { } } -void CapsFileStorage::setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo) { +void CapsFileStorage::setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo) { boost::filesystem::path capsPath(getCapsPath(hash)); if (!boost::filesystem::exists(capsPath.parent_path())) { try { @@ -54,8 +54,8 @@ void CapsFileStorage::setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo) file.close(); } -boost::filesystem::path CapsFileStorage::getCapsPath(const String& hash) const { - return path / (Hexify::hexify(Base64::decode(hash)) + ".xml").getUTF8String(); +boost::filesystem::path CapsFileStorage::getCapsPath(const std::string& hash) const { + return path / (Hexify::hexify(Base64::decode(hash)) + ".xml"); } } diff --git a/Swiften/Disco/CapsFileStorage.h b/Swiften/Disco/CapsFileStorage.h index ea1b1a2..5faf08b 100644 --- a/Swiften/Disco/CapsFileStorage.h +++ b/Swiften/Disco/CapsFileStorage.h @@ -9,18 +9,18 @@ #include <boost/filesystem.hpp> #include "Swiften/Disco/CapsStorage.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class CapsFileStorage : public CapsStorage { public: CapsFileStorage(const boost::filesystem::path& path); - virtual DiscoInfo::ref getDiscoInfo(const String& hash) const; - virtual void setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo); + virtual DiscoInfo::ref getDiscoInfo(const std::string& hash) const; + virtual void setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo); private: - boost::filesystem::path getCapsPath(const String& hash) const; + boost::filesystem::path getCapsPath(const std::string& hash) const; private: boost::filesystem::path path; diff --git a/Swiften/Disco/CapsInfoGenerator.cpp b/Swiften/Disco/CapsInfoGenerator.cpp index 94f2a7a..5c0e9a7 100644 --- a/Swiften/Disco/CapsInfoGenerator.cpp +++ b/Swiften/Disco/CapsInfoGenerator.cpp @@ -22,11 +22,11 @@ namespace { namespace Swift { -CapsInfoGenerator::CapsInfoGenerator(const String& node) : node_(node) { +CapsInfoGenerator::CapsInfoGenerator(const std::string& node) : node_(node) { } CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const { - String serializedCaps; + std::string serializedCaps; std::vector<DiscoInfo::Identity> identities(discoInfo.getIdentities()); std::sort(identities.begin(), identities.end()); @@ -34,9 +34,9 @@ CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const { serializedCaps += identity.getCategory() + "/" + identity.getType() + "/" + identity.getLanguage() + "/" + identity.getName() + "<"; } - std::vector<String> features(discoInfo.getFeatures()); + std::vector<std::string> features(discoInfo.getFeatures()); std::sort(features.begin(), features.end()); - foreach (const String& feature, features) { + foreach (const std::string& feature, features) { serializedCaps += feature + "<"; } @@ -49,15 +49,15 @@ CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const { continue; } serializedCaps += field->getName() + "<"; - std::vector<String> values(field->getRawValues()); + std::vector<std::string> values(field->getRawValues()); std::sort(values.begin(), values.end()); - foreach(const String& value, values) { + foreach(const std::string& value, values) { serializedCaps += value + "<"; } } } - String version(Base64::encode(SHA1::getHash(serializedCaps))); + std::string version(Base64::encode(SHA1::getHash(serializedCaps))); return CapsInfo(node_, version, "sha-1"); } diff --git a/Swiften/Disco/CapsInfoGenerator.h b/Swiften/Disco/CapsInfoGenerator.h index cc32bbd..41a1d94 100644 --- a/Swiften/Disco/CapsInfoGenerator.h +++ b/Swiften/Disco/CapsInfoGenerator.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/CapsInfo.h" namespace Swift { @@ -14,11 +14,11 @@ namespace Swift { class CapsInfoGenerator { public: - CapsInfoGenerator(const String& node); + CapsInfoGenerator(const std::string& node); CapsInfo generateCapsInfo(const DiscoInfo& discoInfo) const; private: - String node_; + std::string node_; }; } diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp index 1c785e5..63166e6 100644 --- a/Swiften/Disco/CapsManager.cpp +++ b/Swiften/Disco/CapsManager.cpp @@ -26,7 +26,7 @@ void CapsManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) { if (!capsInfo || capsInfo->getHash() != "sha-1" || presence->getPayload<ErrorPayload>()) { return; } - String hash = capsInfo->getVersion(); + std::string hash = capsInfo->getVersion(); if (capsStorage->getDiscoInfo(hash)) { return; } @@ -48,16 +48,16 @@ void CapsManager::handleStanzaChannelAvailableChanged(bool available) { } } -void CapsManager::handleDiscoInfoReceived(const JID& from, const String& hash, DiscoInfo::ref discoInfo, ErrorPayload::ref error) { +void CapsManager::handleDiscoInfoReceived(const JID& from, const std::string& hash, DiscoInfo::ref discoInfo, ErrorPayload::ref error) { requestedDiscoInfos.erase(hash); if (error || CapsInfoGenerator("").generateCapsInfo(*discoInfo.get()).getVersion() != hash) { if (warnOnInvalidHash && !error) { std::cerr << "Warning: Caps from " << from.toString() << " do not verify" << std::endl; } failingCaps.insert(std::make_pair(from, hash)); - std::map<String, std::set< std::pair<JID, String> > >::iterator i = fallbacks.find(hash); + std::map<std::string, std::set< std::pair<JID, std::string> > >::iterator i = fallbacks.find(hash); if (i != fallbacks.end() && !i->second.empty()) { - std::pair<JID,String> fallbackAndNode = *i->second.begin(); + std::pair<JID,std::string> fallbackAndNode = *i->second.begin(); i->second.erase(i->second.begin()); requestDiscoInfo(fallbackAndNode.first, fallbackAndNode.second, hash); } @@ -68,14 +68,14 @@ void CapsManager::handleDiscoInfoReceived(const JID& from, const String& hash, D onCapsAvailable(hash); } -void CapsManager::requestDiscoInfo(const JID& jid, const String& node, const String& hash) { +void CapsManager::requestDiscoInfo(const JID& jid, const std::string& node, const std::string& hash) { GetDiscoInfoRequest::ref request = GetDiscoInfoRequest::create(jid, node + "#" + hash, iqRouter); request->onResponse.connect(boost::bind(&CapsManager::handleDiscoInfoReceived, this, jid, hash, _1, _2)); requestedDiscoInfos.insert(hash); request->send(); } -DiscoInfo::ref CapsManager::getCaps(const String& hash) const { +DiscoInfo::ref CapsManager::getCaps(const std::string& hash) const { return capsStorage->getDiscoInfo(hash); } diff --git a/Swiften/Disco/CapsManager.h b/Swiften/Disco/CapsManager.h index 842f2be..961dae8 100644 --- a/Swiften/Disco/CapsManager.h +++ b/Swiften/Disco/CapsManager.h @@ -26,7 +26,7 @@ namespace Swift { public: CapsManager(CapsStorage*, StanzaChannel*, IQRouter*); - DiscoInfo::ref getCaps(const String&) const; + DiscoInfo::ref getCaps(const std::string&) const; // Mainly for testing purposes void setWarnOnInvalidHash(bool b) { @@ -36,15 +36,15 @@ namespace Swift { private: void handlePresenceReceived(boost::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); - void handleDiscoInfoReceived(const JID&, const String& hash, DiscoInfo::ref, ErrorPayload::ref); - void requestDiscoInfo(const JID& jid, const String& node, const String& hash); + void handleDiscoInfoReceived(const JID&, const std::string& hash, DiscoInfo::ref, ErrorPayload::ref); + void requestDiscoInfo(const JID& jid, const std::string& node, const std::string& hash); private: IQRouter* iqRouter; CapsStorage* capsStorage; bool warnOnInvalidHash; - std::set<String> requestedDiscoInfos; - std::set< std::pair<JID, String> > failingCaps; - std::map<String, std::set< std::pair<JID, String> > > fallbacks; + std::set<std::string> requestedDiscoInfos; + std::set< std::pair<JID, std::string> > failingCaps; + std::map<std::string, std::set< std::pair<JID, std::string> > > fallbacks; }; } diff --git a/Swiften/Disco/CapsMemoryStorage.h b/Swiften/Disco/CapsMemoryStorage.h index 71bd5d5..1e2d7be 100644 --- a/Swiften/Disco/CapsMemoryStorage.h +++ b/Swiften/Disco/CapsMemoryStorage.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> #include <map> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Disco/CapsStorage.h" namespace Swift { @@ -17,7 +17,7 @@ namespace Swift { public: CapsMemoryStorage() {} - virtual DiscoInfo::ref getDiscoInfo(const String& hash) const { + virtual DiscoInfo::ref getDiscoInfo(const std::string& hash) const { CapsMap::const_iterator i = caps.find(hash); if (i != caps.end()) { return i->second; @@ -27,12 +27,12 @@ namespace Swift { } } - virtual void setDiscoInfo(const String& hash, DiscoInfo::ref discoInfo) { + virtual void setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo) { caps[hash] = discoInfo; } private: - typedef std::map<String, DiscoInfo::ref> CapsMap; + typedef std::map<std::string, DiscoInfo::ref> CapsMap; CapsMap caps; }; } diff --git a/Swiften/Disco/CapsProvider.h b/Swiften/Disco/CapsProvider.h index 815391a..71e2741 100644 --- a/Swiften/Disco/CapsProvider.h +++ b/Swiften/Disco/CapsProvider.h @@ -11,14 +11,14 @@ #include "Swiften/Elements/CapsInfo.h" namespace Swift { - class String; + class CapsProvider { public: virtual ~CapsProvider() {} - virtual DiscoInfo::ref getCaps(const String&) const = 0; + virtual DiscoInfo::ref getCaps(const std::string&) const = 0; - boost::signal<void (const String&)> onCapsAvailable; + boost::signal<void (const std::string&)> onCapsAvailable; }; } diff --git a/Swiften/Disco/CapsStorage.h b/Swiften/Disco/CapsStorage.h index e4ff945..f0a71a3 100644 --- a/Swiften/Disco/CapsStorage.h +++ b/Swiften/Disco/CapsStorage.h @@ -11,13 +11,13 @@ #include "Swiften/Elements/DiscoInfo.h" namespace Swift { - class String; + class CapsStorage { public: virtual ~CapsStorage(); - virtual DiscoInfo::ref getDiscoInfo(const String&) const = 0; - virtual void setDiscoInfo(const String&, DiscoInfo::ref) = 0; + virtual DiscoInfo::ref getDiscoInfo(const std::string&) const = 0; + virtual void setDiscoInfo(const std::string&, DiscoInfo::ref) = 0; }; } diff --git a/Swiften/Disco/ClientDiscoManager.cpp b/Swiften/Disco/ClientDiscoManager.cpp index 6753df2..fb7cce9 100644 --- a/Swiften/Disco/ClientDiscoManager.cpp +++ b/Swiften/Disco/ClientDiscoManager.cpp @@ -24,7 +24,7 @@ ClientDiscoManager::~ClientDiscoManager() { delete discoInfoResponder; } -void ClientDiscoManager::setCapsNode(const String& node) { +void ClientDiscoManager::setCapsNode(const std::string& node) { capsNode = node; } diff --git a/Swiften/Disco/ClientDiscoManager.h b/Swiften/Disco/ClientDiscoManager.h index b997374..3771044 100644 --- a/Swiften/Disco/ClientDiscoManager.h +++ b/Swiften/Disco/ClientDiscoManager.h @@ -41,7 +41,7 @@ namespace Swift { /** * Needs to be called before calling setDiscoInfo(). */ - void setCapsNode(const String& node); + void setCapsNode(const std::string& node); /** * Sets the capabilities of the client. @@ -61,7 +61,7 @@ namespace Swift { private: PayloadAddingPresenceSender* presenceSender; DiscoInfoResponder* discoInfoResponder; - String capsNode; + std::string capsNode; CapsInfo::ref capsInfo; }; } diff --git a/Swiften/Disco/DiscoInfoResponder.cpp b/Swiften/Disco/DiscoInfoResponder.cpp index 0254ad9..7ba044e 100644 --- a/Swiften/Disco/DiscoInfoResponder.cpp +++ b/Swiften/Disco/DiscoInfoResponder.cpp @@ -22,18 +22,18 @@ void DiscoInfoResponder::setDiscoInfo(const DiscoInfo& info) { info_ = info; } -void DiscoInfoResponder::setDiscoInfo(const String& node, const DiscoInfo& info) { +void DiscoInfoResponder::setDiscoInfo(const std::string& node, const DiscoInfo& info) { DiscoInfo newInfo(info); newInfo.setNode(node); nodeInfo_[node] = newInfo; } -bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr<DiscoInfo> info) { - if (info->getNode().isEmpty()) { +bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<DiscoInfo> info) { + if (info->getNode().empty()) { sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(info_))); } else { - std::map<String,DiscoInfo>::const_iterator i = nodeInfo_.find(info->getNode()); + std::map<std::string,DiscoInfo>::const_iterator i = nodeInfo_.find(info->getNode()); if (i != nodeInfo_.end()) { sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo((*i).second))); } diff --git a/Swiften/Disco/DiscoInfoResponder.h b/Swiften/Disco/DiscoInfoResponder.h index 3861ffd..f114a21 100644 --- a/Swiften/Disco/DiscoInfoResponder.h +++ b/Swiften/Disco/DiscoInfoResponder.h @@ -20,13 +20,13 @@ namespace Swift { void clearDiscoInfo(); void setDiscoInfo(const DiscoInfo& info); - void setDiscoInfo(const String& node, const DiscoInfo& info); + void setDiscoInfo(const std::string& node, const DiscoInfo& info); private: - virtual bool handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<DiscoInfo> payload); + virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> payload); private: DiscoInfo info_; - std::map<String, DiscoInfo> nodeInfo_; + std::map<std::string, DiscoInfo> nodeInfo_; }; } diff --git a/Swiften/Disco/EntityCapsManager.cpp b/Swiften/Disco/EntityCapsManager.cpp index 26e0594..3f2e3d7 100644 --- a/Swiften/Disco/EntityCapsManager.cpp +++ b/Swiften/Disco/EntityCapsManager.cpp @@ -26,8 +26,8 @@ void EntityCapsManager::handlePresenceReceived(boost::shared_ptr<Presence> prese if (!capsInfo || capsInfo->getHash() != "sha-1" || presence->getPayload<ErrorPayload>()) { return; } - String hash = capsInfo->getVersion(); - std::map<JID, String>::iterator i = caps.find(from); + std::string hash = capsInfo->getVersion(); + std::map<JID, std::string>::iterator i = caps.find(from); if (i == caps.end() || i->second != hash) { caps.insert(std::make_pair(from, hash)); DiscoInfo::ref disco = capsProvider->getCaps(hash); @@ -41,7 +41,7 @@ void EntityCapsManager::handlePresenceReceived(boost::shared_ptr<Presence> prese } } else { - std::map<JID, String>::iterator i = caps.find(from); + std::map<JID, std::string>::iterator i = caps.find(from); if (i != caps.end()) { caps.erase(i); onCapsChanged(from); @@ -51,17 +51,17 @@ void EntityCapsManager::handlePresenceReceived(boost::shared_ptr<Presence> prese void EntityCapsManager::handleStanzaChannelAvailableChanged(bool available) { if (available) { - std::map<JID, String> capsCopy; + std::map<JID, std::string> capsCopy; capsCopy.swap(caps); - for (std::map<JID,String>::const_iterator i = capsCopy.begin(); i != capsCopy.end(); ++i) { + for (std::map<JID,std::string>::const_iterator i = capsCopy.begin(); i != capsCopy.end(); ++i) { onCapsChanged(i->first); } } } -void EntityCapsManager::handleCapsAvailable(const String& hash) { +void EntityCapsManager::handleCapsAvailable(const std::string& hash) { // TODO: Use Boost.Bimap ? - for (std::map<JID,String>::const_iterator i = caps.begin(); i != caps.end(); ++i) { + for (std::map<JID,std::string>::const_iterator i = caps.begin(); i != caps.end(); ++i) { if (i->second == hash) { onCapsChanged(i->first); } @@ -69,7 +69,7 @@ void EntityCapsManager::handleCapsAvailable(const String& hash) { } DiscoInfo::ref EntityCapsManager::getCaps(const JID& jid) const { - std::map<JID, String>::const_iterator i = caps.find(jid); + std::map<JID, std::string>::const_iterator i = caps.find(jid); if (i != caps.end()) { return capsProvider->getCaps(i->second); } diff --git a/Swiften/Disco/EntityCapsManager.h b/Swiften/Disco/EntityCapsManager.h index f507a1d..190f876 100644 --- a/Swiften/Disco/EntityCapsManager.h +++ b/Swiften/Disco/EntityCapsManager.h @@ -36,10 +36,10 @@ namespace Swift { private: void handlePresenceReceived(boost::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); - void handleCapsAvailable(const String&); + void handleCapsAvailable(const std::string&); private: CapsProvider* capsProvider; - std::map<JID, String> caps; + std::map<JID, std::string> caps; }; } diff --git a/Swiften/Disco/GetDiscoInfoRequest.h b/Swiften/Disco/GetDiscoInfoRequest.h index 2298b5c..5cec530 100644 --- a/Swiften/Disco/GetDiscoInfoRequest.h +++ b/Swiften/Disco/GetDiscoInfoRequest.h @@ -18,7 +18,7 @@ namespace Swift { return ref(new GetDiscoInfoRequest(jid, router)); } - static ref create(const JID& jid, const String& node, IQRouter* router) { + static ref create(const JID& jid, const std::string& node, IQRouter* router) { return ref(new GetDiscoInfoRequest(jid, node, router)); } @@ -27,7 +27,7 @@ namespace Swift { GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) { } - GetDiscoInfoRequest(const JID& jid, const String& node, IQRouter* router) : + GetDiscoInfoRequest(const JID& jid, const std::string& node, IQRouter* router) : GenericRequest<DiscoInfo>(IQ::Get, jid, boost::shared_ptr<DiscoInfo>(new DiscoInfo()), router) { getPayloadGeneric()->setNode(node); } diff --git a/Swiften/Disco/JIDDiscoInfoResponder.cpp b/Swiften/Disco/JIDDiscoInfoResponder.cpp index 311447f..1298e5a 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.cpp +++ b/Swiften/Disco/JIDDiscoInfoResponder.cpp @@ -22,21 +22,21 @@ void JIDDiscoInfoResponder::setDiscoInfo(const JID& jid, const DiscoInfo& discoI i->second.discoInfo = discoInfo; } -void JIDDiscoInfoResponder::setDiscoInfo(const JID& jid, const String& node, const DiscoInfo& discoInfo) { +void JIDDiscoInfoResponder::setDiscoInfo(const JID& jid, const std::string& node, const DiscoInfo& discoInfo) { JIDDiscoInfoMap::iterator i = info.insert(std::make_pair(jid, JIDDiscoInfo())).first; DiscoInfo newInfo(discoInfo); newInfo.setNode(node); i->second.nodeDiscoInfo[node] = newInfo; } -bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<DiscoInfo> discoInfo) { +bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> discoInfo) { JIDDiscoInfoMap::const_iterator i = info.find(to); if (i != info.end()) { - if (discoInfo->getNode().isEmpty()) { + if (discoInfo->getNode().empty()) { sendResponse(from, to, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(i->second.discoInfo))); } else { - std::map<String,DiscoInfo>::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode()); + std::map<std::string,DiscoInfo>::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode()); if (j != i->second.nodeDiscoInfo.end()) { sendResponse(from, to, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo(j->second))); } diff --git a/Swiften/Disco/JIDDiscoInfoResponder.h b/Swiften/Disco/JIDDiscoInfoResponder.h index aac43de..d532d0f 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.h +++ b/Swiften/Disco/JIDDiscoInfoResponder.h @@ -21,15 +21,15 @@ namespace Swift { void clearDiscoInfo(const JID& jid); void setDiscoInfo(const JID& jid, const DiscoInfo& info); - void setDiscoInfo(const JID& jid, const String& node, const DiscoInfo& info); + void setDiscoInfo(const JID& jid, const std::string& node, const DiscoInfo& info); private: - virtual bool handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<DiscoInfo> payload); + virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> payload); private: struct JIDDiscoInfo { DiscoInfo discoInfo; - std::map<String, DiscoInfo> nodeDiscoInfo; + std::map<std::string, DiscoInfo> nodeDiscoInfo; }; typedef std::map<JID, JIDDiscoInfo> JIDDiscoInfoMap; JIDDiscoInfoMap info; diff --git a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp index aec3a92..d4cb331 100644 --- a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp +++ b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp @@ -30,9 +30,9 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture { CapsInfoGenerator testling("http://code.google.com/p/exodus"); CapsInfo result = testling.generateCapsInfo(discoInfo); - CPPUNIT_ASSERT_EQUAL(String("http://code.google.com/p/exodus"), result.getNode()); - CPPUNIT_ASSERT_EQUAL(String("sha-1"), result.getHash()); - CPPUNIT_ASSERT_EQUAL(String("QgayPKawpkPSDYmwT/WM94uAlu0="), result.getVersion()); + CPPUNIT_ASSERT_EQUAL(std::string("http://code.google.com/p/exodus"), result.getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("sha-1"), result.getHash()); + CPPUNIT_ASSERT_EQUAL(std::string("QgayPKawpkPSDYmwT/WM94uAlu0="), result.getVersion()); } void testGenerate_XEP0115ComplexExample() { @@ -48,7 +48,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture { FormField::ref field = HiddenFormField::create("urn:xmpp:dataforms:softwareinfo"); field->setName("FORM_TYPE"); extension->addField(field); - std::vector<String> ipVersions; + std::vector<std::string> ipVersions; ipVersions.push_back("ipv6"); ipVersions.push_back("ipv4"); field = ListMultiFormField::create(ipVersions); @@ -77,7 +77,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture { CapsInfoGenerator testling("http://psi-im.org"); CapsInfo result = testling.generateCapsInfo(discoInfo); - CPPUNIT_ASSERT_EQUAL(String("q07IKJEyjvHSyhy//CH0CxmKi8w="), result.getVersion()); + CPPUNIT_ASSERT_EQUAL(std::string("q07IKJEyjvHSyhy//CH0CxmKi8w="), result.getVersion()); } }; diff --git a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp index 988065f..bccf0d4 100644 --- a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp +++ b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp @@ -45,7 +45,7 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT_EQUAL(String(""), payload->getNode()); + CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("foo")); testling.stop(); @@ -68,7 +68,7 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT_EQUAL(String("bar-node"), payload->getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("bar")); testling.stop(); diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp index 0a498cf..544bdad 100644 --- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp @@ -159,15 +159,15 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { private: struct DummyCapsProvider : public CapsProvider { - virtual DiscoInfo::ref getCaps(const String& hash) const { - std::map<String, DiscoInfo::ref>::const_iterator i = caps.find(hash); + virtual DiscoInfo::ref getCaps(const std::string& hash) const { + std::map<std::string, DiscoInfo::ref>::const_iterator i = caps.find(hash); if (i != caps.end()) { return i->second; } return DiscoInfo::ref(); } - std::map<String, DiscoInfo::ref> caps; + std::map<std::string, DiscoInfo::ref> caps; }; private: diff --git a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp index 03a3ee8..ef61afa 100644 --- a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp +++ b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp @@ -46,7 +46,7 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT_EQUAL(String(""), payload->getNode()); + CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("foo")); testling.stop(); @@ -69,7 +69,7 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT_EQUAL(String("bar-node"), payload->getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("bar")); testling.stop(); diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h index a1aac31..ba86900 100644 --- a/Swiften/Elements/AuthRequest.h +++ b/Swiften/Elements/AuthRequest.h @@ -14,14 +14,14 @@ namespace Swift { class AuthRequest : public Element { public: - AuthRequest(const String& mechanism = "") : mechanism_(mechanism) { + AuthRequest(const std::string& mechanism = "") : mechanism_(mechanism) { } - AuthRequest(const String& mechanism, const ByteArray& message) : + AuthRequest(const std::string& mechanism, const ByteArray& message) : mechanism_(mechanism), message_(message) { } - AuthRequest(const String& mechanism, const boost::optional<ByteArray>& message) : + AuthRequest(const std::string& mechanism, const boost::optional<ByteArray>& message) : mechanism_(mechanism), message_(message) { } @@ -33,16 +33,16 @@ namespace Swift { message_ = boost::optional<ByteArray>(message); } - const String& getMechanism() const { + const std::string& getMechanism() const { return mechanism_; } - void setMechanism(const String& mechanism) { + void setMechanism(const std::string& mechanism) { mechanism_ = mechanism; } private: - String mechanism_; + std::string mechanism_; boost::optional<ByteArray> message_; }; } diff --git a/Swiften/Elements/Body.h b/Swiften/Elements/Body.h index 8262e09..2887390 100644 --- a/Swiften/Elements/Body.h +++ b/Swiften/Elements/Body.h @@ -7,25 +7,25 @@ #pragma once #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class Body : public Payload { public: typedef boost::shared_ptr<Body> ref; - Body(const String& text = "") : text_(text) { + Body(const std::string& text = "") : text_(text) { } - void setText(const String& text) { + void setText(const std::string& text) { text_ = text; } - const String& getText() const { + const std::string& getText() const { return text_; } private: - String text_; + std::string text_; }; } diff --git a/Swiften/Elements/Bytestreams.h b/Swiften/Elements/Bytestreams.h index 9d45c8a..b493375 100644 --- a/Swiften/Elements/Bytestreams.h +++ b/Swiften/Elements/Bytestreams.h @@ -11,7 +11,7 @@ #include <boost/shared_ptr.hpp> #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { @@ -20,20 +20,20 @@ namespace Swift { typedef boost::shared_ptr<Bytestreams> ref; struct StreamHost { - StreamHost(const String& host = "", const JID& jid = JID(), int port = -1) : host(host), jid(jid), port(port) {} + StreamHost(const std::string& host = "", const JID& jid = JID(), int port = -1) : host(host), jid(jid), port(port) {} - String host; + std::string host; JID jid; int port; }; Bytestreams() {} - const String& getStreamID() const { + const std::string& getStreamID() const { return id; } - void setStreamID(const String& id) { + void setStreamID(const std::string& id) { this->id = id; } @@ -54,7 +54,7 @@ namespace Swift { } private: - String id; + std::string id; boost::optional<JID> usedStreamHost; std::vector<StreamHost> streamHosts; }; diff --git a/Swiften/Elements/CapsInfo.h b/Swiften/Elements/CapsInfo.h index dc3cc2e..ccad278 100644 --- a/Swiften/Elements/CapsInfo.h +++ b/Swiften/Elements/CapsInfo.h @@ -8,7 +8,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { @@ -16,7 +16,7 @@ namespace Swift { public: typedef boost::shared_ptr<CapsInfo> ref; - CapsInfo(const String& node = "", const String& version = "", const String& hash = "sha-1") : node_(node), version_(version), hash_(hash) {} + CapsInfo(const std::string& node = "", const std::string& version = "", const std::string& hash = "sha-1") : node_(node), version_(version), hash_(hash) {} bool operator==(const CapsInfo& o) const { return o.node_ == node_ && o.version_ == version_ && o.hash_ == hash_; @@ -36,24 +36,24 @@ namespace Swift { } } - const String& getNode() const { return node_; } - void setNode(const String& node) { + const std::string& getNode() const { return node_; } + void setNode(const std::string& node) { node_ = node; } - const String& getVersion() const { return version_; } - void setVersion(const String& version) { + const std::string& getVersion() const { return version_; } + void setVersion(const std::string& version) { version_ = version; } - const String& getHash() const { return hash_; } - void setHash(const String& hash) { + const std::string& getHash() const { return hash_; } + void setHash(const std::string& hash) { hash_ = hash; } private: - String node_; - String version_; - String hash_; + std::string node_; + std::string version_; + std::string hash_; }; } diff --git a/Swiften/Elements/ChatState.h b/Swiften/Elements/ChatState.h index 8dcf77c..2896877 100644 --- a/Swiften/Elements/ChatState.h +++ b/Swiften/Elements/ChatState.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { diff --git a/Swiften/Elements/Command.h b/Swiften/Elements/Command.h index 73d359f..f4059a8 100644 --- a/Swiften/Elements/Command.h +++ b/Swiften/Elements/Command.h @@ -8,7 +8,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/Form.h" @@ -26,21 +26,21 @@ namespace Swift { struct Note { enum Type {Info, Warn, Error}; - Note(String note, Type type) : note(note), type(type) {}; + Note(std::string note, Type type) : note(note), type(type) {}; - String note; + std::string note; Type type; }; public: - Command(const String& node, const String& sessionID, Status status) { constructor(node, sessionID, NoAction, status);} - Command(const String& node = "", const String& sessionID = "", Action action = Execute) { constructor(node, sessionID, action, NoStatus); } + Command(const std::string& node, const std::string& sessionID, Status status) { constructor(node, sessionID, NoAction, status);} + Command(const std::string& node = "", const std::string& sessionID = "", Action action = Execute) { constructor(node, sessionID, action, NoStatus); } - const String& getNode() const { return node_; } - void setNode(const String& node) { node_ = node; } + const std::string& getNode() const { return node_; } + void setNode(const std::string& node) { node_ = node; } - const String& getSessionID() const { return sessionID_; } - void setSessionID(const String& id) { sessionID_ = id; } + const std::string& getSessionID() const { return sessionID_; } + void setSessionID(const std::string& id) { sessionID_ = id; } Action getAction() const { return action_; } void setAction(Action action) { action_ = action; } @@ -60,7 +60,7 @@ namespace Swift { void setForm(Form::ref payload) { form_ = payload; } private: - void constructor(const String& node, const String& sessionID, Action action, Status status) { + void constructor(const std::string& node, const std::string& sessionID, Action action, Status status) { node_ = node; sessionID_ = sessionID; action_ = action; @@ -69,8 +69,8 @@ namespace Swift { } private: - String node_; - String sessionID_; + std::string node_; + std::string sessionID_; Action action_; Status status_; Action executeAction_; diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h index ca18e73..6047eab 100644 --- a/Swiften/Elements/ComponentHandshake.h +++ b/Swiften/Elements/ComponentHandshake.h @@ -9,25 +9,25 @@ #include <boost/shared_ptr.hpp> #include "Swiften/Elements/Element.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class ComponentHandshake : public Element { public: typedef boost::shared_ptr<ComponentHandshake> ref; - ComponentHandshake(const String& data = "") : data(data) { + ComponentHandshake(const std::string& data = "") : data(data) { } - void setData(const String& d) { + void setData(const std::string& d) { data = d; } - const String& getData() const { + const std::string& getData() const { return data; } private: - String data; + std::string data; }; } diff --git a/Swiften/Elements/CompressRequest.h b/Swiften/Elements/CompressRequest.h index b6f01e3..0eb302a 100644 --- a/Swiften/Elements/CompressRequest.h +++ b/Swiften/Elements/CompressRequest.h @@ -13,18 +13,18 @@ namespace Swift { class CompressRequest : public Element { public: - CompressRequest(const String& method = "") : method_(method) {} + CompressRequest(const std::string& method = "") : method_(method) {} - const String& getMethod() const { + const std::string& getMethod() const { return method_; } - void setMethod(const String& method) { + void setMethod(const std::string& method) { method_ = method; } private: - String method_; + std::string method_; }; } diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp index a939d48..9c43ef4 100644 --- a/Swiften/Elements/DiscoInfo.cpp +++ b/Swiften/Elements/DiscoInfo.cpp @@ -8,9 +8,9 @@ namespace Swift { -const String DiscoInfo::ChatStatesFeature = String("http://jabber.org/protocol/chatstates"); -const String DiscoInfo::SecurityLabelsFeature = String("urn:xmpp:sec-label:0"); -const String DiscoInfo::JabberSearchFeature = String("jabber:iq:search"); +const std::string DiscoInfo::ChatStatesFeature = std::string("http://jabber.org/protocol/chatstates"); +const std::string DiscoInfo::SecurityLabelsFeature = std::string("urn:xmpp:sec-label:0"); +const std::string DiscoInfo::JabberSearchFeature = std::string("jabber:iq:search"); bool DiscoInfo::Identity::operator<(const Identity& other) const { diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h index 41bf6bf..5101884 100644 --- a/Swiften/Elements/DiscoInfo.h +++ b/Swiften/Elements/DiscoInfo.h @@ -10,7 +10,7 @@ #include <algorithm> #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Form.h" @@ -19,29 +19,29 @@ namespace Swift { public: typedef boost::shared_ptr<DiscoInfo> ref; - static const String ChatStatesFeature; - static const String SecurityLabelsFeature; - static const String JabberSearchFeature; + static const std::string ChatStatesFeature; + static const std::string SecurityLabelsFeature; + static const std::string JabberSearchFeature; const static std::string SecurityLabels; class Identity { public: - Identity(const String& name, const String& category = "client", const String& type = "pc", const String& lang = "") : name_(name), category_(category), type_(type), lang_(lang) { + Identity(const std::string& name, const std::string& category = "client", const std::string& type = "pc", const std::string& lang = "") : name_(name), category_(category), type_(type), lang_(lang) { } - const String& getCategory() const { + const std::string& getCategory() const { return category_; } - const String& getType() const { + const std::string& getType() const { return type_; } - const String& getLanguage() const { + const std::string& getLanguage() const { return lang_; } - const String& getName() const { + const std::string& getName() const { return name_; } @@ -49,20 +49,20 @@ namespace Swift { bool operator<(const Identity& other) const; private: - String name_; - String category_; - String type_; - String lang_; + std::string name_; + std::string category_; + std::string type_; + std::string lang_; }; DiscoInfo() { } - const String& getNode() const { + const std::string& getNode() const { return node_; } - void setNode(const String& node) { + void setNode(const std::string& node) { node_ = node; } @@ -74,15 +74,15 @@ namespace Swift { identities_.push_back(identity); } - const std::vector<String>& getFeatures() const { + const std::vector<std::string>& getFeatures() const { return features_; } - void addFeature(const String& feature) { + void addFeature(const std::string& feature) { features_.push_back(feature); } - bool hasFeature(const String& feature) const { + bool hasFeature(const std::string& feature) const { return std::find(features_.begin(), features_.end(), feature) != features_.end(); } @@ -95,9 +95,9 @@ namespace Swift { } private: - String node_; + std::string node_; std::vector<Identity> identities_; - std::vector<String> features_; + std::vector<std::string> features_; std::vector<Form::ref> extensions_; }; } diff --git a/Swiften/Elements/DiscoItems.h b/Swiften/Elements/DiscoItems.h index 400947a..cc5a583 100644 --- a/Swiften/Elements/DiscoItems.h +++ b/Swiften/Elements/DiscoItems.h @@ -10,7 +10,7 @@ #include <algorithm> #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" namespace Swift { @@ -18,14 +18,14 @@ namespace Swift { public: class Item { public: - Item(const String& name, const JID& jid, const String& node="") : name_(name), jid_(jid), node_(node) { + Item(const std::string& name, const JID& jid, const std::string& node="") : name_(name), jid_(jid), node_(node) { } - const String& getName() const { + const std::string& getName() const { return name_; } - const String& getNode() const { + const std::string& getNode() const { return node_; } @@ -34,19 +34,19 @@ namespace Swift { } private: - String name_; + std::string name_; JID jid_; - String node_; + std::string node_; }; DiscoItems() { } - const String& getNode() const { + const std::string& getNode() const { return node_; } - void setNode(const String& node) { + void setNode(const std::string& node) { node_ = node; } @@ -59,7 +59,7 @@ namespace Swift { } private: - String node_; + std::string node_; std::vector<Item> items_; }; } diff --git a/Swiften/Elements/ErrorPayload.h b/Swiften/Elements/ErrorPayload.h index 8f849f2..12ad574 100644 --- a/Swiften/Elements/ErrorPayload.h +++ b/Swiften/Elements/ErrorPayload.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class ErrorPayload : public Payload { @@ -43,7 +43,7 @@ namespace Swift { UnexpectedRequest }; - ErrorPayload(Condition condition = UndefinedCondition, Type type = Cancel, const String& text = String()) : type_(type), condition_(condition), text_(text) { } + ErrorPayload(Condition condition = UndefinedCondition, Type type = Cancel, const std::string& text = std::string()) : type_(type), condition_(condition), text_(text) { } Type getType() const { return type_; @@ -61,17 +61,17 @@ namespace Swift { condition_ = condition; } - void setText(const String& text) { + void setText(const std::string& text) { text_ = text; } - const String& getText() const { + const std::string& getText() const { return text_; } private: Type type_; Condition condition_; - String text_; + std::string text_; }; } diff --git a/Swiften/Elements/Form.cpp b/Swiften/Elements/Form.cpp index 41014ba..03fd1a4 100644 --- a/Swiften/Elements/Form.cpp +++ b/Swiften/Elements/Form.cpp @@ -9,13 +9,13 @@ namespace Swift { -String Form::getFormType() const { +std::string Form::getFormType() const { FormField::ref field = getField("FORM_TYPE"); boost::shared_ptr<HiddenFormField> f = boost::dynamic_pointer_cast<HiddenFormField>(field); return (f ? f->getValue() : ""); } -FormField::ref Form::getField(const String& name) const { +FormField::ref Form::getField(const std::string& name) const { foreach(FormField::ref field, fields_) { if (field->getName() == name) { return field; diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h index 5e8f994..1c50f0c 100644 --- a/Swiften/Elements/Form.h +++ b/Swiften/Elements/Form.h @@ -10,7 +10,7 @@ #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/FormField.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" @@ -31,23 +31,23 @@ namespace Swift { void addField(boost::shared_ptr<FormField> field) { fields_.push_back(field); } const std::vector<boost::shared_ptr<FormField> >& getFields() const { return fields_; } - void setTitle(const String& title) { title_ = title; } - const String& getTitle() { return title_; } + void setTitle(const std::string& title) { title_ = title; } + const std::string& getTitle() { return title_; } - void setInstructions(const String& instructions) { instructions_ = instructions; } - const String& getInstructions() { return instructions_; } + void setInstructions(const std::string& instructions) { instructions_ = instructions; } + const std::string& getInstructions() { return instructions_; } Type getType() { return type_; } void setType(Type type) { type_ = type; } - String getFormType() const; + std::string getFormType() const; - FormField::ref getField(const String& name) const; + FormField::ref getField(const std::string& name) const; private: std::vector<boost::shared_ptr<FormField> > fields_; - String title_; - String instructions_; + std::string title_; + std::string instructions_; Type type_; }; } diff --git a/Swiften/Elements/FormField.h b/Swiften/Elements/FormField.h index 0221dae..f455303 100644 --- a/Swiften/Elements/FormField.h +++ b/Swiften/Elements/FormField.h @@ -12,7 +12,7 @@ #include <vector> #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" namespace Swift { @@ -23,19 +23,19 @@ namespace Swift { virtual ~FormField() {} struct Option { - Option(const String& label, const String& value) : label(label), value(value) {} - String label; - String value; + Option(const std::string& label, const std::string& value) : label(label), value(value) {} + std::string label; + std::string value; }; - void setName(const String& name) { this->name = name; } - const String& getName() const { return name; } + void setName(const std::string& name) { this->name = name; } + const std::string& getName() const { return name; } - void setLabel(const String& label) { this->label = label; } - const String& getLabel() const { return label; } + void setLabel(const std::string& label) { this->label = label; } + const std::string& getLabel() const { return label; } - void setDescription(const String& description) { this->description = description; } - const String& getDescription() const { return description; } + void setDescription(const std::string& description) { this->description = description; } + const std::string& getDescription() const { return description; } void setRequired(bool required) { this->required = required; } bool getRequired() const { return required; } @@ -48,11 +48,11 @@ namespace Swift { return options; } - const std::vector<String> getRawValues() const { + const std::vector<std::string> getRawValues() const { return rawValues; } - void addRawValue(const String& value) { + void addRawValue(const std::string& value) { rawValues.push_back(value); } @@ -60,12 +60,12 @@ namespace Swift { FormField() : required(false) {} private: - String name; - String label; - String description; + std::string name; + std::string label; + std::string description; bool required; std::vector<Option> options; - std::vector<String> rawValues; + std::vector<std::string> rawValues; }; template<typename T> class GenericFormField : public FormField { @@ -102,14 +102,14 @@ namespace Swift { }; SWIFTEN_DECLARE_FORM_FIELD(Boolean, bool); - SWIFTEN_DECLARE_FORM_FIELD(Fixed, String); - SWIFTEN_DECLARE_FORM_FIELD(Hidden, String); - SWIFTEN_DECLARE_FORM_FIELD(ListSingle, String); - SWIFTEN_DECLARE_FORM_FIELD(TextMulti, String); - SWIFTEN_DECLARE_FORM_FIELD(TextPrivate, String); - SWIFTEN_DECLARE_FORM_FIELD(TextSingle, String); + SWIFTEN_DECLARE_FORM_FIELD(Fixed, std::string); + SWIFTEN_DECLARE_FORM_FIELD(Hidden, std::string); + SWIFTEN_DECLARE_FORM_FIELD(ListSingle, std::string); + SWIFTEN_DECLARE_FORM_FIELD(TextMulti, std::string); + SWIFTEN_DECLARE_FORM_FIELD(TextPrivate, std::string); + SWIFTEN_DECLARE_FORM_FIELD(TextSingle, std::string); SWIFTEN_DECLARE_FORM_FIELD(JIDSingle, JID); SWIFTEN_DECLARE_FORM_FIELD(JIDMulti, std::vector<JID>); - SWIFTEN_DECLARE_FORM_FIELD(ListMulti, std::vector<String>); - SWIFTEN_DECLARE_FORM_FIELD(Untyped, std::vector<String>); + SWIFTEN_DECLARE_FORM_FIELD(ListMulti, std::vector<std::string>); + SWIFTEN_DECLARE_FORM_FIELD(Untyped, std::vector<std::string>); } diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h index 727755f..55f2c4f 100644 --- a/Swiften/Elements/IBB.h +++ b/Swiften/Elements/IBB.h @@ -8,7 +8,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/Elements/Payload.h" @@ -27,23 +27,23 @@ namespace Swift { MessageStanza, }; - IBB(Action action = Open, const String& streamID = "") : action(action), streamID(streamID), stanzaType(IQStanza), blockSize(-1), sequenceNumber(-1) { + IBB(Action action = Open, const std::string& streamID = "") : action(action), streamID(streamID), stanzaType(IQStanza), blockSize(-1), sequenceNumber(-1) { } - static IBB::ref createIBBOpen(const String& streamID, int blockSize) { + static IBB::ref createIBBOpen(const std::string& streamID, int blockSize) { IBB::ref result(new IBB(Open, streamID)); result->setBlockSize(blockSize); return result; } - static IBB::ref createIBBData(const String& streamID, int sequenceNumber, const ByteArray& data) { + static IBB::ref createIBBData(const std::string& streamID, int sequenceNumber, const ByteArray& data) { IBB::ref result(new IBB(Data, streamID)); result->setSequenceNumber(sequenceNumber); result->setData(data); return result; } - static IBB::ref createIBBClose(const String& streamID) { + static IBB::ref createIBBClose(const std::string& streamID) { return IBB::ref(new IBB(Close, streamID)); } @@ -63,11 +63,11 @@ namespace Swift { return stanzaType; } - void setStreamID(const String& id) { + void setStreamID(const std::string& id) { streamID = id; } - const String& getStreamID() const { + const std::string& getStreamID() const { return streamID; } @@ -97,7 +97,7 @@ namespace Swift { private: Action action; - String streamID; + std::string streamID; ByteArray data; StanzaType stanzaType; int blockSize; diff --git a/Swiften/Elements/IQ.cpp b/Swiften/Elements/IQ.cpp index abf32e9..eb62ee4 100644 --- a/Swiften/Elements/IQ.cpp +++ b/Swiften/Elements/IQ.cpp @@ -9,7 +9,7 @@ namespace Swift { boost::shared_ptr<IQ> IQ::createRequest( - Type type, const JID& to, const String& id, boost::shared_ptr<Payload> payload) { + Type type, const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) { boost::shared_ptr<IQ> iq(new IQ(type)); if (to.isValid()) { iq->setTo(to); @@ -21,7 +21,7 @@ boost::shared_ptr<IQ> IQ::createRequest( return iq; } -boost::shared_ptr<IQ> IQ::createResult(const JID& to, const String& id, boost::shared_ptr<Payload> payload) { +boost::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) { boost::shared_ptr<IQ> iq(new IQ(Result)); iq->setTo(to); iq->setID(id); @@ -31,7 +31,7 @@ boost::shared_ptr<IQ> IQ::createResult(const JID& to, const String& id, boost::s return iq; } -boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const String& id, boost::shared_ptr<Payload> payload) { +boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std::string& id, boost::shared_ptr<Payload> payload) { boost::shared_ptr<IQ> iq(new IQ(Result)); iq->setTo(to); iq->setFrom(from); @@ -42,7 +42,7 @@ boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const Str return iq; } -boost::shared_ptr<IQ> IQ::createError(const JID& to, const String& id, ErrorPayload::Condition condition, ErrorPayload::Type type) { +boost::shared_ptr<IQ> IQ::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type) { boost::shared_ptr<IQ> iq(new IQ(IQ::Error)); iq->setTo(to); iq->setID(id); @@ -50,7 +50,7 @@ boost::shared_ptr<IQ> IQ::createError(const JID& to, const String& id, ErrorPayl return iq; } -boost::shared_ptr<IQ> IQ::createError(const JID& to, const JID& from, const String& id, ErrorPayload::Condition condition, ErrorPayload::Type type) { +boost::shared_ptr<IQ> IQ::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type) { boost::shared_ptr<IQ> iq(new IQ(IQ::Error)); iq->setTo(to); iq->setFrom(from); diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h index 007dda2..78a8bbd 100644 --- a/Swiften/Elements/IQ.h +++ b/Swiften/Elements/IQ.h @@ -26,26 +26,26 @@ namespace Swift { static boost::shared_ptr<IQ> createRequest( Type type, const JID& to, - const String& id, + const std::string& id, boost::shared_ptr<Payload> payload); static boost::shared_ptr<IQ> createResult( const JID& to, - const String& id, + const std::string& id, boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); static boost::shared_ptr<IQ> createResult( const JID& to, const JID& from, - const String& id, + const std::string& id, boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); static boost::shared_ptr<IQ> createError( const JID& to, - const String& id, + const std::string& id, ErrorPayload::Condition condition = ErrorPayload::BadRequest, ErrorPayload::Type type = ErrorPayload::Cancel); static boost::shared_ptr<IQ> createError( const JID& to, const JID& from, - const String& id, + const std::string& id, ErrorPayload::Condition condition = ErrorPayload::BadRequest, ErrorPayload::Type type = ErrorPayload::Cancel); diff --git a/Swiften/Elements/InBandRegistrationPayload.h b/Swiften/Elements/InBandRegistrationPayload.h index 1a293ba..e4e1e6f 100644 --- a/Swiften/Elements/InBandRegistrationPayload.h +++ b/Swiften/Elements/InBandRegistrationPayload.h @@ -11,7 +11,7 @@ #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/Form.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class InBandRegistrationPayload : public Payload { @@ -39,147 +39,147 @@ namespace Swift { remove = b; } - const boost::optional<String>& getInstructions() const { + const boost::optional<std::string>& getInstructions() const { return instructions; } - const boost::optional<String>& getUsername() const { + const boost::optional<std::string>& getUsername() const { return username; } - const boost::optional<String>& getNick() const { + const boost::optional<std::string>& getNick() const { return nick; } - const boost::optional<String>& getPassword() const { + const boost::optional<std::string>& getPassword() const { return password; } - const boost::optional<String>& getName() const { + const boost::optional<std::string>& getName() const { return name; } - const boost::optional<String>& getFirst() const { + const boost::optional<std::string>& getFirst() const { return first; } - const boost::optional<String>& getLast() const { + const boost::optional<std::string>& getLast() const { return last; } - const boost::optional<String>& getEMail() const { + const boost::optional<std::string>& getEMail() const { return email; } - const boost::optional<String>& getAddress() const { + const boost::optional<std::string>& getAddress() const { return address; } - const boost::optional<String>& getCity() const { + const boost::optional<std::string>& getCity() const { return city; } - const boost::optional<String>& getState() const { + const boost::optional<std::string>& getState() const { return state; } - const boost::optional<String>& getZip() const { + const boost::optional<std::string>& getZip() const { return zip; } - const boost::optional<String>& getPhone() const { + const boost::optional<std::string>& getPhone() const { return phone; } - const boost::optional<String>& getURL() const { + const boost::optional<std::string>& getURL() const { return url; } - const boost::optional<String>& getDate() const { + const boost::optional<std::string>& getDate() const { return date; } - const boost::optional<String>& getMisc() const { + const boost::optional<std::string>& getMisc() const { return misc; } - const boost::optional<String>& getText() const { + const boost::optional<std::string>& getText() const { return text; } - const boost::optional<String>& getKey() const { + const boost::optional<std::string>& getKey() const { return key; } - void setInstructions(const String& v) { + void setInstructions(const std::string& v) { this->instructions = v; } - void setUsername(const String& v) { + void setUsername(const std::string& v) { this->username = v; } - void setNick(const String& v) { + void setNick(const std::string& v) { this->nick = v; } - void setPassword(const String& v) { + void setPassword(const std::string& v) { this->password = v; } - void setName(const String& v) { + void setName(const std::string& v) { this->name = v; } - void setFirst(const String& v) { + void setFirst(const std::string& v) { this->first = v; } - void setLast(const String& v) { + void setLast(const std::string& v) { this->last = v; } - void setEMail(const String& v) { + void setEMail(const std::string& v) { this->email = v; } - void setAddress(const String& v) { + void setAddress(const std::string& v) { this->address = v; } - void setCity(const String& v) { + void setCity(const std::string& v) { this->city = v; } - void setState(const String& v) { + void setState(const std::string& v) { this->state = v; } - void setZip(const String& v) { + void setZip(const std::string& v) { this->zip = v; } - void setPhone(const String& v) { + void setPhone(const std::string& v) { this->phone = v; } - void setURL(const String& v) { + void setURL(const std::string& v) { this->url = v; } - void setDate(const String& v) { + void setDate(const std::string& v) { this->date = v; } - void setMisc(const String& v) { + void setMisc(const std::string& v) { this->misc = v; } - void setText(const String& v) { + void setText(const std::string& v) { this->text = v; } - void setKey(const String& v) { + void setKey(const std::string& v) { this->key = v; } @@ -187,23 +187,23 @@ namespace Swift { Form::ref form; bool registered; bool remove; - boost::optional<String> instructions; - boost::optional<String> username; - boost::optional<String> nick; - boost::optional<String> password; - boost::optional<String> name; - boost::optional<String> first; - boost::optional<String> last; - boost::optional<String> email; - boost::optional<String> address; - boost::optional<String> city; - boost::optional<String> state; - boost::optional<String> zip; - boost::optional<String> phone; - boost::optional<String> url; - boost::optional<String> date; - boost::optional<String> misc; - boost::optional<String> text; - boost::optional<String> key; + boost::optional<std::string> instructions; + boost::optional<std::string> username; + boost::optional<std::string> nick; + boost::optional<std::string> password; + boost::optional<std::string> name; + boost::optional<std::string> first; + boost::optional<std::string> last; + boost::optional<std::string> email; + boost::optional<std::string> address; + boost::optional<std::string> city; + boost::optional<std::string> state; + boost::optional<std::string> zip; + boost::optional<std::string> phone; + boost::optional<std::string> url; + boost::optional<std::string> date; + boost::optional<std::string> misc; + boost::optional<std::string> text; + boost::optional<std::string> key; }; } diff --git a/Swiften/Elements/JingleContent.h b/Swiften/Elements/JingleContent.h index bf419aa..4ae908b 100644 --- a/Swiften/Elements/JingleContent.h +++ b/Swiften/Elements/JingleContent.h @@ -9,7 +9,7 @@ #include <vector> #include <boost/optional.hpp> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/JingleDescription.h> @@ -37,7 +37,7 @@ namespace Swift { this->creator = creator; } - void setName(const String& name) { + void setName(const std::string& name) { this->name = name; } @@ -81,7 +81,7 @@ namespace Swift { private: Creator creator; - String name; + std::string name; //Senders senders; std::vector<JingleDescription::ref> descriptions; std::vector<JingleTransport::ref> transports; diff --git a/Swiften/Elements/JingleIBBTransport.h b/Swiften/Elements/JingleIBBTransport.h index ca3ecc8..faa5af3 100644 --- a/Swiften/Elements/JingleIBBTransport.h +++ b/Swiften/Elements/JingleIBBTransport.h @@ -6,7 +6,7 @@ #pragma once -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/Elements/JingleTransport.h> namespace Swift { @@ -25,11 +25,11 @@ namespace Swift { return stanzaType; } - void setSessionID(const String& id) { + void setSessionID(const std::string& id) { sessionID = id; } - const String& getSessionID() const { + const std::string& getSessionID() const { return sessionID; } @@ -42,7 +42,7 @@ namespace Swift { } private: - String sessionID; + std::string sessionID; int blockSize; StanzaType stanzaType; }; diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h index 66b6d43..59d3c99 100644 --- a/Swiften/Elements/JinglePayload.h +++ b/Swiften/Elements/JinglePayload.h @@ -9,7 +9,7 @@ #include <vector> #include <boost/optional.hpp> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/JingleContent.h> @@ -40,9 +40,9 @@ namespace Swift { UnsupportedTransports }; - Reason(Type type, const String& text = "") : type(type), text(text) {} + Reason(Type type, const std::string& text = "") : type(type), text(text) {} Type type; - String text; + std::string text; }; enum Action { @@ -63,7 +63,7 @@ namespace Swift { TransportReplace }; - JinglePayload(Action action, const String& sessionID) : action(action), sessionID(sessionID) { + JinglePayload(Action action, const std::string& sessionID) : action(action), sessionID(sessionID) { } void setAction(Action action) { @@ -90,11 +90,11 @@ namespace Swift { return responder; } - void setSessionID(const String& id) { + void setSessionID(const std::string& id) { sessionID = id; } - const String& getSessionID() const { + const std::string& getSessionID() const { return sessionID; } @@ -118,7 +118,7 @@ namespace Swift { Action action; JID initiator; JID responder; - String sessionID; + std::string sessionID; std::vector<JingleContent::ref> contents; boost::optional<Reason> reason; }; diff --git a/Swiften/Elements/MUCOccupant.cpp b/Swiften/Elements/MUCOccupant.cpp index 0d3773e..a5d8f0e 100644 --- a/Swiften/Elements/MUCOccupant.cpp +++ b/Swiften/Elements/MUCOccupant.cpp @@ -8,7 +8,7 @@ namespace Swift { -MUCOccupant::MUCOccupant(const String &nick, Role role, Affiliation affiliation) : nick_(nick), role_(role), affiliation_(affiliation) { +MUCOccupant::MUCOccupant(const std::string &nick, Role role, Affiliation affiliation) : nick_(nick), role_(role), affiliation_(affiliation) { } MUCOccupant::~MUCOccupant() { @@ -18,7 +18,7 @@ MUCOccupant::MUCOccupant(const MUCOccupant& other) : nick_(other.getNick()), rol } -String MUCOccupant::getNick() const { +std::string MUCOccupant::getNick() const { return nick_; } @@ -34,7 +34,7 @@ void MUCOccupant::setRealJID(const JID& realJID) { realJID_ = realJID; } -void MUCOccupant::setNick(const String& nick) { +void MUCOccupant::setNick(const std::string& nick) { nick_ = nick; } diff --git a/Swiften/Elements/MUCOccupant.h b/Swiften/Elements/MUCOccupant.h index 96ac5ad..b3ae4aa 100644 --- a/Swiften/Elements/MUCOccupant.h +++ b/Swiften/Elements/MUCOccupant.h @@ -8,7 +8,7 @@ #include <boost/optional.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" namespace Swift { @@ -19,19 +19,19 @@ namespace Swift { enum Role {Moderator, Participant, Visitor, NoRole}; enum Affiliation {Owner, Admin, Member, Outcast, NoAffiliation}; - MUCOccupant(const String &nick, Role role, Affiliation affiliation); + MUCOccupant(const std::string &nick, Role role, Affiliation affiliation); MUCOccupant(const MUCOccupant& other); ~MUCOccupant(); - String getNick() const; + std::string getNick() const; Role getRole() const; Affiliation getAffiliation() const; boost::optional<JID> getRealJID() const; void setRealJID(const JID& jid); - void setNick(const String& nick); + void setNick(const std::string& nick); private: - String nick_; + std::string nick_; Role role_; Affiliation affiliation_; boost::optional<JID> realJID_; diff --git a/Swiften/Elements/MUCPayload.h b/Swiften/Elements/MUCPayload.h index b8210e1..c372360 100644 --- a/Swiften/Elements/MUCPayload.h +++ b/Swiften/Elements/MUCPayload.h @@ -10,7 +10,7 @@ #include <boost/date_time/posix_time/posix_time.hpp> #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { diff --git a/Swiften/Elements/MUCUserPayload.h b/Swiften/Elements/MUCUserPayload.h index 2364b6c..fb6d4c4 100644 --- a/Swiften/Elements/MUCUserPayload.h +++ b/Swiften/Elements/MUCUserPayload.h @@ -8,9 +8,10 @@ #include <boost/optional.hpp> #include <boost/shared_ptr.hpp> +#include <string> +#include <vector> #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/MUCOccupant.h" @@ -22,7 +23,7 @@ namespace Swift { struct Item { Item(MUCOccupant::Affiliation affiliation = MUCOccupant::NoAffiliation, MUCOccupant::Role role = MUCOccupant::NoRole) : affiliation(affiliation), role(role) {} boost::optional<JID> realJID; - boost::optional<String> nick; + boost::optional<std::string> nick; MUCOccupant::Affiliation affiliation; MUCOccupant::Role role; }; diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index ea03299..a553eb3 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -9,7 +9,7 @@ #include <boost/optional.hpp> #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Body.h" #include "Swiften/Elements/Subject.h" #include "Swiften/Elements/ErrorPayload.h" @@ -24,7 +24,7 @@ namespace Swift { Message() : type_(Chat) { } - String getSubject() const { + std::string getSubject() const { boost::shared_ptr<Subject> subject(getPayload<Subject>()); if (subject) { return subject->getText(); @@ -32,11 +32,11 @@ namespace Swift { return ""; } - void setSubject(const String& subject) { + void setSubject(const std::string& subject) { updatePayload(boost::shared_ptr<Subject>(new Subject(subject))); } - String getBody() const { + std::string getBody() const { boost::shared_ptr<Body> body(getPayload<Body>()); if (body) { return body->getText(); @@ -44,7 +44,7 @@ namespace Swift { return ""; } - void setBody(const String& body) { + void setBody(const std::string& body) { updatePayload(boost::shared_ptr<Body>(new Body(body))); } diff --git a/Swiften/Elements/Nickname.h b/Swiften/Elements/Nickname.h index 1a8d648..540f6da 100644 --- a/Swiften/Elements/Nickname.h +++ b/Swiften/Elements/Nickname.h @@ -7,23 +7,23 @@ #pragma once #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class Nickname : public Payload { public: - Nickname(const String& nickname = "") : nickname(nickname) { + Nickname(const std::string& nickname = "") : nickname(nickname) { } - void setNickname(const String& nickname) { + void setNickname(const std::string& nickname) { this->nickname = nickname; } - const String& getNickname() const { + const std::string& getNickname() const { return nickname; } private: - String nickname; + std::string nickname; }; } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 642262c..7f957ba 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -20,7 +20,7 @@ namespace Swift { enum Type { Available, Error, Probe, Subscribe, Subscribed, Unavailable, Unsubscribe, Unsubscribed }; Presence() : type_(Available) /*, showType_(Online)*/ {} - Presence(const String& status) : type_(Available) { + Presence(const std::string& status) : type_(Available) { setStatus(status); } @@ -28,7 +28,7 @@ namespace Swift { return ref(new Presence()); } - static ref create(const String& status) { + static ref create(const std::string& status) { return ref(new Presence(status)); } @@ -51,7 +51,7 @@ namespace Swift { updatePayload(boost::shared_ptr<StatusShow>(new StatusShow(show))); } - String getStatus() const { + std::string getStatus() const { boost::shared_ptr<Status> status(getPayload<Status>()); if (status) { return status->getText(); @@ -59,7 +59,7 @@ namespace Swift { return ""; } - void setStatus(const String& status) { + void setStatus(const std::string& status) { updatePayload(boost::shared_ptr<Status>(new Status(status))); } diff --git a/Swiften/Elements/ProtocolHeader.h b/Swiften/Elements/ProtocolHeader.h index 36ece34..841f7a0 100644 --- a/Swiften/Elements/ProtocolHeader.h +++ b/Swiften/Elements/ProtocolHeader.h @@ -6,37 +6,37 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class ProtocolHeader { public: ProtocolHeader() : version("1.0") {} - const String& getTo() const { return to; } - void setTo(const String& a) { + const std::string& getTo() const { return to; } + void setTo(const std::string& a) { to = a; } - const String& getFrom() const { return from; } - void setFrom(const String& a) { + const std::string& getFrom() const { return from; } + void setFrom(const std::string& a) { from = a; } - const String& getVersion() const { return version; } - void setVersion(const String& a) { + const std::string& getVersion() const { return version; } + void setVersion(const std::string& a) { version = a; } - const String& getID() const { return id; } - void setID(const String& a) { + const std::string& getID() const { return id; } + void setID(const std::string& a) { id = a; } private: - String to; - String from; - String id; - String version; + std::string to; + std::string from; + std::string id; + std::string version; }; } diff --git a/Swiften/Elements/RawXMLPayload.h b/Swiften/Elements/RawXMLPayload.h index 0a381ac..b042b95 100644 --- a/Swiften/Elements/RawXMLPayload.h +++ b/Swiften/Elements/RawXMLPayload.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { @@ -14,15 +14,15 @@ namespace Swift { public: RawXMLPayload() {} - void setRawXML(const String& data) { + void setRawXML(const std::string& data) { rawXML_ = data; } - const String& getRawXML() const { + const std::string& getRawXML() const { return rawXML_; } private: - String rawXML_; + std::string rawXML_; }; } diff --git a/Swiften/Elements/ResourceBind.h b/Swiften/Elements/ResourceBind.h index c13ac69..3569eb3 100644 --- a/Swiften/Elements/ResourceBind.h +++ b/Swiften/Elements/ResourceBind.h @@ -7,7 +7,7 @@ #ifndef SWIFTEN_ResourceBind_H #define SWIFTEN_ResourceBind_H -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" #include "Swiften/JID/JID.h" @@ -25,17 +25,17 @@ namespace Swift { return jid_; } - void setResource(const String& resource) { + void setResource(const std::string& resource) { resource_ = resource; } - const String& getResource() const { + const std::string& getResource() const { return resource_; } private: JID jid_; - String resource_; + std::string resource_; }; } diff --git a/Swiften/Elements/RosterItemPayload.h b/Swiften/Elements/RosterItemPayload.h index 84b2887..b8a1b10 100644 --- a/Swiften/Elements/RosterItemPayload.h +++ b/Swiften/Elements/RosterItemPayload.h @@ -10,7 +10,7 @@ #include <vector> #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class RosterItemPayload @@ -19,36 +19,36 @@ namespace Swift { enum Subscription { None, To, From, Both, Remove }; RosterItemPayload() : subscription_(None), ask_(false) {} - RosterItemPayload(const JID& jid, const String& name, Subscription subscription) : jid_(jid), name_(name), subscription_(subscription), ask_(false) { } + RosterItemPayload(const JID& jid, const std::string& name, Subscription subscription) : jid_(jid), name_(name), subscription_(subscription), ask_(false) { } void setJID(const JID& jid) { jid_ = jid; } const JID& getJID() const { return jid_; } - void setName(const String& name) { name_ = name; } - const String& getName() const { return name_; } + void setName(const std::string& name) { name_ = name; } + const std::string& getName() const { return name_; } void setSubscription(Subscription subscription) { subscription_ = subscription; } const Subscription& getSubscription() const { return subscription_; } - void addGroup(const String& group) { groups_.push_back(group); } - void setGroups(const std::vector<String>& groups) { groups_ = groups; } - const std::vector<String>& getGroups() const { return groups_; } + void addGroup(const std::string& group) { groups_.push_back(group); } + void setGroups(const std::vector<std::string>& groups) { groups_ = groups; } + const std::vector<std::string>& getGroups() const { return groups_; } void setSubscriptionRequested() { ask_ = true; } bool getSubscriptionRequested() const { return ask_; } - const String& getUnknownContent() const { return unknownContent_; } - void addUnknownContent(const String& c) { + const std::string& getUnknownContent() const { return unknownContent_; } + void addUnknownContent(const std::string& c) { unknownContent_ += c; } private: JID jid_; - String name_; + std::string name_; Subscription subscription_; - std::vector<String> groups_; + std::vector<std::string> groups_; bool ask_; - String unknownContent_; + std::string unknownContent_; }; } diff --git a/Swiften/Elements/SearchPayload.h b/Swiften/Elements/SearchPayload.h index 61b8547..3a484cc 100644 --- a/Swiften/Elements/SearchPayload.h +++ b/Swiften/Elements/SearchPayload.h @@ -11,7 +11,7 @@ #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/Form.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { /** @@ -22,10 +22,10 @@ namespace Swift { typedef boost::shared_ptr<SearchPayload> ref; struct Item { - String first; - String last; - String nick; - String email; + std::string first; + std::string last; + std::string nick; + std::string email; JID jid; }; @@ -34,43 +34,43 @@ namespace Swift { Form::ref getForm() const { return form; } void setForm(Form::ref f) { form = f; } - const boost::optional<String>& getInstructions() const { + const boost::optional<std::string>& getInstructions() const { return instructions; } - const boost::optional<String>& getNick() const { + const boost::optional<std::string>& getNick() const { return nick; } - const boost::optional<String>& getFirst() const { + const boost::optional<std::string>& getFirst() const { return first; } - const boost::optional<String>& getLast() const { + const boost::optional<std::string>& getLast() const { return last; } - const boost::optional<String>& getEMail() const { + const boost::optional<std::string>& getEMail() const { return email; } - void setInstructions(const String& v) { + void setInstructions(const std::string& v) { this->instructions = v; } - void setNick(const String& v) { + void setNick(const std::string& v) { this->nick = v; } - void setFirst(const String& v) { + void setFirst(const std::string& v) { this->first = v; } - void setLast(const String& v) { + void setLast(const std::string& v) { this->last = v; } - void setEMail(const String& v) { + void setEMail(const std::string& v) { this->email = v; } @@ -84,11 +84,11 @@ namespace Swift { private: Form::ref form; - boost::optional<String> instructions; - boost::optional<String> nick; - boost::optional<String> first; - boost::optional<String> last; - boost::optional<String> email; + boost::optional<std::string> instructions; + boost::optional<std::string> nick; + boost::optional<std::string> first; + boost::optional<std::string> last; + boost::optional<std::string> email; std::vector<Item> items; }; } diff --git a/Swiften/Elements/SecurityLabel.h b/Swiften/Elements/SecurityLabel.h index 978d14f..ca38e32 100644 --- a/Swiften/Elements/SecurityLabel.h +++ b/Swiften/Elements/SecurityLabel.h @@ -9,7 +9,7 @@ #include <vector> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { @@ -17,46 +17,46 @@ namespace Swift { public: SecurityLabel() {} - const String& getDisplayMarking() const { return displayMarking_; } + const std::string& getDisplayMarking() const { return displayMarking_; } - void setDisplayMarking(const String& displayMarking) { + void setDisplayMarking(const std::string& displayMarking) { displayMarking_ = displayMarking; } - const String& getForegroundColor() const { + const std::string& getForegroundColor() const { return foregroundColor_; } - void setForegroundColor(const String& foregroundColor) { + void setForegroundColor(const std::string& foregroundColor) { foregroundColor_ = foregroundColor; } - const String& getBackgroundColor() const { + const std::string& getBackgroundColor() const { return backgroundColor_; } - void setBackgroundColor(const String& backgroundColor) { + void setBackgroundColor(const std::string& backgroundColor) { backgroundColor_ = backgroundColor; } - const String& getLabel() const { return label_; } + const std::string& getLabel() const { return label_; } - void setLabel(const String& label) { + void setLabel(const std::string& label) { label_ = label; } - const std::vector<String>& getEquivalentLabels() const { return equivalentLabels_; } + const std::vector<std::string>& getEquivalentLabels() const { return equivalentLabels_; } - void addEquivalentLabel(const String& label) { + void addEquivalentLabel(const std::string& label) { equivalentLabels_.push_back(label); } private: - String displayMarking_; - String foregroundColor_; - String backgroundColor_; - String label_; - std::vector<String> equivalentLabels_; + std::string displayMarking_; + std::string foregroundColor_; + std::string backgroundColor_; + std::string label_; + std::vector<std::string> equivalentLabels_; }; } diff --git a/Swiften/Elements/SecurityLabelsCatalog.h b/Swiften/Elements/SecurityLabelsCatalog.h index e0c7bcb..1c13fdf 100644 --- a/Swiften/Elements/SecurityLabelsCatalog.h +++ b/Swiften/Elements/SecurityLabelsCatalog.h @@ -10,7 +10,7 @@ #include <vector> #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/SecurityLabel.h" @@ -35,26 +35,26 @@ namespace Swift { to_ = to; } - const String& getName() const { + const std::string& getName() const { return name_; } - void setName(const String& name) { + void setName(const std::string& name) { name_ = name; } - const String& getDescription() const { + const std::string& getDescription() const { return description_; } - void setDescription(const String& description) { + void setDescription(const std::string& description) { description_ = description; } private: JID to_; - String name_; - String description_; + std::string name_; + std::string description_; std::vector<SecurityLabel> labels_; }; } diff --git a/Swiften/Elements/SoftwareVersion.h b/Swiften/Elements/SoftwareVersion.h index 1a33f2c..26d49b1 100644 --- a/Swiften/Elements/SoftwareVersion.h +++ b/Swiften/Elements/SoftwareVersion.h @@ -8,45 +8,45 @@ #define SWIFTEN_SoftwareVersion_H #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class SoftwareVersion : public Payload { public: SoftwareVersion( - const String& name = "", - const String& version = "", - const String& os = "") : + const std::string& name = "", + const std::string& version = "", + const std::string& os = "") : name_(name), version_(version), os_(os) {} - const String& getName() const { + const std::string& getName() const { return name_; } - void setName(const String& name) { + void setName(const std::string& name) { name_ = name; } - const String& getVersion() const { + const std::string& getVersion() const { return version_; } - void setVersion(const String& version) { + void setVersion(const std::string& version) { version_ = version; } - const String& getOS() const { + const std::string& getOS() const { return os_; } - void setOS(const String& os) { + void setOS(const std::string& os) { os_ = os; } private: - String name_; - String version_; - String os_; + std::string name_; + std::string version_; + std::string os_; }; } diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h index 0f07223..9b934e4 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -13,7 +13,7 @@ #include "Swiften/Elements/Element.h" #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/foreach.h" #include "Swiften/JID/JID.h" @@ -66,8 +66,8 @@ namespace Swift { const JID& getTo() const { return to_; } void setTo(const JID& to) { to_ = to; } - const String& getID() const { return id_; } - void setID(const String& id) { id_ = id; } + const std::string& getID() const { return id_; } + void setID(const std::string& id) { id_ = id; } boost::optional<boost::posix_time::ptime> getTimestamp() const; @@ -75,7 +75,7 @@ namespace Swift { boost::optional<boost::posix_time::ptime> getTimestampFrom(const JID& jid) const; private: - String id_; + std::string id_; JID from_; JID to_; diff --git a/Swiften/Elements/StartSession.h b/Swiften/Elements/StartSession.h index 921f1e8..0586f40 100644 --- a/Swiften/Elements/StartSession.h +++ b/Swiften/Elements/StartSession.h @@ -7,7 +7,7 @@ #ifndef SWIFTEN_StartSession_H #define SWIFTEN_StartSession_H -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { diff --git a/Swiften/Elements/Status.h b/Swiften/Elements/Status.h index e0e3951..3ef6401 100644 --- a/Swiften/Elements/Status.h +++ b/Swiften/Elements/Status.h @@ -8,24 +8,24 @@ #define SWIFTEN_Status_H #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class Status : public Payload { public: - Status(const String& text = "") : text_(text) { + Status(const std::string& text = "") : text_(text) { } - void setText(const String& text) { + void setText(const std::string& text) { text_ = text; } - const String& getText() const { + const std::string& getText() const { return text_; } private: - String text_; + std::string text_; }; } diff --git a/Swiften/Elements/StatusShow.h b/Swiften/Elements/StatusShow.h index 1bdae96..f579ace 100644 --- a/Swiften/Elements/StatusShow.h +++ b/Swiften/Elements/StatusShow.h @@ -8,7 +8,7 @@ #define SWIFTEN_StatusShow_H #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class StatusShow : public Payload { @@ -26,7 +26,7 @@ namespace Swift { return type_; } - static String typeToFriendlyName(Type type) { + static std::string typeToFriendlyName(Type type) { switch (type) { case Online: return "Available"; case FFC: return "Available"; diff --git a/Swiften/Elements/Storage.h b/Swiften/Elements/Storage.h index 447ca2e..a2f244c 100644 --- a/Swiften/Elements/Storage.h +++ b/Swiften/Elements/Storage.h @@ -9,7 +9,7 @@ #include <vector> #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" namespace Swift { @@ -18,18 +18,18 @@ namespace Swift { struct Room { Room() : autoJoin(false) {} - String name; + std::string name; JID jid; bool autoJoin; - String nick; - String password; + std::string nick; + std::string password; }; struct URL { URL() {} - String name; - String url; + std::string name; + std::string url; }; Storage() { diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h index 4311055..0d0551c 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> #include <Swiften/Elements/Element.h> -#include <Swiften/Base/String.h> +#include <string> namespace Swift { class StreamError : public Element { @@ -44,7 +44,7 @@ namespace Swift { UnsupportedVersion, }; - StreamError(Type type = UndefinedCondition, const String& text = String()) : type_(type), text_(text) { } + StreamError(Type type = UndefinedCondition, const std::string& text = std::string()) : type_(type), text_(text) { } Type getType() const { return type_; @@ -54,16 +54,16 @@ namespace Swift { type_ = type; } - void setText(const String& text) { + void setText(const std::string& text) { text_ = text; } - const String& getText() const { + const std::string& getText() const { return text_; } private: Type type_; - String text_; + std::string text_; }; } diff --git a/Swiften/Elements/StreamFeatures.h b/Swiften/Elements/StreamFeatures.h index 32446ce..fbc0bb8 100644 --- a/Swiften/Elements/StreamFeatures.h +++ b/Swiften/Elements/StreamFeatures.h @@ -9,7 +9,7 @@ #include <vector> #include <algorithm> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Element.h" namespace Swift { @@ -43,27 +43,27 @@ namespace Swift { return hasResourceBind_; } - const std::vector<String>& getCompressionMethods() const { + const std::vector<std::string>& getCompressionMethods() const { return compressionMethods_; } - void addCompressionMethod(const String& mechanism) { + void addCompressionMethod(const std::string& mechanism) { compressionMethods_.push_back(mechanism); } - bool hasCompressionMethod(const String& mechanism) const { + bool hasCompressionMethod(const std::string& mechanism) const { return std::find(compressionMethods_.begin(), compressionMethods_.end(), mechanism) != compressionMethods_.end(); } - const std::vector<String>& getAuthenticationMechanisms() const { + const std::vector<std::string>& getAuthenticationMechanisms() const { return authenticationMechanisms_; } - void addAuthenticationMechanism(const String& mechanism) { + void addAuthenticationMechanism(const std::string& mechanism) { authenticationMechanisms_.push_back(mechanism); } - bool hasAuthenticationMechanism(const String& mechanism) const { + bool hasAuthenticationMechanism(const std::string& mechanism) const { return std::find(authenticationMechanisms_.begin(), authenticationMechanisms_.end(), mechanism) != authenticationMechanisms_.end(); } @@ -81,8 +81,8 @@ namespace Swift { private: bool hasStartTLS_; - std::vector<String> compressionMethods_; - std::vector<String> authenticationMechanisms_; + std::vector<std::string> compressionMethods_; + std::vector<std::string> authenticationMechanisms_; bool hasResourceBind_; bool hasSession_; bool hasStreamManagement_; diff --git a/Swiften/Elements/StreamInitiation.h b/Swiften/Elements/StreamInitiation.h index 16dfd4d..6217cbb 100644 --- a/Swiften/Elements/StreamInitiation.h +++ b/Swiften/Elements/StreamInitiation.h @@ -10,7 +10,7 @@ #include <boost/optional.hpp> #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" #include <Swiften/Elements/StreamInitiationFileInfo.h> @@ -21,11 +21,11 @@ namespace Swift { StreamInitiation() : isFileTransfer(true) {} - const String& getID() const { + const std::string& getID() const { return id; } - void setID(const String& id) { + void setID(const std::string& id) { this->id = id; } @@ -37,19 +37,19 @@ namespace Swift { fileInfo = info; } - const std::vector<String>& getProvidedMethods() const { + const std::vector<std::string>& getProvidedMethods() const { return providedMethods; } - void addProvidedMethod(const String& method) { + void addProvidedMethod(const std::string& method) { providedMethods.push_back(method); } - void setRequestedMethod(const String& method) { + void setRequestedMethod(const std::string& method) { requestedMethod = method; } - const String& getRequestedMethod() const { + const std::string& getRequestedMethod() const { return requestedMethod; } @@ -63,9 +63,9 @@ namespace Swift { private: bool isFileTransfer; - String id; + std::string id; boost::optional<StreamInitiationFileInfo> fileInfo; - std::vector<String> providedMethods; - String requestedMethod; + std::vector<std::string> providedMethods; + std::string requestedMethod; }; } diff --git a/Swiften/Elements/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h index 15b5a66..92b9824 100644 --- a/Swiften/Elements/StreamInitiationFileInfo.h +++ b/Swiften/Elements/StreamInitiationFileInfo.h @@ -6,14 +6,14 @@ #pragma once -#include <Swiften/Base/String.h> +#include <string> namespace Swift { struct StreamInitiationFileInfo { - StreamInitiationFileInfo(const String& name = "", const String& description = "", int size = -1) : name(name), description(description), size(size) {} + StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", int size = -1) : name(name), description(description), size(size) {} - String name; - String description; + std::string name; + std::string description; int size; }; } diff --git a/Swiften/Elements/Subject.h b/Swiften/Elements/Subject.h index 745ddb5..6b5a916 100644 --- a/Swiften/Elements/Subject.h +++ b/Swiften/Elements/Subject.h @@ -7,23 +7,23 @@ #pragma once #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class Subject : public Payload { public: - Subject(const String& text = "") : text_(text) { + Subject(const std::string& text = "") : text_(text) { } - void setText(const String& text) { + void setText(const std::string& text) { text_ = text; } - const String& getText() const { + const std::string& getText() const { return text_; } private: - String text_; + std::string text_; }; } diff --git a/Swiften/Elements/UnitTest/FormTest.cpp b/Swiften/Elements/UnitTest/FormTest.cpp index 715111b..de92d70 100644 --- a/Swiften/Elements/UnitTest/FormTest.cpp +++ b/Swiften/Elements/UnitTest/FormTest.cpp @@ -31,7 +31,7 @@ class FormTest : public CppUnit::TestFixture { form.addField(FixedFormField::create("Bar")); - CPPUNIT_ASSERT_EQUAL(String("jabber:bot"), form.getFormType()); + CPPUNIT_ASSERT_EQUAL(std::string("jabber:bot"), form.getFormType()); } void testGetFormType_InvalidFormType() { @@ -41,7 +41,7 @@ class FormTest : public CppUnit::TestFixture { field->setName("FORM_TYPE"); form.addField(field); - CPPUNIT_ASSERT_EQUAL(String(""), form.getFormType()); + CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); } void testGetFormType_NoFormType() { @@ -49,7 +49,7 @@ class FormTest : public CppUnit::TestFixture { form.addField(FixedFormField::create("Foo")); - CPPUNIT_ASSERT_EQUAL(String(""), form.getFormType()); + CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); } }; diff --git a/Swiften/Elements/UnitTest/IQTest.cpp b/Swiften/Elements/UnitTest/IQTest.cpp index 532cec0..c170d61 100644 --- a/Swiften/Elements/UnitTest/IQTest.cpp +++ b/Swiften/Elements/UnitTest/IQTest.cpp @@ -29,7 +29,7 @@ class IQTest : public CppUnit::TestFixture boost::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid", payload)); CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); - CPPUNIT_ASSERT_EQUAL(String("myid"), iq->getID()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); CPPUNIT_ASSERT(iq->getPayload<SoftwareVersion>()); CPPUNIT_ASSERT(payload == iq->getPayload<SoftwareVersion>()); } @@ -38,7 +38,7 @@ class IQTest : public CppUnit::TestFixture boost::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid")); CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); - CPPUNIT_ASSERT_EQUAL(String("myid"), iq->getID()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); CPPUNIT_ASSERT(!iq->getPayload<SoftwareVersion>()); } @@ -46,7 +46,7 @@ class IQTest : public CppUnit::TestFixture boost::shared_ptr<IQ> iq(IQ::createError(JID("foo@bar/fum"), "myid", ErrorPayload::BadRequest, ErrorPayload::Modify)); CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); - CPPUNIT_ASSERT_EQUAL(String("myid"), iq->getID()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); boost::shared_ptr<ErrorPayload> error(iq->getPayload<ErrorPayload>()); CPPUNIT_ASSERT(error); CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, error->getCondition()); diff --git a/Swiften/Elements/UnitTest/StanzaTest.cpp b/Swiften/Elements/UnitTest/StanzaTest.cpp index 27b0f09..4020f8b 100644 --- a/Swiften/Elements/UnitTest/StanzaTest.cpp +++ b/Swiften/Elements/UnitTest/StanzaTest.cpp @@ -43,9 +43,9 @@ class StanzaTest : public CppUnit::TestFixture class MyPayload2 : public Payload { public: - MyPayload2(const String& s = "") : text_(s) {} + MyPayload2(const std::string& s = "") : text_(s) {} - String text_; + std::string text_; }; class MyPayload3 : public Payload { @@ -143,7 +143,7 @@ class StanzaTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); - CPPUNIT_ASSERT_EQUAL(String("bar"), p->text_); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); } void testUpdatePayload_NewPayload() { @@ -155,7 +155,7 @@ class StanzaTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); - CPPUNIT_ASSERT_EQUAL(String("bar"), p->text_); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); } void testGetPayloadOfSameType() { @@ -166,7 +166,7 @@ class StanzaTest : public CppUnit::TestFixture boost::shared_ptr<MyPayload2> payload(boost::dynamic_pointer_cast<MyPayload2>(m.getPayloadOfSameType(boost::shared_ptr<MyPayload2>(new MyPayload2("bar"))))); CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT_EQUAL(String("foo"), payload->text_); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), payload->text_); } void testGetPayloadOfSameType_NoSuchPayload() { diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h index 5e26003..d2423e1 100644 --- a/Swiften/Elements/VCard.h +++ b/Swiften/Elements/VCard.h @@ -8,7 +8,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/Elements/Payload.h" @@ -26,47 +26,47 @@ namespace Swift { bool isInternet; bool isPreferred; bool isX400; - String address; + std::string address; }; VCard() {} - void setVersion(const String& version) { version_ = version; } - const String& getVersion() const { return version_; } + void setVersion(const std::string& version) { version_ = version; } + const std::string& getVersion() const { return version_; } - void setFullName(const String& fullName) { fullName_ = fullName; } - const String& getFullName() const { return fullName_; } + void setFullName(const std::string& fullName) { fullName_ = fullName; } + const std::string& getFullName() const { return fullName_; } - void setFamilyName(const String& familyName) { familyName_ = familyName; } - const String& getFamilyName() const { return familyName_; } + void setFamilyName(const std::string& familyName) { familyName_ = familyName; } + const std::string& getFamilyName() const { return familyName_; } - void setGivenName(const String& givenName) { givenName_ = givenName; } - const String& getGivenName() const { return givenName_; } + void setGivenName(const std::string& givenName) { givenName_ = givenName; } + const std::string& getGivenName() const { return givenName_; } - void setMiddleName(const String& middleName) { middleName_ = middleName; } - const String& getMiddleName() const { return middleName_; } + void setMiddleName(const std::string& middleName) { middleName_ = middleName; } + const std::string& getMiddleName() const { return middleName_; } - void setPrefix(const String& prefix) { prefix_ = prefix; } - const String& getPrefix() const { return prefix_; } + void setPrefix(const std::string& prefix) { prefix_ = prefix; } + const std::string& getPrefix() const { return prefix_; } - void setSuffix(const String& suffix) { suffix_ = suffix; } - const String& getSuffix() const { return suffix_; } + void setSuffix(const std::string& suffix) { suffix_ = suffix; } + const std::string& getSuffix() const { return suffix_; } - //void setEMailAddress(const String& email) { email_ = email; } - //const String& getEMailAddress() const { return email_; } + //void setEMailAddress(const std::string& email) { email_ = email; } + //const std::string& getEMailAddress() const { return email_; } - void setNickname(const String& nick) { nick_ = nick; } - const String& getNickname() const { return nick_; } + void setNickname(const std::string& nick) { nick_ = nick; } + const std::string& getNickname() const { return nick_; } void setPhoto(const ByteArray& photo) { photo_ = photo; } const ByteArray& getPhoto() { return photo_; } - void setPhotoType(const String& photoType) { photoType_ = photoType; } - const String& getPhotoType() { return photoType_; } + void setPhotoType(const std::string& photoType) { photoType_ = photoType; } + const std::string& getPhotoType() { return photoType_; } - const String& getUnknownContent() const { return unknownContent_; } - void addUnknownContent(const String& c) { + const std::string& getUnknownContent() const { return unknownContent_; } + void addUnknownContent(const std::string& c) { unknownContent_ += c; } @@ -81,18 +81,18 @@ namespace Swift { EMailAddress getPreferredEMailAddress() const; private: - String version_; - String fullName_; - String familyName_; - String givenName_; - String middleName_; - String prefix_; - String suffix_; - //String email_; + std::string version_; + std::string fullName_; + std::string familyName_; + std::string givenName_; + std::string middleName_; + std::string prefix_; + std::string suffix_; + //std::string email_; ByteArray photo_; - String photoType_; - String nick_; - String unknownContent_; + std::string photoType_; + std::string nick_; + std::string unknownContent_; std::vector<EMailAddress> emailAddresses_; }; } diff --git a/Swiften/Elements/VCardUpdate.h b/Swiften/Elements/VCardUpdate.h index 40eda76..bbfd31e 100644 --- a/Swiften/Elements/VCardUpdate.h +++ b/Swiften/Elements/VCardUpdate.h @@ -6,18 +6,18 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { class VCardUpdate : public Payload { public: - VCardUpdate(const String& photoHash = "") : photoHash_(photoHash) {} + VCardUpdate(const std::string& photoHash = "") : photoHash_(photoHash) {} - void setPhotoHash(const String& photoHash) { photoHash_ = photoHash; } - const String& getPhotoHash() { return photoHash_; } + void setPhotoHash(const std::string& photoHash) { photoHash_ = photoHash; } + const std::string& getPhotoHash() { return photoHash_; } private: - String photoHash_; + std::string photoHash_; }; } diff --git a/Swiften/Elements/Version.h b/Swiften/Elements/Version.h index 3ed1958..0a65573 100644 --- a/Swiften/Elements/Version.h +++ b/Swiften/Elements/Version.h @@ -7,23 +7,23 @@ #ifndef SWIFTEN_STANZAS_VERSION_H #define SWIFTEN_STANZAS_VERSION_H -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Payload.h" namespace Swift { class Version : public Payload { public: - Version(const String& name = "", const String& version = "", const String& os = "") : name_(name), version_(version), os_(os) { } + Version(const std::string& name = "", const std::string& version = "", const std::string& os = "") : name_(name), version_(version), os_(os) { } - const String& getName() const { return name_; } - const String& getVersion() const { return version_; } - const String& getOS() const { return os_; } + const std::string& getName() const { return name_; } + const std::string& getVersion() const { return version_; } + const std::string& getOS() const { return os_; } private: - String name_; - String version_; - String os_; + std::string name_; + std::string version_; + std::string os_; }; } diff --git a/Swiften/Examples/BenchTool/BenchTool.cpp b/Swiften/Examples/BenchTool/BenchTool.cpp index aaf83b5..9e54ed9 100644 --- a/Swiften/Examples/BenchTool/BenchTool.cpp +++ b/Swiften/Examples/BenchTool/BenchTool.cpp @@ -45,7 +45,7 @@ int main(int, char**) { BlindCertificateTrustChecker trustChecker; std::vector<CoreClient*> clients; for (int i = 0; i < numberOfInstances; ++i) { - CoreClient* client = new Swift::CoreClient(JID(jid), String(pass), &networkFactories); + CoreClient* client = new Swift::CoreClient(JID(jid), std::string(pass), &networkFactories); client->setCertificateTrustChecker(&trustChecker); client->onConnected.connect(&handleConnected); clients.push_back(client); diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp index 2f3a751..fda203a 100644 --- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp +++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp @@ -62,13 +62,13 @@ int main(int argc, char* argv[]) { int argi = 1; - String jid = argv[argi++]; - String connectHost = ""; + std::string jid = argv[argi++]; + std::string connectHost = ""; if (argc == 5) { connectHost = argv[argi++]; } - client = new Swift::Client(JID(jid), String(argv[argi++]), &networkFactories); + client = new Swift::Client(JID(jid), std::string(argv[argi++]), &networkFactories); char* timeoutChar = argv[argi++]; int timeout = atoi(timeoutChar); timeout = (timeout ? timeout : 30) * 1000; @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) { client->onConnected.connect(&handleConnected); errorConnection = client->onDisconnected.connect(&handleDisconnected); std::cout << "Connecting to JID " << jid << " with timeout " << timeout << "ms on host: "; ; - if (!connectHost.isEmpty()) { + if (!connectHost.empty()) { std::cout << connectHost << std::endl; client->connect(connectHost); } else { diff --git a/Swiften/Examples/LinkLocalTool/main.cpp b/Swiften/Examples/LinkLocalTool/main.cpp index 65fc9bc..d63ef53 100644 --- a/Swiften/Examples/LinkLocalTool/main.cpp +++ b/Swiften/Examples/LinkLocalTool/main.cpp @@ -27,13 +27,13 @@ int main(int argc, char* argv[]) { boost::shared_ptr<DNSSDQuerier> querier = factory.createQuerier(); querier->start(); - if (String(argv[1]) == "browse") { + if (std::string(argv[1]) == "browse") { boost::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); browseQuery->startBrowsing(); eventLoop.run(); browseQuery->stopBrowsing(); } - else if (String(argv[1]) == "resolve-service") { + else if (std::string(argv[1]) == "resolve-service") { if (argc < 5) { std::cerr << "Invalid parameters" << std::endl; return -1; diff --git a/Swiften/Examples/SendFile/ReceiveFile.cpp b/Swiften/Examples/SendFile/ReceiveFile.cpp index 278cc3e..b46d790 100644 --- a/Swiften/Examples/SendFile/ReceiveFile.cpp +++ b/Swiften/Examples/SendFile/ReceiveFile.cpp @@ -25,7 +25,7 @@ int exitCode = 2; class FileReceiver { public: - FileReceiver(const JID& jid, const String& password) : jid(jid), password(password), jingleSessionManager(NULL), incomingFileTransferManager(NULL) { + FileReceiver(const JID& jid, const std::string& password) : jid(jid), password(password), jingleSessionManager(NULL), incomingFileTransferManager(NULL) { client = new Swift::Client(jid, password, &networkFactories); client->onConnected.connect(boost::bind(&FileReceiver::handleConnected, this)); client->onDisconnected.connect(boost::bind(&FileReceiver::handleDisconnected, this, _1)); @@ -91,7 +91,7 @@ class FileReceiver { private: JID jid; - String password; + std::string password; Client* client; ClientXMLTracer* tracer; JingleSessionManager* jingleSessionManager; @@ -107,7 +107,7 @@ int main(int argc, char* argv[]) { } JID jid(argv[1]); - FileReceiver fileReceiver(jid, String(argv[2])); + FileReceiver fileReceiver(jid, std::string(argv[2])); fileReceiver.start(); eventLoop.run(); diff --git a/Swiften/Examples/SendFile/SendFile.cpp b/Swiften/Examples/SendFile/SendFile.cpp index b2db22b..5ec00a9 100644 --- a/Swiften/Examples/SendFile/SendFile.cpp +++ b/Swiften/Examples/SendFile/SendFile.cpp @@ -28,7 +28,7 @@ int exitCode = 2; class FileSender { public: - FileSender(const JID& jid, const String& password, const JID& recipient, const boost::filesystem::path& file, int port) : jid(jid), password(password), recipient(recipient), file(file), transfer(NULL) { + FileSender(const JID& jid, const std::string& password, const JID& recipient, const boost::filesystem::path& file, int port) : jid(jid), password(password), recipient(recipient), file(file), transfer(NULL) { connectionServer = BoostConnectionServer::create(port, networkFactories.getIOServiceThread()->getIOService(), &eventLoop); socksBytestreamServer = new SOCKS5BytestreamServer(connectionServer); @@ -94,7 +94,7 @@ class FileSender { BoostConnectionServer::ref connectionServer; SOCKS5BytestreamServer* socksBytestreamServer; JID jid; - String password; + std::string password; JID recipient; boost::filesystem::path file; Client* client; @@ -111,7 +111,7 @@ int main(int argc, char* argv[]) { JID sender(argv[1]); JID recipient(argv[3]); - FileSender fileSender(sender, String(argv[2]), recipient, boost::filesystem::path(argv[4]), 8888); + FileSender fileSender(sender, std::string(argv[2]), recipient, boost::filesystem::path(argv[4]), 8888); fileSender.start(); { diff --git a/Swiften/Examples/SendMessage/SendMessage.cpp b/Swiften/Examples/SendMessage/SendMessage.cpp index d763ffc..d7f7333 100644 --- a/Swiften/Examples/SendMessage/SendMessage.cpp +++ b/Swiften/Examples/SendMessage/SendMessage.cpp @@ -51,13 +51,13 @@ int main(int argc, char* argv[]) { int argi = 1; - String jid = argv[argi++]; - String connectHost = ""; + std::string jid = argv[argi++]; + std::string connectHost = ""; if (argc == 6) { connectHost = argv[argi++]; } - client = new Swift::Client(JID(jid), String(argv[argi++]), &networkFactories); + client = new Swift::Client(JID(jid), std::string(argv[argi++]), &networkFactories); client->setAlwaysTrustCertificates(); recipient = JID(argv[argi++]); @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) { ClientXMLTracer* tracer = new ClientXMLTracer(client); client->onConnected.connect(&handleConnected); errorConnection = client->onDisconnected.connect(&handleDisconnected); - if (!connectHost.isEmpty()) { + if (!connectHost.empty()) { client->connect(connectHost); } else { client->connect(); diff --git a/Swiften/FileTransfer/IBBReceiveSession.cpp b/Swiften/FileTransfer/IBBReceiveSession.cpp index 9eed21d..5c90757 100644 --- a/Swiften/FileTransfer/IBBReceiveSession.cpp +++ b/Swiften/FileTransfer/IBBReceiveSession.cpp @@ -14,7 +14,7 @@ namespace Swift { -IBBReceiveSession::IBBReceiveSession(const String& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router) : SetResponder<IBB>(router), id(id), from(from), size(size), bytestream(bytestream), router(router), sequenceNumber(0), active(false), receivedSize(0) { +IBBReceiveSession::IBBReceiveSession(const std::string& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router) : SetResponder<IBB>(router), id(id), from(from), size(size), bytestream(bytestream), router(router), sequenceNumber(0), active(false), receivedSize(0) { } IBBReceiveSession::~IBBReceiveSession() { @@ -36,7 +36,7 @@ void IBBReceiveSession::finish(boost::optional<FileTransferError> error) { onFinished(error); } -bool IBBReceiveSession::handleSetRequest(const JID& from, const JID&, const String& id, IBB::ref ibb) { +bool IBBReceiveSession::handleSetRequest(const JID& from, const JID&, const std::string& id, IBB::ref ibb) { if (from == this->from && ibb->getStreamID() == id) { if (ibb->getAction() == IBB::Data) { if (sequenceNumber == ibb->getSequenceNumber()) { diff --git a/Swiften/FileTransfer/IBBReceiveSession.h b/Swiften/FileTransfer/IBBReceiveSession.h index b2399b6..6d936de 100644 --- a/Swiften/FileTransfer/IBBReceiveSession.h +++ b/Swiften/FileTransfer/IBBReceiveSession.h @@ -22,7 +22,7 @@ namespace Swift { class IBBReceiveSession : public SetResponder<IBB> { public: - IBBReceiveSession(const String& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router); + IBBReceiveSession(const std::string& id, const JID& from, size_t size, WriteBytestream::ref bytestream, IQRouter* router); ~IBBReceiveSession(); void start(); @@ -31,11 +31,11 @@ namespace Swift { boost::signal<void (boost::optional<FileTransferError>)> onFinished; private: - bool handleSetRequest(const JID& from, const JID& to, const String& id, IBB::ref payload); + bool handleSetRequest(const JID& from, const JID& to, const std::string& id, IBB::ref payload); void finish(boost::optional<FileTransferError>); private: - String id; + std::string id; JID from; size_t size; WriteBytestream::ref bytestream; diff --git a/Swiften/FileTransfer/IBBSendSession.cpp b/Swiften/FileTransfer/IBBSendSession.cpp index 30f8836..0fb47d3 100644 --- a/Swiften/FileTransfer/IBBSendSession.cpp +++ b/Swiften/FileTransfer/IBBSendSession.cpp @@ -14,7 +14,7 @@ namespace Swift { -IBBSendSession::IBBSendSession(const String& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router) : id(id), to(to), bytestream(bytestream), router(router), blockSize(4096), sequenceNumber(0), active(false) { +IBBSendSession::IBBSendSession(const std::string& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router) : id(id), to(to), bytestream(bytestream), router(router), blockSize(4096), sequenceNumber(0), active(false) { } IBBSendSession::~IBBSendSession() { diff --git a/Swiften/FileTransfer/IBBSendSession.h b/Swiften/FileTransfer/IBBSendSession.h index e114b23..bef7bec 100644 --- a/Swiften/FileTransfer/IBBSendSession.h +++ b/Swiften/FileTransfer/IBBSendSession.h @@ -21,7 +21,7 @@ namespace Swift { class IBBSendSession { public: - IBBSendSession(const String& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router); + IBBSendSession(const std::string& id, const JID& to, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* router); ~IBBSendSession(); void start(); @@ -38,7 +38,7 @@ namespace Swift { void finish(boost::optional<FileTransferError>); private: - String id; + std::string id; JID to; boost::shared_ptr<ReadBytestream> bytestream; IQRouter* router; diff --git a/Swiften/FileTransfer/OutgoingFileTransfer.cpp b/Swiften/FileTransfer/OutgoingFileTransfer.cpp index 8e6f839..32f7e17 100644 --- a/Swiften/FileTransfer/OutgoingFileTransfer.cpp +++ b/Swiften/FileTransfer/OutgoingFileTransfer.cpp @@ -15,7 +15,7 @@ namespace Swift { -OutgoingFileTransfer::OutgoingFileTransfer(const String& id, const JID& from, const JID& to, const String& name, int size, const String& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer) : id(id), from(from), to(to), name(name), size(size), description(description), bytestream(bytestream), iqRouter(iqRouter), socksServer(socksServer) { +OutgoingFileTransfer::OutgoingFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer) : id(id), from(from), to(to), name(name), size(size), description(description), bytestream(bytestream), iqRouter(iqRouter), socksServer(socksServer) { } void OutgoingFileTransfer::start() { diff --git a/Swiften/FileTransfer/OutgoingFileTransfer.h b/Swiften/FileTransfer/OutgoingFileTransfer.h index 3ecef5d..a694c13 100644 --- a/Swiften/FileTransfer/OutgoingFileTransfer.h +++ b/Swiften/FileTransfer/OutgoingFileTransfer.h @@ -24,7 +24,7 @@ namespace Swift { class OutgoingFileTransfer { public: - OutgoingFileTransfer(const String& id, const JID& from, const JID& to, const String& name, int size, const String& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer); + OutgoingFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer); void start(); void stop(); @@ -38,12 +38,12 @@ namespace Swift { void handleIBBSessionFinished(boost::optional<FileTransferError> error); private: - String id; + std::string id; JID from; JID to; - String name; + std::string name; int size; - String description; + std::string description; boost::shared_ptr<ReadBytestream> bytestream; IQRouter* iqRouter; SOCKS5BytestreamServer* socksServer; diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp index a4715a0..7f889b1 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp @@ -11,15 +11,15 @@ namespace Swift { SOCKS5BytestreamRegistry::SOCKS5BytestreamRegistry() { } -void SOCKS5BytestreamRegistry::addBytestream(const String& destination, boost::shared_ptr<ReadBytestream> byteStream) { +void SOCKS5BytestreamRegistry::addBytestream(const std::string& destination, boost::shared_ptr<ReadBytestream> byteStream) { byteStreams[destination] = byteStream; } -void SOCKS5BytestreamRegistry::removeBytestream(const String& destination) { +void SOCKS5BytestreamRegistry::removeBytestream(const std::string& destination) { byteStreams.erase(destination); } -boost::shared_ptr<ReadBytestream> SOCKS5BytestreamRegistry::getBytestream(const String& destination) const { +boost::shared_ptr<ReadBytestream> SOCKS5BytestreamRegistry::getBytestream(const std::string& destination) const { BytestreamMap::const_iterator i = byteStreams.find(destination); if (i != byteStreams.end()) { return i->second; diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h index 1afd03f..7cee256 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> #include <map> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/FileTransfer/ReadBytestream.h" namespace Swift { @@ -17,12 +17,12 @@ namespace Swift { public: SOCKS5BytestreamRegistry(); - boost::shared_ptr<ReadBytestream> getBytestream(const String& destination) const; - void addBytestream(const String& destination, boost::shared_ptr<ReadBytestream> byteStream); - void removeBytestream(const String& destination); + boost::shared_ptr<ReadBytestream> getBytestream(const std::string& destination) const; + void addBytestream(const std::string& destination, boost::shared_ptr<ReadBytestream> byteStream); + void removeBytestream(const std::string& destination); private: - typedef std::map<String, boost::shared_ptr<ReadBytestream> > BytestreamMap; + typedef std::map<std::string, boost::shared_ptr<ReadBytestream> > BytestreamMap; BytestreamMap byteStreams; }; } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp index 58506f3..9bc49ae 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp @@ -25,15 +25,15 @@ void SOCKS5BytestreamServer::stop() { connectionServer->onNewConnection.disconnect(boost::bind(&SOCKS5BytestreamServer::handleNewConnection, this, _1)); } -void SOCKS5BytestreamServer::addBytestream(const String& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream) { +void SOCKS5BytestreamServer::addBytestream(const std::string& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream) { bytestreams.addBytestream(getSOCKSDestinationAddress(id, from, to), byteStream); } -void SOCKS5BytestreamServer::removeBytestream(const String& id, const JID& from, const JID& to) { +void SOCKS5BytestreamServer::removeBytestream(const std::string& id, const JID& from, const JID& to) { bytestreams.removeBytestream(getSOCKSDestinationAddress(id, from, to)); } -String SOCKS5BytestreamServer::getSOCKSDestinationAddress(const String& id, const JID& from, const JID& to) { +std::string SOCKS5BytestreamServer::getSOCKSDestinationAddress(const std::string& id, const JID& from, const JID& to) { return Hexify::hexify(SHA1::getHash(ByteArray(id + from.toString() + to.toString()))); } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.h b/Swiften/FileTransfer/SOCKS5BytestreamServer.h index 35a8d4f..d5a62bb 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServer.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.h @@ -10,7 +10,7 @@ #include <map> #include "Swiften/Network/ConnectionServer.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/FileTransfer/ReadBytestream.h" #include "Swiften/FileTransfer/SOCKS5BytestreamRegistry.h" @@ -27,16 +27,16 @@ namespace Swift { void start(); void stop(); - void addBytestream(const String& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream); - void removeBytestream(const String& id, const JID& from, const JID& to); + void addBytestream(const std::string& id, const JID& from, const JID& to, boost::shared_ptr<ReadBytestream> byteStream); + void removeBytestream(const std::string& id, const JID& from, const JID& to); /*protected: - boost::shared_ptr<ReadBytestream> getBytestream(const String& dest);*/ + boost::shared_ptr<ReadBytestream> getBytestream(const std::string& dest);*/ private: void handleNewConnection(boost::shared_ptr<Connection> connection); - static String getSOCKSDestinationAddress(const String& id, const JID& from, const JID& to); + static std::string getSOCKSDestinationAddress(const std::string& id, const JID& from, const JID& to); private: friend class SOCKS5BytestreamServerSession; diff --git a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp index afd71c0..0cd273a 100644 --- a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp @@ -52,7 +52,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { IBB::ref ibb = stanzaChannel->sentStanzas[0]->getPayload<IBB>(); CPPUNIT_ASSERT_EQUAL(IBB::Open, ibb->getAction()); CPPUNIT_ASSERT_EQUAL(1234, ibb->getBlockSize()); - CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID()); } void testStart_ResponseStartsSending() { @@ -68,7 +68,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(IBB::Data, ibb->getAction()); CPPUNIT_ASSERT_EQUAL(ByteArray("abc"), ibb->getData()); CPPUNIT_ASSERT_EQUAL(0, ibb->getSequenceNumber()); - CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID()); } void testResponseContinuesSending() { @@ -84,7 +84,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(IBB::Data, ibb->getAction()); CPPUNIT_ASSERT_EQUAL(ByteArray("def"), ibb->getData()); CPPUNIT_ASSERT_EQUAL(1, ibb->getSequenceNumber()); - CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID()); } void testRespondToAllFinishes() { @@ -120,7 +120,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<IBB>(1, JID("foo@bar.com/baz"), IQ::Set)); IBB::ref ibb = stanzaChannel->sentStanzas[1]->getPayload<IBB>(); CPPUNIT_ASSERT_EQUAL(IBB::Close, ibb->getAction()); - CPPUNIT_ASSERT_EQUAL(String("myid"), ibb->getStreamID()); + CPPUNIT_ASSERT_EQUAL(std::string("myid"), ibb->getStreamID()); CPPUNIT_ASSERT(finished); CPPUNIT_ASSERT(!error); } @@ -144,7 +144,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } private: - std::auto_ptr<IBBSendSession> createSession(const String& to) { + std::auto_ptr<IBBSendSession> createSession(const std::string& to) { std::auto_ptr<IBBSendSession> session(new IBBSendSession("myid", JID(to), bytestream, iqRouter)); session->onFinished.connect(boost::bind(&IBBSendSessionTest::handleFinished, this, _1)); return session; diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp index b3b93ac..c6d246d 100644 --- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp @@ -123,12 +123,12 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { receivedDataChunks = 0; } - void request(const String& hostname) { - receive(ByteArray("\x05\x01\x00\x03", 4) + hostname.getUTF8Size() + hostname + ByteArray("\x00\x00", 2)); + void request(const std::string& hostname) { + receive(ByteArray("\x05\x01\x00\x03", 4) + hostname.size() + hostname + ByteArray("\x00\x00", 2)); } - void skipHeader(const String& hostname) { - int headerSize = 7 + hostname.getUTF8Size(); + void skipHeader(const std::string& hostname) { + int headerSize = 7 + hostname.size(); receivedData = ByteArray(receivedData.getData() + headerSize, receivedData.getSize() - headerSize); } diff --git a/Swiften/History/HistoryManager.h b/Swiften/History/HistoryManager.h index c6b80e5..c918cbc 100644 --- a/Swiften/History/HistoryManager.h +++ b/Swiften/History/HistoryManager.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/History/HistoryMessage.h" diff --git a/Swiften/History/HistoryMessage.h b/Swiften/History/HistoryMessage.h index bb605ee..5e4782d 100644 --- a/Swiften/History/HistoryMessage.h +++ b/Swiften/History/HistoryMessage.h @@ -11,10 +11,10 @@ namespace Swift { class HistoryMessage { public: - HistoryMessage(const String& message, const JID& from, const JID& to, const boost::posix_time::ptime time) : message_(message), from_(from), to_(to), time_(time) { + HistoryMessage(const std::string& message, const JID& from, const JID& to, const boost::posix_time::ptime time) : message_(message), from_(from), to_(to), time_(time) { } - const String& getMessage() const { + const std::string& getMessage() const { return message_; } @@ -35,7 +35,7 @@ namespace Swift { } private: - String message_; + std::string message_; JID from_; JID to_; boost::posix_time::ptime time_; diff --git a/Swiften/History/SQLiteHistoryManager.cpp b/Swiften/History/SQLiteHistoryManager.cpp index 43443c7..9d5a000 100644 --- a/Swiften/History/SQLiteHistoryManager.cpp +++ b/Swiften/History/SQLiteHistoryManager.cpp @@ -12,9 +12,9 @@ namespace { -inline Swift::String getEscapedString(const Swift::String& s) { - Swift::String result(s); - result.replaceAll('\'', Swift::String("\\'")); +inline Swift::std::string getEscapedString(const Swift::std::string& s) { + Swift::std::string result(s); + result.replaceAll('\'', Swift::std::string("\\'")); return result; } @@ -23,8 +23,8 @@ inline Swift::String getEscapedString(const Swift::String& s) { namespace Swift { -SQLiteHistoryManager::SQLiteHistoryManager(const String& file) : db_(0) { - sqlite3_open(file.getUTF8Data(), &db_); +SQLiteHistoryManager::SQLiteHistoryManager(const std::string& file) : db_(0) { + sqlite3_open(file.c_str(), &db_); if (!db_) { std::cerr << "Error opening database " << file << std::endl; // FIXME } @@ -49,9 +49,9 @@ SQLiteHistoryManager::~SQLiteHistoryManager() { void SQLiteHistoryManager::addMessage(const HistoryMessage& message) { int secondsSinceEpoch = (message.getTime() - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))).total_seconds(); - String statement = String("INSERT INTO messages('from', 'to', 'message', 'time') VALUES(") + boost::lexical_cast<std::string>(getIDForJID(message.getFrom())) + ", " + boost::lexical_cast<std::string>(getIDForJID(message.getTo())) + ", '" + getEscapedString(message.getMessage()) + "', " + boost::lexical_cast<std::string>(secondsSinceEpoch) + ")"; + std::string statement = std::string("INSERT INTO messages('from', 'to', 'message', 'time') VALUES(") + boost::lexical_cast<std::string>(getIDForJID(message.getFrom())) + ", " + boost::lexical_cast<std::string>(getIDForJID(message.getTo())) + ", '" + getEscapedString(message.getMessage()) + "', " + boost::lexical_cast<std::string>(secondsSinceEpoch) + ")"; char* errorMessage; - int result = sqlite3_exec(db_, statement.getUTF8Data(), 0, 0, &errorMessage); + int result = sqlite3_exec(db_, statement.c_str(), 0, 0, &errorMessage); if (result != SQLITE_OK) { std::cerr << "SQL Error: " << errorMessage << std::endl; sqlite3_free(errorMessage); @@ -61,8 +61,8 @@ void SQLiteHistoryManager::addMessage(const HistoryMessage& message) { std::vector<HistoryMessage> SQLiteHistoryManager::getMessages() const { std::vector<HistoryMessage> result; sqlite3_stmt* selectStatement; - String selectQuery("SELECT messages.'from', messages.'to', messages.'message', messages.'time' FROM messages"); - int r = sqlite3_prepare(db_, selectQuery.getUTF8Data(), selectQuery.getUTF8Size(), &selectStatement, NULL); + std::string selectQuery("SELECT messages.'from', messages.'to', messages.'message', messages.'time' FROM messages"); + int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL); if (r != SQLITE_OK) { std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl; } @@ -70,7 +70,7 @@ std::vector<HistoryMessage> SQLiteHistoryManager::getMessages() const { while (r == SQLITE_ROW) { boost::optional<JID> from(getJIDFromID(sqlite3_column_int(selectStatement, 0))); boost::optional<JID> to(getJIDFromID(sqlite3_column_int(selectStatement, 1))); - String message(reinterpret_cast<const char*>(sqlite3_column_text(selectStatement, 2))); + std::string message(reinterpret_cast<const char*>(sqlite3_column_text(selectStatement, 2))); int secondsSinceEpoch(sqlite3_column_int(selectStatement, 3)); boost::posix_time::ptime time(boost::gregorian::date(1970, 1, 1), boost::posix_time::seconds(secondsSinceEpoch)); @@ -95,9 +95,9 @@ int SQLiteHistoryManager::getIDForJID(const JID& jid) { } int SQLiteHistoryManager::addJID(const JID& jid) { - String statement = String("INSERT INTO jids('jid') VALUES('") + getEscapedString(jid.toString()) + "')"; + std::string statement = std::string("INSERT INTO jids('jid') VALUES('") + getEscapedString(jid.toString()) + "')"; char* errorMessage; - int result = sqlite3_exec(db_, statement.getUTF8Data(), 0, 0, &errorMessage); + int result = sqlite3_exec(db_, statement.c_str(), 0, 0, &errorMessage); if (result != SQLITE_OK) { std::cerr << "SQL Error: " << errorMessage << std::endl; sqlite3_free(errorMessage); @@ -108,8 +108,8 @@ int SQLiteHistoryManager::addJID(const JID& jid) { boost::optional<JID> SQLiteHistoryManager::getJIDFromID(int id) const { boost::optional<JID> result; sqlite3_stmt* selectStatement; - String selectQuery("SELECT jid FROM jids WHERE id=" + boost::lexical_cast<std::string>(id)); - int r = sqlite3_prepare(db_, selectQuery.getUTF8Data(), selectQuery.getUTF8Size(), &selectStatement, NULL); + std::string selectQuery("SELECT jid FROM jids WHERE id=" + boost::lexical_cast<std::string>(id)); + int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL); if (r != SQLITE_OK) { std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl; } @@ -124,8 +124,8 @@ boost::optional<JID> SQLiteHistoryManager::getJIDFromID(int id) const { boost::optional<int> SQLiteHistoryManager::getIDFromJID(const JID& jid) const { boost::optional<int> result; sqlite3_stmt* selectStatement; - String selectQuery("SELECT id FROM jids WHERE jid='" + jid.toString() + "'"); - int r = sqlite3_prepare(db_, selectQuery.getUTF8Data(), selectQuery.getUTF8Size(), &selectStatement, NULL); + std::string selectQuery("SELECT id FROM jids WHERE jid='" + jid.toString() + "'"); + int r = sqlite3_prepare(db_, selectQuery.c_str(), selectQuery.size(), &selectStatement, NULL); if (r != SQLITE_OK) { std::cout << "Error: " << sqlite3_errmsg(db_) << std::endl; } diff --git a/Swiften/History/SQLiteHistoryManager.h b/Swiften/History/SQLiteHistoryManager.h index 5c8d153..a2b89f4 100644 --- a/Swiften/History/SQLiteHistoryManager.h +++ b/Swiften/History/SQLiteHistoryManager.h @@ -15,7 +15,7 @@ struct sqlite3; namespace Swift { class SQLiteHistoryManager : public HistoryManager { public: - SQLiteHistoryManager(const String& file); + SQLiteHistoryManager(const std::string& file); ~SQLiteHistoryManager(); virtual void addMessage(const HistoryMessage& message); diff --git a/Swiften/IDN/IDNA.cpp b/Swiften/IDN/IDNA.cpp index 0e76c0b..6b6c7a4 100644 --- a/Swiften/IDN/IDNA.cpp +++ b/Swiften/IDN/IDNA.cpp @@ -13,10 +13,10 @@ namespace Swift { -String IDNA::getEncoded(const String& domain) { +std::string IDNA::getEncoded(const std::string& domain) { char* output; - if (idna_to_ascii_8z(domain.getUTF8Data(), &output, 0) == IDNA_SUCCESS) { - String result(output); + if (idna_to_ascii_8z(domain.c_str(), &output, 0) == IDNA_SUCCESS) { + std::string result(output); free(output); return result; } diff --git a/Swiften/IDN/IDNA.h b/Swiften/IDN/IDNA.h index cc4144b..19af1e6 100644 --- a/Swiften/IDN/IDNA.h +++ b/Swiften/IDN/IDNA.h @@ -6,11 +6,11 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class IDNA { public: - static String getEncoded(const String& s); + static std::string getEncoded(const std::string& s); }; } diff --git a/Swiften/IDN/StringPrep.cpp b/Swiften/IDN/StringPrep.cpp index d9e061e..ff01eed 100644 --- a/Swiften/IDN/StringPrep.cpp +++ b/Swiften/IDN/StringPrep.cpp @@ -8,6 +8,7 @@ #include <stringprep.h> #include <vector> +#include <cassert> namespace Swift { @@ -24,12 +25,12 @@ const Stringprep_profile* getLibIDNProfile(StringPrep::Profile profile) { return 0; } -String StringPrep::getPrepared(const String& s, Profile profile) { +std::string StringPrep::getPrepared(const std::string& s, Profile profile) { - std::vector<char> input(s.getUTF8String().begin(), s.getUTF8String().end()); + std::vector<char> input(s.begin(), s.end()); input.resize(MAX_STRINGPREP_SIZE); if (stringprep(&input[0], MAX_STRINGPREP_SIZE, static_cast<Stringprep_profile_flags>(0), getLibIDNProfile(profile)) == 0) { - return String(&input[0]); + return std::string(&input[0]); } else { return ""; diff --git a/Swiften/IDN/StringPrep.h b/Swiften/IDN/StringPrep.h index 3b27efa..f40553b 100644 --- a/Swiften/IDN/StringPrep.h +++ b/Swiften/IDN/StringPrep.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class StringPrep { @@ -18,6 +18,6 @@ namespace Swift { SASLPrep, }; - static String getPrepared(const String& s, Profile profile); + static std::string getPrepared(const std::string& s, Profile profile); }; } diff --git a/Swiften/JID/JID.cpp b/Swiften/JID/JID.cpp index 3ecd881..e4611b3 100644 --- a/Swiften/JID/JID.cpp +++ b/Swiften/JID/JID.cpp @@ -9,17 +9,18 @@ #include <vector> #include <iostream> -#include <Swiften/Base/String.h> +#include <string> #ifdef SWIFTEN_CACHE_JID_PREP #include <boost/unordered_map.hpp> #endif #include <stringprep.h> +#include <Swiften/Base/String.h> #include "Swiften/JID/JID.h" #include "Swiften/IDN/StringPrep.h" #ifdef SWIFTEN_CACHE_JID_PREP -typedef boost::unordered_map<std::string, Swift::String> PrepCache; +typedef boost::unordered_map<std::string, std::string> PrepCache; static PrepCache nodePrepCache; static PrepCache domainPrepCache; @@ -29,39 +30,39 @@ static PrepCache resourcePrepCache; namespace Swift { JID::JID(const char* jid) { - initializeFromString(String(jid)); + initializeFromString(std::string(jid)); } -JID::JID(const String& jid) { +JID::JID(const std::string& jid) { initializeFromString(jid); } -JID::JID(const String& node, const String& domain) : hasResource_(false) { +JID::JID(const std::string& node, const std::string& domain) : hasResource_(false) { nameprepAndSetComponents(node, domain, ""); } -JID::JID(const String& node, const String& domain, const String& resource) : hasResource_(true) { +JID::JID(const std::string& node, const std::string& domain, const std::string& resource) : hasResource_(true) { nameprepAndSetComponents(node, domain, resource); } -void JID::initializeFromString(const String& jid) { - if (jid.beginsWith('@')) { +void JID::initializeFromString(const std::string& jid) { + if (String::beginsWith(jid, '@')) { return; } - String bare, resource; + std::string bare, resource; size_t slashIndex = jid.find('/'); - if (slashIndex != jid.npos()) { + if (slashIndex != jid.npos) { hasResource_ = true; - bare = jid.getSubstring(0, slashIndex); - resource = jid.getSubstring(slashIndex + 1, jid.npos()); + bare = jid.substr(0, slashIndex); + resource = jid.substr(slashIndex + 1, jid.npos); } else { hasResource_ = false; bare = jid; } - std::pair<String,String> nodeAndDomain = bare.getSplittedAtFirst('@'); - if (nodeAndDomain.second.isEmpty()) { + std::pair<std::string,std::string> nodeAndDomain = String::getSplittedAtFirst(bare, '@'); + if (nodeAndDomain.second.empty()) { nameprepAndSetComponents("", nodeAndDomain.first, resource); } else { @@ -70,7 +71,7 @@ void JID::initializeFromString(const String& jid) { } -void JID::nameprepAndSetComponents(const String& node, const String& domain, const String& resource) { +void JID::nameprepAndSetComponents(const std::string& node, const std::string& domain, const std::string& resource) { #ifndef SWIFTEN_CACHE_JID_PREP node_ = StringPrep::getPrepared(node, StringPrep::NamePrep); domain_ = StringPrep::getPrepared(domain, StringPrep::XMPPNodePrep); @@ -78,19 +79,19 @@ void JID::nameprepAndSetComponents(const String& node, const String& domain, con #else std::pair<PrepCache::iterator, bool> r; - r = nodePrepCache.insert(std::make_pair(node.getUTF8String(), String())); + r = nodePrepCache.insert(std::make_pair(node, std::string())); if (r.second) { r.first->second = StringPrep::getPrepared(node, StringPrep::NamePrep); } node_ = r.first->second; - r = domainPrepCache.insert(std::make_pair(domain.getUTF8String(), String())); + r = domainPrepCache.insert(std::make_pair(domain, std::string())); if (r.second) { r.first->second = StringPrep::getPrepared(domain, StringPrep::XMPPNodePrep); } domain_ = r.first->second; - r = resourcePrepCache.insert(std::make_pair(resource.getUTF8String(), String())); + r = resourcePrepCache.insert(std::make_pair(resource, std::string())); if (r.second) { r.first->second = StringPrep::getPrepared(resource, StringPrep::XMPPResourcePrep); } @@ -98,9 +99,9 @@ void JID::nameprepAndSetComponents(const String& node, const String& domain, con #endif } -String JID::toString() const { - String string; - if (!node_.isEmpty()) { +std::string JID::toString() const { + std::string string; + if (!node_.empty()) { string += node_ + "@"; } string += domain_; diff --git a/Swiften/JID/JID.h b/Swiften/JID/JID.h index 76c2606..78136ff 100644 --- a/Swiften/JID/JID.h +++ b/Swiften/JID/JID.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class JID { @@ -15,22 +15,22 @@ namespace Swift { WithResource, WithoutResource }; - explicit JID(const String& = String()); + explicit JID(const std::string& = std::string()); explicit JID(const char*); - JID(const String& node, const String& domain); - JID(const String& node, const String& domain, const String& resource); + JID(const std::string& node, const std::string& domain); + JID(const std::string& node, const std::string& domain, const std::string& resource); bool isValid() const { - return !domain_.isEmpty(); /* FIXME */ + return !domain_.empty(); /* FIXME */ } - const String& getNode() const { + const std::string& getNode() const { return node_; } - const String& getDomain() const { + const std::string& getDomain() const { return domain_; } - const String& getResource() const { + const std::string& getResource() const { return resource_; } bool isBare() const { @@ -44,7 +44,7 @@ namespace Swift { return result; } - String toString() const; + std::string toString() const; bool equals(const JID& o, CompareType compareType) const { return compare(o, compareType) == 0; @@ -52,7 +52,7 @@ namespace Swift { int compare(const JID& o, CompareType compareType) const; - operator String() const { + operator std::string() const { return toString(); } @@ -74,13 +74,13 @@ namespace Swift { } private: - void nameprepAndSetComponents(const String& node, const String& domain, const String& resource); - void initializeFromString(const String&); + void nameprepAndSetComponents(const std::string& node, const std::string& domain, const std::string& resource); + void initializeFromString(const std::string&); private: - String node_; - String domain_; + std::string node_; + std::string domain_; bool hasResource_; - String resource_; + std::string resource_; }; } diff --git a/Swiften/JID/UnitTest/JIDTest.cpp b/Swiften/JID/UnitTest/JIDTest.cpp index 51e6d2c..0f22e15 100644 --- a/Swiften/JID/UnitTest/JIDTest.cpp +++ b/Swiften/JID/UnitTest/JIDTest.cpp @@ -59,18 +59,18 @@ class JIDTest : public CppUnit::TestFixture void testConstructorWithString() { JID testling("foo@bar/baz"); - CPPUNIT_ASSERT_EQUAL(String("foo"), testling.getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.getDomain()); - CPPUNIT_ASSERT_EQUAL(String("baz"), testling.getResource()); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), testling.getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("baz"), testling.getResource()); CPPUNIT_ASSERT(!testling.isBare()); } void testConstructorWithString_NoResource() { JID testling("foo@bar"); - CPPUNIT_ASSERT_EQUAL(String("foo"), testling.getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.getDomain()); - CPPUNIT_ASSERT_EQUAL(String(""), testling.getResource()); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), testling.getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getResource()); CPPUNIT_ASSERT(testling.isBare()); } @@ -84,38 +84,38 @@ class JIDTest : public CppUnit::TestFixture void testConstructorWithString_NoNode() { JID testling("bar/baz"); - CPPUNIT_ASSERT_EQUAL(String(""), testling.getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.getDomain()); - CPPUNIT_ASSERT_EQUAL(String("baz"), testling.getResource()); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("baz"), testling.getResource()); CPPUNIT_ASSERT(!testling.isBare()); } void testConstructorWithString_OnlyDomain() { JID testling("bar"); - CPPUNIT_ASSERT_EQUAL(String(""), testling.getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.getDomain()); - CPPUNIT_ASSERT_EQUAL(String(""), testling.getResource()); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getResource()); CPPUNIT_ASSERT(testling.isBare()); } void testConstructorWithString_UpperCaseNode() { JID testling("Fo\xCE\xA9@bar"); - CPPUNIT_ASSERT_EQUAL(String("fo\xCF\x89"), testling.getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("fo\xCF\x89"), testling.getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain()); } void testConstructorWithString_UpperCaseDomain() { JID testling("Fo\xCE\xA9"); - CPPUNIT_ASSERT_EQUAL(String("fo\xCF\x89"), testling.getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("fo\xCF\x89"), testling.getDomain()); } void testConstructorWithString_UpperCaseResource() { JID testling("bar/Fo\xCE\xA9"); - CPPUNIT_ASSERT_EQUAL(testling.getResource(), String("Fo\xCE\xA9")); + CPPUNIT_ASSERT_EQUAL(testling.getResource(), std::string("Fo\xCE\xA9")); } void testConstructorWithString_EmptyNode() { @@ -127,9 +127,9 @@ class JIDTest : public CppUnit::TestFixture void testConstructorWithStrings() { JID testling("foo", "bar", "baz"); - CPPUNIT_ASSERT_EQUAL(String("foo"), testling.getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.getDomain()); - CPPUNIT_ASSERT_EQUAL(String("baz"), testling.getResource()); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), testling.getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("baz"), testling.getResource()); } void testIsBare() { @@ -143,49 +143,49 @@ class JIDTest : public CppUnit::TestFixture void testToBare() { JID testling("foo@bar/baz"); - CPPUNIT_ASSERT_EQUAL(String("foo"), testling.toBare().getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.toBare().getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), testling.toBare().getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.toBare().getDomain()); CPPUNIT_ASSERT(testling.toBare().isBare()); } void testToBare_EmptyNode() { JID testling("bar/baz"); - CPPUNIT_ASSERT_EQUAL(String(""), testling.toBare().getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.toBare().getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.toBare().getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.toBare().getDomain()); CPPUNIT_ASSERT(testling.toBare().isBare()); } void testToBare_EmptyResource() { JID testling("bar/"); - CPPUNIT_ASSERT_EQUAL(String(""), testling.toBare().getNode()); - CPPUNIT_ASSERT_EQUAL(String("bar"), testling.toBare().getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string(""), testling.toBare().getNode()); + CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.toBare().getDomain()); CPPUNIT_ASSERT(testling.toBare().isBare()); } void testToString() { JID testling("foo@bar/baz"); - CPPUNIT_ASSERT_EQUAL(String("foo@bar/baz"), testling.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("foo@bar/baz"), testling.toString()); } void testToString_EmptyNode() { JID testling("bar/baz"); - CPPUNIT_ASSERT_EQUAL(String("bar/baz"), testling.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("bar/baz"), testling.toString()); } void testToString_NoResource() { JID testling("foo@bar"); - CPPUNIT_ASSERT_EQUAL(String("foo@bar"), testling.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("foo@bar"), testling.toString()); } void testToString_EmptyResource() { JID testling("foo@bar/"); - CPPUNIT_ASSERT_EQUAL(String("foo@bar/"), testling.toString()); + CPPUNIT_ASSERT_EQUAL(std::string("foo@bar/"), testling.toString()); } void testCompare_SmallerNode() { diff --git a/Swiften/Jingle/IncomingJingleSession.cpp b/Swiften/Jingle/IncomingJingleSession.cpp index 29155b8..b18d9d3 100644 --- a/Swiften/Jingle/IncomingJingleSession.cpp +++ b/Swiften/Jingle/IncomingJingleSession.cpp @@ -8,7 +8,7 @@ namespace Swift { -IncomingJingleSession::IncomingJingleSession(const String& id, const std::vector<JingleContent::ref>& contents) : JingleSession(id, contents) { +IncomingJingleSession::IncomingJingleSession(const std::string& id, const std::vector<JingleContent::ref>& contents) : JingleSession(id, contents) { } diff --git a/Swiften/Jingle/IncomingJingleSession.h b/Swiften/Jingle/IncomingJingleSession.h index 222100f..64816f6 100644 --- a/Swiften/Jingle/IncomingJingleSession.h +++ b/Swiften/Jingle/IncomingJingleSession.h @@ -13,7 +13,7 @@ namespace Swift { class IncomingJingleSession : public JingleSession { public: - IncomingJingleSession(const String& id, const std::vector<JingleContent::ref>& contents); + IncomingJingleSession(const std::string& id, const std::vector<JingleContent::ref>& contents); typedef boost::shared_ptr<IncomingJingleSession> ref; }; diff --git a/Swiften/Jingle/JingleResponder.cpp b/Swiften/Jingle/JingleResponder.cpp index 3dfc327..2397e63 100644 --- a/Swiften/Jingle/JingleResponder.cpp +++ b/Swiften/Jingle/JingleResponder.cpp @@ -16,7 +16,7 @@ namespace Swift { JingleResponder::JingleResponder(JingleSessionManager* sessionManager, IQRouter* router) : SetResponder<JinglePayload>(router), sessionManager(sessionManager) { } -bool JingleResponder::handleSetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr<JinglePayload> payload) { +bool JingleResponder::handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<JinglePayload> payload) { if (payload->getAction() == JinglePayload::SessionInitiate) { if (sessionManager->getSession(from, payload->getSessionID())) { // TODO: Add tie-break error diff --git a/Swiften/Jingle/JingleResponder.h b/Swiften/Jingle/JingleResponder.h index 47dc90a..6e1965c 100644 --- a/Swiften/Jingle/JingleResponder.h +++ b/Swiften/Jingle/JingleResponder.h @@ -18,7 +18,7 @@ namespace Swift { JingleResponder(JingleSessionManager* sessionManager, IQRouter* router); private: - virtual bool handleSetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<JinglePayload> payload); + virtual bool handleSetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<JinglePayload> payload); private: JingleSessionManager* sessionManager; diff --git a/Swiften/Jingle/JingleSession.cpp b/Swiften/Jingle/JingleSession.cpp index 3dbb12a..d255abd 100644 --- a/Swiften/Jingle/JingleSession.cpp +++ b/Swiften/Jingle/JingleSession.cpp @@ -10,7 +10,7 @@ namespace Swift { -JingleSession::JingleSession(const String& id, const std::vector<JingleContent::ref>& contents) : id(id), contents(contents) { +JingleSession::JingleSession(const std::string& id, const std::vector<JingleContent::ref>& contents) : id(id), contents(contents) { } diff --git a/Swiften/Jingle/JingleSession.h b/Swiften/Jingle/JingleSession.h index 7ed86c2..c00492d 100644 --- a/Swiften/Jingle/JingleSession.h +++ b/Swiften/Jingle/JingleSession.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/Elements/JinglePayload.h> #include <Swiften/Elements/JingleContent.h> #include <Swiften/Base/foreach.h> @@ -20,10 +20,10 @@ namespace Swift { public: typedef boost::shared_ptr<JingleSession> ref; - JingleSession(const String& id, const std::vector<JingleContent::ref>& contents); + JingleSession(const std::string& id, const std::vector<JingleContent::ref>& contents); virtual ~JingleSession(); - String getID() const { + std::string getID() const { return id; } @@ -47,7 +47,7 @@ namespace Swift { void handleIncomingAction(JinglePayload::ref); private: - String id; + std::string id; std::vector<JingleContent::ref> contents; }; } diff --git a/Swiften/Jingle/JingleSessionManager.cpp b/Swiften/Jingle/JingleSessionManager.cpp index d8630cc..e60449b 100644 --- a/Swiften/Jingle/JingleSessionManager.cpp +++ b/Swiften/Jingle/JingleSessionManager.cpp @@ -18,7 +18,7 @@ JingleSessionManager::~JingleSessionManager() { delete responder; } -JingleSession::ref JingleSessionManager::getSession(const JID& jid, const String& id) const { +JingleSession::ref JingleSessionManager::getSession(const JID& jid, const std::string& id) const { SessionMap::const_iterator i = incomingSessions.find(JIDSession(jid, id)); return i != incomingSessions.end() ? i->second : JingleSession::ref(); } diff --git a/Swiften/Jingle/JingleSessionManager.h b/Swiften/Jingle/JingleSessionManager.h index ea4199d..3e99656 100644 --- a/Swiften/Jingle/JingleSessionManager.h +++ b/Swiften/Jingle/JingleSessionManager.h @@ -23,7 +23,7 @@ namespace Swift { JingleSessionManager(IQRouter* router); ~JingleSessionManager(); - JingleSession::ref getSession(const JID& jid, const String& id) const; + JingleSession::ref getSession(const JID& jid, const std::string& id) const; void addIncomingSessionHandler(IncomingJingleSessionHandler* handler); void removeIncomingSessionHandler(IncomingJingleSessionHandler* handler); @@ -36,12 +36,12 @@ namespace Swift { JingleResponder* responder; std::vector<IncomingJingleSessionHandler*> incomingSessionHandlers; struct JIDSession { - JIDSession(const JID& jid, const String& session) : jid(jid), session(session) {} + JIDSession(const JID& jid, const std::string& session) : jid(jid), session(session) {} bool operator<(const JIDSession& o) const { return jid == o.jid ? session < o.session : jid < o.jid; } JID jid; - String session; + std::string session; }; typedef std::map<JIDSession, JingleSession::ref> SessionMap; SessionMap incomingSessions; diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp index f9f2f8f..dd189d9 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp @@ -25,7 +25,7 @@ boost::shared_ptr<DNSSDBrowseQuery> AvahiQuerier::createBrowseQuery() { return boost::shared_ptr<DNSSDBrowseQuery>(new AvahiBrowseQuery(shared_from_this(), eventLoop)); } -boost::shared_ptr<DNSSDRegisterQuery> AvahiQuerier::createRegisterQuery(const String& name, int port, const ByteArray& info) { +boost::shared_ptr<DNSSDRegisterQuery> AvahiQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { return boost::shared_ptr<DNSSDRegisterQuery>(new AvahiRegisterQuery(name, port, info, shared_from_this(), eventLoop)); } @@ -33,7 +33,7 @@ boost::shared_ptr<DNSSDResolveServiceQuery> AvahiQuerier::createResolveServiceQu return boost::shared_ptr<DNSSDResolveServiceQuery>(new AvahiResolveServiceQuery(service, shared_from_this(), eventLoop)); } -boost::shared_ptr<DNSSDResolveHostnameQuery> AvahiQuerier::createResolveHostnameQuery(const String& hostname, int interfaceIndex) { +boost::shared_ptr<DNSSDResolveHostnameQuery> AvahiQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { return boost::shared_ptr<DNSSDResolveHostnameQuery>(new AvahiResolveHostnameQuery(hostname, interfaceIndex, shared_from_this(), eventLoop)); } diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h index d900ade..bfb017e 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h @@ -30,11 +30,11 @@ namespace Swift { boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( - const String& name, int port, const ByteArray& info); + const std::string& name, int port, const ByteArray& info); boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( - const String& hostname, int interfaceIndex); + const std::string& hostname, int interfaceIndex); void start(); void stop(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h index 780a0ca..07966af 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h @@ -18,7 +18,7 @@ namespace Swift { class AvahiRegisterQuery : public DNSSDRegisterQuery, public AvahiQuery { public: - AvahiRegisterQuery(const String& name, int port, const ByteArray& txtRecord, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), name(name), port(port), txtRecord(txtRecord), group(0) { + AvahiRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), name(name), port(port), txtRecord(txtRecord), group(0) { } void registerService() { @@ -58,7 +58,7 @@ namespace Swift { AvahiStringList* txtList; avahi_string_list_parse(txtRecord.getData(), txtRecord.getSize(), &txtList); - int result = avahi_entry_group_add_service_strlst(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, static_cast<AvahiPublishFlags>(0), name.getUTF8Data(), "_presence._tcp", NULL, NULL, port, txtList); + int result = avahi_entry_group_add_service_strlst(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, static_cast<AvahiPublishFlags>(0), name.c_str(), "_presence._tcp", NULL, NULL, port, txtList); if (result < 0) { std::cout << "Error registering service: " << avahi_strerror(result) << std::endl; eventLoop->postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<DNSSDServiceID>()), shared_from_this()); @@ -100,7 +100,7 @@ namespace Swift { /* DNSServiceErrorType result = DNSServiceRegister( - &sdRef, 0, 0, name.getUTF8Data(), "_presence._tcp", NULL, NULL, port, + &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, port, txtRecord.getSize(), txtRecord.getData(), &AvahiRegisterQuery::handleServiceRegisteredStatic, this); if (result != kDNSServiceErr_NoError) { @@ -125,7 +125,7 @@ namespace Swift { */ private: - String name; + std::string name; int port; ByteArray txtRecord; AvahiEntryGroup* group; diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h index ebbc68f..00712f1 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h" #include "Swiften/EventLoop/EventLoop.h" @@ -19,7 +19,7 @@ namespace Swift { class AvahiResolveHostnameQuery : public DNSSDResolveHostnameQuery, public AvahiQuery { public: - AvahiResolveHostnameQuery(const String& hostname, int, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) { + AvahiResolveHostnameQuery(const std::string& hostname, int, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) { std::cout << "Resolving hostname " << hostname << std::endl; } @@ -32,6 +32,6 @@ namespace Swift { private: HostAddress hostAddress; - String hostname; + std::string hostname; }; } diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h index a7985ec..e9c4db1 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h @@ -24,7 +24,7 @@ namespace Swift { std::cout << "Start resolving " << service.getName() << " " << service.getType() << " " << service.getDomain() << std::endl; avahi_threaded_poll_lock(querier->getThreadedPoll()); assert(!resolver); - resolver = avahi_service_resolver_new(querier->getClient(), service.getNetworkInterfaceID(), AVAHI_PROTO_UNSPEC, service.getName().getUTF8Data(), service.getType().getUTF8Data(), service.getDomain().getUTF8Data(), AVAHI_PROTO_UNSPEC, static_cast<AvahiLookupFlags>(0), handleServiceResolvedStatic, this); + resolver = avahi_service_resolver_new(querier->getClient(), service.getNetworkInterfaceID(), AVAHI_PROTO_UNSPEC, service.getName().c_str(), service.getType().c_str(), service.getDomain().c_str(), AVAHI_PROTO_UNSPEC, static_cast<AvahiLookupFlags>(0), handleServiceResolvedStatic, this); if (!resolver) { std::cout << "Error starting resolver" << std::endl; eventLoop->postEvent(boost::bind(boost::ref(onServiceResolved), boost::optional<Result>()), shared_from_this()); @@ -62,12 +62,12 @@ namespace Swift { avahi_string_list_serialize(txt, txtRecord.getData(), txtRecord.getSize()); // FIXME: Probably not accurate - String fullname = String(name) + "." + String(type) + "." + String(domain) + "."; - std::cout << "Result: " << fullname << "->" << String(a) << ":" << port << std::endl; + std::string fullname = std::string(name) + "." + std::string(type) + "." + std::string(domain) + "."; + std::cout << "Result: " << fullname << "->" << std::string(a) << ":" << port << std::endl; eventLoop->postEvent( boost::bind( boost::ref(onServiceResolved), - Result(fullname, String(a), port, txtRecord)), + Result(fullname, std::string(a), port, txtRecord)), shared_from_this()); break; } diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp index 03271d6..2d346d9 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp @@ -35,7 +35,7 @@ boost::shared_ptr<DNSSDBrowseQuery> BonjourQuerier::createBrowseQuery() { return boost::shared_ptr<DNSSDBrowseQuery>(new BonjourBrowseQuery(shared_from_this(), eventLoop)); } -boost::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const String& name, int port, const ByteArray& info) { +boost::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { return boost::shared_ptr<DNSSDRegisterQuery>(new BonjourRegisterQuery(name, port, info, shared_from_this(), eventLoop)); } @@ -43,7 +43,7 @@ boost::shared_ptr<DNSSDResolveServiceQuery> BonjourQuerier::createResolveService return boost::shared_ptr<DNSSDResolveServiceQuery>(new BonjourResolveServiceQuery(service, shared_from_this(), eventLoop)); } -boost::shared_ptr<DNSSDResolveHostnameQuery> BonjourQuerier::createResolveHostnameQuery(const String& hostname, int interfaceIndex) { +boost::shared_ptr<DNSSDResolveHostnameQuery> BonjourQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { return boost::shared_ptr<DNSSDResolveHostnameQuery>(new BonjourResolveHostnameQuery(hostname, interfaceIndex, shared_from_this(), eventLoop)); } diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h index 916acc3..edd3056 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h @@ -27,11 +27,11 @@ namespace Swift { boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( - const String& name, int port, const ByteArray& info); + const std::string& name, int port, const ByteArray& info); boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( - const String& hostname, int interfaceIndex); + const std::string& hostname, int interfaceIndex); void start(); void stop(); diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h index 9d8516b..7eb7ae1 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h @@ -16,9 +16,9 @@ namespace Swift { class BonjourRegisterQuery : public DNSSDRegisterQuery, public BonjourQuery { public: - BonjourRegisterQuery(const String& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceRegister( - &sdRef, 0, 0, name.getUTF8Data(), "_presence._tcp", NULL, NULL, port, + &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, port, txtRecord.getSize(), txtRecord.getData(), &BonjourRegisterQuery::handleServiceRegisteredStatic, this); if (result != kDNSServiceErr_NoError) { diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h index 16e9be6..b08b0b7 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h @@ -8,7 +8,7 @@ #pragma GCC diagnostic ignored "-Wold-style-cast" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h" #include "Swiften/EventLoop/EventLoop.h" @@ -21,10 +21,10 @@ namespace Swift { class BonjourResolveHostnameQuery : public DNSSDResolveHostnameQuery, public BonjourQuery { public: - BonjourResolveHostnameQuery(const String& hostname, int interfaceIndex, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourResolveHostnameQuery(const std::string& hostname, int interfaceIndex, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceGetAddrInfo( &sdRef, 0, interfaceIndex, kDNSServiceProtocol_IPv4, - hostname.getUTF8Data(), + hostname.c_str(), &BonjourResolveHostnameQuery::handleHostnameResolvedStatic, this); if (result != kDNSServiceErr_NoError) { sdRef = NULL; diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h index 136b366..0501b56 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h @@ -20,8 +20,8 @@ namespace Swift { BonjourResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceResolve( &sdRef, 0, service.getNetworkInterfaceID(), - service.getName().getUTF8Data(), service.getType().getUTF8Data(), - service.getDomain().getUTF8Data(), + service.getName().c_str(), service.getType().c_str(), + service.getDomain().c_str(), &BonjourResolveServiceQuery::handleServiceResolvedStatic, this); if (result != kDNSServiceErr_NoError) { sdRef = NULL; @@ -55,7 +55,7 @@ namespace Swift { eventLoop->postEvent( boost::bind( boost::ref(onServiceResolved), - Result(String(fullName), String(host), port, + Result(std::string(fullName), std::string(host), port, ByteArray(reinterpret_cast<const char*>(txtRecord), txtLen))), shared_from_this()); } diff --git a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h index 21c4bdc..cd55fb7 100644 --- a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> namespace Swift { - class String; + class ByteArray; class DNSSDServiceID; class DNSSDBrowseQuery; @@ -26,10 +26,10 @@ namespace Swift { virtual boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery() = 0; virtual boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( - const String& name, int port, const ByteArray& info) = 0; + const std::string& name, int port, const ByteArray& info) = 0; virtual boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&) = 0; virtual boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( - const String& hostname, int interfaceIndex) = 0; + const std::string& hostname, int interfaceIndex) = 0; }; } diff --git a/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h index b5ce232..ad73663 100644 --- a/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h @@ -16,10 +16,10 @@ namespace Swift { class DNSSDResolveServiceQuery { public: struct Result { - Result(const String& fullName, const String& host, int port, const ByteArray& info) : + Result(const std::string& fullName, const std::string& host, int port, const ByteArray& info) : fullName(fullName), host(host), port(port), info(info) {} - String fullName; - String host; + std::string fullName; + std::string host; int port; ByteArray info; }; diff --git a/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h index 1a720a0..9ce0781 100644 --- a/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h +++ b/Swiften/LinkLocal/DNSSD/DNSSDServiceID.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class DNSSDServiceID { @@ -14,9 +14,9 @@ namespace Swift { static const char* PresenceServiceType; DNSSDServiceID( - const String& name, - const String& domain, - const String& type = PresenceServiceType, + const std::string& name, + const std::string& domain, + const std::string& type = PresenceServiceType, int networkInterface = -1) : name(name), domain(domain), @@ -47,15 +47,15 @@ namespace Swift { } } - const String& getName() const { + const std::string& getName() const { return name; } - const String& getDomain() const { + const std::string& getDomain() const { return domain; } - const String& getType() const { + const std::string& getType() const { return type; } @@ -64,9 +64,9 @@ namespace Swift { } private: - String name; - String domain; - String type; + std::string name; + std::string domain; + std::string type; int networkInterface; }; } diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp index 0bcdba1..d7d0228 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp @@ -16,7 +16,7 @@ namespace Swift { -FakeDNSSDQuerier::FakeDNSSDQuerier(const String& domain, EventLoop* eventLoop) : domain(domain), eventLoop(eventLoop) { +FakeDNSSDQuerier::FakeDNSSDQuerier(const std::string& domain, EventLoop* eventLoop) : domain(domain), eventLoop(eventLoop) { } FakeDNSSDQuerier::~FakeDNSSDQuerier() { @@ -29,7 +29,7 @@ boost::shared_ptr<DNSSDBrowseQuery> FakeDNSSDQuerier::createBrowseQuery() { return boost::shared_ptr<DNSSDBrowseQuery>(new FakeDNSSDBrowseQuery(shared_from_this())); } -boost::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const String& name, int port, const ByteArray& info) { +boost::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { return boost::shared_ptr<DNSSDRegisterQuery>(new FakeDNSSDRegisterQuery(name, port, info, shared_from_this())); } @@ -37,7 +37,7 @@ boost::shared_ptr<DNSSDResolveServiceQuery> FakeDNSSDQuerier::createResolveServi return boost::shared_ptr<DNSSDResolveServiceQuery>(new FakeDNSSDResolveServiceQuery(service, shared_from_this())); } -boost::shared_ptr<DNSSDResolveHostnameQuery> FakeDNSSDQuerier::createResolveHostnameQuery(const String& hostname, int interfaceIndex) { +boost::shared_ptr<DNSSDResolveHostnameQuery> FakeDNSSDQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { return boost::shared_ptr<DNSSDResolveHostnameQuery>(new FakeDNSSDResolveHostnameQuery(hostname, interfaceIndex, shared_from_this())); } @@ -61,7 +61,7 @@ void FakeDNSSDQuerier::addRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) eventLoop->postEvent(boost::bind(boost::ref(registerQuery->onRegisterFinished), service), shared_from_this()); } else if (boost::shared_ptr<FakeDNSSDResolveHostnameQuery> resolveHostnameQuery = boost::dynamic_pointer_cast<FakeDNSSDResolveHostnameQuery>(query)) { - std::map<String,boost::optional<HostAddress> >::const_iterator i = addresses.find(resolveHostnameQuery->hostname); + std::map<std::string,boost::optional<HostAddress> >::const_iterator i = addresses.find(resolveHostnameQuery->hostname); if (i != addresses.end()) { eventLoop->postEvent( boost::bind( @@ -103,7 +103,7 @@ void FakeDNSSDQuerier::setServiceInfo(const DNSSDServiceID& id, const DNSSDResol } } -bool FakeDNSSDQuerier::isServiceRegistered(const String& name, int port, const ByteArray& info) { +bool FakeDNSSDQuerier::isServiceRegistered(const std::string& name, int port, const ByteArray& info) { foreach(const boost::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { if (query->name == name && query->port == port && query->info == info) { return true; @@ -124,7 +124,7 @@ void FakeDNSSDQuerier::setRegisterError() { } } -void FakeDNSSDQuerier::setAddress(const String& hostname, boost::optional<HostAddress> address) { +void FakeDNSSDQuerier::setAddress(const std::string& hostname, boost::optional<HostAddress> address) { addresses[hostname] = address; foreach(const boost::shared_ptr<FakeDNSSDResolveHostnameQuery>& query, getQueries<FakeDNSSDResolveHostnameQuery>()) { if (query->hostname == hostname) { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h index 9338dd4..b2871c9 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h @@ -12,7 +12,7 @@ #include <set> #include "Swiften/Base/foreach.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/EventLoop/EventOwner.h" #include "Swiften/LinkLocal/DNSSD/DNSSDQuerier.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h" @@ -29,7 +29,7 @@ namespace Swift { public EventOwner, public boost::enable_shared_from_this<FakeDNSSDQuerier> { public: - FakeDNSSDQuerier(const String& domain, EventLoop* eventLoop); + FakeDNSSDQuerier(const std::string& domain, EventLoop* eventLoop); ~FakeDNSSDQuerier(); void start() {} @@ -41,11 +41,11 @@ namespace Swift { boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( - const String& name, int port, const ByteArray& info); + const std::string& name, int port, const ByteArray& info); boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( - const String& hostname, int interfaceIndex); + const std::string& hostname, int interfaceIndex); void addRunningQuery(boost::shared_ptr<FakeDNSSDQuery>); void removeRunningQuery(boost::shared_ptr<FakeDNSSDQuery>); @@ -53,8 +53,8 @@ namespace Swift { void addService(const DNSSDServiceID& id); void removeService(const DNSSDServiceID& id); void setServiceInfo(const DNSSDServiceID& id, const DNSSDResolveServiceQuery::Result& info); - bool isServiceRegistered(const String& name, int port, const ByteArray& info); - void setAddress(const String& hostname, boost::optional<HostAddress> address); + bool isServiceRegistered(const std::string& name, int port, const ByteArray& info); + void setAddress(const std::string& hostname, boost::optional<HostAddress> address); void setBrowseError(); void setRegisterError(); @@ -84,13 +84,13 @@ namespace Swift { } private: - String domain; + std::string domain; EventLoop* eventLoop; std::list< boost::shared_ptr<FakeDNSSDQuery> > runningQueries; std::list< boost::shared_ptr<FakeDNSSDQuery> > allQueriesEverRun; std::set<DNSSDServiceID> services; typedef std::map<DNSSDServiceID,DNSSDResolveServiceQuery::Result> ServiceInfoMap; ServiceInfoMap serviceInfo; - std::map<String, boost::optional<HostAddress> > addresses; + std::map<std::string, boost::optional<HostAddress> > addresses; }; } diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h index dc144b3..a6ae17a 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h @@ -9,14 +9,14 @@ #include "Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h" #include "Swiften/Base/ByteArray.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class FakeDNSSDQuerier; class FakeDNSSDRegisterQuery : public DNSSDRegisterQuery, public FakeDNSSDQuery { public: - FakeDNSSDRegisterQuery(const String& name, int port, const ByteArray& info, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) { + FakeDNSSDRegisterQuery(const std::string& name, int port, const ByteArray& info, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) { } void registerService() { @@ -31,7 +31,7 @@ namespace Swift { finish(); } - String name; + std::string name; int port; ByteArray info; }; diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h index b19bfe9..cbaa6e6 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h" #include "Swiften/Network/HostAddress.h" @@ -16,7 +16,7 @@ namespace Swift { class FakeDNSSDResolveHostnameQuery : public DNSSDResolveHostnameQuery, public FakeDNSSDQuery { public: - FakeDNSSDResolveHostnameQuery(const String& hostname, int interfaceIndex, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), hostname(hostname), interfaceIndex(interfaceIndex) { + FakeDNSSDResolveHostnameQuery(const std::string& hostname, int interfaceIndex, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), hostname(hostname), interfaceIndex(interfaceIndex) { } void run() { @@ -27,7 +27,7 @@ namespace Swift { FakeDNSSDQuery::finish(); } - String hostname; + std::string hostname; int interfaceIndex; }; } diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.h b/Swiften/LinkLocal/IncomingLinkLocalSession.h index 2973330..a586a2e 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.h +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.h @@ -15,7 +15,7 @@ namespace Swift { class ProtocolHeader; - class String; + class Element; class PayloadParserFactoryCollection; class PayloadSerializerCollection; diff --git a/Swiften/LinkLocal/LinkLocalService.cpp b/Swiften/LinkLocal/LinkLocalService.cpp index d67361c..c8d707d 100644 --- a/Swiften/LinkLocal/LinkLocalService.cpp +++ b/Swiften/LinkLocal/LinkLocalService.cpp @@ -8,19 +8,19 @@ namespace Swift { -String LinkLocalService::getDescription() const { +std::string LinkLocalService::getDescription() const { LinkLocalServiceInfo info = getInfo(); - if (!info.getNick().isEmpty()) { + if (!info.getNick().empty()) { return info.getNick(); } - else if (!info.getFirstName().isEmpty()) { - String result = info.getFirstName(); - if (!info.getLastName().isEmpty()) { + else if (!info.getFirstName().empty()) { + std::string result = info.getFirstName(); + if (!info.getLastName().empty()) { result += " " + info.getLastName(); } return result; } - else if (!info.getLastName().isEmpty()) { + else if (!info.getLastName().empty()) { return info.getLastName(); } return getName(); diff --git a/Swiften/LinkLocal/LinkLocalService.h b/Swiften/LinkLocal/LinkLocalService.h index 27491e4..2e74338 100644 --- a/Swiften/LinkLocal/LinkLocalService.h +++ b/Swiften/LinkLocal/LinkLocalService.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h" @@ -25,7 +25,7 @@ namespace Swift { return id; } - const String& getName() const { + const std::string& getName() const { return id.getName(); } @@ -33,7 +33,7 @@ namespace Swift { return info.port; } - const String& getHostname() const { + const std::string& getHostname() const { return info.host; } @@ -41,7 +41,7 @@ namespace Swift { return LinkLocalServiceInfo::createFromTXTRecord(info.info); } - String getDescription() const; + std::string getDescription() const; JID getJID() const; diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp index efd56e3..8393ade 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp @@ -63,7 +63,7 @@ bool LinkLocalServiceBrowser::isRegistered() const { return registerQuery; } -void LinkLocalServiceBrowser::registerService(const String& name, int port, const LinkLocalServiceInfo& info) { +void LinkLocalServiceBrowser::registerService(const std::string& name, int port, const LinkLocalServiceInfo& info) { assert(!registerQuery); registerQuery = querier->createRegisterQuery(name, port, info.toTXTRecord()); registerQuery->onRegisterFinished.connect( diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.h b/Swiften/LinkLocal/LinkLocalServiceBrowser.h index 6918150..56b4aa4 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.h +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.h @@ -12,7 +12,7 @@ #include <map> #include <vector> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/LinkLocal/DNSSD/DNSSDQuerier.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h" @@ -32,7 +32,7 @@ namespace Swift { bool hasError() const; void registerService( - const String& name, + const std::string& name, int port, const LinkLocalServiceInfo& info = LinkLocalServiceInfo()); void updateService( diff --git a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp index cdde354..bec2e97 100644 --- a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp @@ -12,26 +12,26 @@ namespace Swift { ByteArray LinkLocalServiceInfo::toTXTRecord() const { ByteArray result(getEncoded("txtvers=1")); - if (!firstName.isEmpty()) { + if (!firstName.empty()) { result += getEncoded("1st=" + firstName); } - if (!lastName.isEmpty()) { + if (!lastName.empty()) { result += getEncoded("last=" + lastName); } - if (!email.isEmpty()) { + if (!email.empty()) { result += getEncoded("email=" + email); } if (jid.isValid()) { result += getEncoded("jid=" + jid.toString()); } - if (!message.isEmpty()) { + if (!message.empty()) { result += getEncoded("msg=" + message); } - if (!nick.isEmpty()) { + if (!nick.empty()) { result += getEncoded("nick=" + nick); } if (port) { - result += getEncoded("port.p2pj=" + String(boost::lexical_cast<std::string>(*port))); + result += getEncoded("port.p2pj=" + std::string(boost::lexical_cast<std::string>(*port))); } switch (status) { @@ -43,10 +43,10 @@ ByteArray LinkLocalServiceInfo::toTXTRecord() const { return result; } -ByteArray LinkLocalServiceInfo::getEncoded(const String& s) { +ByteArray LinkLocalServiceInfo::getEncoded(const std::string& s) { ByteArray sizeByte; sizeByte.resize(1); - sizeByte[0] = s.getUTF8Size(); + sizeByte[0] = s.size(); return sizeByte + ByteArray(s); } @@ -54,8 +54,8 @@ LinkLocalServiceInfo LinkLocalServiceInfo::createFromTXTRecord(const ByteArray& LinkLocalServiceInfo info; size_t i = 0; while (i < record.getSize()) { - std::pair<String,String> entry = readEntry(record, &i); - if (entry.first.isEmpty()) { + std::pair<std::string,std::string> entry = readEntry(record, &i); + if (entry.first.empty()) { break; } else if (entry.first == "1st") { @@ -91,10 +91,10 @@ LinkLocalServiceInfo LinkLocalServiceInfo::createFromTXTRecord(const ByteArray& return info; } -std::pair<String,String> LinkLocalServiceInfo::readEntry(const ByteArray& record, size_t* index) { +std::pair<std::string,std::string> LinkLocalServiceInfo::readEntry(const ByteArray& record, size_t* index) { size_t& i = *index; - String key; - String value; + std::string key; + std::string value; size_t entryEnd = i + 1 + record[i]; ++i; diff --git a/Swiften/LinkLocal/LinkLocalServiceInfo.h b/Swiften/LinkLocal/LinkLocalServiceInfo.h index efe9245..a166c64 100644 --- a/Swiften/LinkLocal/LinkLocalServiceInfo.h +++ b/Swiften/LinkLocal/LinkLocalServiceInfo.h @@ -9,7 +9,7 @@ #include <boost/optional.hpp> #include "Swiften/Base/ByteArray.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" namespace Swift { @@ -20,23 +20,23 @@ namespace Swift { LinkLocalServiceInfo() : status(Available) {} - const String& getFirstName() const { return firstName; } - void setFirstName(const String& f) { firstName = f; } + const std::string& getFirstName() const { return firstName; } + void setFirstName(const std::string& f) { firstName = f; } - const String& getLastName() const { return lastName; } - void setLastName(const String& l) { lastName = l; } + const std::string& getLastName() const { return lastName; } + void setLastName(const std::string& l) { lastName = l; } - const String& getEMail() const { return email; } - void setEMail(const String& e) { email = e; } + const std::string& getEMail() const { return email; } + void setEMail(const std::string& e) { email = e; } const JID& getJID() const { return jid; } void setJID(const JID& j) { jid = j; } - const String& getMessage() const { return message; } - void setMessage(const String& m) { message = m; } + const std::string& getMessage() const { return message; } + void setMessage(const std::string& m) { message = m; } - const String& getNick() const { return nick; } - void setNick(const String& n) { nick = n; } + const std::string& getNick() const { return nick; } + void setNick(const std::string& n) { nick = n; } Status getStatus() const { return status; } void setStatus(Status s) { status = s; } @@ -49,16 +49,16 @@ namespace Swift { static LinkLocalServiceInfo createFromTXTRecord(const ByteArray& record); private: - static ByteArray getEncoded(const String&); - static std::pair<String,String> readEntry(const ByteArray&, size_t*); + static ByteArray getEncoded(const std::string&); + static std::pair<std::string,std::string> readEntry(const ByteArray&, size_t*); private: - String firstName; - String lastName; - String email; + std::string firstName; + std::string lastName; + std::string email; JID jid; - String message; - String nick; + std::string message; + std::string nick; Status status; boost::optional<int> port; }; diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.h b/Swiften/LinkLocal/OutgoingLinkLocalSession.h index 2c339bb..34ea411 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.h +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.h @@ -16,7 +16,7 @@ namespace Swift { class ConnectionFactory; - class String; + class Element; class PayloadParserFactoryCollection; class PayloadSerializerCollection; diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp index 65b8a67..98deed1 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp @@ -51,7 +51,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(connectFinished); CPPUNIT_ASSERT(!connectError); CPPUNIT_ASSERT(connection->connectedTo); - CPPUNIT_ASSERT_EQUAL(String(connection->connectedTo->getAddress().toString()), String("192.168.1.1")); + CPPUNIT_ASSERT_EQUAL(std::string(connection->connectedTo->getAddress().toString()), std::string("192.168.1.1")); CPPUNIT_ASSERT_EQUAL(connection->connectedTo->getPort(), 1234); } @@ -113,7 +113,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<LinkLocalConnector> createConnector(const String& hostname, int port) { + boost::shared_ptr<LinkLocalConnector> createConnector(const std::string& hostname, int port) { LinkLocalService service( DNSSDServiceID("myname", "local."), DNSSDResolveServiceQuery::Result( diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp index 1e0ee8a..3943e31 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp @@ -28,21 +28,21 @@ class LinkLocalServiceInfoTest : public CppUnit::TestFixture { info.setLastName("Tron\xc3\xe7on"); info.setStatus(LinkLocalServiceInfo::Away); - CPPUNIT_ASSERT_EQUAL(ByteArray("\x09txtvers=1\x09" + String("1st=Remko\x0dlast=Tron\xc3\xe7on\x0bstatus=away")), info.toTXTRecord()); + CPPUNIT_ASSERT_EQUAL(ByteArray("\x09txtvers=1\x09" + std::string("1st=Remko\x0dlast=Tron\xc3\xe7on\x0bstatus=away")), info.toTXTRecord()); } void testCreateFromTXTRecord() { - LinkLocalServiceInfo info = LinkLocalServiceInfo::createFromTXTRecord(ByteArray("\x09txtvers=1\x09" + String("1st=Remko\x0dlast=Tron\xc3\xe7on\x0bstatus=away"))); + LinkLocalServiceInfo info = LinkLocalServiceInfo::createFromTXTRecord(ByteArray("\x09txtvers=1\x09" + std::string("1st=Remko\x0dlast=Tron\xc3\xe7on\x0bstatus=away"))); - CPPUNIT_ASSERT_EQUAL(String("Remko"), info.getFirstName()); - CPPUNIT_ASSERT_EQUAL(String("Tron\xc3\xe7on"), info.getLastName()); + CPPUNIT_ASSERT_EQUAL(std::string("Remko"), info.getFirstName()); + CPPUNIT_ASSERT_EQUAL(std::string("Tron\xc3\xe7on"), info.getLastName()); CPPUNIT_ASSERT_EQUAL(LinkLocalServiceInfo::Away, info.getStatus()); } void testCreateFromTXTRecord_InvalidSize() { LinkLocalServiceInfo info = LinkLocalServiceInfo::createFromTXTRecord(ByteArray("\x10last=a")); - CPPUNIT_ASSERT_EQUAL(String("a"), info.getLastName()); + CPPUNIT_ASSERT_EQUAL(std::string("a"), info.getLastName()); } void testGetTXTRecordCreateFromTXTRecord_RoundTrip() { diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalServiceTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalServiceTest.cpp index 0d4de13..4835bde 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalServiceTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalServiceTest.cpp @@ -24,35 +24,35 @@ class LinkLocalServiceTest : public CppUnit::TestFixture { void testGetDescription_WithNick() { LinkLocalService testling = createService("alice@wonderland", "Alice", "Alice In", "Wonderland"); - CPPUNIT_ASSERT_EQUAL(String("Alice"), testling.getDescription()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice"), testling.getDescription()); } void testGetDescription_WithFirstName() { LinkLocalService testling = createService("alice@wonderland", "", "Alice In"); - CPPUNIT_ASSERT_EQUAL(String("Alice In"), testling.getDescription()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice In"), testling.getDescription()); } void testGetDescription_WithLastName() { LinkLocalService testling = createService("alice@wonderland", "", "", "Wonderland"); - CPPUNIT_ASSERT_EQUAL(String("Wonderland"), testling.getDescription()); + CPPUNIT_ASSERT_EQUAL(std::string("Wonderland"), testling.getDescription()); } void testGetDescription_WithFirstAndLastName() { LinkLocalService testling = createService("alice@wonderland", "", "Alice In", "Wonderland"); - CPPUNIT_ASSERT_EQUAL(String("Alice In Wonderland"), testling.getDescription()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice In Wonderland"), testling.getDescription()); } void testGetDescription_NoInfo() { LinkLocalService testling = createService("alice@wonderland"); - CPPUNIT_ASSERT_EQUAL(String("alice@wonderland"), testling.getDescription()); + CPPUNIT_ASSERT_EQUAL(std::string("alice@wonderland"), testling.getDescription()); } private: - LinkLocalService createService(const String& name, const String& nickName = String(), const String& firstName = String(), const String& lastName = String()) { + LinkLocalService createService(const std::string& name, const std::string& nickName = std::string(), const std::string& firstName = std::string(), const std::string& lastName = std::string()) { DNSSDServiceID service(name, "local."); LinkLocalServiceInfo info; info.setFirstName(firstName); diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp index 486ba27..b8c23cd 100644 --- a/Swiften/MUC/MUC.cpp +++ b/Swiften/MUC/MUC.cpp @@ -22,7 +22,7 @@ namespace Swift { -typedef std::pair<String, MUCOccupant> StringMUCOccupantPair; +typedef std::pair<std::string, MUCOccupant> StringMUCOccupantPair; MUC::MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSender* presenceSender, const JID &muc, MUCRegistry* mucRegistry) : ownMUCJID(muc), stanzaChannel(stanzaChannel), iqRouter_(iqRouter), presenceSender(presenceSender), mucRegistry(mucRegistry) { scopedConnection_ = stanzaChannel->onPresenceReceived.connect(boost::bind(&MUC::handleIncomingPresence, this, _1)); @@ -33,7 +33,7 @@ MUC::MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSende /** * Join the MUC with default context. */ -void MUC::joinAs(const String &nick) { +void MUC::joinAs(const std::string &nick) { joinSince_ = boost::posix_time::not_a_date_time; internalJoin(nick); } @@ -41,12 +41,12 @@ void MUC::joinAs(const String &nick) { /** * Join the MUC with context since date. */ -void MUC::joinWithContextSince(const String &nick, const boost::posix_time::ptime& since) { +void MUC::joinWithContextSince(const std::string &nick, const boost::posix_time::ptime& since) { joinSince_ = since; internalJoin(nick); } -void MUC::internalJoin(const String &nick) { +void MUC::internalJoin(const std::string &nick) { //TODO: password //TODO: history request joinComplete_ = false; @@ -74,7 +74,7 @@ void MUC::part() { } void MUC::handleUserLeft(LeavingType type) { - std::map<String,MUCOccupant>::iterator i = occupants.find(ownMUCJID.getResource()); + std::map<std::string,MUCOccupant>::iterator i = occupants.find(ownMUCJID.getResource()); if (i != occupants.end()) { MUCOccupant me = i->second; occupants.erase(i); @@ -102,7 +102,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) { // (i.e. we start getting non-error presence from the MUC) or not if (!joinSucceeded_) { if (presence->getType() == Presence::Error) { - String reason; + std::string reason; onJoinFailed(presence->getPayload<ErrorPayload>()); return; } @@ -112,8 +112,8 @@ void MUC::handleIncomingPresence(Presence::ref presence) { } } - String nick = presence->getFrom().getResource(); - if (nick.isEmpty()) { + std::string nick = presence->getFrom().getResource(); + if (nick.empty()) { return; } MUCOccupant::Role role(MUCOccupant::NoRole); @@ -135,7 +135,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) { return; } else { - std::map<String,MUCOccupant>::iterator i = occupants.find(nick); + std::map<std::string,MUCOccupant>::iterator i = occupants.find(nick); if (i != occupants.end()) { //TODO: part type onOccupantLeft(i->second, Part, ""); @@ -144,7 +144,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) { } } else if (presence->getType() == Presence::Available) { - std::map<String, MUCOccupant>::iterator it = occupants.find(nick); + std::map<std::string, MUCOccupant>::iterator it = occupants.find(nick); MUCOccupant occupant(nick, role, affiliation); bool isJoin = true; if (realJID) { @@ -161,7 +161,7 @@ void MUC::handleIncomingPresence(Presence::ref presence) { } occupants.erase(it); } - std::pair<std::map<String, MUCOccupant>::iterator, bool> result = occupants.insert(std::make_pair(nick, occupant)); + std::pair<std::map<std::string, MUCOccupant>::iterator, bool> result = occupants.insert(std::make_pair(nick, occupant)); if (isJoin) { onOccupantJoined(result.first->second); } diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h index cdef292..ef76a6a 100644 --- a/Swiften/MUC/MUC.h +++ b/Swiften/MUC/MUC.h @@ -7,7 +7,7 @@ #pragma once #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Message.h" #include "Swiften/Elements/Presence.h" #include "Swiften/Elements/MUCOccupant.h" @@ -42,24 +42,24 @@ namespace Swift { return ownMUCJID.toBare(); } - void joinAs(const String &nick); - void joinWithContextSince(const String &nick, const boost::posix_time::ptime& since); + void joinAs(const std::string &nick); + void joinWithContextSince(const std::string &nick, const boost::posix_time::ptime& since); /*void queryRoomInfo(); */ /*void queryRoomItems(); */ - String getCurrentNick(); + std::string getCurrentNick(); void part(); void handleIncomingMessage(Message::ref message); /** Expose public so it can be called when e.g. user goes offline */ void handleUserLeft(LeavingType); public: - boost::signal<void (const String& /*nick*/)> onJoinComplete; + boost::signal<void (const std::string& /*nick*/)> onJoinComplete; boost::signal<void (ErrorPayload::ref)> onJoinFailed; boost::signal<void (Presence::ref)> onOccupantPresenceChange; - boost::signal<void (const String&, const MUCOccupant& /*now*/, const MUCOccupant::Role& /*old*/)> onOccupantRoleChanged; - boost::signal<void (const String&, const MUCOccupant::Affiliation& /*new*/, const MUCOccupant::Affiliation& /*old*/)> onOccupantAffiliationChanged; + boost::signal<void (const std::string&, const MUCOccupant& /*now*/, const MUCOccupant::Role& /*old*/)> onOccupantRoleChanged; + boost::signal<void (const std::string&, const MUCOccupant::Affiliation& /*new*/, const MUCOccupant::Affiliation& /*old*/)> onOccupantAffiliationChanged; boost::signal<void (const MUCOccupant&)> onOccupantJoined; - boost::signal<void (const MUCOccupant&, LeavingType, const String& /*reason*/)> onOccupantLeft; + boost::signal<void (const MUCOccupant&, LeavingType, const std::string& /*reason*/)> onOccupantLeft; /* boost::signal<void (const MUCInfo&)> onInfoResult; */ /* boost::signal<void (const blah&)> onItemsResult; */ @@ -69,13 +69,13 @@ namespace Swift { return ownMUCJID.equals(j, JID::WithoutResource); } - const String& getOwnNick() const { + const std::string& getOwnNick() const { return ownMUCJID.getResource(); } private: void handleIncomingPresence(Presence::ref presence); - void internalJoin(const String& nick); + void internalJoin(const std::string& nick); void handleCreationConfigResponse(MUCOwnerPayload::ref, ErrorPayload::ref); private: @@ -84,7 +84,7 @@ namespace Swift { IQRouter* iqRouter_; DirectedPresenceSender* presenceSender; MUCRegistry* mucRegistry; - std::map<String, MUCOccupant> occupants; + std::map<std::string, MUCOccupant> occupants; bool joinSucceeded_; bool joinComplete_; boost::bsignals::scoped_connection scopedConnection_; diff --git a/Swiften/MUC/MUCBookmark.h b/Swiften/MUC/MUCBookmark.h index 65797e5..10e1b78 100644 --- a/Swiften/MUC/MUCBookmark.h +++ b/Swiften/MUC/MUCBookmark.h @@ -8,7 +8,7 @@ #include <boost/optional.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/Elements/Storage.h" @@ -23,7 +23,7 @@ namespace Swift { autojoin_ = room.autoJoin; } - MUCBookmark(const JID& room, const String& bookmarkName) : room_(room), name_(bookmarkName), autojoin_(false) { + MUCBookmark(const JID& room, const std::string& bookmarkName) : room_(room), name_(bookmarkName), autojoin_(false) { } void setAutojoin(bool enabled) { @@ -34,23 +34,23 @@ namespace Swift { return autojoin_; } - void setNick(const boost::optional<String>& nick) { + void setNick(const boost::optional<std::string>& nick) { nick_ = nick; } - void setPassword(const boost::optional<String>& password) { + void setPassword(const boost::optional<std::string>& password) { password_ = password; } - const boost::optional<String>& getNick() const { + const boost::optional<std::string>& getNick() const { return nick_; } - const boost::optional<String>& getPassword() const { + const boost::optional<std::string>& getPassword() const { return password_; } - const String& getName() const { + const std::string& getName() const { return name_; } @@ -78,9 +78,9 @@ namespace Swift { private: JID room_; - String name_; - boost::optional<String> nick_; - boost::optional<String> password_; + std::string name_; + boost::optional<std::string> nick_; + boost::optional<std::string> password_; bool autojoin_; }; } diff --git a/Swiften/MUC/UnitTest/MUCTest.cpp b/Swiften/MUC/UnitTest/MUCTest.cpp index fd07711..117760c 100644 --- a/Swiften/MUC/UnitTest/MUCTest.cpp +++ b/Swiften/MUC/UnitTest/MUCTest.cpp @@ -73,7 +73,7 @@ class MUCTest : public CppUnit::TestFixture { Presence::ref p = channel->getStanzaAtIndex<Presence>(2); CPPUNIT_ASSERT(p); CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/Alice"), p->getTo()); - CPPUNIT_ASSERT_EQUAL(String("Test"), p->getStatus()); + CPPUNIT_ASSERT_EQUAL(std::string("Test"), p->getStatus()); } /*void testJoin_Success() { @@ -83,7 +83,7 @@ class MUCTest : public CppUnit::TestFixture { receivePresence(JID("foo@bar.com/Rabbit"), "Here"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(joinResults.size())); - CPPUNIT_ASSERT_EQUAL(String("Alice"), joinResults[0].nick); + CPPUNIT_ASSERT_EQUAL(std::string("Alice"), joinResults[0].nick); CPPUNIT_ASSERT(joinResults[0].error); } @@ -96,14 +96,14 @@ class MUCTest : public CppUnit::TestFixture { return boost::make_shared<MUC>(channel, router, presenceSender, jid, mucRegistry); } - void handleJoinFinished(const String& nick, ErrorPayload::ref error) { + void handleJoinFinished(const std::string& nick, ErrorPayload::ref error) { JoinResult r; r.nick = nick; r.error = error; joinResults.push_back(r); } - void receivePresence(const JID& jid, const String& status) { + void receivePresence(const JID& jid, const std::string& status) { Presence::ref p = Presence::create(status); p->setFrom(jid); //MUCUserPayload::ref mucUserPayload = boost::make_shared<MUCUserPayload>(); @@ -119,7 +119,7 @@ class MUCTest : public CppUnit::TestFixture { StanzaChannelPresenceSender* stanzaChannelPresenceSender; DirectedPresenceSender* presenceSender; struct JoinResult { - String nick; + std::string nick; ErrorPayload::ref error; }; std::vector<JoinResult> joinResults; diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp index 3f33cfc..f7ff8c4 100644 --- a/Swiften/Network/BoostConnection.cpp +++ b/Swiften/Network/BoostConnection.cpp @@ -12,7 +12,7 @@ #include <Swiften/Base/Log.h> #include "Swiften/EventLoop/EventLoop.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/Network/HostAddressPort.h" #include "Swiften/Base/sleep.h" diff --git a/Swiften/Network/CAresDomainNameResolver.cpp b/Swiften/Network/CAresDomainNameResolver.cpp index 8462e4f..dd49139 100644 --- a/Swiften/Network/CAresDomainNameResolver.cpp +++ b/Swiften/Network/CAresDomainNameResolver.cpp @@ -26,7 +26,7 @@ namespace Swift { class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public EventOwner { public: - CAresQuery(const String& query, int dnsclass, int type, CAresDomainNameResolver* resolver) : query(query), dnsclass(dnsclass), type(type), resolver(resolver) { + CAresQuery(const std::string& query, int dnsclass, int type, CAresDomainNameResolver* resolver) : query(query), dnsclass(dnsclass), type(type), resolver(resolver) { } virtual ~CAresQuery() { @@ -37,7 +37,7 @@ class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public Eve } void doRun(ares_channel* channel) { - ares_query(*channel, query.getUTF8Data(), dnsclass, type, &CAresQuery::handleResult, this); + ares_query(*channel, query.c_str(), dnsclass, type, &CAresQuery::handleResult, this); } static void handleResult(void* arg, int status, int timeouts, unsigned char* buffer, int len) { @@ -47,7 +47,7 @@ class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public Eve virtual void handleResult(int status, int, unsigned char* buffer, int len) = 0; private: - String query; + std::string query; int dnsclass; int type; CAresDomainNameResolver* resolver; @@ -55,7 +55,7 @@ class CAresQuery : public boost::enable_shared_from_this<CAresQuery>, public Eve class CAresDomainNameServiceQuery : public DomainNameServiceQuery, public CAresQuery { public: - CAresDomainNameServiceQuery(const String& service, CAresDomainNameResolver* resolver) : CAresQuery(service, 1, 33, resolver) { + CAresDomainNameServiceQuery(const std::string& service, CAresDomainNameResolver* resolver) : CAresQuery(service, 1, 33, resolver) { } virtual void run() { @@ -72,7 +72,7 @@ class CAresDomainNameServiceQuery : public DomainNameServiceQuery, public CAresQ record.priority = rawRecords->priority; record.weight = rawRecords->weight; record.port = rawRecords->port; - record.hostname = String(rawRecords->host); + record.hostname = std::string(rawRecords->host); records.push_back(record); } } @@ -87,7 +87,7 @@ class CAresDomainNameServiceQuery : public DomainNameServiceQuery, public CAresQ class CAresDomainNameAddressQuery : public DomainNameAddressQuery, public CAresQuery { public: - CAresDomainNameAddressQuery(const String& host, CAresDomainNameResolver* resolver) : CAresQuery(host, 1, 1, resolver) { + CAresDomainNameAddressQuery(const std::string& host, CAresDomainNameResolver* resolver) : CAresQuery(host, 1, 1, resolver) { } virtual void run() { @@ -129,11 +129,11 @@ CAresDomainNameResolver::~CAresDomainNameResolver() { ares_destroy(channel); } -boost::shared_ptr<DomainNameServiceQuery> CAresDomainNameResolver::createServiceQuery(const String& name) { +boost::shared_ptr<DomainNameServiceQuery> CAresDomainNameResolver::createServiceQuery(const std::string& name) { return boost::shared_ptr<DomainNameServiceQuery>(new CAresDomainNameServiceQuery(getNormalized(name), this)); } -boost::shared_ptr<DomainNameAddressQuery> CAresDomainNameResolver::createAddressQuery(const String& name) { +boost::shared_ptr<DomainNameAddressQuery> CAresDomainNameResolver::createAddressQuery(const std::string& name) { return boost::shared_ptr<DomainNameAddressQuery>(new CAresDomainNameAddressQuery(getNormalized(name), this)); } diff --git a/Swiften/Network/CAresDomainNameResolver.h b/Swiften/Network/CAresDomainNameResolver.h index 74bb6ae..a630b61 100644 --- a/Swiften/Network/CAresDomainNameResolver.h +++ b/Swiften/Network/CAresDomainNameResolver.h @@ -21,8 +21,8 @@ namespace Swift { CAresDomainNameResolver(); ~CAresDomainNameResolver(); - virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name); - virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name); + virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& name); + virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name); private: friend class CAresQuery; diff --git a/Swiften/Network/Connection.h b/Swiften/Network/Connection.h index 712f145..529dd82 100644 --- a/Swiften/Network/Connection.h +++ b/Swiften/Network/Connection.h @@ -10,7 +10,7 @@ #include "Swiften/Base/boost_bsignals.h" #include "Swiften/Base/ByteArray.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Network/HostAddressPort.h" namespace Swift { diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp index 28088c5..868bd50 100644 --- a/Swiften/Network/Connector.cpp +++ b/Swiften/Network/Connector.cpp @@ -17,7 +17,7 @@ namespace Swift { -Connector::Connector(const String& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0), queriedAllServices(true) { +Connector::Connector(const std::string& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0), queriedAllServices(true) { } void Connector::setTimeoutMilliseconds(int milliseconds) { @@ -45,7 +45,7 @@ void Connector::stop() { finish(boost::shared_ptr<Connection>()); } -void Connector::queryAddress(const String& hostname) { +void Connector::queryAddress(const std::string& hostname) { assert(!addressQuery); addressQuery = resolver->createAddressQuery(hostname); addressQuery->onResult.connect(boost::bind(&Connector::handleAddressQueryResult, shared_from_this(), _1, _2)); diff --git a/Swiften/Network/Connector.h b/Swiften/Network/Connector.h index 52779c2..b3e7d83 100644 --- a/Swiften/Network/Connector.h +++ b/Swiften/Network/Connector.h @@ -14,7 +14,7 @@ #include "Swiften/Network/Connection.h" #include "Swiften/Network/Timer.h" #include "Swiften/Network/HostAddressPort.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Network/DomainNameResolveError.h" namespace Swift { @@ -27,7 +27,7 @@ namespace Swift { public: typedef boost::shared_ptr<Connector> ref; - static Connector::ref create(const String& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) { + static Connector::ref create(const std::string& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) { return Connector::ref(new Connector(hostname, resolver, connectionFactory, timerFactory)); } @@ -38,11 +38,11 @@ namespace Swift { boost::signal<void (boost::shared_ptr<Connection>)> onConnectFinished; private: - Connector(const String& hostname, DomainNameResolver*, ConnectionFactory*, TimerFactory*); + Connector(const std::string& hostname, DomainNameResolver*, ConnectionFactory*, TimerFactory*); void handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result); void handleAddressQueryResult(const std::vector<HostAddress>& address, boost::optional<DomainNameResolveError> error); - void queryAddress(const String& hostname); + void queryAddress(const std::string& hostname); void tryNextServiceOrFallback(); void tryNextAddress(); @@ -54,7 +54,7 @@ namespace Swift { private: - String hostname; + std::string hostname; DomainNameResolver* resolver; ConnectionFactory* connectionFactory; TimerFactory* timerFactory; diff --git a/Swiften/Network/DomainNameResolver.h b/Swiften/Network/DomainNameResolver.h index cf9d521..b0ebc35 100644 --- a/Swiften/Network/DomainNameResolver.h +++ b/Swiften/Network/DomainNameResolver.h @@ -8,18 +8,18 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class DomainNameServiceQuery; class DomainNameAddressQuery; - class String; + class DomainNameResolver { public: virtual ~DomainNameResolver(); - virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name) = 0; - virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name) = 0; + virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& name) = 0; + virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name) = 0; }; } diff --git a/Swiften/Network/DomainNameServiceQuery.h b/Swiften/Network/DomainNameServiceQuery.h index fb44e82..63d5841 100644 --- a/Swiften/Network/DomainNameServiceQuery.h +++ b/Swiften/Network/DomainNameServiceQuery.h @@ -11,7 +11,7 @@ #include <vector> #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Network/DomainNameResolveError.h" namespace Swift { @@ -20,8 +20,8 @@ namespace Swift { typedef boost::shared_ptr<DomainNameServiceQuery> ref; struct Result { - Result(const String& hostname = "", int port = -1, int priority = -1, int weight = -1) : hostname(hostname), port(port), priority(priority), weight(weight) {} - String hostname; + Result(const std::string& hostname = "", int port = -1, int priority = -1, int weight = -1) : hostname(hostname), port(port), priority(priority), weight(weight) {} + std::string hostname; int port; int priority; int weight; diff --git a/Swiften/Network/HostAddress.cpp b/Swiften/Network/HostAddress.cpp index b3876c0..7acd407 100644 --- a/Swiften/Network/HostAddress.cpp +++ b/Swiften/Network/HostAddress.cpp @@ -13,16 +13,16 @@ #include <boost/array.hpp> #include "Swiften/Base/foreach.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { HostAddress::HostAddress() { } -HostAddress::HostAddress(const String& address) { +HostAddress::HostAddress(const std::string& address) { try { - address_ = boost::asio::ip::address::from_string(address.getUTF8String()); + address_ = boost::asio::ip::address::from_string(address); } catch (const std::exception& t) { } diff --git a/Swiften/Network/HostAddress.h b/Swiften/Network/HostAddress.h index 6e2bde0..34ccd24 100644 --- a/Swiften/Network/HostAddress.h +++ b/Swiften/Network/HostAddress.h @@ -11,12 +11,12 @@ #include <boost/asio.hpp> namespace Swift { - class String; + class HostAddress { public: HostAddress(); - HostAddress(const String&); + HostAddress(const std::string&); HostAddress(const unsigned char* address, int length); HostAddress(const boost::asio::ip::address& address); diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.cpp b/Swiften/Network/PlatformDomainNameAddressQuery.cpp index 2a8574d..1832255 100644 --- a/Swiften/Network/PlatformDomainNameAddressQuery.cpp +++ b/Swiften/Network/PlatformDomainNameAddressQuery.cpp @@ -11,7 +11,7 @@ namespace Swift { -PlatformDomainNameAddressQuery::PlatformDomainNameAddressQuery(const String& host, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), hostname(host), eventLoop(eventLoop) { +PlatformDomainNameAddressQuery::PlatformDomainNameAddressQuery(const std::string& host, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), hostname(host), eventLoop(eventLoop) { } void PlatformDomainNameAddressQuery::run() { @@ -21,7 +21,7 @@ void PlatformDomainNameAddressQuery::run() { void PlatformDomainNameAddressQuery::runBlocking() { //std::cout << "PlatformDomainNameResolver::doRun()" << std::endl; boost::asio::ip::tcp::resolver resolver(ioService); - boost::asio::ip::tcp::resolver::query query(hostname.getUTF8String(), "5222"); + boost::asio::ip::tcp::resolver::query query(hostname, "5222"); try { //std::cout << "PlatformDomainNameResolver::doRun(): Resolving" << std::endl; boost::asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve(query); diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.h b/Swiften/Network/PlatformDomainNameAddressQuery.h index 0153688..c2854ac 100644 --- a/Swiften/Network/PlatformDomainNameAddressQuery.h +++ b/Swiften/Network/PlatformDomainNameAddressQuery.h @@ -12,7 +12,7 @@ #include <Swiften/Network/DomainNameAddressQuery.h> #include <Swiften/Network/PlatformDomainNameQuery.h> #include <Swiften/EventLoop/EventOwner.h> -#include <Swiften/Base/String.h> +#include <string> namespace Swift { class PlatformDomainNameResolver; @@ -20,7 +20,7 @@ namespace Swift { class PlatformDomainNameAddressQuery : public DomainNameAddressQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameAddressQuery>, public EventOwner { public: - PlatformDomainNameAddressQuery(const String& host, EventLoop* eventLoop, PlatformDomainNameResolver*); + PlatformDomainNameAddressQuery(const std::string& host, EventLoop* eventLoop, PlatformDomainNameResolver*); void run(); @@ -30,7 +30,7 @@ namespace Swift { private: boost::asio::io_service ioService; - String hostname; + std::string hostname; EventLoop* eventLoop; }; } diff --git a/Swiften/Network/PlatformDomainNameResolver.cpp b/Swiften/Network/PlatformDomainNameResolver.cpp index ec23091..f2c1e36 100644 --- a/Swiften/Network/PlatformDomainNameResolver.cpp +++ b/Swiften/Network/PlatformDomainNameResolver.cpp @@ -15,7 +15,7 @@ #include <boost/thread.hpp> #include <algorithm> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/IDN/IDNA.h" #include "Swiften/Network/HostAddress.h" #include "Swiften/EventLoop/EventLoop.h" @@ -38,11 +38,11 @@ PlatformDomainNameResolver::~PlatformDomainNameResolver() { delete thread; } -boost::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const String& name) { +boost::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const std::string& name) { return boost::shared_ptr<DomainNameServiceQuery>(new PlatformDomainNameServiceQuery(IDNA::getEncoded(name), eventLoop, this)); } -boost::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const String& name) { +boost::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const std::string& name) { return boost::shared_ptr<DomainNameAddressQuery>(new PlatformDomainNameAddressQuery(IDNA::getEncoded(name), eventLoop, this)); } diff --git a/Swiften/Network/PlatformDomainNameResolver.h b/Swiften/Network/PlatformDomainNameResolver.h index 249f2e3..e681331 100644 --- a/Swiften/Network/PlatformDomainNameResolver.h +++ b/Swiften/Network/PlatformDomainNameResolver.h @@ -17,7 +17,7 @@ #include <Swiften/Network/DomainNameAddressQuery.h> namespace Swift { - class String; + class EventLoop; class PlatformDomainNameResolver : public DomainNameResolver { @@ -25,8 +25,8 @@ namespace Swift { PlatformDomainNameResolver(EventLoop* eventLoop); ~PlatformDomainNameResolver(); - virtual DomainNameServiceQuery::ref createServiceQuery(const String& name); - virtual DomainNameAddressQuery::ref createAddressQuery(const String& name); + virtual DomainNameServiceQuery::ref createServiceQuery(const std::string& name); + virtual DomainNameAddressQuery::ref createAddressQuery(const std::string& name); private: void run(); diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp index 838b3cf..d3b3561 100644 --- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp +++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp @@ -36,7 +36,7 @@ using namespace Swift; namespace Swift { -PlatformDomainNameServiceQuery::PlatformDomainNameServiceQuery(const String& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), eventLoop(eventLoop), service(service) { +PlatformDomainNameServiceQuery::PlatformDomainNameServiceQuery(const std::string& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), eventLoop(eventLoop), service(service) { } void PlatformDomainNameServiceQuery::run() { @@ -51,7 +51,7 @@ void PlatformDomainNameServiceQuery::runBlocking() { #if defined(SWIFTEN_PLATFORM_WINDOWS) DNS_RECORD* responses; // FIXME: This conversion doesn't work if unicode is deffed above - if (DnsQuery(service.getUTF8Data(), DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &responses, NULL) != ERROR_SUCCESS) { + if (DnsQuery(service.c_str(), DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &responses, NULL) != ERROR_SUCCESS) { emitError(); return; } @@ -68,7 +68,7 @@ void PlatformDomainNameServiceQuery::runBlocking() { // conversion to not work at all, but it does. // Actually, it doesn't. Fix this and remove explicit cast // Remove unicode undef above as well - record.hostname = String((const char*) currentEntry->Data.SRV.pNameTarget); + record.hostname = std::string((const char*) currentEntry->Data.SRV.pNameTarget); records.push_back(record); } currentEntry = currentEntry->pNext; @@ -81,7 +81,7 @@ void PlatformDomainNameServiceQuery::runBlocking() { ByteArray response; response.resize(NS_PACKETSZ); - int responseLength = res_query(const_cast<char*>(service.getUTF8Data()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(response.getData()), response.getSize()); + int responseLength = res_query(const_cast<char*>(service.c_str()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(response.getData()), response.getSize()); if (responseLength == -1) { SWIFT_LOG(debug) << "Error" << std::endl; emitError(); @@ -151,7 +151,7 @@ void PlatformDomainNameServiceQuery::runBlocking() { emitError(); return; } - record.hostname = String(entry.getData()); + record.hostname = std::string(entry.getData()); records.push_back(record); currentEntry += entryLength; answersCount--; diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.h b/Swiften/Network/PlatformDomainNameServiceQuery.h index c9dbd65..52f8bc1 100644 --- a/Swiften/Network/PlatformDomainNameServiceQuery.h +++ b/Swiften/Network/PlatformDomainNameServiceQuery.h @@ -10,7 +10,7 @@ #include "Swiften/Network/DomainNameServiceQuery.h" #include "Swiften/EventLoop/EventOwner.h" -#include "Swiften/Base/String.h" +#include <string> #include <Swiften/Network/PlatformDomainNameQuery.h> namespace Swift { @@ -18,7 +18,7 @@ namespace Swift { class PlatformDomainNameServiceQuery : public DomainNameServiceQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameServiceQuery>, public EventOwner { public: - PlatformDomainNameServiceQuery(const String& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver); + PlatformDomainNameServiceQuery(const std::string& service, EventLoop* eventLoop, PlatformDomainNameResolver* resolver); virtual void run(); @@ -28,6 +28,6 @@ namespace Swift { private: EventLoop* eventLoop; - String service; + std::string service; }; } diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp index ccea2b7..a338272 100644 --- a/Swiften/Network/StaticDomainNameResolver.cpp +++ b/Swiften/Network/StaticDomainNameResolver.cpp @@ -10,13 +10,13 @@ #include <boost/lexical_cast.hpp> #include "Swiften/Network/DomainNameResolveError.h" -#include "Swiften/Base/String.h" +#include <string> using namespace Swift; namespace { struct ServiceQuery : public DomainNameServiceQuery, public boost::enable_shared_from_this<ServiceQuery> { - ServiceQuery(const String& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), service(service), resolver(resolver) {} + ServiceQuery(const std::string& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), service(service), resolver(resolver) {} virtual void run() { if (!resolver->getIsResponsive()) { @@ -36,12 +36,12 @@ namespace { } EventLoop* eventLoop; - String service; + std::string service; StaticDomainNameResolver* resolver; }; struct AddressQuery : public DomainNameAddressQuery, public boost::enable_shared_from_this<AddressQuery> { - AddressQuery(const String& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), host(host), resolver(resolver) {} + AddressQuery(const std::string& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop) : eventLoop(eventLoop), host(host), resolver(resolver) {} virtual void run() { if (!resolver->getIsResponsive()) { @@ -62,7 +62,7 @@ namespace { } EventLoop* eventLoop; - String host; + std::string host; StaticDomainNameResolver* resolver; }; } @@ -72,32 +72,32 @@ namespace Swift { StaticDomainNameResolver::StaticDomainNameResolver(EventLoop* eventLoop) : eventLoop(eventLoop), isResponsive(true) { } -void StaticDomainNameResolver::addAddress(const String& domain, const HostAddress& address) { +void StaticDomainNameResolver::addAddress(const std::string& domain, const HostAddress& address) { addresses[domain].push_back(address); } -void StaticDomainNameResolver::addService(const String& service, const DomainNameServiceQuery::Result& result) { +void StaticDomainNameResolver::addService(const std::string& service, const DomainNameServiceQuery::Result& result) { services.push_back(std::make_pair(service, result)); } -void StaticDomainNameResolver::addXMPPClientService(const String& domain, const HostAddressPort& address) { +void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, const HostAddressPort& address) { static int hostid = 0; - String hostname(std::string("host-") + boost::lexical_cast<std::string>(hostid)); + std::string hostname(std::string("host-") + boost::lexical_cast<std::string>(hostid)); hostid++; addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, address.getPort(), 0, 0)); addAddress(hostname, address.getAddress()); } -void StaticDomainNameResolver::addXMPPClientService(const String& domain, const String& hostname, int port) { +void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, const std::string& hostname, int port) { addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, port, 0, 0)); } -boost::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const String& name) { +boost::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const std::string& name) { return boost::shared_ptr<DomainNameServiceQuery>(new ServiceQuery(name, this, eventLoop)); } -boost::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const String& name) { +boost::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const std::string& name) { return boost::shared_ptr<DomainNameAddressQuery>(new AddressQuery(name, this, eventLoop)); } diff --git a/Swiften/Network/StaticDomainNameResolver.h b/Swiften/Network/StaticDomainNameResolver.h index 39b2782..2ef1295 100644 --- a/Swiften/Network/StaticDomainNameResolver.h +++ b/Swiften/Network/StaticDomainNameResolver.h @@ -17,20 +17,20 @@ #include "Swiften/EventLoop/EventLoop.h" namespace Swift { - class String; + class StaticDomainNameResolver : public DomainNameResolver { public: - typedef std::map<String, std::vector<HostAddress> > AddressesMap; - typedef std::vector< std::pair<String, DomainNameServiceQuery::Result> > ServicesCollection; + typedef std::map<std::string, std::vector<HostAddress> > AddressesMap; + typedef std::vector< std::pair<std::string, DomainNameServiceQuery::Result> > ServicesCollection; public: StaticDomainNameResolver(EventLoop* eventLoop); - void addAddress(const String& domain, const HostAddress& address); - void addService(const String& service, const DomainNameServiceQuery::Result& result); - void addXMPPClientService(const String& domain, const HostAddressPort&); - void addXMPPClientService(const String& domain, const String& host, int port); + void addAddress(const std::string& domain, const HostAddress& address); + void addService(const std::string& service, const DomainNameServiceQuery::Result& result); + void addXMPPClientService(const std::string& domain, const HostAddressPort&); + void addXMPPClientService(const std::string& domain, const std::string& host, int port); const AddressesMap& getAddresses() const { return addresses; @@ -48,8 +48,8 @@ namespace Swift { isResponsive = b; } - virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name); - virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name); + virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& name); + virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name); private: EventLoop* eventLoop; diff --git a/Swiften/Network/UnitTest/HostAddressTest.cpp b/Swiften/Network/UnitTest/HostAddressTest.cpp index 45793fa..7fb33ca 100644 --- a/Swiften/Network/UnitTest/HostAddressTest.cpp +++ b/Swiften/Network/UnitTest/HostAddressTest.cpp @@ -8,7 +8,7 @@ #include <cppunit/extensions/TestFactoryRegistry.h> #include "Swiften/Network/HostAddress.h" -#include "Swiften/Base/String.h" +#include <string> using namespace Swift; 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::handleSta |