| 36 | } |
| 37 | |
| 38 | QStringList splitWithEscaping(const QString& input, QChar splitchar, QChar escapechar) |
| 39 | { |
| 40 | enum State { Normal, SeenEscape } state; |
| 41 | |
| 42 | state = Normal; |
| 43 | |
| 44 | QStringList result; |
| 45 | QString currentstring; |
| 46 | for (const QChar c : input) { |
| 47 | switch (state) { |
| 48 | case Normal: |
| 49 | if (c == escapechar) { |
| 50 | state = SeenEscape; |
| 51 | } else if (c == splitchar) { |
| 52 | result << currentstring; |
| 53 | currentstring.clear(); |
| 54 | } else { |
| 55 | currentstring += c; |
| 56 | } |
| 57 | break; |
| 58 | case SeenEscape: |
| 59 | currentstring += c; |
| 60 | state = Normal; |
| 61 | break; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | if (!currentstring.isEmpty()) { |
| 66 | result << currentstring; |
| 67 | } |
| 68 | return result; |
| 69 | } |
| 70 | |
| 71 | QVariant stringToQVariant(const QString& s) |
| 72 | { |
no test coverage detected