diff options
author | Kevin Smith <git@kismith.co.uk> | 2018-07-27 13:39:18 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2018-07-27 13:53:55 (GMT) |
commit | 48596613cfe0f45c0916beabbcc3a27e01752c4b (patch) | |
tree | f8137f72b599d02eb1bc4f6dbc833c416f4e0295 | |
parent | 1bcdcbd4c8e1c6c971087f049422d3bd52be2a6b (diff) | |
download | swift-48596613cfe0f45c0916beabbcc3a27e01752c4b.zip swift-48596613cfe0f45c0916beabbcc3a27e01752c4b.tar.bz2 |
Autofix boost-use-to-string clang-tidy warnings
Done by adding --fix --fix-errors to the clang-tidy args in
the Makefile
Test-Information:
Unit tests pass (macOS)
Change-Id: I3a4df955ac3553afeb9384f23f9d8b2ef01117e2
32 files changed, 83 insertions, 83 deletions
diff --git a/Slimber/MainController.cpp b/Slimber/MainController.cpp index cd36132..93eb4e7 100644 --- a/Slimber/MainController.cpp +++ b/Slimber/MainController.cpp @@ -102,13 +102,13 @@ void MainController::handleServerStopped(boost::optional<ServerError> error) { std::string message; switch (error->getType()) { case ServerError::C2SPortConflict: - message = std::string("Error: Port ") + boost::lexical_cast<std::string>(server->getClientToServerPort()) + std::string(" in use"); + message = std::string("Error: Port ") + std::to_string(server->getClientToServerPort()) + std::string(" in use"); break; case ServerError::C2SError: message = std::string("Local connection server error"); break; case ServerError::LinkLocalPortConflict: - message = std::string("Error: Port ") + boost::lexical_cast<std::string>(server->getLinkLocalPort()) + std::string(" in use"); + message = std::string("Error: Port ") + std::to_string(server->getLinkLocalPort()) + std::string(" in use"); break; case ServerError::LinkLocalError: message = std::string("External connection server error"); diff --git a/Swift/Controllers/AccountController.cpp b/Swift/Controllers/AccountController.cpp index fe7c200..ec914a6 100644 --- a/Swift/Controllers/AccountController.cpp +++ b/Swift/Controllers/AccountController.cpp @@ -688,7 +688,7 @@ void AccountController::handleDisconnected(const boost::optional<ClientError>& e setReconnectTimer(); } if (lastDisconnectError_) { - message = str(format(QT_TRANSLATE_NOOP("", "Reconnect to %1% failed: %2%. Will retry in %3% seconds.")) % jid_.getDomain() % message % boost::lexical_cast<std::string>(timeBeforeNextReconnect_)); + message = str(format(QT_TRANSLATE_NOOP("", "Reconnect to %1% failed: %2%. Will retry in %3% seconds.")) % jid_.getDomain() % message % std::to_string(timeBeforeNextReconnect_)); lastDisconnectError_->conclude(); } else { message = str(format(QT_TRANSLATE_NOOP("", "Disconnected from %1%: %2%.")) % jid_.getDomain() % message); diff --git a/Swift/QtUI/QtCachedImageScaler.cpp b/Swift/QtUI/QtCachedImageScaler.cpp index e1f540b..445d113 100644 --- a/Swift/QtUI/QtCachedImageScaler.cpp +++ b/Swift/QtUI/QtCachedImageScaler.cpp @@ -21,7 +21,7 @@ QtCachedImageScaler::QtCachedImageScaler() { boost::filesystem::path QtCachedImageScaler::getScaledImage(const boost::filesystem::path& imagePath, int size) { boost::filesystem::path scaledImagePath(imagePath); - std::string suffix = "." + boost::lexical_cast<std::string>(size); + std::string suffix = "." + std::to_string(size); scaledImagePath = stringToPath(pathToString(scaledImagePath) + suffix); if (!boost::filesystem::exists(scaledImagePath)) { QImage image(P2QSTRING(pathToString(imagePath))); diff --git a/Swift/QtUI/QtFormWidget.cpp b/Swift/QtUI/QtFormWidget.cpp index 96c2da0..860ddfa 100644 --- a/Swift/QtUI/QtFormWidget.cpp +++ b/Swift/QtUI/QtFormWidget.cpp @@ -147,7 +147,7 @@ QWidget* QtFormWidget::createWidget(FormField::ref field, const FormField::Type std::string indexString; if (index) { /* for multi-item forms we need to distinguish between the different rows */ - indexString = boost::lexical_cast<std::string>(index); + indexString = std::to_string(index); } fields_[field->getName() + indexString] = widget; return widget; diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 983d0e9..0e7e89d 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -131,7 +131,7 @@ void QtHistoryWindow::addMessage(const std::string &message, const std::string & QTime dayTime = QTime(time.time_of_day().hours(), time.time_of_day().minutes(), time.time_of_day().seconds()); QDateTime qTime = QDateTime(date, dayTime); - std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); + std::string id = "id" + std::to_string(idCounter_++); QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index 3d67091..cdee1e6 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp @@ -178,7 +178,7 @@ void QtPlainChatView::setAckState(const std::string& /*id*/, ChatWindow::AckStat std::string QtPlainChatView::addFileTransfer(const std::string& senderName, const std::string& /*avatarPath*/, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) { - const std::string ftId = "ft" + boost::lexical_cast<std::string>(idGenerator_++); + const std::string ftId = "ft" + std::to_string(idGenerator_++); const std::string sizeString = formatSize(sizeInBytes); FileTransfer* transfer; diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index f2effa8..bca9e2e 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -580,7 +580,7 @@ std::string QtWebKitChatView::addMessage( bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasMessage, senderName, senderIsSelf, label); QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.svg" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); - std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); + std::string id = "id" + std::to_string(idCounter_++); addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), direction)); previousMessageWasSelf_ = senderIsSelf; @@ -658,7 +658,7 @@ std::string QtWebKitChatView::addFileTransfer(const std::string& senderName, con bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasFileTransfer, senderName, senderIsSelf); QString scaledAvatarPath = QtScaledAvatarCache(32).getScaledAvatarPath(avatarPath.c_str()); QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.svg" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); - std::string id = "ftmessage" + boost::lexical_cast<std::string>(idCounter_++); + std::string id = "ftmessage" + std::to_string(idCounter_++); addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); previousMessageWasSelf_ = senderIsSelf; @@ -692,7 +692,7 @@ std::string QtWebKitChatView::addWhiteboardRequest(const QString& contact, bool "</div>"; } QString qAvatarPath = "qrc:/icons/avatar.svg"; - std::string id = "wbmessage" + boost::lexical_cast<std::string>(idCounter_++); + std::string id = "wbmessage" + std::to_string(idCounter_++); addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(contact), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, false, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); previousMessageWasSelf_ = false; previousSenderName_ = contact; @@ -849,7 +849,7 @@ void QtWebKitChatView::addErrorMessage(const ChatWindow::ChatMessage& errorMessa } QString errorMessageHTML(chatMessageToHTML(errorMessage)); - std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); + std::string id = "id" + std::to_string(idCounter_++); addMessageBottom(std::make_shared<SystemMessageSnippet>("<span class=\"error\">" + errorMessageHTML + "</span>", QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), ChatSnippet::getDirection(errorMessage))); previousMessageWasSelf_ = false; @@ -862,7 +862,7 @@ std::string QtWebKitChatView::addSystemMessage(const ChatWindow::ChatMessage& me } QString messageHTML = chatMessageToHTML(message); - std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); + std::string id = "id" + std::to_string(idCounter_++); addMessageBottom(std::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); previousMessageKind_ = PreviousMessageWasSystem; @@ -928,7 +928,7 @@ void QtWebKitChatView::addPresenceMessage(const ChatWindow::ChatMessage& message } QString messageHTML = chatMessageToHTML(message); - std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); + std::string id = "id" + std::to_string(idCounter_++); addMessageBottom(std::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); previousMessageKind_ = PreviousMessageWasPresence; diff --git a/Swiften/Base/URL.cpp b/Swiften/Base/URL.cpp index 4a47a11..3bc97ba 100644 --- a/Swiften/Base/URL.cpp +++ b/Swiften/Base/URL.cpp @@ -132,7 +132,7 @@ std::string URL::toString() const { } if (port) { result += ":"; - result += boost::lexical_cast<std::string>(*port); + result += std::to_string(*port); } result += path; return result; diff --git a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp index 7a7ed3b..771251a 100644 --- a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp @@ -35,7 +35,7 @@ ByteArray LinkLocalServiceInfo::toTXTRecord() const { append(result, getEncoded("nick=" + nick)); } if (port) { - append(result, getEncoded("port.p2pj=" + std::string(boost::lexical_cast<std::string>(*port)))); + append(result, getEncoded("port.p2pj=" + std::string(std::to_string(*port)))); } switch (status) { diff --git a/Swiften/Network/HostAddressPort.cpp b/Swiften/Network/HostAddressPort.cpp index 76c276e..401ddec 100644 --- a/Swiften/Network/HostAddressPort.cpp +++ b/Swiften/Network/HostAddressPort.cpp @@ -21,7 +21,7 @@ HostAddressPort::HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint) std::string HostAddressPort::toString() const { std::string portAsString; try { - portAsString = boost::lexical_cast<std::string>(getPort()); + portAsString = std::to_string(getPort()); } catch (boost::bad_lexical_cast&) { } return getAddress().toString() + ":" + portAsString; diff --git a/Swiften/Network/MiniUPnPInterface.cpp b/Swiften/Network/MiniUPnPInterface.cpp index dbe8bcd..2c61ad3 100644 --- a/Swiften/Network/MiniUPnPInterface.cpp +++ b/Swiften/Network/MiniUPnPInterface.cpp @@ -80,9 +80,9 @@ boost::optional<NATPortMapping> MiniUPnPInterface::addPortForward(int actualLoca NATPortMapping mapping(actualLocalPort, actualPublicPort, NATPortMapping::TCP); - std::string publicPort = boost::lexical_cast<std::string>(mapping.getPublicPort()); - std::string localPort = boost::lexical_cast<std::string>(mapping.getLocalPort()); - std::string leaseSeconds = boost::lexical_cast<std::string>(mapping.getLeaseInSeconds()); + std::string publicPort = std::to_string(mapping.getPublicPort()); + std::string localPort = std::to_string(mapping.getLocalPort()); + std::string leaseSeconds = std::to_string(mapping.getLeaseInSeconds()); int ret = UPNP_AddPortMapping( p->urls.controlURL, @@ -107,9 +107,9 @@ bool MiniUPnPInterface::removePortForward(const NATPortMapping& mapping) { return false; } - std::string publicPort = boost::lexical_cast<std::string>(mapping.getPublicPort()); - std::string localPort = boost::lexical_cast<std::string>(mapping.getLocalPort()); - std::string leaseSeconds = boost::lexical_cast<std::string>(mapping.getLeaseInSeconds()); + std::string publicPort = std::to_string(mapping.getPublicPort()); + std::string localPort = std::to_string(mapping.getLocalPort()); + std::string leaseSeconds = std::to_string(mapping.getLeaseInSeconds()); int ret = UPNP_DeletePortMapping(p->urls.controlURL, p->data.first.servicetype, publicPort.c_str(), mapping.getProtocol() == NATPortMapping::TCP ? "TCP" : "UDP", nullptr); return ret == UPNPCOMMAND_SUCCESS; diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp index b8f4c7a..5a38fc4 100644 --- a/Swiften/Network/StaticDomainNameResolver.cpp +++ b/Swiften/Network/StaticDomainNameResolver.cpp @@ -102,7 +102,7 @@ void StaticDomainNameResolver::addService(const std::string& service, const Doma void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, const HostAddressPort& address) { static int hostid = 0; - std::string hostname(std::string("host-") + boost::lexical_cast<std::string>(hostid)); + std::string hostname(std::string("host-") + std::to_string(hostid)); hostid++; addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, address.getPort(), 0, 0)); diff --git a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp index 5d6fedd..4aeaf24 100644 --- a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp +++ b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp @@ -194,7 +194,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(st(2), connectionFactory->connections.size()); /* 0 was waiting for response, open and send on 1 */ CPPUNIT_ASSERT_EQUAL(st(4), boshDataWritten.size()); /* data */ c1 = connectionFactory->connections[1]; - std::string fullBody = "<body rid='" + boost::lexical_cast<std::string>(rid) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'><blah/></body>"; /* check empty write */ + std::string fullBody = "<body rid='" + std::to_string(rid) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'><blah/></body>"; /* check empty write */ CPPUNIT_ASSERT_EQUAL(fullBody, lastBody()); CPPUNIT_ASSERT(c0->pending); CPPUNIT_ASSERT(c1->pending); @@ -310,7 +310,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { readResponse("<body></body>", c0); eventLoop->processEvents(); CPPUNIT_ASSERT_EQUAL(st(3), boshDataWritten.size()); - std::string fullBody = "<body rid='" + boost::lexical_cast<std::string>(initialRID + 2) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'></body>"; + std::string fullBody = "<body rid='" + std::to_string(initialRID + 2) + "' sid='" + sid + "' xmlns='http://jabber.org/protocol/httpbind'></body>"; std::string response = boshDataWritten[2]; size_t bodyPosition = response.find("\r\n\r\n"); CPPUNIT_ASSERT_EQUAL(fullBody, response.substr(bodyPosition+4)); @@ -427,7 +427,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { "Access-Control-Allow-Headers: Content-Type\r\n" "Content-Length: ")); connection->onDataRead(data1); - std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size()))); + std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(std::to_string(response.size()))); connection->onDataRead(data2); std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n")); connection->onDataRead(data3); @@ -440,7 +440,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { std::string result = "POST /" + path + " HTTP/1.1\r\n" + "Host: " + to + ":" + port + "\r\n" + "Content-Type: text/xml; charset=utf-8\r\n" - + "Content-Length: " + boost::lexical_cast<std::string>(body.size()) + "\r\n\r\n" + + "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n" + body; return result; } diff --git a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp index e34cb96..17d8333 100644 --- a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp +++ b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp @@ -318,7 +318,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture { "Access-Control-Allow-Headers: Content-Type\r\n" "Content-Length: ")); connection->onDataRead(data1); - std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size()))); + std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(std::to_string(response.size()))); connection->onDataRead(data2); std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n")); connection->onDataRead(data3); diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp index 78bb0eb..37a9c03 100644 --- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp @@ -25,7 +25,7 @@ std::string BytestreamsSerializer::serializePayload(std::shared_ptr<Bytestreams> std::shared_ptr<XMLElement> streamHostElement(new XMLElement("streamhost")); streamHostElement->setAttribute("host", streamHost.host); streamHostElement->setAttribute("jid", streamHost.jid.toString()); - streamHostElement->setAttribute("port", boost::lexical_cast<std::string>(streamHost.port)); + streamHostElement->setAttribute("port", std::to_string(streamHost.port)); queryElement.addNode(streamHostElement); } diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp index e41ff8c..74a8e7b 100644 --- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp @@ -26,7 +26,7 @@ std::string IBBSerializer::serializePayload(std::shared_ptr<IBB> ibb) const { XMLElement ibbElement("data", "http://jabber.org/protocol/ibb"); ibbElement.setAttribute("sid", ibb->getStreamID()); if (ibb->getSequenceNumber() >= 0) { - ibbElement.setAttribute("seq", boost::lexical_cast<std::string>(ibb->getSequenceNumber())); + ibbElement.setAttribute("seq", std::to_string(ibb->getSequenceNumber())); } ibbElement.addNode(std::make_shared<XMLTextNode>(Base64::encode(ibb->getData()))); return ibbElement.serialize(); @@ -39,7 +39,7 @@ std::string IBBSerializer::serializePayload(std::shared_ptr<IBB> ibb) const { case IBB::MessageStanza: ibbElement.setAttribute("stanza", "message"); break; } assert(ibb->getBlockSize() > 0); - ibbElement.setAttribute("block-size", boost::lexical_cast<std::string>(ibb->getBlockSize())); + ibbElement.setAttribute("block-size", std::to_string(ibb->getBlockSize())); return ibbElement.serialize(); } case IBB::Close: { diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp index 35a0a6e..95996c7 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp @@ -44,13 +44,13 @@ std::string JingleFileTransferFileInfoSerializer::serializePayload(std::shared_p if (fileInfo->getSupportsRangeRequests()) { std::shared_ptr<XMLElement> range = std::make_shared<XMLElement>("range"); if (fileInfo->getRangeOffset() != 0) { - range->setAttribute("offset", boost::lexical_cast<std::string>(fileInfo->getRangeOffset())); + range->setAttribute("offset", std::to_string(fileInfo->getRangeOffset())); } fileElement.addNode(range); } if (fileInfo->getSize() > 0) { - fileElement.addNode(std::make_shared<XMLElement>("size", "", boost::lexical_cast<std::string>(fileInfo->getSize()))); + fileElement.addNode(std::make_shared<XMLElement>("size", "", std::to_string(fileInfo->getSize()))); } for (const auto& hashElement : fileInfo->getHashes()) { diff --git a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp index 9930e44..c5c45e1 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp @@ -28,7 +28,7 @@ JingleIBBTransportPayloadSerializer::JingleIBBTransportPayloadSerializer() { std::string JingleIBBTransportPayloadSerializer::serializePayload(std::shared_ptr<JingleIBBTransportPayload> payload) const { XMLElement payloadXML("transport", "urn:xmpp:jingle:transports:ibb:1"); if (payload->getBlockSize()) { - payloadXML.setAttribute("block-size", boost::lexical_cast<std::string>(*payload->getBlockSize())); + payloadXML.setAttribute("block-size", std::to_string(*payload->getBlockSize())); } payloadXML.setAttribute("sid", payload->getSessionID()); diff --git a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp index 5e74d8e..f9a1832 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp @@ -39,8 +39,8 @@ std::string JingleS5BTransportPayloadSerializer::serializePayload(std::shared_pt candidateXML->setAttribute("cid", candidate.cid); candidateXML->setAttribute("host", candidate.hostPort.getAddress().toString()); candidateXML->setAttribute("jid", candidate.jid.toString()); - candidateXML->setAttribute("port", boost::lexical_cast<std::string>(candidate.hostPort.getPort())); - candidateXML->setAttribute("priority", boost::lexical_cast<std::string>(candidate.priority)); + candidateXML->setAttribute("port", std::to_string(candidate.hostPort.getPort())); + candidateXML->setAttribute("priority", std::to_string(candidate.priority)); candidateXML->setAttribute("type", typeToString(candidate.type)); payloadXML.addNode(candidateXML); } diff --git a/Swiften/Serializer/PayloadSerializers/LastSerializer.h b/Swiften/Serializer/PayloadSerializers/LastSerializer.h index 1710bc0..719eff5 100644 --- a/Swiften/Serializer/PayloadSerializers/LastSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/LastSerializer.h @@ -18,7 +18,7 @@ namespace Swift { LastSerializer() : GenericPayloadSerializer<Last>() {} virtual std::string serializePayload(std::shared_ptr<Last> last) const { - return "<query xmlns='jabber:iq:last' seconds='" + boost::lexical_cast<std::string>(last->getSeconds()) + "'/>"; + return "<query xmlns='jabber:iq:last' seconds='" + std::to_string(last->getSeconds()) + "'/>"; } }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp index 4f0f637..cde129e 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp @@ -25,15 +25,15 @@ std::string MUCPayloadSerializer::serializePayload(std::shared_ptr<MUCPayload> m std::shared_ptr<XMLElement> historyElement(new XMLElement("history")); bool history = false; if (muc->getMaxChars() >= 0) { - historyElement->setAttribute("maxchars", boost::lexical_cast<std::string>(muc->getMaxChars())); + historyElement->setAttribute("maxchars", std::to_string(muc->getMaxChars())); history = true; } if (muc->getMaxStanzas() >= 0) { - historyElement->setAttribute("maxstanzas", boost::lexical_cast<std::string>(muc->getMaxStanzas())); + historyElement->setAttribute("maxstanzas", std::to_string(muc->getMaxStanzas())); history = true; } if (muc->getSeconds() >= 0) { - historyElement->setAttribute("seconds", boost::lexical_cast<std::string>(muc->getSeconds())); + historyElement->setAttribute("seconds", std::to_string(muc->getSeconds())); history = true; } if (muc->getSince() != boost::posix_time::not_a_date_time) { diff --git a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h index 687d07f..fa2cef0 100644 --- a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h @@ -18,7 +18,7 @@ namespace Swift { PrioritySerializer() : GenericPayloadSerializer<Priority>() {} virtual std::string serializePayload(std::shared_ptr<Priority> priority) const { - return "<priority>" + boost::lexical_cast<std::string>(priority->getPriority()) + "</priority>"; + return "<priority>" + std::to_string(priority->getPriority()) + "</priority>"; } }; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp index 9786f51..b2c7326 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp @@ -37,7 +37,7 @@ std::string PubSubItemsSerializer::serializePayload(std::shared_ptr<PubSubItems> element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item))); } if (payload->getMaximumItems()) { - element.setAttribute("max_items", boost::lexical_cast<std::string>(*payload->getMaximumItems())); + element.setAttribute("max_items", std::to_string(*payload->getMaximumItems())); } if (payload->getSubscriptionID()) { element.setAttribute("subid", *payload->getSubscriptionID()); diff --git a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp index 3302863..3d13ce3 100644 --- a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp @@ -29,21 +29,21 @@ std::string ResultSetSerializer::serializePayload(std::shared_ptr<ResultSet> pay XMLElement element("set", "http://jabber.org/protocol/rsm"); if (payload->getMaxItems()) { - element.addNode(std::make_shared<XMLElement>("max", "", boost::lexical_cast<std::string>(*payload->getMaxItems()))); + element.addNode(std::make_shared<XMLElement>("max", "", std::to_string(*payload->getMaxItems()))); } if (payload->getCount()) { - element.addNode(std::make_shared<XMLElement>("count", "", boost::lexical_cast<std::string>(*payload->getCount()))); + element.addNode(std::make_shared<XMLElement>("count", "", std::to_string(*payload->getCount()))); } if (payload->getIndex()) { - element.addNode(std::make_shared<XMLElement>("index", "", boost::lexical_cast<std::string>(*payload->getIndex()))); + element.addNode(std::make_shared<XMLElement>("index", "", std::to_string(*payload->getIndex()))); } if (payload->getFirstID()) { std::shared_ptr<XMLElement> firstElement = std::make_shared<XMLElement>("first", "", *payload->getFirstID()); if (payload->getFirstIDIndex()) { - firstElement->setAttribute("index", boost::lexical_cast<std::string>(*payload->getFirstIDIndex())); + firstElement->setAttribute("index", std::to_string(*payload->getFirstIDIndex())); } element.addNode(firstElement); } diff --git a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h index 14cbd14..e992f72 100644 --- a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h @@ -29,7 +29,7 @@ namespace Swift { if (s5bProxyRequest && s5bProxyRequest->getStreamHost()) { std::shared_ptr<XMLElement> streamHost = std::make_shared<XMLElement>("streamhost"); streamHost->setAttribute("host", s5bProxyRequest->getStreamHost().get().host); - streamHost->setAttribute("port", boost::lexical_cast<std::string>(s5bProxyRequest->getStreamHost().get().port)); + streamHost->setAttribute("port", std::to_string(s5bProxyRequest->getStreamHost().get().port)); streamHost->setAttribute("jid", s5bProxyRequest->getStreamHost().get().jid.toString()); queryElement.addNode(streamHost); } else if (s5bProxyRequest && s5bProxyRequest->getActivate()) { diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp index ba296f9..718e550 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp @@ -40,7 +40,7 @@ std::string StreamInitiationFileInfoSerializer::serializePayload(std::shared_ptr fileElement.setAttribute("name", fileInfo->getName()); } if (fileInfo->getSize() != 0) { - fileElement.setAttribute("size", boost::lexical_cast<std::string>(fileInfo->getSize())); + fileElement.setAttribute("size", std::to_string(fileInfo->getSize())); } if (!fileInfo->getDescription().empty()) { std::shared_ptr<XMLElement> desc = std::make_shared<XMLElement>("desc", "", fileInfo->getDescription()); @@ -49,7 +49,7 @@ std::string StreamInitiationFileInfoSerializer::serializePayload(std::shared_ptr if (fileInfo->getSupportsRangeRequests()) { std::shared_ptr<XMLElement> range = std::make_shared<XMLElement>("range"); if (fileInfo->getRangeOffset() != 0) { - range->setAttribute("offset", boost::lexical_cast<std::string>(fileInfo->getRangeOffset())); + range->setAttribute("offset", std::to_string(fileInfo->getRangeOffset())); } fileElement.addNode(range); } diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp index 3faa5b7..813edb4 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp @@ -38,7 +38,7 @@ std::string StreamInitiationSerializer::serializePayload(std::shared_ptr<StreamI std::shared_ptr<XMLElement> fileElement(new XMLElement("file", "http://jabber.org/protocol/si/profile/file-transfer")); fileElement->setAttribute("name", file.getName()); if (file.getSize() != 0) { - fileElement->setAttribute("size", boost::lexical_cast<std::string>(file.getSize())); + fileElement->setAttribute("size", std::to_string(file.getSize())); } if (!file.getDescription().empty()) { std::shared_ptr<XMLElement> descElement(new XMLElement("desc")); diff --git a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp index 687b566..8bb3a4b 100644 --- a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp @@ -26,7 +26,7 @@ std::string UserTuneSerializer::serializePayload(std::shared_ptr<UserTune> paylo } XMLElement element("tune", "http://jabber.org/protocol/tune"); if (payload->getRating()) { - element.addNode(std::make_shared<XMLElement>("rating", "", boost::lexical_cast<std::string>(*payload->getRating()))); + element.addNode(std::make_shared<XMLElement>("rating", "", std::to_string(*payload->getRating()))); } if (payload->getTitle()) { element.addNode(std::make_shared<XMLElement>("title", "", *payload->getTitle())); @@ -44,7 +44,7 @@ std::string UserTuneSerializer::serializePayload(std::shared_ptr<UserTune> paylo element.addNode(std::make_shared<XMLElement>("source", "", *payload->getSource())); } if (payload->getLength()) { - element.addNode(std::make_shared<XMLElement>("length", "", boost::lexical_cast<std::string>(*payload->getLength()))); + element.addNode(std::make_shared<XMLElement>("length", "", std::to_string(*payload->getLength()))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp index 34fd149..4743089 100644 --- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp @@ -26,13 +26,13 @@ namespace Swift { void WhiteboardElementSerializingVisitor::visit(WhiteboardLineElement& line) { element = std::make_shared<XMLElement>("line"); try { - element->setAttribute("x1", boost::lexical_cast<std::string>(line.x1())); - element->setAttribute("y1", boost::lexical_cast<std::string>(line.y1())); - element->setAttribute("x2", boost::lexical_cast<std::string>(line.x2())); - element->setAttribute("y2", boost::lexical_cast<std::string>(line.y2())); + element->setAttribute("x1", std::to_string(line.x1())); + element->setAttribute("y1", std::to_string(line.y1())); + element->setAttribute("x2", std::to_string(line.x2())); + element->setAttribute("y2", std::to_string(line.y2())); element->setAttribute("id", line.getID()); element->setAttribute("stroke", line.getColor().toHex()); - element->setAttribute("stroke-width", boost::lexical_cast<std::string>(line.getPenWidth())); + element->setAttribute("stroke-width", std::to_string(line.getPenWidth())); element->setAttribute("opacity", alphaToOpacity(line.getColor().getAlpha())); } catch (boost::bad_lexical_cast&) { } @@ -43,14 +43,14 @@ namespace Swift { element->setAttribute("id", path.getID()); element->setAttribute("stroke", path.getColor().toHex()); try { - element->setAttribute("stroke-width", boost::lexical_cast<std::string>(path.getPenWidth())); + element->setAttribute("stroke-width", std::to_string(path.getPenWidth())); element->setAttribute("opacity", alphaToOpacity(path.getColor().getAlpha())); std::string pathData; if (path.getPoints().size() != 0) { std::vector<std::pair<int, int> >::const_iterator it = path.getPoints().begin(); - pathData = "M"+boost::lexical_cast<std::string>(it->first)+" "+boost::lexical_cast<std::string>(it->second)+"L"; + pathData = "M"+std::to_string(it->first)+" "+std::to_string(it->second)+"L"; for (; it != path.getPoints().end(); ++it) { - pathData += boost::lexical_cast<std::string>(it->first)+" "+boost::lexical_cast<std::string>(it->second)+" "; + pathData += std::to_string(it->first)+" "+std::to_string(it->second)+" "; } } element->setAttribute("d", pathData); @@ -61,14 +61,14 @@ namespace Swift { void WhiteboardElementSerializingVisitor::visit(WhiteboardRectElement& rect) { element = std::make_shared<XMLElement>("rect"); try { - element->setAttribute("x", boost::lexical_cast<std::string>(rect.getX())); - element->setAttribute("y", boost::lexical_cast<std::string>(rect.getY())); - element->setAttribute("width", boost::lexical_cast<std::string>(rect.getWidth())); - element->setAttribute("height", boost::lexical_cast<std::string>(rect.getHeight())); + element->setAttribute("x", std::to_string(rect.getX())); + element->setAttribute("y", std::to_string(rect.getY())); + element->setAttribute("width", std::to_string(rect.getWidth())); + element->setAttribute("height", std::to_string(rect.getHeight())); element->setAttribute("id", rect.getID()); element->setAttribute("stroke", rect.getPenColor().toHex()); element->setAttribute("fill", rect.getBrushColor().toHex());; - element->setAttribute("stroke-width", boost::lexical_cast<std::string>(rect.getPenWidth())); + element->setAttribute("stroke-width", std::to_string(rect.getPenWidth())); element->setAttribute("opacity", alphaToOpacity(rect.getPenColor().getAlpha())); element->setAttribute("fill-opacity", alphaToOpacity(rect.getBrushColor().getAlpha())); } catch (boost::bad_lexical_cast&) { @@ -81,13 +81,13 @@ namespace Swift { element->setAttribute("id", polygon.getID()); element->setAttribute("stroke", polygon.getPenColor().toHex()); element->setAttribute("fill", polygon.getBrushColor().toHex());; - element->setAttribute("stroke-width", boost::lexical_cast<std::string>(polygon.getPenWidth())); + element->setAttribute("stroke-width", std::to_string(polygon.getPenWidth())); element->setAttribute("opacity", alphaToOpacity(polygon.getPenColor().getAlpha())); element->setAttribute("fill-opacity", alphaToOpacity(polygon.getBrushColor().getAlpha())); std::string points; std::vector<std::pair<int, int> >::const_iterator it = polygon.getPoints().begin(); for (; it != polygon.getPoints().end(); ++it) { - points += boost::lexical_cast<std::string>(it->first)+","+boost::lexical_cast<std::string>(it->second)+" "; + points += std::to_string(it->first)+","+std::to_string(it->second)+" "; } element->setAttribute("points", points); } catch (boost::bad_lexical_cast&) { @@ -97,9 +97,9 @@ namespace Swift { void WhiteboardElementSerializingVisitor::visit(WhiteboardTextElement& text) { element = std::make_shared<XMLElement>("text"); try { - element->setAttribute("x", boost::lexical_cast<std::string>(text.getX())); - element->setAttribute("y", boost::lexical_cast<std::string>(text.getY())); - element->setAttribute("font-size", boost::lexical_cast<std::string>(text.getSize())); + element->setAttribute("x", std::to_string(text.getX())); + element->setAttribute("y", std::to_string(text.getY())); + element->setAttribute("font-size", std::to_string(text.getSize())); element->setAttribute("id", text.getID()); element->setAttribute("fill", text.getColor().toHex()); element->setAttribute("opacity", alphaToOpacity(text.getColor().getAlpha())); @@ -111,14 +111,14 @@ namespace Swift { void WhiteboardElementSerializingVisitor::visit(WhiteboardEllipseElement& ellipse) { element = std::make_shared<XMLElement>("ellipse"); try { - element->setAttribute("cx", boost::lexical_cast<std::string>(ellipse.getCX())); - element->setAttribute("cy", boost::lexical_cast<std::string>(ellipse.getCY())); - element->setAttribute("rx", boost::lexical_cast<std::string>(ellipse.getRX())); - element->setAttribute("ry", boost::lexical_cast<std::string>(ellipse.getRY())); + element->setAttribute("cx", std::to_string(ellipse.getCX())); + element->setAttribute("cy", std::to_string(ellipse.getCY())); + element->setAttribute("rx", std::to_string(ellipse.getRX())); + element->setAttribute("ry", std::to_string(ellipse.getRY())); element->setAttribute("id", ellipse.getID()); element->setAttribute("stroke", ellipse.getPenColor().toHex()); element->setAttribute("fill", ellipse.getBrushColor().toHex());; - element->setAttribute("stroke-width", boost::lexical_cast<std::string>(ellipse.getPenWidth())); + element->setAttribute("stroke-width", std::to_string(ellipse.getPenWidth())); element->setAttribute("opacity", alphaToOpacity(ellipse.getPenColor().getAlpha())); element->setAttribute("fill-opacity", alphaToOpacity(ellipse.getBrushColor().getAlpha())); } catch (boost::bad_lexical_cast&) { @@ -134,7 +134,7 @@ namespace Swift { if (opacity == 100) { return "1"; } else { - return "."+boost::lexical_cast<std::string>(opacity); + return "."+std::to_string(opacity); } } @@ -148,7 +148,7 @@ namespace Swift { if (insertOp) { try { operationNode->setAttribute("type", "insert"); - operationNode->setAttribute("pos", boost::lexical_cast<std::string>(insertOp->getPos())); + operationNode->setAttribute("pos", std::to_string(insertOp->getPos())); operationNode->setAttribute("id", insertOp->getID()); operationNode->setAttribute("parentid", insertOp->getParentID()); } catch (boost::bad_lexical_cast&) { @@ -160,10 +160,10 @@ namespace Swift { if (updateOp) { try { operationNode->setAttribute("type", "update"); - operationNode->setAttribute("pos", boost::lexical_cast<std::string>(updateOp->getPos())); + operationNode->setAttribute("pos", std::to_string(updateOp->getPos())); operationNode->setAttribute("id", updateOp->getID()); operationNode->setAttribute("parentid", updateOp->getParentID()); - operationNode->setAttribute("newpos", boost::lexical_cast<std::string>(updateOp->getNewPos())); + operationNode->setAttribute("newpos", std::to_string(updateOp->getNewPos())); } catch (boost::bad_lexical_cast&) { } updateOp->getElement()->accept(visitor); @@ -175,7 +175,7 @@ namespace Swift { if (deleteOp) { try { operationNode->setAttribute("type", "delete"); - operationNode->setAttribute("pos", boost::lexical_cast<std::string>(deleteOp->getPos())); + operationNode->setAttribute("pos", std::to_string(deleteOp->getPos())); operationNode->setAttribute("id", deleteOp->getID()); operationNode->setAttribute("parentid", deleteOp->getParentID()); operationNode->setAttribute("elementid", deleteOp->getElementID()); diff --git a/Swiften/Serializer/StanzaAckSerializer.h b/Swiften/Serializer/StanzaAckSerializer.h index f5a27dc..228d67b 100644 --- a/Swiften/Serializer/StanzaAckSerializer.h +++ b/Swiften/Serializer/StanzaAckSerializer.h @@ -25,7 +25,7 @@ namespace Swift { StanzaAck::ref stanzaAck(std::dynamic_pointer_cast<StanzaAck>(element)); assert(stanzaAck->isValid()); XMLElement result("a", "urn:xmpp:sm:2"); - result.setAttribute("h", std::string(boost::lexical_cast<std::string>(stanzaAck->getHandledStanzasCount()))); + result.setAttribute("h", std::string(std::to_string(stanzaAck->getHandledStanzasCount()))); return createSafeByteArray(result.serialize()); } }; diff --git a/Swiften/Serializer/StreamResumeSerializer.cpp b/Swiften/Serializer/StreamResumeSerializer.cpp index 619ac9c..e4a40c9 100644 --- a/Swiften/Serializer/StreamResumeSerializer.cpp +++ b/Swiften/Serializer/StreamResumeSerializer.cpp @@ -23,7 +23,7 @@ SafeByteArray StreamResumeSerializer::serialize(std::shared_ptr<ToplevelElement> XMLElement element("resume", "urn:xmpp:sm:2"); element.setAttribute("previd", e->getResumeID()); if (e->getHandledStanzasCount()) { - element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount().get())); + element.setAttribute("h", std::to_string(e->getHandledStanzasCount().get())); } return createSafeByteArray(element.serialize()); } diff --git a/Swiften/Serializer/StreamResumedSerializer.cpp b/Swiften/Serializer/StreamResumedSerializer.cpp index 5b88ded..2398335 100644 --- a/Swiften/Serializer/StreamResumedSerializer.cpp +++ b/Swiften/Serializer/StreamResumedSerializer.cpp @@ -23,7 +23,7 @@ SafeByteArray StreamResumedSerializer::serialize(std::shared_ptr<ToplevelElement XMLElement element("resumed", "urn:xmpp:sm:2"); element.setAttribute("previd", e->getResumeID()); if (e->getHandledStanzasCount()) { - element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount().get())); + element.setAttribute("h", std::to_string(e->getHandledStanzasCount().get())); } return createSafeByteArray(element.serialize()); } |