App: PR6497 move return statement to new line
This commit is contained in:
@@ -160,7 +160,8 @@ const char *Application::getActiveTransaction(int *id) const {
|
||||
|
||||
void Application::closeActiveTransaction(bool abort, int id) {
|
||||
if(!id) id = _activeTransactionID;
|
||||
if(!id) return;
|
||||
if(!id)
|
||||
return;
|
||||
|
||||
if(_activeTransactionGuard>0 && !abort) {
|
||||
FC_LOG("ignore close transaction");
|
||||
|
||||
@@ -172,9 +172,11 @@ const char *ComplexGeoData::isMappedElement(const char *name) {
|
||||
}
|
||||
|
||||
std::string ComplexGeoData::newElementName(const char *name) {
|
||||
if(!name) return std::string();
|
||||
if(!name)
|
||||
return std::string();
|
||||
const char *dot = strrchr(name,'.');
|
||||
if(!dot || dot==name) return name;
|
||||
if(!dot || dot==name)
|
||||
return name;
|
||||
const char *c = dot-1;
|
||||
for(;c!=name;--c) {
|
||||
if(*c == '.') {
|
||||
@@ -188,9 +190,11 @@ std::string ComplexGeoData::newElementName(const char *name) {
|
||||
}
|
||||
|
||||
std::string ComplexGeoData::oldElementName(const char *name) {
|
||||
if(!name) return std::string();
|
||||
if(!name)
|
||||
return std::string();
|
||||
const char *dot = strrchr(name,'.');
|
||||
if(!dot || dot==name) return name;
|
||||
if(!dot || dot==name)
|
||||
return name;
|
||||
const char *c = dot-1;
|
||||
for(;c!=name;--c) {
|
||||
if(*c == '.') {
|
||||
@@ -204,7 +208,8 @@ std::string ComplexGeoData::oldElementName(const char *name) {
|
||||
}
|
||||
|
||||
std::string ComplexGeoData::noElementName(const char *name) {
|
||||
if(!name) return std::string();
|
||||
if(!name)
|
||||
return std::string();
|
||||
auto element = findElementName(name);
|
||||
if(element)
|
||||
return std::string(name,element-name);
|
||||
|
||||
@@ -1170,7 +1170,8 @@ void Document::_checkTransaction(DocumentObject* pcDelObj, const Property *What,
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!pcDelObj) return;
|
||||
if(!pcDelObj)
|
||||
return;
|
||||
// When the object is going to be deleted we have to check if it has already been added to
|
||||
// the undo transactions
|
||||
std::list<Transaction*>::iterator it;
|
||||
|
||||
@@ -275,7 +275,8 @@ const char *DocumentObject::getNameInDocument() const
|
||||
// to an object that has been removed from the document. In this case we should rather
|
||||
// return 0.
|
||||
//assert(pcNameInDocument);
|
||||
if (!pcNameInDocument) return nullptr;
|
||||
if (!pcNameInDocument)
|
||||
return nullptr;
|
||||
return pcNameInDocument->c_str();
|
||||
}
|
||||
|
||||
@@ -1055,7 +1056,8 @@ void App::DocumentObject::_addBackLink(DocumentObject* newObj)
|
||||
int DocumentObject::setElementVisible(const char *element, bool visible) {
|
||||
for(auto ext : getExtensionsDerivedFromType<DocumentObjectExtension>()) {
|
||||
int ret = ext->extensionSetElementVisible(element,visible);
|
||||
if(ret>=0) return ret;
|
||||
if(ret>=0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -1064,7 +1066,8 @@ int DocumentObject::setElementVisible(const char *element, bool visible) {
|
||||
int DocumentObject::isElementVisible(const char *element) const {
|
||||
for(auto ext : getExtensionsDerivedFromType<DocumentObjectExtension>()) {
|
||||
int ret = ext->extensionIsElementVisible(element);
|
||||
if(ret>=0) return ret;
|
||||
if(ret>=0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -1256,7 +1259,8 @@ const std::string &DocumentObject::hiddenMarker() {
|
||||
}
|
||||
|
||||
const char *DocumentObject::hasHiddenMarker(const char *subname) {
|
||||
if(!subname) return nullptr;
|
||||
if(!subname)
|
||||
return nullptr;
|
||||
const char *marker = strrchr(subname,'.');
|
||||
if(!marker)
|
||||
marker = subname;
|
||||
|
||||
@@ -835,7 +835,8 @@ int DocumentPy::setCustomAttributes(const char* attr, PyObject *)
|
||||
return 0;
|
||||
}
|
||||
PyObject* item = PyDict_GetItemString(this->ob_type->tp_dict, attr);
|
||||
if (item) return 0;
|
||||
if (item)
|
||||
return 0;
|
||||
DocumentObject* obj = getDocumentPtr()->getObject(attr);
|
||||
if (obj)
|
||||
{
|
||||
|
||||
@@ -3158,7 +3158,8 @@ double num_change(char* yytext,char dez_delim,char grp_delim)
|
||||
else
|
||||
temp[i++] = *c;
|
||||
// check buffer overflow
|
||||
if (i>39) return 0.0;
|
||||
if (i>39)
|
||||
return 0.0;
|
||||
}
|
||||
temp[i] = '\0';
|
||||
|
||||
|
||||
@@ -102,7 +102,8 @@ Extension* ExtensionContainer::getExtension(Base::Type t, bool derived, bool no_
|
||||
if(entry.first.isDerivedFrom(t))
|
||||
return entry.second;
|
||||
}
|
||||
if(no_except) return nullptr;
|
||||
if(no_except)
|
||||
return nullptr;
|
||||
//if we arrive here we don't have anything matching
|
||||
throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available");
|
||||
}
|
||||
@@ -110,7 +111,8 @@ Extension* ExtensionContainer::getExtension(Base::Type t, bool derived, bool no_
|
||||
return result->second;
|
||||
}
|
||||
else {
|
||||
if(no_except) return nullptr;
|
||||
if(no_except)
|
||||
return nullptr;
|
||||
//if we arrive here we don't have anything matching
|
||||
throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available");
|
||||
}
|
||||
|
||||
@@ -87,7 +87,8 @@ std::pair<std::string,std::string> GeoFeature::getElementName(
|
||||
(void)type;
|
||||
|
||||
std::pair<std::string,std::string> ret;
|
||||
if(!name) return ret;
|
||||
if(!name)
|
||||
return ret;
|
||||
|
||||
ret.second = name;
|
||||
return ret;
|
||||
|
||||
@@ -399,7 +399,8 @@ App::DocumentObjectExecReturn *LinkBaseExtension::extensionExecute(void) {
|
||||
|
||||
short LinkBaseExtension::extensionMustExecute(void) {
|
||||
auto link = getLink();
|
||||
if(!link) return 0;
|
||||
if(!link)
|
||||
return 0;
|
||||
return link->mustExecute();
|
||||
}
|
||||
|
||||
@@ -982,7 +983,8 @@ int LinkBaseExtension::extensionSetElementVisible(const char *element, bool visi
|
||||
if(!propElementVis || !element || !element[0])
|
||||
return -1;
|
||||
if(propElementVis->getSize()<=index) {
|
||||
if(visible) return 1;
|
||||
if(visible)
|
||||
return 1;
|
||||
propElementVis->setSize(index+1, true);
|
||||
}
|
||||
propElementVis->setStatus(Property::User3,true);
|
||||
@@ -1047,10 +1049,12 @@ int LinkBaseExtension::getArrayIndex(const char *subname, const char **psubname)
|
||||
return -1;
|
||||
const char *dot = strchr(subname,'.');
|
||||
if(!dot) dot= subname+strlen(subname);
|
||||
if(dot == subname) return -1;
|
||||
if(dot == subname)
|
||||
return -1;
|
||||
int idx = 0;
|
||||
for(const char *c=subname;c!=dot;++c) {
|
||||
if(!isdigit(*c)) return -1;
|
||||
if(!isdigit(*c))
|
||||
return -1;
|
||||
idx = idx*10 + *c -'0';
|
||||
}
|
||||
if(psubname) {
|
||||
@@ -1072,7 +1076,8 @@ int LinkBaseExtension::getElementIndex(const char *subname, const char **psubnam
|
||||
if(isdigit(subname[0])) {
|
||||
// If the name start with digits, treat as index reference
|
||||
idx = getArrayIndex(subname,nullptr);
|
||||
if(idx<0) return -1;
|
||||
if(idx<0)
|
||||
return -1;
|
||||
if(_getElementCountProperty()) {
|
||||
if(idx>=_getElementCountValue())
|
||||
return -1;
|
||||
@@ -1103,7 +1108,8 @@ int LinkBaseExtension::getElementIndex(const char *subname, const char **psubnam
|
||||
// Then check for the actual linked object's name or label, and
|
||||
// redirect that reference to the first array element
|
||||
auto linked = getTrueLinkedObject(false);
|
||||
if(!linked || !linked->getNameInDocument()) return -1;
|
||||
if(!linked || !linked->getNameInDocument())
|
||||
return -1;
|
||||
if(subname[0]=='$') {
|
||||
CharRange sub(subname+1, dot);
|
||||
if (boost::equals(sub, linked->Label.getValue()))
|
||||
@@ -1424,7 +1430,8 @@ DocumentObject *LinkBaseExtension::getTrueLinkedObject(
|
||||
}
|
||||
|
||||
auto ret = getLink(depth);
|
||||
if(!ret) return nullptr;
|
||||
if(!ret)
|
||||
return nullptr;
|
||||
bool transform = linkTransform();
|
||||
const char *subname = getSubName();
|
||||
if(subname || (mat && transform)) {
|
||||
@@ -1557,7 +1564,8 @@ void LinkBaseExtension::updateGroup() {
|
||||
}
|
||||
|
||||
void LinkBaseExtension::update(App::DocumentObject *parent, const Property *prop) {
|
||||
if(!prop) return;
|
||||
if(!prop)
|
||||
return;
|
||||
|
||||
if(prop == getLinkPlacementProperty() || prop == getPlacementProperty()) {
|
||||
auto src = getLinkPlacementProperty();
|
||||
|
||||
@@ -297,11 +297,13 @@ int ObjectIdentifier::numSubComponents() const
|
||||
bool ObjectIdentifier::verify(const App::Property &prop, bool silent) const {
|
||||
ResolveResults result(*this);
|
||||
if(components.size() - result.propertyIndex != 1) {
|
||||
if(silent) return false;
|
||||
if(silent)
|
||||
return false;
|
||||
FC_THROWM(Base::ValueError,"Invalid property path: single component expected");
|
||||
}
|
||||
if(!components[result.propertyIndex].isSimple()) {
|
||||
if(silent) return false;
|
||||
if(silent)
|
||||
return false;
|
||||
FC_THROWM(Base::ValueError,"Invalid property path: simple component expected");
|
||||
}
|
||||
const std::string &name = components[result.propertyIndex].getName();
|
||||
@@ -310,7 +312,8 @@ bool ObjectIdentifier::verify(const App::Property &prop, bool silent) const {
|
||||
if((isAddress && addr.toString(CellAddress::Cell::ShowRowColumn) != prop.getName()) ||
|
||||
(!isAddress && name!=prop.getName()))
|
||||
{
|
||||
if(silent) return false;
|
||||
if(silent)
|
||||
return false;
|
||||
FC_THROWM(Base::ValueError,"Invalid property path: name mismatch");
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -77,7 +77,8 @@ App::Property* PropertyContainer::addDynamicProperty(
|
||||
Property *PropertyContainer::getPropertyByName(const char* name) const
|
||||
{
|
||||
auto prop = dynamicProps.getDynamicPropertyByName(name);
|
||||
if(prop) return prop;
|
||||
if(prop)
|
||||
return prop;
|
||||
return getPropertyData().getPropertyByName(this,name);
|
||||
}
|
||||
|
||||
@@ -120,28 +121,32 @@ short PropertyContainer::getPropertyType(const char *name) const
|
||||
const char* PropertyContainer::getPropertyGroup(const Property* prop) const
|
||||
{
|
||||
auto group = dynamicProps.getPropertyGroup(prop);
|
||||
if(group) return group;
|
||||
if(group)
|
||||
return group;
|
||||
return getPropertyData().getGroup(this,prop);
|
||||
}
|
||||
|
||||
const char* PropertyContainer::getPropertyGroup(const char *name) const
|
||||
{
|
||||
auto group = dynamicProps.getPropertyGroup(name);
|
||||
if(group) return group;
|
||||
if(group)
|
||||
return group;
|
||||
return getPropertyData().getGroup(this,name);
|
||||
}
|
||||
|
||||
const char* PropertyContainer::getPropertyDocumentation(const Property* prop) const
|
||||
{
|
||||
auto doc = dynamicProps.getPropertyDocumentation(prop);
|
||||
if(doc) return doc;
|
||||
if(doc)
|
||||
return doc;
|
||||
return getPropertyData().getDocumentation(this,prop);
|
||||
}
|
||||
|
||||
const char* PropertyContainer::getPropertyDocumentation(const char *name) const
|
||||
{
|
||||
auto doc = dynamicProps.getPropertyDocumentation(name);
|
||||
if(doc) return doc;
|
||||
if(doc)
|
||||
return doc;
|
||||
return getPropertyData().getDocumentation(this,name);
|
||||
}
|
||||
|
||||
|
||||
@@ -649,7 +649,8 @@ void PropertyLinkList::set1Value(int idx, DocumentObject* const &value) {
|
||||
DocumentObject *obj = nullptr;
|
||||
if(idx>=0 && idx<(int)_lValueList.size()) {
|
||||
obj = _lValueList[idx];
|
||||
if(obj == value) return;
|
||||
if(obj == value)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!value || !value->getNameInDocument())
|
||||
@@ -2806,7 +2807,8 @@ public:
|
||||
}
|
||||
|
||||
void slotFinishRestoreDocument(const App::Document &doc) {
|
||||
if(pcDoc) return;
|
||||
if(pcDoc)
|
||||
return;
|
||||
QString fullpath(getFullPath());
|
||||
if(!fullpath.isEmpty() && getFullPath(doc.getFileName())==fullpath)
|
||||
attach(const_cast<App::Document*>(&doc));
|
||||
@@ -2817,7 +2819,8 @@ public:
|
||||
slotFinishRestoreDocument(doc);
|
||||
return;
|
||||
}
|
||||
if(&doc!=pcDoc) return;
|
||||
if(&doc!=pcDoc)
|
||||
return;
|
||||
|
||||
QFileInfo info(myPos->first);
|
||||
// QString path(info.canonicalFilePath());
|
||||
@@ -2879,7 +2882,8 @@ public:
|
||||
deinit();
|
||||
return;
|
||||
}
|
||||
if(pcDoc!=&doc) return;
|
||||
if(pcDoc!=&doc)
|
||||
return;
|
||||
std::map<App::PropertyLinkBase*,std::vector<App::PropertyXLink*> > parentLinks;
|
||||
for(auto link : links) {
|
||||
link->setFlag(PropertyLinkBase::LinkDetached);
|
||||
|
||||
@@ -1374,7 +1374,8 @@ PropertyString::~PropertyString()
|
||||
|
||||
void PropertyString::setValue(const char* newLabel)
|
||||
{
|
||||
if(!newLabel) return;
|
||||
if(!newLabel)
|
||||
return;
|
||||
|
||||
if(_cValue == newLabel)
|
||||
return;
|
||||
|
||||
@@ -99,7 +99,8 @@ static std::atomic<int> _TransactionID;
|
||||
|
||||
int Transaction::getNewID() {
|
||||
int id = ++_TransactionID;
|
||||
if(id) return id;
|
||||
if(id)
|
||||
return id;
|
||||
// wrap around? really?
|
||||
return ++_TransactionID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user