void Events_InfoMessage::addParameter(double theParam)
{
- char aBuf[50];
- int n = sprintf(aBuf, "%g", theParam);
- std::string aStr(aBuf);
- myParameters.push_back(aStr);
+ static char aBuf[50];
+ sprintf(aBuf, "%g", theParam);
+ myParameters.push_back(std::string(aBuf));
}
void Events_InfoMessage::addParameter(int theParam)
{
- char aBuf[50];
- int n = sprintf(aBuf, "%d", theParam);
- std::string aStr(aBuf);
- myParameters.push_back(aStr);
+ static char aBuf[50];
+ sprintf(aBuf, "%d", theParam);
+ myParameters.push_back(std::string(aBuf));
}
void Events_InfoMessage::send()
aFindID->second[theSender] = std::list<Events_Listener*>();
aFindSender = aFindID->second.find(theSender);
}
- // check that listener was not registered wit hsuch parameters before
+ // check that listener was not registered with such parameters before
std::list<Events_Listener*>& aListeners = aFindSender->second;
for (std::list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
if (*aL == theListener)
aLMap.erase(aLIt->first);
myListeners[anIt->first] = aLMap;
if (aLMap.empty())
- break; // avoid incrementation of the iterator if the the container is empty
+ break; // avoid incrementation of the iterator if the container is empty
}
aLIt++;
}
if (anIt->second.empty()) {
myListeners.erase(anIt->first);
if (myListeners.empty())
- break; // avoid incrementation of the iterator if the the container is empty
+ break; // avoid incrementation of the iterator if the container is empty
}
anIt++;
}
if (anImIt->second == theListener) {
myImmediateListeners.erase(anImIt->first);
if (myImmediateListeners.empty())
- break; // avoid incrementation of the iterator if the the container is empty
+ break; // avoid incrementation of the iterator if the container is empty
}
anImIt++;
}
aFormatName = "STEP";
} else if (anExtension == "IGES" || anExtension == "IGS") {
aFormatName = "IGES-5.1";
- } else if (anExtension == "XAO") {
- aFormatName = "XAO";
} else {
aFormatName = anExtension;
}
}
// Store compound if we have more than one shape.
- std::shared_ptr<GeomAPI_Shape> aShape;
- if(aShapes.size() == 1) {
- aShape = aShapes.front();
- } else {
- aShape = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
- }
+ std::shared_ptr<GeomAPI_Shape> aShape =
+ aShapes.size() == 1 ? aShapes.front() : GeomAlgoAPI_CompoundBuilder::compound(aShapes);
// Perform the export
std::string anError;
return false;
ExchangePlugin_ExportFeature* aThis = ((ExchangePlugin_ExportFeature*)(this));
AttributeStringPtr aFormatAttr = aThis->string(FILE_FORMAT_ID());
- if (!aFormatAttr.get())
- return false;
- std::string aFormat = aFormatAttr->value();
+ std::string aFormat(aFormatAttr.get() ? aFormatAttr->value() : "");
if (aFormat.empty()) { // get default format for the extension
AttributeStringPtr aFilePathAttr = aThis->string(FILE_PATH_ID());
std::string aFilePath = aFilePathAttr->value();
if (!aFilePath.empty()) {
std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath);
- if (anExtension == "XAO") {
- aFormat = "XAO";
- }
+ aFormat = anExtension;
}
}
bool ModelAPI_Result::isDisabled()
{
- if (myIsDisabled != data()->isDeleted())
+ if (data()->isValid() && myIsDisabled != data()->isDeleted())
setDisabled(std::dynamic_pointer_cast<ModelAPI_Result>(
data()->owner()), data()->isDeleted()); // restore from the data model the correct value
return myIsDisabled;