TechDraw: apply std::ranges
This commit is contained in:
@@ -116,10 +116,9 @@ std::pair<int, int> DrawTemplate::getPageNumbers() const
|
||||
std::sort(pageNames.begin(), pageNames.end(), collator);
|
||||
|
||||
int pos = 0;
|
||||
DrawPage *page = getParentPage();
|
||||
if (page) {
|
||||
auto it = std::find(pageNames.begin(), pageNames.end(), QString::fromUtf8(page->Label.getValue()));
|
||||
if (it != pageNames.end()) {
|
||||
if (const DrawPage* page = getParentPage()) {
|
||||
if (const auto it = std::ranges::find(pageNames, QString::fromUtf8(page->Label.getValue()));
|
||||
it != pageNames.end()) {
|
||||
pos = it - pageNames.begin() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ std::string DrawViewSpreadsheet::getSheetImage()
|
||||
cell->getAlignment(alignment);
|
||||
}
|
||||
// skip cell if found in skiplist
|
||||
if (std::find(skiplist.begin(), skiplist.end(), address.toString()) == skiplist.end()) {
|
||||
if (std::ranges::find(skiplist, address.toString()) == skiplist.end()) {
|
||||
result << " <rect x=\"" << coloffset << "\" y=\"" << rowoffset << "\" width=\""
|
||||
<< cellwidth << "\" height=\"" << cellheight << "\" style=\"fill:" << bcolor
|
||||
<< ";stroke-width:" << LineWidth.getValue() / getScale()
|
||||
@@ -388,7 +388,7 @@ std::string DrawViewSpreadsheet::getSheetImage()
|
||||
int DrawViewSpreadsheet::colInList(const std::vector<std::string>& list,
|
||||
const std::string& toFind)
|
||||
{
|
||||
auto match = std::find(std::begin(list), std::end(list), toFind);
|
||||
const auto match = std::ranges::find(list, toFind);
|
||||
if (match == std::end(list)) {
|
||||
return -1; // Error value
|
||||
}
|
||||
|
||||
@@ -126,8 +126,7 @@ void CmdTechDrawHatch::activated(int iMsg)
|
||||
std::vector<std::string> hatchSubs = h->Source.getSubValues();
|
||||
for (auto& hs: hatchSubs) { //all the Faces in this hatch object
|
||||
int hatchFace = TechDraw::DrawUtil::getIndexFromName(hs);
|
||||
std::vector<int>::iterator it = std::find(selFaces.begin(), selFaces.end(), hatchFace);
|
||||
if (it != selFaces.end()) {
|
||||
if (auto it = std::ranges::find(selFaces, hatchFace); it != selFaces.end()) {
|
||||
std::pair< int, TechDraw::DrawHatch*> removeItem;
|
||||
removeItem.first = hatchFace;
|
||||
removeItem.second = h;
|
||||
|
||||
@@ -990,7 +990,7 @@ std::vector<T> QGIView::getObjects(std::vector<int> indexes)
|
||||
T object = static_cast<T>(child);
|
||||
int target = object->getProjIndex();
|
||||
// If child item's index in indexes, then add to results
|
||||
if (std::find(indexes.begin(), indexes.end(), target) != indexes.end()) {
|
||||
if (std::ranges::find(indexes, target) != indexes.end()) {
|
||||
result.push_back(object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,8 +146,8 @@ void QGIViewClip::drawClip()
|
||||
for (; it != qgItems.end(); it++) {
|
||||
QGIView* qv = dynamic_cast<QGIView*>((*it));
|
||||
if (qv) {
|
||||
std::string qvName = std::string(qv->getViewName());
|
||||
if (std::find(childNames.begin(), childNames.end(), qvName) == childNames.end()) {
|
||||
if (auto qvName = std::string(qv->getViewName());
|
||||
std::ranges::find(childNames, qvName) == childNames.end()) {
|
||||
m_cliparea->removeFromGroup(qv);
|
||||
removeFromGroup(qv);
|
||||
qv->isInnerView(false);
|
||||
|
||||
Reference in New Issue
Block a user