replace hard-coded values with enum values
This commit is contained in:
@@ -1202,9 +1202,9 @@ void Document::Restore(Base::XMLReader &reader)
|
||||
string name = reader.getAttribute("name");
|
||||
DocumentObject* pObj = getObject(name.c_str());
|
||||
if (pObj) { // check if this feature has been registered
|
||||
pObj->StatusBits.set(4);
|
||||
pObj->setStatus(ObjectStatus::Restore, true);
|
||||
pObj->Restore(reader);
|
||||
pObj->StatusBits.reset(4);
|
||||
pObj->setStatus(ObjectStatus::Restore, false);
|
||||
}
|
||||
reader.readEndElement("Feature");
|
||||
}
|
||||
@@ -1330,9 +1330,9 @@ Document::readObjects(Base::XMLReader& reader)
|
||||
std::string name = reader.getName(reader.getAttribute("name"));
|
||||
DocumentObject* pObj = getObject(name.c_str());
|
||||
if (pObj) { // check if this feature has been registered
|
||||
pObj->StatusBits.set(4);
|
||||
pObj->setStatus(ObjectStatus::Restore, true);
|
||||
pObj->Restore(reader);
|
||||
pObj->StatusBits.reset(4);
|
||||
pObj->setStatus(ObjectStatus::Restore, false);
|
||||
}
|
||||
reader.readEndElement("Object");
|
||||
}
|
||||
@@ -2203,7 +2203,7 @@ DocumentObject * Document::addObject(const char* sType, const char* pObjectName,
|
||||
}
|
||||
|
||||
// mark the object as new (i.e. set status bit 2) and send the signal
|
||||
pcObject->StatusBits.set(2);
|
||||
pcObject->setStatus(ObjectStatus::New, true);
|
||||
signalNewObject(*pcObject);
|
||||
|
||||
// do no transactions if we do a rollback!
|
||||
@@ -2287,7 +2287,7 @@ std::vector<DocumentObject *> Document::addObjects(const char* sType, const std:
|
||||
}
|
||||
|
||||
// mark the object as new (i.e. set status bit 2) and send the signal
|
||||
pcObject->StatusBits.set(2);
|
||||
pcObject->setStatus(ObjectStatus::New, true);
|
||||
signalNewObject(*pcObject);
|
||||
|
||||
// do no transactions if we do a rollback!
|
||||
@@ -2338,7 +2338,7 @@ void Document::addObject(DocumentObject* pcObject, const char* pObjectName)
|
||||
pcObject->Label.setValue( ObjectName );
|
||||
|
||||
// mark the object as new (i.e. set status bit 2) and send the signal
|
||||
pcObject->StatusBits.set(2);
|
||||
pcObject->setStatus(ObjectStatus::New, true);
|
||||
signalNewObject(*pcObject);
|
||||
|
||||
// do no transactions if we do a rollback!
|
||||
@@ -2391,13 +2391,13 @@ void Document::remObject(const char* sName)
|
||||
d->activeObject = 0;
|
||||
|
||||
// Mark the object as about to be deleted
|
||||
pos->second->StatusBits.set (ObjectStatus::Delete);
|
||||
pos->second->setStatus(ObjectStatus::Delete, true);
|
||||
if (!d->undoing && !d->rollback) {
|
||||
pos->second->unsetupObject();
|
||||
}
|
||||
|
||||
signalDeletedObject(*(pos->second));
|
||||
pos->second->StatusBits.reset (ObjectStatus::Delete); // Unset the bit to be on the safe side
|
||||
pos->second->setStatus(ObjectStatus::Delete, false); // Unset the bit to be on the safe side
|
||||
|
||||
// do no transactions if we do a rollback!
|
||||
if (!d->rollback && d->activeUndoTransaction) {
|
||||
@@ -2468,13 +2468,13 @@ void Document::_remObject(DocumentObject* pcObject)
|
||||
d->activeObject = 0;
|
||||
|
||||
// Mark the object as about to be deleted
|
||||
pcObject->StatusBits.set (ObjectStatus::Delete);
|
||||
pcObject->setStatus(ObjectStatus::Delete, true);
|
||||
if (!d->undoing && !d->rollback) {
|
||||
pcObject->unsetupObject();
|
||||
}
|
||||
signalDeletedObject(*pcObject);
|
||||
// TODO Check me if it's needed (2015-09-01, Fat-Zer)
|
||||
pcObject->StatusBits.reset (ObjectStatus::Delete); // Unset the bit to be on the safe side
|
||||
pcObject->setStatus(ObjectStatus::Delete, false); // Unset the bit to be on the safe side
|
||||
|
||||
//remove the tip if needed
|
||||
if (Tip.getValue() == pcObject) {
|
||||
|
||||
@@ -425,7 +425,7 @@ void DocumentObject::onChanged(const Property* prop)
|
||||
if (prop->getType() & Prop_Output)
|
||||
return;
|
||||
// set object touched
|
||||
StatusBits.set(0);
|
||||
StatusBits.set(ObjectStatus::Touch);
|
||||
}
|
||||
|
||||
PyObject *DocumentObject::getPyObject(void)
|
||||
@@ -445,7 +445,7 @@ std::vector<PyObject *> DocumentObject::getPySubObjects(const std::vector<std::s
|
||||
|
||||
void DocumentObject::touch(void)
|
||||
{
|
||||
StatusBits.set(0);
|
||||
StatusBits.set(ObjectStatus::Touch);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -455,7 +455,7 @@ void DocumentObject::touch(void)
|
||||
|
||||
bool DocumentObject::isTouched() const
|
||||
{
|
||||
return ExpressionEngine.isTouched() || StatusBits.test(0);
|
||||
return ExpressionEngine.isTouched() || StatusBits.test(ObjectStatus::Touch);
|
||||
}
|
||||
|
||||
void DocumentObject::Save (Base::Writer &writer) const
|
||||
|
||||
@@ -109,18 +109,21 @@ public:
|
||||
/// test if this feature is touched
|
||||
bool isTouched(void) const;
|
||||
/// reset this feature touched
|
||||
void purgeTouched(void){StatusBits.reset(0);setPropertyStatus(0,false);}
|
||||
void purgeTouched(void) {
|
||||
StatusBits.reset(ObjectStatus::Touch);
|
||||
setPropertyStatus(0,false);
|
||||
}
|
||||
/// set this feature to error
|
||||
bool isError(void) const {return StatusBits.test(1);}
|
||||
bool isValid(void) const {return !StatusBits.test(1);}
|
||||
bool isError(void) const {return StatusBits.test(ObjectStatus::Error);}
|
||||
bool isValid(void) const {return !StatusBits.test(ObjectStatus::Error);}
|
||||
/// remove the error from the object
|
||||
void purgeError(void){StatusBits.reset(1);}
|
||||
void purgeError(void){StatusBits.reset(ObjectStatus::Error);}
|
||||
/// returns true if this objects is currently recomputing
|
||||
bool isRecomputing() const {return StatusBits.test(3);}
|
||||
bool isRecomputing() const {return StatusBits.test(ObjectStatus::Recompute);}
|
||||
/// returns true if this objects is currently restoring from file
|
||||
bool isRestoring() const {return StatusBits.test(4);}
|
||||
bool isRestoring() const {return StatusBits.test(ObjectStatus::Restore);}
|
||||
/// returns true if this objects is currently restoring from file
|
||||
bool isDeleting() const {return StatusBits.test(5);}
|
||||
bool isDeleting() const {return StatusBits.test(ObjectStatus::Delete);}
|
||||
/// return the status bits
|
||||
unsigned long getStatus() const {return StatusBits.to_ulong();}
|
||||
bool testStatus(ObjectStatus pos) const {return StatusBits.test((size_t)pos);}
|
||||
@@ -248,8 +251,8 @@ protected:
|
||||
*/
|
||||
std::bitset<32> StatusBits;
|
||||
|
||||
void setError(void){StatusBits.set(1);}
|
||||
void resetError(void){StatusBits.reset(1);}
|
||||
void setError(void){StatusBits.set(ObjectStatus::Error);}
|
||||
void resetError(void){StatusBits.reset(ObjectStatus::Error);}
|
||||
void setDocument(App::Document* doc);
|
||||
|
||||
/// get called before the value is changed
|
||||
|
||||
@@ -108,7 +108,7 @@ void Property::touch()
|
||||
{
|
||||
if (father)
|
||||
father->onChanged(this);
|
||||
StatusBits.set(0);
|
||||
StatusBits.set(Touched);
|
||||
}
|
||||
|
||||
void Property::setReadOnly(bool readOnly)
|
||||
@@ -123,7 +123,7 @@ void Property::hasSetValue(void)
|
||||
{
|
||||
if (father)
|
||||
father->onChanged(this);
|
||||
StatusBits.set(0);
|
||||
StatusBits.set(Touched);
|
||||
}
|
||||
|
||||
void Property::aboutToSetValue(void)
|
||||
|
||||
@@ -122,11 +122,11 @@ public:
|
||||
void touch();
|
||||
/// Test if this property is touched
|
||||
inline bool isTouched(void) const {
|
||||
return StatusBits.test(0);
|
||||
return StatusBits.test(Touched);
|
||||
}
|
||||
/// Reset this property touched
|
||||
inline void purgeTouched(void) {
|
||||
StatusBits.reset(0);
|
||||
StatusBits.reset(Touched);
|
||||
}
|
||||
/// return the status bits
|
||||
inline unsigned long getStatus() const {
|
||||
|
||||
Reference in New Issue
Block a user