Mercurial > hg > svcore
diff base/StringBits.cpp @ 1527:710e6250a401 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:14 +0100 |
parents | 48e9f538e6e9 |
children | 21c792334c2e |
line wrap: on
line diff
--- a/base/StringBits.cpp Mon Dec 12 15:18:52 2016 +0000 +++ b/base/StringBits.cpp Mon Sep 17 13:51:14 2018 +0100 @@ -42,7 +42,7 @@ while (i < len) { - QChar c = s[i]; + QChar c = s[i]; if (c.isDigit()) { @@ -85,45 +85,45 @@ enum { sep, unq, q1, q2 } mode = sep; for (int i = 0; i < s.length(); ++i) { - - QChar c = s[i]; + + QChar c = s[i]; - if (c == '\'') { - switch (mode) { - case sep: mode = q1; break; - case unq: case q2: tok += c; break; - case q1: mode = unq; break; - } + if (c == '\'') { + switch (mode) { + case sep: mode = q1; break; + case unq: case q2: tok += c; break; + case q1: mode = unq; break; + } - } else if (c == '"') { - switch (mode) { - case sep: mode = q2; break; - case unq: case q1: tok += c; break; - case q2: mode = unq; break; - } + } else if (c == '"') { + switch (mode) { + case sep: mode = q2; break; + case unq: case q1: tok += c; break; + case q2: mode = unq; break; + } - } else if (c == separator || (separator == ' ' && c.isSpace())) { - switch (mode) { - case sep: if (separator != ' ') tokens << ""; break; - case unq: mode = sep; tokens << tok; tok = ""; break; - case q1: case q2: tok += c; break; - } + } else if (c == separator || (separator == ' ' && c.isSpace())) { + switch (mode) { + case sep: if (separator != ' ') tokens << ""; break; + case unq: mode = sep; tokens << tok; tok = ""; break; + case q1: case q2: tok += c; break; + } - } else if (c == '\\') { - if (++i < s.length()) { - c = s[i]; - switch (mode) { - case sep: mode = unq; tok += c; break; + } else if (c == '\\') { + if (++i < s.length()) { + c = s[i]; + switch (mode) { + case sep: mode = unq; tok += c; break; case unq: case q1: case q2: tok += c; break; - } - } + } + } - } else { - switch (mode) { - case sep: mode = unq; tok += c; break; + } else { + switch (mode) { + case sep: mode = unq; tok += c; break; case unq: case q1: case q2: tok += c; break; - } - } + } + } } if (tok != "" || mode != sep) {