21 for (
const std::string& str : container)
22 result.append(QString::fromStdString(str));
29 QRegExp regexp(R
"(\((\d+)\))");
33 newNumber = regexp.cap(1).toInt();
38 for (
const auto&
name : existingNames) {
40 newNumber = std::max(newNumber, 2);
41 else if (regexp.indexIn(
name) >= 0)
42 newNumber = std::max(newNumber, regexp.cap(1).toInt() + 1);
48 return QString(
"%1 (%2)").arg(
baseName).arg(newNumber);
Defines functions from namespace GUI::Util::String.
QString const & name(EShape k)
QString baseName(const QString &fileName)
Returns base name of file.
QStringList fromStdStrings(const std::vector< std::string > &container)
QString suggestName(const QStringList &existingNames, const QString &name)
Returns a name suggestion based on the given name.