Toponaming/Part: Clang-format cleanup

This commit is contained in:
Chris Hennes
2024-02-28 19:18:45 -06:00
committed by GitHub
parent 7d0afaec54
commit a4efcf0533
3 changed files with 27 additions and 19 deletions

View File

@@ -88,37 +88,43 @@ GeoFeature::getElementName(const char *name, ElementNameType type) const
if(!name)
return ret;
auto prop = getPropertyOfGeometry();
if(!prop) return std::make_pair("", name);
if (!prop) {
return std::make_pair("", name);
}
auto geo = prop->getComplexData();
if(!geo) return std::make_pair("", name);
if (!geo) {
return std::make_pair("", name);
}
return _getElementName(name, geo->getElementName(name));
}
std::pair<std::string,std::string>
GeoFeature::_getElementName(const char *name, const Data::MappedElement &mapped) const
std::pair<std::string, std::string>
GeoFeature::_getElementName(const char* name, const Data::MappedElement& mapped) const
{
std::pair<std::string,std::string> ret;
std::pair<std::string, std::string> ret;
if (mapped.index && mapped.name) {
std::ostringstream ss;
ss << Data::ComplexGeoData::elementMapPrefix()
<< mapped.name << '.' << mapped.index;
ss << Data::ComplexGeoData::elementMapPrefix() << mapped.name << '.' << mapped.index;
ret.first = ss.str();
mapped.index.appendToStringBuffer(ret.second);
} else if (mapped.name) {
// FC_TRACE("element mapped name " << name << " not found in " << getFullName());
}
else if (mapped.name) {
// FC_TRACE("element mapped name " << name << " not found in " << getFullName());
ret.first = name;
const char *dot = strrchr(name,'.');
if(dot) {
const char* dot = strrchr(name, '.');
if (dot) {
// deliberately mangle the old style element name to signal a
// missing reference
ret.second = Data::MISSING_PREFIX;
ret.second += dot+1;
ret.second += dot + 1;
}
} else {
}
else {
mapped.index.appendToStringBuffer(ret.second);
}
return ret;
}

View File

@@ -477,17 +477,19 @@ std::pair<TopAbs_ShapeEnum,int> TopoShape::shapeTypeAndIndex(const char *name) {
return std::make_pair(type,idx);
}
std::pair<TopAbs_ShapeEnum,int>
TopoShape::shapeTypeAndIndex(const Data::IndexedName & element)
std::pair<TopAbs_ShapeEnum, int> TopoShape::shapeTypeAndIndex(const Data::IndexedName& element)
{
if (!element)
if (!element) {
return std::make_pair(TopAbs_SHAPE, 0);
}
static const std::string _subshape("SubShape");
if (boost::equals(element.getType(), _subshape))
if (boost::equals(element.getType(), _subshape)) {
return std::make_pair(TopAbs_SHAPE, element.getIndex());
}
TopAbs_ShapeEnum shapetype = shapeType(element.getType(), true);
if (shapetype == TopAbs_SHAPE)
if (shapetype == TopAbs_SHAPE) {
return std::make_pair(TopAbs_SHAPE, 0);
}
return std::make_pair(shapetype, element.getIndex());
}

View File

@@ -1131,7 +1131,7 @@ public:
static const std::string& shapeName(TopAbs_ShapeEnum type, bool silent = false);
const std::string& shapeName(bool silent = false) const;
static std::pair<TopAbs_ShapeEnum, int> shapeTypeAndIndex(const char* name);
static std::pair<TopAbs_ShapeEnum,int> shapeTypeAndIndex(const Data::IndexedName &name);
static std::pair<TopAbs_ShapeEnum, int> shapeTypeAndIndex(const Data::IndexedName &name);
Data::MappedName setElementComboName(const Data::IndexedName & element,
const std::vector<Data::MappedName> &names,