[Gui] Use std::shared_ptr instead of boost::shared_ptr
There's no need to use boost version when stl has support for shared_ptr
This commit is contained in:
@@ -41,7 +41,7 @@ using namespace App;
|
||||
using namespace Gui::Dialog;
|
||||
|
||||
DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path,
|
||||
boost::shared_ptr<const Expression> _expression,
|
||||
std::shared_ptr<const Expression> _expression,
|
||||
const Base::Unit & _impliedUnit, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::DlgExpressionInput)
|
||||
@@ -135,7 +135,7 @@ void DlgExpressionInput::textChanged(const QString &text)
|
||||
setMinimumWidth(ui->expression->minimumWidth());
|
||||
|
||||
//now handle expression
|
||||
boost::shared_ptr<Expression> expr(ExpressionParser::parse(path.getDocumentObject(), text.toUtf8().constData()));
|
||||
std::shared_ptr<Expression> expr(ExpressionParser::parse(path.getDocumentObject(), text.toUtf8().constData()));
|
||||
|
||||
if (expr) {
|
||||
std::string error = path.getDocumentObject()->ExpressionEngine.validateExpression(path, expr);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QDialog>
|
||||
#include <Base/Unit.h>
|
||||
#include <App/ObjectIdentifier.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class DlgExpressionInput;
|
||||
@@ -51,10 +51,10 @@ class GuiExport DlgExpressionInput : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgExpressionInput(const App::ObjectIdentifier & _path, boost::shared_ptr<const App::Expression> _expression, const Base::Unit &_impliedUnit, QWidget *parent = 0);
|
||||
explicit DlgExpressionInput(const App::ObjectIdentifier & _path, std::shared_ptr<const App::Expression> _expression, const Base::Unit &_impliedUnit, QWidget *parent = 0);
|
||||
~DlgExpressionInput();
|
||||
|
||||
boost::shared_ptr<App::Expression> getExpression() const { return expression; }
|
||||
std::shared_ptr<App::Expression> getExpression() const { return expression; }
|
||||
|
||||
bool discardedFormula() const { return discarded; }
|
||||
|
||||
@@ -77,7 +77,7 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
::Ui::DlgExpressionInput *ui;
|
||||
boost::shared_ptr<App::Expression> expression;
|
||||
std::shared_ptr<App::Expression> expression;
|
||||
App::ObjectIdentifier path;
|
||||
bool discarded;
|
||||
const Base::Unit impliedUnit;
|
||||
|
||||
@@ -66,7 +66,7 @@ void ExpressionBinding::unbind()
|
||||
path = App::ObjectIdentifier();
|
||||
}
|
||||
|
||||
void Gui::ExpressionBinding::setExpression(boost::shared_ptr<Expression> expr)
|
||||
void Gui::ExpressionBinding::setExpression(std::shared_ptr<Expression> expr)
|
||||
{
|
||||
DocumentObject * docObj = path.getDocumentObject();
|
||||
|
||||
@@ -124,7 +124,7 @@ bool ExpressionBinding::hasExpression() const
|
||||
return isBound() && getExpression() != 0;
|
||||
}
|
||||
|
||||
boost::shared_ptr<App::Expression> ExpressionBinding::getExpression() const
|
||||
std::shared_ptr<App::Expression> ExpressionBinding::getExpression() const
|
||||
{
|
||||
DocumentObject * docObj = path.getDocumentObject();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <App/ObjectIdentifier.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <memory>
|
||||
#include <QLabel>
|
||||
#include <boost_signals2.hpp>
|
||||
|
||||
@@ -58,17 +58,17 @@ public:
|
||||
|
||||
protected:
|
||||
const App::ObjectIdentifier & getPath() const { return path; }
|
||||
boost::shared_ptr<App::Expression> getExpression() const;
|
||||
std::shared_ptr<App::Expression> getExpression() const;
|
||||
std::string getExpressionString(bool no_throw=true) const;
|
||||
std::string getEscapedExpressionString() const;
|
||||
virtual void setExpression(boost::shared_ptr<App::Expression> expr);
|
||||
virtual void setExpression(std::shared_ptr<App::Expression> expr);
|
||||
|
||||
//gets called when the bound expression is changed, either by this binding or any external action
|
||||
virtual void onChange() {}
|
||||
|
||||
private:
|
||||
App::ObjectIdentifier path;
|
||||
boost::shared_ptr<App::Expression> lastExpression;
|
||||
std::shared_ptr<App::Expression> lastExpression;
|
||||
|
||||
protected:
|
||||
QLabel* iconLabel;
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#define GUI_GRAPHVIZVIEW_H
|
||||
|
||||
#include "MDIView.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost_signals2.hpp>
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "GuiApplicationNativeEventAware.h"
|
||||
#include <Base/Interpreter.h> // For Base::SystemExitException
|
||||
#include <QList>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <memory>
|
||||
|
||||
class QSessionManager;
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
bool notify (QObject * receiver, QEvent * event);
|
||||
|
||||
/// Pointer to exceptions caught in Qt event handler
|
||||
boost::shared_ptr<Base::SystemExitException> caughtException;
|
||||
std::shared_ptr<Base::SystemExitException> caughtException;
|
||||
|
||||
public Q_SLOTS:
|
||||
void commitData(QSessionManager &manager);
|
||||
|
||||
@@ -113,7 +113,7 @@ void InputField::bind(const App::ObjectIdentifier &_path)
|
||||
DocumentObject * docObj = getPath().getDocumentObject();
|
||||
|
||||
if (docObj) {
|
||||
boost::shared_ptr<const Expression> expr(docObj->getExpression(getPath()).expression);
|
||||
std::shared_ptr<const Expression> expr(docObj->getExpression(getPath()).expression);
|
||||
|
||||
if (expr)
|
||||
newInput(Tools::fromStdString(expr->toString()));
|
||||
@@ -157,7 +157,7 @@ QPixmap InputField::getValidationIcon(const char* name, const QSize& size) const
|
||||
void InputField::updateText(const Base::Quantity& quant)
|
||||
{
|
||||
if (isBound()) {
|
||||
boost::shared_ptr<const Expression> e(getPath().getDocumentObject()->getExpression(getPath()).expression);
|
||||
std::shared_ptr<const Expression> e(getPath().getDocumentObject()->getExpression(getPath()).expression);
|
||||
|
||||
if (e) {
|
||||
setText(Tools::fromStdString(e->toString()));
|
||||
@@ -240,7 +240,7 @@ void InputField::newInput(const QString & text)
|
||||
fixup(input);
|
||||
|
||||
if (isBound()) {
|
||||
boost::shared_ptr<Expression> e(ExpressionParser::parse(getPath().getDocumentObject(), input.toUtf8()));
|
||||
std::shared_ptr<Expression> e(ExpressionParser::parse(getPath().getDocumentObject(), input.toUtf8()));
|
||||
|
||||
setExpression(e);
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ void QuantitySpinBox::bind(const App::ObjectIdentifier &_path)
|
||||
iconLabel->show();
|
||||
}
|
||||
|
||||
void Gui::QuantitySpinBox::setExpression(boost::shared_ptr<Expression> expr)
|
||||
void Gui::QuantitySpinBox::setExpression(std::shared_ptr<Expression> expr)
|
||||
{
|
||||
Q_ASSERT(isBound());
|
||||
|
||||
@@ -661,7 +661,7 @@ void QuantitySpinBox::finishFormulaDialog()
|
||||
if (box->result() == QDialog::Accepted)
|
||||
setExpression(box->getExpression());
|
||||
else if (box->discardedFormula())
|
||||
setExpression(boost::shared_ptr<Expression>());
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
box->deleteLater();
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
QSize minimumSizeHint() const;
|
||||
bool event(QEvent *event);
|
||||
|
||||
void setExpression(boost::shared_ptr<App::Expression> expr);
|
||||
void setExpression(std::shared_ptr<App::Expression> expr);
|
||||
void bind(const App::ObjectIdentifier &_path);
|
||||
bool apply(const std::string &propName);
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ void UIntSpinBox::bind(const App::ObjectIdentifier &_path)
|
||||
iconLabel->show();
|
||||
}
|
||||
|
||||
void UIntSpinBox::setExpression(boost::shared_ptr<Expression> expr)
|
||||
void UIntSpinBox::setExpression(std::shared_ptr<Expression> expr)
|
||||
{
|
||||
Q_ASSERT(isBound());
|
||||
|
||||
@@ -399,7 +399,7 @@ void UIntSpinBox::finishFormulaDialog()
|
||||
if (box->result() == QDialog::Accepted)
|
||||
setExpression(box->getExpression());
|
||||
else if (box->discardedFormula())
|
||||
setExpression(boost::shared_ptr<Expression>());
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
box->deleteLater();
|
||||
}
|
||||
@@ -473,7 +473,7 @@ void IntSpinBox::bind(const ObjectIdentifier& _path) {
|
||||
iconLabel->show();
|
||||
}
|
||||
|
||||
void IntSpinBox::setExpression(boost::shared_ptr<Expression> expr)
|
||||
void IntSpinBox::setExpression(std::shared_ptr<Expression> expr)
|
||||
{
|
||||
Q_ASSERT(isBound());
|
||||
|
||||
@@ -592,7 +592,7 @@ void IntSpinBox::finishFormulaDialog()
|
||||
if (box->result() == QDialog::Accepted)
|
||||
setExpression(box->getExpression());
|
||||
else if (box->discardedFormula())
|
||||
setExpression(boost::shared_ptr<Expression>());
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
box->deleteLater();
|
||||
}
|
||||
@@ -666,7 +666,7 @@ void DoubleSpinBox::bind(const ObjectIdentifier& _path) {
|
||||
iconLabel->show();
|
||||
}
|
||||
|
||||
void DoubleSpinBox::setExpression(boost::shared_ptr<Expression> expr)
|
||||
void DoubleSpinBox::setExpression(std::shared_ptr<Expression> expr)
|
||||
{
|
||||
Q_ASSERT(isBound());
|
||||
|
||||
@@ -784,7 +784,7 @@ void DoubleSpinBox::finishFormulaDialog()
|
||||
if (box->result() == QDialog::Accepted)
|
||||
setExpression(box->getExpression());
|
||||
else if (box->discardedFormula())
|
||||
setExpression(boost::shared_ptr<Expression>());
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
box->deleteLater();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
uint maximum() const;
|
||||
void setMaximum( uint value );
|
||||
|
||||
void setExpression(boost::shared_ptr<App::Expression> expr);
|
||||
void setExpression(std::shared_ptr<App::Expression> expr);
|
||||
void bind(const App::ObjectIdentifier &_path);
|
||||
bool apply(const std::string &propName);
|
||||
bool apply();
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
IntSpinBox ( QWidget* parent=0 );
|
||||
virtual ~IntSpinBox();
|
||||
|
||||
void setExpression(boost::shared_ptr<App::Expression> expr);
|
||||
void setExpression(std::shared_ptr<App::Expression> expr);
|
||||
void bind(const App::ObjectIdentifier &_path);
|
||||
bool apply(const std::string &propName);
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
DoubleSpinBox ( QWidget* parent=0 );
|
||||
virtual ~DoubleSpinBox();
|
||||
|
||||
void setExpression(boost::shared_ptr<App::Expression> expr);
|
||||
void setExpression(std::shared_ptr<App::Expression> expr);
|
||||
void bind(const App::ObjectIdentifier &_path);
|
||||
bool apply(const std::string &propName);
|
||||
|
||||
|
||||
@@ -1404,7 +1404,7 @@ void ExpLineEdit::bind(const ObjectIdentifier& _path) {
|
||||
iconLabel->show();
|
||||
}
|
||||
|
||||
void ExpLineEdit::setExpression(boost::shared_ptr<Expression> expr)
|
||||
void ExpLineEdit::setExpression(std::shared_ptr<Expression> expr)
|
||||
{
|
||||
Q_ASSERT(isBound());
|
||||
|
||||
@@ -1512,7 +1512,7 @@ void ExpLineEdit::finishFormulaDialog()
|
||||
if (box->result() == QDialog::Accepted)
|
||||
setExpression(box->getExpression());
|
||||
else if (box->discardedFormula())
|
||||
setExpression(boost::shared_ptr<Expression>());
|
||||
setExpression(std::shared_ptr<Expression>());
|
||||
|
||||
box->deleteLater();
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ class GuiExport ExpLineEdit : public QLineEdit, public ExpressionBinding
|
||||
public:
|
||||
ExpLineEdit ( QWidget * parent=0, bool expressionOnly=false );
|
||||
|
||||
void setExpression(boost::shared_ptr<App::Expression> expr);
|
||||
void setExpression(std::shared_ptr<App::Expression> expr);
|
||||
void bind(const App::ObjectIdentifier &_path);
|
||||
bool apply(const std::string &propName);
|
||||
|
||||
|
||||
@@ -121,11 +121,11 @@ void PropertyItem::onChange()
|
||||
if(hasExpression()) {
|
||||
for(auto child : childItems) {
|
||||
if(child && child->hasExpression())
|
||||
child->setExpression(boost::shared_ptr<App::Expression>());
|
||||
child->setExpression(std::shared_ptr<App::Expression>());
|
||||
}
|
||||
for(auto item=parentItem;item;item=item->parentItem) {
|
||||
if(item->hasExpression())
|
||||
item->setExpression(boost::shared_ptr<App::Expression>());
|
||||
item->setExpression(std::shared_ptr<App::Expression>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user