diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 17:23:49 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-04 08:28:23 (GMT) |
commit | 741c45b74d5f634622eb5f757c49323274fb8937 (patch) | |
tree | b9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swift/QtUI/QtVCardWidget | |
parent | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff) | |
download | swift-741c45b74d5f634622eb5f757c49323274fb8937.zip swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2 |
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed'
replacement calls to all source files:
's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g'
's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g'
's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g'
's/boost::make_shared/std::make_shared/g'
's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g'
's/boost::shared_ptr/std::shared_ptr/g'
's/boost::weak_ptr/std::weak_ptr/g'
's/boost::enable_shared_from_this/std::enable_shared_from_this/g'
The remaining issues have been fixed manually.
Test-Information:
Code builds on OS X 10.11.4 and unit tests pass.
Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swift/QtUI/QtVCardWidget')
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp | 30 | ||||
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardWidget.h | 8 |
2 files changed, 19 insertions, 19 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp index fffd4b3..c5f99f0 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp @@ -52,17 +52,17 @@ QtVCardWidget::QtVCardWidget(QWidget* parent) : toolButton->hide(); toolButton->setMenu(menu); - addFieldType(menu, boost::make_shared<QtVCardInternetEMailField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardTelephoneField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardAddressField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardAddressLabelField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardBirthdayField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardJIDField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardDescriptionField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardRoleField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardTitleField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardOrganizationField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardURLField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardInternetEMailField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardTelephoneField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardAddressField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardAddressLabelField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardBirthdayField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardJIDField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardDescriptionField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardRoleField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardTitleField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardOrganizationField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardURLField::FieldInfo>()); setEditable(false); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -111,7 +111,7 @@ void QtVCardWidget::setEditable(bool editable) { void QtVCardWidget::setVCard(VCard::ref vcard) { clearFields(); - this->vcard = boost::make_shared<VCard>(*vcard); + this->vcard = std::make_shared<VCard>(*vcard); ui->photoAndName->setFormattedName(P2QSTRING(vcard->getFullName())); ui->photoAndName->setNickname(P2QSTRING(vcard->getNickname())); ui->photoAndName->setPrefix(P2QSTRING(vcard->getPrefix())); @@ -312,7 +312,7 @@ VCard::ref QtVCardWidget::getVCard() { void QtVCardWidget::addField() { QAction* action = nullptr; if ((action = dynamic_cast<QAction*>(sender()))) { - boost::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; + std::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; QWidget* newField = fieldInfo->createFieldInstance(this, ui->cardFields, true); QtVCardGeneralField* newGeneralField = dynamic_cast<QtVCardGeneralField*>(newField); if (newGeneralField) { @@ -341,7 +341,7 @@ void QtVCardWidget::removeField(QtVCardGeneralField *field) { delete field; } -void QtVCardWidget::addFieldType(QMenu* menu, boost::shared_ptr<QtVCardFieldInfo> fieldType) { +void QtVCardWidget::addFieldType(QMenu* menu, std::shared_ptr<QtVCardFieldInfo> fieldType) { if (!fieldType->getMenuName().isEmpty()) { QAction* action = new QAction(tr("Add %1").arg(fieldType->getMenuName()), this); actionFieldInfo[action] = fieldType; @@ -350,7 +350,7 @@ void QtVCardWidget::addFieldType(QMenu* menu, boost::shared_ptr<QtVCardFieldInfo } } -int QtVCardWidget::fieldTypeInstances(boost::shared_ptr<QtVCardFieldInfo> fieldType) { +int QtVCardWidget::fieldTypeInstances(std::shared_ptr<QtVCardFieldInfo> fieldType) { int instances = 0; for (int n = 0; n < ui->cardFields->count(); n++) { if (fieldType->testInstance(ui->cardFields->itemAt(n)->widget())) instances++; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h index 76fc46c..5334016 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QToolButton> #include <QWidget> @@ -53,8 +53,8 @@ namespace Swift { void removeField(QtVCardGeneralField* field); private: - void addFieldType(QMenu*, boost::shared_ptr<QtVCardFieldInfo>); - int fieldTypeInstances(boost::shared_ptr<QtVCardFieldInfo>); + void addFieldType(QMenu*, std::shared_ptr<QtVCardFieldInfo>); + int fieldTypeInstances(std::shared_ptr<QtVCardFieldInfo>); void clearFields(); void clearEmptyFields(); void appendField(QtVCardGeneralField* field); @@ -67,7 +67,7 @@ namespace Swift { bool editable; QMenu* menu; std::list<QtVCardGeneralField*> fields; - std::map<QAction*, boost::shared_ptr<QtVCardFieldInfo> > actionFieldInfo; + std::map<QAction*, std::shared_ptr<QtVCardFieldInfo> > actionFieldInfo; }; } |