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/Component | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Swiften/Component')
-rw-r--r-- | Swiften/Component/Component.cpp | 4 | ||||
-rw-r--r-- | Swiften/Component/Component.h | 4 | ||||
-rw-r--r-- | Swiften/Component/ComponentConnector.cpp | 2 | ||||
-rw-r--r-- | Swiften/Component/ComponentConnector.h | 8 | ||||
-rw-r--r-- | Swiften/Component/ComponentHandshakeGenerator.cpp | 15 | ||||
-rw-r--r-- | Swiften/Component/ComponentHandshakeGenerator.h | 4 | ||||
-rw-r--r-- | Swiften/Component/ComponentSession.cpp | 2 | ||||
-rw-r--r-- | Swiften/Component/ComponentSession.h | 8 | ||||
-rw-r--r-- | Swiften/Component/ComponentSessionStanzaChannel.cpp | 2 | ||||
-rw-r--r-- | Swiften/Component/ComponentSessionStanzaChannel.h | 2 | ||||
-rw-r--r-- | Swiften/Component/ComponentXMLTracer.h | 2 | ||||
-rw-r--r-- | Swiften/Component/CoreComponent.cpp | 8 | ||||
-rw-r--r-- | Swiften/Component/CoreComponent.h | 16 | ||||
-rw-r--r-- | Swiften/Component/UnitTest/ComponentConnectorTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp | 8 | ||||
-rw-r--r-- | Swiften/Component/UnitTest/ComponentSessionTest.cpp | 4 |
16 files changed, 46 insertions, 45 deletions
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; }; |