#include <TDataStd_Name.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <algorithm>
+#include <stdexcept>
#ifdef DEB_NAMING
#include <BRepTools.hxx>
} else {
int anOrientation = 1; // default
if (theOriented) { // here must be a symbol in the end of digit 'f' or 'r'
- const char aSymbol = anID.back();
- if (aSymbol == 'r') anOrientation = -1;
- anID.pop_back();
+ std::string::iterator aSymbol = anID.end() - 1;
+ if (*aSymbol == 'r') anOrientation = -1;
+ anID.erase(aSymbol); // remove last symbol
}
// check start/end symbols
- if (anID.back() == 's') {
+ std::string::iterator aBack = anID.end() - 1;
+ if (*aBack == 's') {
anOrientation *= 2;
- anID.pop_back();
- } else if (anID.back() == 'e') {
+ anID.erase(aBack); // remove last symbol
+ } else if (*aBack == 'e') {
anOrientation *= 3;
- anID.pop_back();
+ anID.erase(aBack); // remove last symbol
}
if (aNames.find(anID) != aNames.end()) {
aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end());
// remove the last 's', 'e', 'f' and 'r' symbols: they are used as markers of start/end/forward/rewersed indicators
static const std::string aSyms("sefr");
- while(aSyms.find(aName.back()) != std::string::npos) {
- aName.pop_back();
+ std::string::iterator aSuffix = aName.end() - 1;
+ while(aSyms.find(*aSuffix) != std::string::npos) {
+ --aSuffix;
}
+ aName.erase(aSuffix + 1, aName.end());
+
if (theEdgeVertexPos == 1) {
aName += "s"; // start
} else if (theEdgeVertexPos == 2) {
std::string anError = storeFeatures(
aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, false);
if (!anError.empty()) {
- Events_InfoMessage anError("checkPythonDump", anError);
- anError.send();
+ Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
+ anErrorMsg.send();
return false;
}
// close all before importation of the script
aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, true);
if (!anError.empty()) {
std::cout<<anError<<std::endl;
- Events_InfoMessage anError("checkPythonDump", anError);
- anError.send();
+ Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
+ anErrorMsg.send();
return false;
}
PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
return NULL;
}
- temp = ModelHighAPI_RefAttr(temp_selection->resultSubShapePair().first);
+ temp = ModelHighAPI_RefAttr(std::shared_ptr<ModelAPI_Object>(temp_selection->resultSubShapePair().first));
if (newmem & SWIG_CAST_NEW_MEMORY) {
delete temp_selection;
}