App: Single arg ctors must be explicit
This commit is contained in:
@@ -488,7 +488,7 @@ protected:
|
||||
|
||||
private:
|
||||
/// Constructor
|
||||
Application(std::map<std::string,std::string> &mConfig);
|
||||
explicit Application(std::map<std::string,std::string> &mConfig);
|
||||
/// Destructor
|
||||
virtual ~Application();
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class AppExport ColorModel
|
||||
{
|
||||
public:
|
||||
ColorModel() = default;
|
||||
ColorModel (std::size_t usCt) {
|
||||
explicit ColorModel (std::size_t usCt) {
|
||||
colors.resize(usCt);
|
||||
}
|
||||
ColorModel(const ColorModel&) = default;
|
||||
|
||||
@@ -328,7 +328,7 @@ void Document::exportGraphviz(std::ostream& out) const
|
||||
class GraphCreator {
|
||||
public:
|
||||
|
||||
GraphCreator(struct DocumentP* _d) : d(_d), vertex_no(0), seed(std::random_device()()), distribution(0,255) {
|
||||
explicit GraphCreator(struct DocumentP* _d) : d(_d), vertex_no(0), seed(std::random_device()()), distribution(0,255) {
|
||||
build();
|
||||
}
|
||||
|
||||
@@ -1793,7 +1793,7 @@ static DocExportStatus _ExportStatus;
|
||||
// Exception-safe exporting status setter
|
||||
class DocumentExporting {
|
||||
public:
|
||||
DocumentExporting(const std::vector<App::DocumentObject*> &objs) {
|
||||
explicit DocumentExporting(const std::vector<App::DocumentObject*> &objs) {
|
||||
_ExportStatus.status = Document::Exporting;
|
||||
_ExportStatus.objs.insert(objs.begin(),objs.end());
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ public:
|
||||
|
||||
protected:
|
||||
/// Construction
|
||||
Document(const char *name = "");
|
||||
explicit Document(const char *name = "");
|
||||
|
||||
void _removeObject(DocumentObject* pcObject);
|
||||
void _addObject(DocumentObject* pcObject, const char* pObjectName);
|
||||
|
||||
@@ -74,11 +74,11 @@ enum ObjectStatus {
|
||||
class AppExport DocumentObjectExecReturn
|
||||
{
|
||||
public:
|
||||
DocumentObjectExecReturn(const std::string& sWhy, DocumentObject* WhichObject=nullptr)
|
||||
explicit DocumentObjectExecReturn(const std::string& sWhy, DocumentObject* WhichObject=nullptr)
|
||||
: Why(sWhy), Which(WhichObject)
|
||||
{
|
||||
}
|
||||
DocumentObjectExecReturn(const char* sWhy, DocumentObject* WhichObject=nullptr)
|
||||
explicit DocumentObjectExecReturn(const char* sWhy, DocumentObject* WhichObject=nullptr)
|
||||
: Which(WhichObject)
|
||||
{
|
||||
if (sWhy)
|
||||
|
||||
@@ -476,7 +476,7 @@ PyObject* DocumentObjectPy::getSubObject(PyObject *args, PyObject *keywds)
|
||||
Py::Object obj;
|
||||
Py::Object pyObj;
|
||||
Base::Matrix4D mat;
|
||||
SubInfo(const Base::Matrix4D &mat) : sobj(nullptr), mat(mat){}
|
||||
explicit SubInfo(const Base::Matrix4D &mat) : sobj(nullptr), mat(mat){}
|
||||
};
|
||||
|
||||
Base::Matrix4D mat;
|
||||
|
||||
@@ -544,7 +544,7 @@ std::string PropertyLinkT::getPropertyPython() const
|
||||
|
||||
class DocumentWeakPtrT::Private {
|
||||
public:
|
||||
Private(App::Document* doc) : _document(doc) {
|
||||
explicit Private(App::Document* doc) : _document(doc) {
|
||||
if (doc) {
|
||||
connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(std::bind
|
||||
(&Private::deletedDocument, this, sp::_1));
|
||||
@@ -596,7 +596,7 @@ App::Document* DocumentWeakPtrT::operator->() const noexcept
|
||||
|
||||
class DocumentObjectWeakPtrT::Private {
|
||||
public:
|
||||
Private(App::DocumentObject* obj) : object(obj), indocument(false) {
|
||||
explicit Private(App::DocumentObject* obj) : object(obj), indocument(false) {
|
||||
set(obj);
|
||||
}
|
||||
void deletedDocument(const App::Document& doc) {
|
||||
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
/*! Constructor */
|
||||
DocumentT();
|
||||
/*! Constructor */
|
||||
DocumentT(Document*);
|
||||
DocumentT(Document*); // explicit bombs
|
||||
/*! Constructor */
|
||||
DocumentT(const std::string&);
|
||||
explicit DocumentT(const std::string&);
|
||||
/*! Constructor */
|
||||
DocumentT(const DocumentT&);
|
||||
/*! Destructor */
|
||||
@@ -99,13 +99,13 @@ public:
|
||||
/*! Constructor */
|
||||
DocumentObjectT(DocumentObjectT &&);
|
||||
/*! Constructor */
|
||||
DocumentObjectT(const DocumentObject*);
|
||||
explicit DocumentObjectT(const DocumentObject*);
|
||||
/*! Constructor */
|
||||
DocumentObjectT(const Document*, const std::string& objName);
|
||||
/*! Constructor */
|
||||
DocumentObjectT(const char *docName, const char *objName);
|
||||
/*! Constructor */
|
||||
DocumentObjectT(const Property*);
|
||||
explicit DocumentObjectT(const Property*);
|
||||
/*! Destructor */
|
||||
~DocumentObjectT();
|
||||
/*! Assignment operator */
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
SubObjectT(const DocumentObject*, const char *subname);
|
||||
|
||||
/*! Constructor */
|
||||
SubObjectT(const DocumentObject*);
|
||||
SubObjectT(const DocumentObject*);// explicit bombs
|
||||
|
||||
/*! Constructor */
|
||||
SubObjectT(const char *docName, const char *objName, const char *subname);
|
||||
@@ -257,13 +257,13 @@ public:
|
||||
PropertyLinkT();
|
||||
|
||||
/*! Constructor */
|
||||
PropertyLinkT(DocumentObject *obj);
|
||||
PropertyLinkT(DocumentObject *obj);// explicit bombs
|
||||
|
||||
/*! Constructor */
|
||||
PropertyLinkT(DocumentObject *obj, const std::vector<std::string>& subNames);
|
||||
|
||||
/*! Constructor */
|
||||
PropertyLinkT(const std::vector<DocumentObject*>& objs);
|
||||
explicit PropertyLinkT(const std::vector<DocumentObject*>& objs);
|
||||
|
||||
/*! Constructor */
|
||||
PropertyLinkT(const std::vector<DocumentObject*>& objs, const std::vector<std::string>& subNames);
|
||||
@@ -281,7 +281,7 @@ private:
|
||||
class AppExport DocumentWeakPtrT
|
||||
{
|
||||
public:
|
||||
DocumentWeakPtrT(App::Document*) noexcept;
|
||||
explicit DocumentWeakPtrT(App::Document*) noexcept;
|
||||
~DocumentWeakPtrT();
|
||||
|
||||
/*!
|
||||
@@ -320,7 +320,7 @@ private:
|
||||
class AppExport DocumentObjectWeakPtrT
|
||||
{
|
||||
public:
|
||||
DocumentObjectWeakPtrT(App::DocumentObject*);
|
||||
explicit DocumentObjectWeakPtrT(App::DocumentObject*);
|
||||
~DocumentObjectWeakPtrT();
|
||||
|
||||
/*!
|
||||
@@ -383,7 +383,7 @@ template <class T>
|
||||
class WeakPtrT
|
||||
{
|
||||
public:
|
||||
WeakPtrT(T* t) : ptr(t) {
|
||||
explicit WeakPtrT(T* t) : ptr(t) {
|
||||
}
|
||||
~WeakPtrT() = default;
|
||||
|
||||
@@ -466,7 +466,7 @@ class AppExport DocumentObserver
|
||||
public:
|
||||
/// Constructor
|
||||
DocumentObserver();
|
||||
DocumentObserver(Document*);
|
||||
explicit DocumentObserver(Document*);
|
||||
virtual ~DocumentObserver();
|
||||
|
||||
/** Attaches to another document, the old document
|
||||
|
||||
@@ -34,7 +34,7 @@ using namespace App;
|
||||
|
||||
namespace {
|
||||
struct StringCopy : public Enumeration::Object {
|
||||
StringCopy(const char* str) : d(str) {
|
||||
explicit StringCopy(const char* str) : d(str) {
|
||||
}
|
||||
const char* data() const override {
|
||||
return d.data();
|
||||
@@ -51,7 +51,7 @@ private:
|
||||
};
|
||||
|
||||
struct StringView : public Enumeration::Object {
|
||||
StringView(const char* str) : d(str) {
|
||||
explicit StringView(const char* str) : d(str) {
|
||||
}
|
||||
const char* data() const override {
|
||||
return d.data();
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace App
|
||||
Enumeration(const Enumeration& other);
|
||||
|
||||
/// Constructs an Enumeration with a single element
|
||||
Enumeration(const char *valStr);
|
||||
explicit Enumeration(const char *valStr);
|
||||
|
||||
/// Constructs an Enumeration using val within list
|
||||
Enumeration(const char **list, const char *valStr);
|
||||
|
||||
@@ -380,7 +380,7 @@ struct PyObjectWrapper {
|
||||
public:
|
||||
typedef std::shared_ptr<PyObjectWrapper> Pointer;
|
||||
|
||||
PyObjectWrapper(PyObject *obj):pyobj(obj) {
|
||||
explicit PyObjectWrapper(PyObject *obj):pyobj(obj) {
|
||||
Py::_XINCREF(pyobj);
|
||||
}
|
||||
~PyObjectWrapper() {
|
||||
@@ -940,7 +940,7 @@ std::map<App::DocumentObject*,bool> Expression::getDepObjects(std::vector<std::s
|
||||
|
||||
class GetIdentifiersExpressionVisitor : public ExpressionVisitor {
|
||||
public:
|
||||
GetIdentifiersExpressionVisitor(std::map<App::ObjectIdentifier,bool> &deps)
|
||||
explicit GetIdentifiersExpressionVisitor(std::map<App::ObjectIdentifier,bool> &deps)
|
||||
:deps(deps)
|
||||
{}
|
||||
|
||||
@@ -964,7 +964,7 @@ std::map<App::ObjectIdentifier,bool> Expression::getIdentifiers() const {
|
||||
|
||||
class AdjustLinksExpressionVisitor : public ExpressionVisitor {
|
||||
public:
|
||||
AdjustLinksExpressionVisitor(const std::set<App::DocumentObject*> &inList)
|
||||
explicit AdjustLinksExpressionVisitor(const std::set<App::DocumentObject*> &inList)
|
||||
:inList(inList),res(false)
|
||||
{}
|
||||
|
||||
@@ -985,7 +985,7 @@ bool Expression::adjustLinks(const std::set<App::DocumentObject*> &inList) {
|
||||
|
||||
class ImportSubNamesExpressionVisitor : public ExpressionVisitor {
|
||||
public:
|
||||
ImportSubNamesExpressionVisitor(const ObjectIdentifier::SubNameMap &subNameMap)
|
||||
explicit ImportSubNamesExpressionVisitor(const ObjectIdentifier::SubNameMap &subNameMap)
|
||||
:subNameMap(subNameMap)
|
||||
{}
|
||||
|
||||
@@ -1698,7 +1698,7 @@ TYPESYSTEM_SOURCE(App::FunctionExpression, App::UnitExpression)
|
||||
static int _HiddenReference;
|
||||
|
||||
struct HiddenReference {
|
||||
HiddenReference(bool cond)
|
||||
explicit HiddenReference(bool cond)
|
||||
:cond(cond)
|
||||
{
|
||||
if(cond)
|
||||
|
||||
@@ -80,7 +80,7 @@ protected:
|
||||
|
||||
template<class P> class ExpressionModifier : public ExpressionVisitor {
|
||||
public:
|
||||
ExpressionModifier(P & _prop)
|
||||
explicit ExpressionModifier(P & _prop)
|
||||
: prop(_prop)
|
||||
, propLink(Base::freecad_dynamic_cast<App::PropertyLinkBase>(&prop))
|
||||
, signaller(_prop,false)
|
||||
@@ -117,7 +117,7 @@ class AppExport Expression : public Base::BaseClass {
|
||||
|
||||
public:
|
||||
|
||||
Expression(const App::DocumentObject * _owner);
|
||||
explicit Expression(const App::DocumentObject * _owner);
|
||||
|
||||
~Expression() override;
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
|
||||
class Exception : public Base::Exception {
|
||||
public:
|
||||
Exception(const char *sMessage) : Base::Exception(sMessage) { }
|
||||
explicit Exception(const char *sMessage) : Base::Exception(sMessage) { }
|
||||
};
|
||||
|
||||
App::DocumentObject * getOwner() const { return owner; }
|
||||
|
||||
@@ -43,9 +43,9 @@ struct AppExport Expression::Component {
|
||||
Expression* e2;
|
||||
Expression* e3;
|
||||
|
||||
Component(const std::string &n);
|
||||
explicit Component(const std::string &n);
|
||||
Component(Expression *e1, Expression *e2, Expression *e3, bool isRange=false);
|
||||
Component(const ObjectIdentifier::Component &comp);
|
||||
explicit Component(const ObjectIdentifier::Component &comp);
|
||||
Component(const Component &other);
|
||||
~Component();
|
||||
Component &operator=(const Component &)=delete;
|
||||
@@ -71,7 +71,7 @@ struct AppExport Expression::Component {
|
||||
class AppExport UnitExpression : public Expression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
UnitExpression(const App::DocumentObject *_owner = nullptr, const Base::Quantity & _quantity = Base::Quantity(), const std::string & _unitStr = std::string());
|
||||
explicit UnitExpression(const App::DocumentObject *_owner = nullptr, const Base::Quantity & _quantity = Base::Quantity(), const std::string & _unitStr = std::string());
|
||||
|
||||
~UnitExpression() override;
|
||||
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
class AppExport NumberExpression : public UnitExpression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
NumberExpression(const App::DocumentObject *_owner = nullptr, const Base::Quantity & quantity = Base::Quantity());
|
||||
explicit NumberExpression(const App::DocumentObject *_owner = nullptr, const Base::Quantity & quantity = Base::Quantity());
|
||||
|
||||
Expression * simplify() const override;
|
||||
|
||||
@@ -127,7 +127,7 @@ protected:
|
||||
class AppExport ConstantExpression : public NumberExpression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
ConstantExpression(const App::DocumentObject *_owner = nullptr,
|
||||
explicit ConstantExpression(const App::DocumentObject *_owner = nullptr,
|
||||
const char *_name = "",
|
||||
const Base::Quantity &_quantity = Base::Quantity());
|
||||
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
NEG,
|
||||
POS
|
||||
};
|
||||
OperatorExpression(const App::DocumentObject *_owner = nullptr, Expression * _left = nullptr, Operator _op = NONE, Expression * _right = nullptr);
|
||||
explicit OperatorExpression(const App::DocumentObject *_owner = nullptr, Expression * _left = nullptr, Operator _op = NONE, Expression * _right = nullptr);
|
||||
|
||||
~OperatorExpression() override;
|
||||
|
||||
@@ -209,7 +209,7 @@ protected:
|
||||
class AppExport ConditionalExpression : public Expression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
ConditionalExpression(const App::DocumentObject *_owner = nullptr, Expression * _condition = nullptr,Expression * _trueExpr = nullptr, Expression * _falseExpr = nullptr);
|
||||
explicit ConditionalExpression(const App::DocumentObject *_owner = nullptr, Expression * _condition = nullptr,Expression * _trueExpr = nullptr, Expression * _falseExpr = nullptr);
|
||||
|
||||
~ConditionalExpression() override;
|
||||
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
LAST,
|
||||
};
|
||||
|
||||
FunctionExpression(const App::DocumentObject *_owner = nullptr, Function _f = NONE,
|
||||
explicit FunctionExpression(const App::DocumentObject *_owner = nullptr, Function _f = NONE,
|
||||
std::string &&name = std::string(), std::vector<Expression *> _args = std::vector<Expression*>());
|
||||
|
||||
~FunctionExpression() override;
|
||||
@@ -327,7 +327,7 @@ protected:
|
||||
class AppExport VariableExpression : public UnitExpression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
VariableExpression(const App::DocumentObject *_owner = nullptr, const ObjectIdentifier& _var = ObjectIdentifier());
|
||||
explicit VariableExpression(const App::DocumentObject *_owner = nullptr, const ObjectIdentifier& _var = ObjectIdentifier());
|
||||
|
||||
~VariableExpression() override;
|
||||
|
||||
@@ -375,7 +375,7 @@ class AppExport PyObjectExpression : public Expression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
public:
|
||||
PyObjectExpression(const App::DocumentObject *_owner=nullptr, PyObject *pyobj=nullptr, bool owned=false)
|
||||
explicit PyObjectExpression(const App::DocumentObject *_owner=nullptr, PyObject *pyobj=nullptr, bool owned=false)
|
||||
:Expression(_owner)
|
||||
{
|
||||
setPyValue(pyobj,owned);
|
||||
@@ -404,7 +404,7 @@ protected:
|
||||
class AppExport StringExpression : public Expression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
StringExpression(const App::DocumentObject *_owner = nullptr, const std::string & _text = std::string());
|
||||
explicit StringExpression(const App::DocumentObject *_owner = nullptr, const std::string & _text = std::string());
|
||||
~StringExpression() override;
|
||||
|
||||
Expression * simplify() const override;
|
||||
@@ -424,7 +424,7 @@ private:
|
||||
class AppExport RangeExpression : public App::Expression {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
RangeExpression(const App::DocumentObject * _owner = nullptr, const std::string & begin = std::string(), const std::string & end = std::string());
|
||||
explicit RangeExpression(const App::DocumentObject * _owner = nullptr, const std::string & begin = std::string(), const std::string & end = std::string());
|
||||
|
||||
~RangeExpression() override = default;
|
||||
|
||||
@@ -460,7 +460,7 @@ AppExport std::vector<std::tuple<int, int, std::string> > tokenize(const std::st
|
||||
/// Convenient class to mark begin of importing
|
||||
class AppExport ExpressionImporter {
|
||||
public:
|
||||
ExpressionImporter(Base::XMLReader &reader);
|
||||
explicit ExpressionImporter(Base::XMLReader &reader);
|
||||
~ExpressionImporter();
|
||||
static Base::XMLReader *reader();
|
||||
};
|
||||
|
||||
@@ -34,11 +34,13 @@ namespace App {
|
||||
|
||||
template<class P> class RenameObjectIdentifierExpressionVisitor : public ExpressionModifier<P> {
|
||||
public:
|
||||
RenameObjectIdentifierExpressionVisitor(P & _prop,
|
||||
const std::map<ObjectIdentifier, ObjectIdentifier> &_paths, const ObjectIdentifier & _owner)
|
||||
: ExpressionModifier<P>(_prop)
|
||||
, paths(_paths)
|
||||
, owner(_owner)
|
||||
RenameObjectIdentifierExpressionVisitor(
|
||||
P &_prop,
|
||||
const std::map<ObjectIdentifier, ObjectIdentifier> &_paths,
|
||||
const ObjectIdentifier &_owner )
|
||||
: ExpressionModifier<P>( _prop ),
|
||||
paths( _paths ),
|
||||
owner( _owner )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -46,7 +48,6 @@ public:
|
||||
this->renameObjectIdentifier(node,paths,owner);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
const std::map<ObjectIdentifier, ObjectIdentifier> &paths; /**< Map with current and new object identifiers */
|
||||
const ObjectIdentifier owner; /**< Owner of expression */
|
||||
@@ -55,7 +56,7 @@ private:
|
||||
template<class P> class UpdateElementReferenceExpressionVisitor : public ExpressionModifier<P> {
|
||||
public:
|
||||
|
||||
UpdateElementReferenceExpressionVisitor(P & _prop, App::DocumentObject *feature=nullptr, bool reverse=false)
|
||||
explicit UpdateElementReferenceExpressionVisitor(P & _prop, App::DocumentObject *feature=nullptr, bool reverse=false)
|
||||
: ExpressionModifier<P>(_prop),feature(feature),reverse(reverse)
|
||||
{
|
||||
}
|
||||
@@ -76,7 +77,7 @@ private:
|
||||
class RelabelDocumentExpressionVisitor : public ExpressionVisitor {
|
||||
public:
|
||||
|
||||
RelabelDocumentExpressionVisitor(const App::Document &doc)
|
||||
explicit RelabelDocumentExpressionVisitor(const App::Document &doc)
|
||||
: doc(doc)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
Rejected = 2 // handled and rejected
|
||||
};
|
||||
|
||||
FeaturePythonImp(App::DocumentObject*);
|
||||
explicit FeaturePythonImp(App::DocumentObject*);
|
||||
~FeaturePythonImp();
|
||||
|
||||
bool execute();
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
static PyTypeObject Type;
|
||||
|
||||
public:
|
||||
FeaturePythonPyT(Base::BaseClass *pcObject, PyTypeObject *T = &Type);
|
||||
explicit FeaturePythonPyT(Base::BaseClass *pcObject, PyTypeObject *T = &Type);
|
||||
virtual ~FeaturePythonPyT();
|
||||
|
||||
/** @name callbacks and implementers for the python object methods */
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
* Does basically the same as the constructor above unless that (R,G,B,A) is
|
||||
* encoded as an unsigned int.
|
||||
*/
|
||||
Color(uint32_t rgba)
|
||||
explicit Color(uint32_t rgba)
|
||||
{ setPackedValue( rgba ); }
|
||||
/** Copy constructor. */
|
||||
Color(const Color& c)
|
||||
@@ -222,9 +222,9 @@ public:
|
||||
/** Defines the colors and shininess for the material \a MatName. If \a MatName isn't defined then USER_DEFINED is
|
||||
* set and the user must define the colors itself.
|
||||
*/
|
||||
Material(const char* MatName);
|
||||
explicit Material(const char* MatName);
|
||||
/** Does basically the same as the constructor above unless that it accepts a MaterialType as argument. */
|
||||
Material(const MaterialType MatType);
|
||||
explicit Material(const MaterialType MatType);
|
||||
//@}
|
||||
~Material();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class DocumentObject;
|
||||
class AppExport MergeDocuments : public Base::Persistence
|
||||
{
|
||||
public:
|
||||
MergeDocuments(App::Document* doc);
|
||||
explicit MergeDocuments(App::Document* doc);
|
||||
~MergeDocuments() override;
|
||||
bool isVerbose() const { return verbose; }
|
||||
void setVerbose(bool on) { verbose = on; }
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace App {
|
||||
*/
|
||||
struct AppExport Version {
|
||||
Version();
|
||||
Version(int major, int minor = 0, int patch = 0, const std::string& suffix = std::string());
|
||||
explicit Version(int major, int minor = 0, int patch = 0, const std::string& suffix = std::string());
|
||||
explicit Version(const std::string& semanticString);
|
||||
|
||||
int major;
|
||||
|
||||
@@ -856,7 +856,7 @@ App::DocumentObject * ObjectIdentifier::getDocumentObject(const App::Document *
|
||||
if (strcmp((*j)->Label.getValue(), static_cast<const char*>(name)) == 0) {
|
||||
// Found object with matching label
|
||||
if (objectByLabel) {
|
||||
FC_WARN("duplicate object label " << doc->getName() << '#' << name);
|
||||
FC_WARN("duplicate object label " << doc->getName() << '#' << static_cast<const char*>(name));
|
||||
return nullptr;
|
||||
}
|
||||
objectByLabel = *j;
|
||||
@@ -935,13 +935,12 @@ void ObjectIdentifier::resolve(ResolveResults &results) const
|
||||
if (!results.resolvedDocumentObject)
|
||||
return;
|
||||
|
||||
if (!components.empty()) {
|
||||
results.propertyName = components[0].name.getString();
|
||||
results.propertyIndex = 0;
|
||||
results.getProperty(*this);
|
||||
}
|
||||
else
|
||||
if (components.empty())
|
||||
return;
|
||||
|
||||
results.propertyName = components[ 0 ].name.getString();
|
||||
results.propertyIndex = 0;
|
||||
results.getProperty( *this );
|
||||
}
|
||||
else {
|
||||
/* Document object name not specified, resolve from path */
|
||||
@@ -966,8 +965,10 @@ void ObjectIdentifier::resolve(ResolveResults &results) const
|
||||
/* Possible to resolve component to a document object? */
|
||||
if (results.resolvedDocumentObject) {
|
||||
/* Yes */
|
||||
results.resolvedDocumentObjectName = String(
|
||||
components[0].name, false, results.flags.test(ResolveByIdentifier));
|
||||
results.resolvedDocumentObjectName = String {
|
||||
components[0].name.getString(),
|
||||
false,
|
||||
results.flags.test(ResolveByIdentifier)};
|
||||
results.propertyName = components[1].name.getString();
|
||||
results.propertyIndex = 1;
|
||||
results.getProperty(*this);
|
||||
@@ -976,7 +977,10 @@ void ObjectIdentifier::resolve(ResolveResults &results) const
|
||||
// interpret the first component as the property name.
|
||||
DocumentObject *sobj = nullptr;
|
||||
results.resolvedProperty = resolveProperty(
|
||||
owner,components[0].name,sobj,results.propertyType);
|
||||
owner,
|
||||
components[0].name.toString().c_str(),
|
||||
sobj,
|
||||
results.propertyType);
|
||||
if(results.resolvedProperty) {
|
||||
results.propertyName = components[0].name.getString();
|
||||
results.resolvedDocument = owner->getDocument();
|
||||
@@ -1018,7 +1022,7 @@ Document * ObjectIdentifier::getDocument(String name, bool *ambiguous) const
|
||||
App::Document * docById = nullptr;
|
||||
|
||||
if(!name.isRealString()) {
|
||||
docById = App::GetApplication().getDocument(name);
|
||||
docById = App::GetApplication().getDocument(name.toString().c_str());
|
||||
if (name.isForceIdentifier())
|
||||
return docById;
|
||||
}
|
||||
@@ -1267,7 +1271,7 @@ Property *ObjectIdentifier::resolveProperty(const App::DocumentObject *obj,
|
||||
const char *propertyName, App::DocumentObject *&sobj, int &ptype) const
|
||||
{
|
||||
if(obj && !subObjectName.getString().empty()) {
|
||||
sobj = obj->getSubObject(subObjectName);
|
||||
sobj = obj->getSubObject(subObjectName.toString().c_str());
|
||||
obj = sobj;
|
||||
}
|
||||
if(!obj)
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
class AppExport DocumentMapper {
|
||||
public:
|
||||
DocumentMapper(const std::map<std::string,std::string> &);
|
||||
explicit DocumentMapper(const std::map<std::string,std::string> &);
|
||||
~DocumentMapper();
|
||||
};
|
||||
|
||||
@@ -81,14 +81,21 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
String(const std::string & s = "", bool _isRealString = false, bool _forceIdentifier = false)
|
||||
: str(s), isString(_isRealString), forceIdentifier(_forceIdentifier)
|
||||
{ }
|
||||
String(const std::string &s = "",
|
||||
bool _isRealString = false,
|
||||
bool _forceIdentifier = false)
|
||||
: str(s),
|
||||
isString(_isRealString),
|
||||
forceIdentifier(_forceIdentifier)
|
||||
{}//explicit bombs
|
||||
|
||||
String(std::string &&s, bool _isRealString = false, bool _forceIdentifier = false)
|
||||
: str(std::move(s)), isString(_isRealString), forceIdentifier(_forceIdentifier)
|
||||
{ }
|
||||
explicit String(std::string &&s,
|
||||
bool _isRealString = false,
|
||||
bool _forceIdentifier = false)
|
||||
: str(std::move(s)),
|
||||
isString(_isRealString),
|
||||
forceIdentifier(_forceIdentifier)
|
||||
{}
|
||||
|
||||
FC_DEFAULT_CTORS(String) {
|
||||
str = std::move(other.str);
|
||||
@@ -112,9 +119,9 @@ public:
|
||||
|
||||
// Operators
|
||||
|
||||
operator std::string() const { return str; }
|
||||
explicit operator std::string() const { return str; }
|
||||
|
||||
operator const char *() const { return str.c_str(); }
|
||||
explicit operator const char *() const { return str.c_str(); }
|
||||
|
||||
bool operator==(const String & other) const { return str == other.str; }
|
||||
|
||||
@@ -166,9 +173,9 @@ public:
|
||||
}
|
||||
|
||||
Component(const String &_name = String(), typeEnum _type=SIMPLE,
|
||||
int begin=INT_MAX, int end=INT_MAX, int step=1);
|
||||
int begin=INT_MAX, int end=INT_MAX, int step=1);//explicit bombs
|
||||
Component(String &&_name, typeEnum _type=SIMPLE,
|
||||
int begin=INT_MAX, int end=INT_MAX, int step=1);
|
||||
int begin=INT_MAX, int end=INT_MAX, int step=1);//explicit bombs
|
||||
|
||||
static Component SimpleComponent(const char * _component);
|
||||
|
||||
@@ -234,6 +241,9 @@ public:
|
||||
static Component SimpleComponent(String &&_component)
|
||||
{return Component::SimpleComponent(std::move(_component));}
|
||||
|
||||
static Component SimpleComponent(const std::string _component)
|
||||
{return Component::SimpleComponent(_component.c_str());}
|
||||
|
||||
static Component ArrayComponent(int _index)
|
||||
{return Component::ArrayComponent(_index); }
|
||||
|
||||
@@ -246,12 +256,12 @@ public:
|
||||
static Component MapComponent(String &&_key)
|
||||
{return Component::MapComponent(_key);}
|
||||
|
||||
ObjectIdentifier(const App::PropertyContainer * _owner = nullptr,
|
||||
explicit ObjectIdentifier(const App::PropertyContainer * _owner = nullptr,
|
||||
const std::string & property = std::string(), int index=INT_MAX);
|
||||
|
||||
ObjectIdentifier(const App::PropertyContainer * _owner, bool localProperty);
|
||||
|
||||
ObjectIdentifier(const App::Property & prop, int index=INT_MAX);
|
||||
ObjectIdentifier(const App::Property & prop, int index=INT_MAX);//explicit bombs
|
||||
|
||||
FC_DEFAULT_CTORS(ObjectIdentifier) {
|
||||
owner = other.owner;
|
||||
@@ -436,7 +446,7 @@ protected:
|
||||
|
||||
struct ResolveResults {
|
||||
|
||||
ResolveResults(const ObjectIdentifier & oi);
|
||||
explicit ResolveResults(const ObjectIdentifier & oi);
|
||||
|
||||
int propertyIndex;
|
||||
App::Document * resolvedDocument;
|
||||
|
||||
@@ -137,7 +137,7 @@ private:
|
||||
class OriginExtension : public GeoFeatureGroupExtension {
|
||||
Origin* obj;
|
||||
public:
|
||||
OriginExtension(Origin* obj);
|
||||
explicit OriginExtension(Origin* obj);
|
||||
void initExtension(ExtensionContainer* obj) override;
|
||||
bool extensionGetSubObject(DocumentObject *&ret, const char *subname,
|
||||
PyObject **, Base::Matrix4D *, bool, int) const override;
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
public:
|
||||
/// Constructor
|
||||
Path();
|
||||
Path(const std::vector<Base::Persistence *> & PathVector);
|
||||
explicit Path(const std::vector<Base::Persistence *> & PathVector);
|
||||
|
||||
virtual ~Path();
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace App {
|
||||
* active.
|
||||
*/
|
||||
struct PropertyCleaner {
|
||||
PropertyCleaner(Property *p)
|
||||
explicit PropertyCleaner(Property *p)
|
||||
: prop(p)
|
||||
{
|
||||
++_PropCleanerCounter;
|
||||
|
||||
@@ -345,7 +345,7 @@ public:
|
||||
* hasn't been marked before, and calls its
|
||||
* aboutToSetValue().
|
||||
*/
|
||||
AtomicPropertyChange(P & prop, bool markChange=true) : mProp(prop) {
|
||||
explicit AtomicPropertyChange(P & prop, bool markChange=true) : mProp(prop) {
|
||||
mProp.signalCounter++;
|
||||
if (markChange)
|
||||
aboutToChange();
|
||||
|
||||
@@ -73,8 +73,8 @@ struct AppExport PropertyData
|
||||
//accepting void*
|
||||
struct OffsetBase
|
||||
{
|
||||
OffsetBase(const App::PropertyContainer* container) : m_container(container) {}
|
||||
OffsetBase(const App::Extension* container) : m_container(container) {}
|
||||
OffsetBase(const App::PropertyContainer* container) : m_container(container) {}//explicit bombs
|
||||
OffsetBase(const App::Extension* container) : m_container(container) {}//explicit bombs
|
||||
|
||||
short int getOffsetTo(const App::Property* prop) const {
|
||||
auto *pt = (const char*)prop;
|
||||
|
||||
@@ -632,7 +632,7 @@ DocumentObjectExecReturn *App::PropertyExpressionEngine::execute(ExecuteOption o
|
||||
|
||||
class resetter {
|
||||
public:
|
||||
resetter(bool & b) : _b(b) { _b = true; }
|
||||
explicit resetter(bool & b) : _b(b) { _b = true; }
|
||||
~resetter() { _b = false; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
std::shared_ptr<App::Expression> expression; /**< The actual expression tree */
|
||||
bool busy;
|
||||
|
||||
ExpressionInfo(std::shared_ptr<App::Expression> expression = std::shared_ptr<App::Expression>()) {
|
||||
explicit ExpressionInfo(std::shared_ptr<App::Expression> expression = std::shared_ptr<App::Expression>()) {
|
||||
this->expression = expression;
|
||||
this->busy = false;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ void PropertyLinkBase::_registerElementReference(App::DocumentObject *obj, std::
|
||||
|
||||
class StringGuard {
|
||||
public:
|
||||
StringGuard(char *c)
|
||||
explicit StringGuard(char *c)
|
||||
:c(c)
|
||||
{
|
||||
v1 = c[0];
|
||||
|
||||
@@ -1054,7 +1054,7 @@ class AppExport PropertyXLink : public PropertyLinkGlobal
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
public:
|
||||
PropertyXLink(bool allowPartial=false, PropertyLinkBase *parent=nullptr);
|
||||
explicit PropertyXLink(bool allowPartial=false, PropertyLinkBase *parent=nullptr);
|
||||
|
||||
~PropertyXLink() override;
|
||||
|
||||
@@ -1178,7 +1178,7 @@ class AppExport PropertyXLinkSub: public PropertyXLink {
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
public:
|
||||
PropertyXLinkSub(bool allowPartial=false, PropertyLinkBase *parent=nullptr);
|
||||
explicit PropertyXLinkSub(bool allowPartial=false, PropertyLinkBase *parent=nullptr);
|
||||
|
||||
~PropertyXLinkSub() override;
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
PropertyEnumeration();
|
||||
|
||||
/// Obvious constructor
|
||||
PropertyEnumeration(const Enumeration &e);
|
||||
explicit PropertyEnumeration(const Enumeration &e);
|
||||
|
||||
/// destructor
|
||||
~PropertyEnumeration() override;
|
||||
|
||||
@@ -49,15 +49,15 @@ struct AppExport CellAddress {
|
||||
ShowFull = Absolute | ShowRow | ShowColumn
|
||||
};
|
||||
|
||||
CellAddress(int row = -1, int col = -1, bool absRow=false, bool absCol=false)
|
||||
explicit CellAddress(int row = -1, int col = -1, bool absRow=false, bool absCol=false)
|
||||
: _row(row), _col(col), _absRow(absRow), _absCol(absCol)
|
||||
{ }
|
||||
|
||||
CellAddress(const char * address) {
|
||||
explicit CellAddress(const char * address) {
|
||||
*this = stringToAddress(address);
|
||||
}
|
||||
|
||||
CellAddress(const std::string & address) {
|
||||
explicit CellAddress(const std::string & address) {
|
||||
*this = stringToAddress(address.c_str());
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ protected:
|
||||
|
||||
class AppExport Range {
|
||||
public:
|
||||
Range(const char *range, bool normalize=false);
|
||||
explicit Range(const char *range, bool normalize=false);
|
||||
|
||||
Range(int _row_begin, int _col_begin, int _row_end, int _col_end, bool normalize=false);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
* transactions from different document, so that they can be undo/redo
|
||||
* together.
|
||||
*/
|
||||
Transaction(int id = 0);
|
||||
explicit Transaction(int id = 0);
|
||||
/// Construction
|
||||
~Transaction() override;
|
||||
|
||||
@@ -176,7 +176,7 @@ template <class CLASS>
|
||||
class TransactionProducer : public Base::AbstractProducer
|
||||
{
|
||||
public:
|
||||
TransactionProducer (const Base::Type& type)
|
||||
explicit TransactionProducer (const Base::Type& type)
|
||||
{
|
||||
TransactionFactory::instance().addProducer(type, this);
|
||||
}
|
||||
|
||||
@@ -386,14 +386,14 @@ void PreferencePackManager::save(const std::string& name, const std::vector<Temp
|
||||
metadata = std::make_unique<App::Metadata>();
|
||||
metadata->setName("User-Saved PreferencePacks");
|
||||
metadata->setDescription("Generated automatically -- edits may be lost when saving new preferencePacks");
|
||||
metadata->setVersion(1);
|
||||
metadata->setVersion(static_cast<App::Meta::Version>(1));
|
||||
metadata->addMaintainer(App::Meta::Contact("No Maintainer", "email@freecadweb.org"));
|
||||
metadata->addLicense(App::Meta::License("(Unspecified)", "(Unspecified)"));
|
||||
metadata->addUrl(App::Meta::Url("https://github.com/FreeCAD/FreeCAD", App::Meta::UrlType::repository));
|
||||
}
|
||||
App::Metadata newPreferencePackMetadata;
|
||||
newPreferencePackMetadata.setName(name);
|
||||
newPreferencePackMetadata.setVersion(1);
|
||||
newPreferencePackMetadata.setVersion(static_cast<App::Meta::Version>(1));
|
||||
|
||||
metadata->addContentItem("preferencepack", newPreferencePackMetadata);
|
||||
metadata->write(savedPreferencePacksDirectory / "package.xml");
|
||||
|
||||
@@ -1358,7 +1358,7 @@ void PropertySheet::onRelabeledDocument(const App::Document &doc)
|
||||
|
||||
void PropertySheet::renameObjectIdentifiers(const std::map<App::ObjectIdentifier, App::ObjectIdentifier> &paths)
|
||||
{
|
||||
RenameObjectIdentifierExpressionVisitor<PropertySheet> v(*this, paths, *this);
|
||||
RenameObjectIdentifierExpressionVisitor<PropertySheet> v {*this, paths, *this};
|
||||
for(auto &c : data) {
|
||||
c.second->visit(v);
|
||||
if(v.changed()) {
|
||||
|
||||
@@ -712,7 +712,7 @@ void QGIFace::getParameters()
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color temp = hGrp->GetUnsigned("FaceColor",0xffffffff);
|
||||
App::Color temp {static_cast<uint32_t>(hGrp->GetUnsigned("FaceColor",0xffffffff))};
|
||||
setFillColor(temp.asValue<QColor>());
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
|
||||
Reference in New Issue
Block a user