Changeset View
Changeset View
Standalone View
Standalone View
language/duchain/stringhelpers.cpp
Show All 14 Lines | 1 | /* | |||
---|---|---|---|---|---|
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
16 | Boston, MA 02110-1301, USA. | 16 | Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "stringhelpers.h" | 19 | #include "stringhelpers.h" | ||
20 | #include "safetycounter.h" | 20 | #include "safetycounter.h" | ||
21 | #include <debug.h> | 21 | #include <debug.h> | ||
22 | 22 | | |||
23 | #include <qtcompat_p.h> | ||||
24 | | ||||
23 | #include <QString> | 25 | #include <QString> | ||
24 | #include <QStringList> | 26 | #include <QStringList> | ||
25 | 27 | | |||
26 | namespace { | 28 | namespace { | ||
27 | 29 | | |||
28 | template<typename T> | 30 | template<typename T> | ||
29 | int strip_impl(const T& str, T& from) | 31 | int strip_impl(const T& str, T& from) | ||
30 | { | 32 | { | ||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 164 | { | |||
165 | case '(': | 167 | case '(': | ||
166 | case '[': | 168 | case '[': | ||
167 | case '{': | 169 | case '{': | ||
168 | st.push_front( str[a] ); | 170 | st.push_front( str[a] ); | ||
169 | depth++; | 171 | depth++; | ||
170 | break; | 172 | break; | ||
171 | case '>': | 173 | case '>': | ||
172 | if( last == '-' ) break; | 174 | if( last == '-' ) break; | ||
175 | Q_FALLTHROUGH(); | ||||
173 | case ')': | 176 | case ')': | ||
174 | case ']': | 177 | case ']': | ||
175 | case '}': | 178 | case '}': | ||
176 | if( !st.isEmpty() && parenFits(st.front(), str[a]) ) | 179 | if( !st.isEmpty() && parenFits(st.front(), str[a]) ) | ||
177 | { | 180 | { | ||
178 | depth--; | 181 | depth--; | ||
179 | st.pop_front(); | 182 | st.pop_front(); | ||
180 | } | 183 | } | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 226 | case '(': | |||
228 | if( a == -1 ) return str.length(); | 231 | if( a == -1 ) return str.length(); | ||
229 | break; | 232 | break; | ||
230 | case ')': | 233 | case ')': | ||
231 | case ']': | 234 | case ']': | ||
232 | case '}': | 235 | case '}': | ||
233 | case '>': | 236 | case '>': | ||
234 | if( validEnd != ' ' && validEnd != str[a] ) | 237 | if( validEnd != ' ' && validEnd != str[a] ) | ||
235 | continue; | 238 | continue; | ||
239 | Q_FALLTHROUGH(); | ||||
236 | case ',': | 240 | case ',': | ||
237 | return a; | 241 | return a; | ||
238 | } | 242 | } | ||
239 | } | 243 | } | ||
240 | 244 | | |||
241 | return str.length(); | 245 | return str.length(); | ||
242 | } | 246 | } | ||
243 | 247 | | |||
▲ Show 20 Lines • Show All 348 Lines • Show Last 20 Lines |