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/Roster | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Swiften/Roster')
-rw-r--r-- | Swiften/Roster/RosterPushResponder.h | 2 | ||||
-rw-r--r-- | Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp | 12 | ||||
-rw-r--r-- | Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp | 18 | ||||
-rw-r--r-- | Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h | 10 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRoster.h | 10 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRosterController.h | 2 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRosterImpl.cpp | 18 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRosterImpl.h | 8 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRosterItem.h | 16 |
9 files changed, 48 insertions, 48 deletions
diff --git a/Swiften/Roster/RosterPushResponder.h b/Swiften/Roster/RosterPushResponder.h index ea7cff5..b38914b 100644 --- a/Swiften/Roster/RosterPushResponder.h +++ b/Swiften/Roster/RosterPushResponder.h @@ -20,7 +20,7 @@ namespace Swift { boost::signal<void (boost::shared_ptr<RosterPayload>)> onRosterReceived; private: - virtual bool handleSetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr<RosterPayload> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<RosterPayload> payload) { onRosterReceived(payload); sendResponse(from, id, boost::shared_ptr<RosterPayload>()); return true; diff --git a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp index cabf2bf..4ef1cc1 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp @@ -65,7 +65,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), xmppRoster_->getGroupsForJID(jid1_).size()); CPPUNIT_ASSERT(xmppRoster_->containsJID(jid1_)); - CPPUNIT_ASSERT_EQUAL(String("Bob"), xmppRoster_->getNameForJID(jid1_)); + CPPUNIT_ASSERT_EQUAL(std::string("Bob"), xmppRoster_->getNameForJID(jid1_)); } void testModify() { @@ -85,7 +85,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(Update, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("Bob2"), xmppRoster_->getNameForJID(jid1_)); + CPPUNIT_ASSERT_EQUAL(std::string("Bob2"), xmppRoster_->getNameForJID(jid1_)); } void testRemove() { @@ -135,7 +135,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { boost::shared_ptr<RosterPayload> payload4(new RosterPayload()); RosterItemPayload item(jid3_, "Jane", RosterItemPayload::Both); - String janesGroup("Jane's Group"); + std::string janesGroup("Jane's Group"); item.addGroup(janesGroup); payload4->addItem(item); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id4", payload4)); @@ -156,14 +156,14 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { boost::shared_ptr<RosterPayload> payload6(new RosterPayload()); RosterItemPayload item2(jid2_, "Little Alice", RosterItemPayload::Both); - String alicesGroup("Alice's Group"); + std::string alicesGroup("Alice's Group"); item2.addGroup(alicesGroup); payload6->addItem(item2); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id6", payload6)); CPPUNIT_ASSERT_EQUAL(Update, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid2_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("Little Alice"), xmppRoster_->getNameForJID(jid2_)); - CPPUNIT_ASSERT_EQUAL(String("Jane"), xmppRoster_->getNameForJID(jid3_)); + CPPUNIT_ASSERT_EQUAL(std::string("Little Alice"), xmppRoster_->getNameForJID(jid2_)); + CPPUNIT_ASSERT_EQUAL(std::string("Jane"), xmppRoster_->getNameForJID(jid3_)); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), xmppRoster_->getGroupsForJID(jid2_).size()); CPPUNIT_ASSERT_EQUAL(alicesGroup, xmppRoster_->getGroupsForJID(jid2_)[0]); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), xmppRoster_->getGroupsForJID(jid3_).size()); diff --git a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp index 77993ea..edb8271 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp @@ -45,21 +45,21 @@ class XMPPRosterImplTest : public CppUnit::TestFixture { roster_->addContact(jid1_, "NewName", groups1_, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(Add, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("NewName"), roster_->getNameForJID(jid1_)); + CPPUNIT_ASSERT_EQUAL(std::string("NewName"), roster_->getNameForJID(jid1_)); CPPUNIT_ASSERT(groups1_ == roster_->getGroupsForJID(jid1_)); handler_->reset(); roster_->addContact(jid2_, "NameTwo", groups1_, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(Add, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid2_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("NameTwo"), roster_->getNameForJID(jid2_)); - CPPUNIT_ASSERT_EQUAL(String("NewName"), roster_->getNameForJID(jid1_)); + CPPUNIT_ASSERT_EQUAL(std::string("NameTwo"), roster_->getNameForJID(jid2_)); + CPPUNIT_ASSERT_EQUAL(std::string("NewName"), roster_->getNameForJID(jid1_)); CPPUNIT_ASSERT(groups1_ == roster_->getGroupsForJID(jid2_)); CPPUNIT_ASSERT(groups1_ == roster_->getGroupsForJID(jid1_)); handler_->reset(); roster_->addContact(jid3_, "NewName", groups2_, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(Add, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid3_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("NewName"), roster_->getNameForJID(jid3_)); + CPPUNIT_ASSERT_EQUAL(std::string("NewName"), roster_->getNameForJID(jid3_)); CPPUNIT_ASSERT(groups2_ == roster_->getGroupsForJID(jid3_)); } @@ -73,7 +73,7 @@ class XMPPRosterImplTest : public CppUnit::TestFixture { roster_->addContact(jid1_, "NewName2", groups1_, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(Add, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("NewName2"), roster_->getNameForJID(jid1_)); + CPPUNIT_ASSERT_EQUAL(std::string("NewName2"), roster_->getNameForJID(jid1_)); roster_->addContact(jid2_, "NewName3", groups1_, RosterItemPayload::Both); handler_->reset(); roster_->removeContact(jid2_); @@ -89,13 +89,13 @@ class XMPPRosterImplTest : public CppUnit::TestFixture { roster_->addContact(jid1_, "NewName", groups1_, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(Add, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("NewName"), roster_->getNameForJID(jid1_)); + CPPUNIT_ASSERT_EQUAL(std::string("NewName"), roster_->getNameForJID(jid1_)); CPPUNIT_ASSERT(groups1_ == roster_->getGroupsForJID(jid1_)); handler_->reset(); roster_->addContact(jid1_, "NameTwo", groups2_, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(Update, handler_->getLastEvent()); CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); - CPPUNIT_ASSERT_EQUAL(String("NameTwo"), roster_->getNameForJID(jid1_)); + CPPUNIT_ASSERT_EQUAL(std::string("NameTwo"), roster_->getNameForJID(jid1_)); CPPUNIT_ASSERT(groups2_ == roster_->getGroupsForJID(jid1_)); } @@ -105,8 +105,8 @@ class XMPPRosterImplTest : public CppUnit::TestFixture { JID jid1_; JID jid2_; JID jid3_; - std::vector<String> groups1_; - std::vector<String> groups2_; + std::vector<std::string> groups1_; + std::vector<std::string> groups2_; }; CPPUNIT_TEST_SUITE_REGISTRATION(XMPPRosterImplTest); diff --git a/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h b/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h index 5e15e9f..1bbd8e9 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h +++ b/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h @@ -34,11 +34,11 @@ public: return lastJID_; } - String getLastOldName() { + std::string getLastOldName() { return lastOldName_; } - std::vector<String> getLastOldGroups() { + std::vector<std::string> getLastOldGroups() { return lastOldGroups_; } @@ -57,7 +57,7 @@ private: lastEvent_ = Remove; } - void handleJIDUpdated(const JID& jid, const String& oldName, const std::vector<String>& oldGroups) { + void handleJIDUpdated(const JID& jid, const std::string& oldName, const std::vector<std::string>& oldGroups) { CPPUNIT_ASSERT_EQUAL(None, lastEvent_); lastJID_ = jid; lastOldName_ = oldName; @@ -67,7 +67,7 @@ private: XMPPRosterEvents lastEvent_; JID lastJID_; - String lastOldName_; - std::vector<String> lastOldGroups_; + std::string lastOldName_; + std::vector<std::string> lastOldGroups_; }; diff --git a/Swiften/Roster/XMPPRoster.h b/Swiften/Roster/XMPPRoster.h index 676e8f9..958c1f6 100644 --- a/Swiften/Roster/XMPPRoster.h +++ b/Swiften/Roster/XMPPRoster.h @@ -11,7 +11,7 @@ #include <set> #include "Swiften/Base/boost_bsignals.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/Elements/RosterItemPayload.h" #include <Swiften/Roster/XMPPRosterItem.h> @@ -41,12 +41,12 @@ namespace Swift { /** * Retrieves the stored roster name for the given jid. */ - virtual String getNameForJID(const JID& jid) const = 0; + virtual std::string getNameForJID(const JID& jid) const = 0; /** * Returns the list of groups for the given JID. */ - virtual std::vector<String> getGroupsForJID(const JID& jid) = 0; + virtual std::vector<std::string> getGroupsForJID(const JID& jid) = 0; /** * Retrieve the items in the roster. @@ -61,7 +61,7 @@ namespace Swift { /** * Retrieve the list of (existing) groups. */ - virtual std::set<String> getGroups() const = 0; + virtual std::set<std::string> getGroups() const = 0; public: /** @@ -78,7 +78,7 @@ namespace Swift { * Emitted when the name or the groups of the roster item with the * given JID changes. */ - boost::signal<void (const JID&, const String&, const std::vector<String>&)> onJIDUpdated; + boost::signal<void (const JID&, const std::string&, const std::vector<std::string>&)> onJIDUpdated; /** * Emitted when the roster is reset (e.g. due to logging in/logging out). diff --git a/Swiften/Roster/XMPPRosterController.h b/Swiften/Roster/XMPPRosterController.h index 073a233..28c2541 100644 --- a/Swiften/Roster/XMPPRosterController.h +++ b/Swiften/Roster/XMPPRosterController.h @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/IQ.h" #include "Swiften/Elements/RosterPayload.h" #include "Swiften/Roster/RosterPushResponder.h" diff --git a/Swiften/Roster/XMPPRosterImpl.cpp b/Swiften/Roster/XMPPRosterImpl.cpp index 3e9e312..8086806 100644 --- a/Swiften/Roster/XMPPRosterImpl.cpp +++ b/Swiften/Roster/XMPPRosterImpl.cpp @@ -12,12 +12,12 @@ namespace Swift { XMPPRosterImpl::XMPPRosterImpl() { } -void XMPPRosterImpl::addContact(const JID& jid, const String& name, const std::vector<String>& groups, RosterItemPayload::Subscription subscription) { +void XMPPRosterImpl::addContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, RosterItemPayload::Subscription subscription) { JID bareJID(jid.toBare()); std::map<JID, XMPPRosterItem>::iterator i = entries_.find(bareJID); if (i != entries_.end()) { - String oldName = i->second.getName(); - std::vector<String> oldGroups = i->second.getGroups(); + std::string oldName = i->second.getName(); + std::vector<std::string> oldGroups = i->second.getGroups(); i->second = XMPPRosterItem(jid, name, groups, subscription); onJIDUpdated(bareJID, oldName, oldGroups); } @@ -41,7 +41,7 @@ bool XMPPRosterImpl::containsJID(const JID& jid) { return entries_.find(JID(jid.toBare())) != entries_.end(); } -String XMPPRosterImpl::getNameForJID(const JID& jid) const { +std::string XMPPRosterImpl::getNameForJID(const JID& jid) const { std::map<JID, XMPPRosterItem>::const_iterator i = entries_.find(jid.toBare()); if (i != entries_.end()) { return i->second.getName(); @@ -51,13 +51,13 @@ String XMPPRosterImpl::getNameForJID(const JID& jid) const { } } -std::vector<String> XMPPRosterImpl::getGroupsForJID(const JID& jid) { +std::vector<std::string> XMPPRosterImpl::getGroupsForJID(const JID& jid) { std::map<JID, XMPPRosterItem>::iterator i = entries_.find(jid.toBare()); if (i != entries_.end()) { return i->second.getGroups(); } else { - return std::vector<String>(); + return std::vector<std::string>(); } } @@ -89,10 +89,10 @@ boost::optional<XMPPRosterItem> XMPPRosterImpl::getItem(const JID& jid) const { } } -std::set<String> XMPPRosterImpl::getGroups() const { - std::set<String> result; +std::set<std::string> XMPPRosterImpl::getGroups() const { + std::set<std::string> result; foreach(const RosterMap::value_type& entry, entries_) { - std::vector<String> groups = entry.second.getGroups(); + std::vector<std::string> groups = entry.second.getGroups(); result.insert(groups.begin(), groups.end()); } return result; diff --git a/Swiften/Roster/XMPPRosterImpl.h b/Swiften/Roster/XMPPRosterImpl.h index f65683f..a44a1ce 100644 --- a/Swiften/Roster/XMPPRosterImpl.h +++ b/Swiften/Roster/XMPPRosterImpl.h @@ -16,18 +16,18 @@ namespace Swift { public: XMPPRosterImpl(); - void addContact(const JID& jid, const String& name, const std::vector<String>& groups, const RosterItemPayload::Subscription subscription); + void addContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const RosterItemPayload::Subscription subscription); void removeContact(const JID& jid); void clear(); bool containsJID(const JID& jid); RosterItemPayload::Subscription getSubscriptionStateForJID(const JID& jid); - String getNameForJID(const JID& jid) const; - std::vector<String> getGroupsForJID(const JID& jid); + std::string getNameForJID(const JID& jid) const; + std::vector<std::string> getGroupsForJID(const JID& jid); virtual std::vector<XMPPRosterItem> getItems() const; virtual boost::optional<XMPPRosterItem> getItem(const JID&) const; - virtual std::set<String> getGroups() const; + virtual std::set<std::string> getGroups() const; private: typedef std::map<JID, XMPPRosterItem> RosterMap; diff --git a/Swiften/Roster/XMPPRosterItem.h b/Swiften/Roster/XMPPRosterItem.h index ceb7763..c821cbf 100644 --- a/Swiften/Roster/XMPPRosterItem.h +++ b/Swiften/Roster/XMPPRosterItem.h @@ -9,33 +9,33 @@ #include <vector> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/JID/JID.h> #include <Swiften/Elements/RosterItemPayload.h> namespace Swift { class XMPPRosterItem { public: - XMPPRosterItem(const JID& jid, const String& name, const std::vector<String>& groups, RosterItemPayload::Subscription subscription) : jid(jid), name(name), groups(groups), subscription(subscription) { + XMPPRosterItem(const JID& jid, const std::string& name, const std::vector<std::string>& groups, RosterItemPayload::Subscription subscription) : jid(jid), name(name), groups(groups), subscription(subscription) { } const JID& getJID() const { return jid; } - const String& getName() const { + const std::string& getName() const { return name; } - void setName(const String& name) { + void setName(const std::string& name) { this->name = name; } - const std::vector<String>& getGroups() const { + const std::vector<std::string>& getGroups() const { return groups; } - void setGroups(const std::vector<String>& groups) { + void setGroups(const std::vector<std::string>& groups) { this->groups = groups; } @@ -45,8 +45,8 @@ namespace Swift { private: JID jid; - String name; - std::vector<String> groups; + std::string name; + std::vector<std::string> groups; RosterItemPayload::Subscription subscription; }; } |