OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2002, 2003 The Karbon Developers | 2 * Copyright (C) 2002, 2003 The Karbon Developers |
3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> |
5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 bool parseNumber(const LChar*& ptr, const LChar* end, float& number, bool skip) | 157 bool parseNumber(const LChar*& ptr, const LChar* end, float& number, bool skip) |
158 { | 158 { |
159 return genericParseNumber(ptr, end, number, skip); | 159 return genericParseNumber(ptr, end, number, skip); |
160 } | 160 } |
161 | 161 |
162 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip) | 162 bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip) |
163 { | 163 { |
164 return genericParseNumber(ptr, end, number, skip); | 164 return genericParseNumber(ptr, end, number, skip); |
165 } | 165 } |
166 | 166 |
167 bool parseNumberFromString(const String& string, float& number, bool skip) | |
168 { | |
169 if (string.isEmpty()) | |
170 return false; | |
171 if (string.is8Bit()) { | |
172 const LChar* ptr = string.characters8(); | |
173 const LChar* end = ptr + string.length(); | |
174 return genericParseNumber(ptr, end, number, skip) && ptr == end; | |
175 } | |
176 const UChar* ptr = string.characters16(); | |
177 const UChar* end = ptr + string.length(); | |
178 return genericParseNumber(ptr, end, number, skip) && ptr == end; | |
179 } | |
180 | |
181 // only used to parse largeArcFlag and sweepFlag which must be a "0" or "1" | 167 // only used to parse largeArcFlag and sweepFlag which must be a "0" or "1" |
182 // and might not have any whitespace/comma after it | 168 // and might not have any whitespace/comma after it |
183 template <typename CharType> | 169 template <typename CharType> |
184 bool genericParseArcFlag(const CharType*& ptr, const CharType* end, bool& flag) | 170 bool genericParseArcFlag(const CharType*& ptr, const CharType* end, bool& flag) |
185 { | 171 { |
186 if (ptr >= end) | 172 if (ptr >= end) |
187 return false; | 173 return false; |
188 const CharType flagChar = *ptr++; | 174 const CharType flagChar = *ptr++; |
189 if (flagChar == '0') | 175 if (flagChar == '0') |
190 flag = false; | 176 flag = false; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 parseAndSkipTransformType(ptr, end, type); | 522 parseAndSkipTransformType(ptr, end, type); |
537 } else { | 523 } else { |
538 const UChar* ptr = string.characters16(); | 524 const UChar* ptr = string.characters16(); |
539 const UChar* end = ptr + string.length(); | 525 const UChar* end = ptr + string.length(); |
540 parseAndSkipTransformType(ptr, end, type); | 526 parseAndSkipTransformType(ptr, end, type); |
541 } | 527 } |
542 return type; | 528 return type; |
543 } | 529 } |
544 | 530 |
545 } | 531 } |
OLD | NEW |