MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / sanitiseLabel

Function sanitiseLabel

app/src/Misc/BackupManager.cpp:61–72  ·  view source on GitHub ↗

* @brief Sanitise a label into a filename-safe token. */

Source from the content-addressed store, hash-verified

59 * @brief Sanitise a label into a filename-safe token.
60 */
61static QString sanitiseLabel(const QString& label)
62{
63 QString out;
64 out.reserve(label.size());
65 for (const auto& ch : label)
66 if (ch.isLetterOrNumber() || ch == QLatin1Char('-') || ch == QLatin1Char('_'))
67 out.append(ch);
68 else if (ch == QLatin1Char(' ') || ch == QLatin1Char('.'))
69 out.append(QLatin1Char('-'));
70
71 return out.left(32);
72}
73
74/**
75 * @brief Construct the singleton. Debounce timer + initial state.

Callers 1

snapshotMethod · 0.85

Calls 2

sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected