OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #ifndef SVGPathStringSource_h | 21 #ifndef SVGPathStringSource_h |
22 #define SVGPathStringSource_h | 22 #define SVGPathStringSource_h |
23 | 23 |
24 #include "core/CoreExport.h" | 24 #include "core/CoreExport.h" |
25 #include "core/svg/SVGParsingError.h" | 25 #include "core/svg/SVGParsingError.h" |
26 #include "core/svg/SVGPathSource.h" | 26 #include "core/svg/SVGPathData.h" |
27 #include "wtf/text/WTFString.h" | 27 #include "wtf/text/WTFString.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 class CORE_EXPORT SVGPathStringSource final : public SVGPathSource { | 31 class CORE_EXPORT SVGPathStringSource { |
| 32 WTF_MAKE_NONCOPYABLE(SVGPathStringSource); |
| 33 STACK_ALLOCATED(); |
32 public: | 34 public: |
33 explicit SVGPathStringSource(const String&); | 35 explicit SVGPathStringSource(const String&); |
34 | 36 |
| 37 bool hasMoreData() const |
| 38 { |
| 39 if (m_is8BitSource) |
| 40 return m_current.m_character8 < m_end.m_character8; |
| 41 return m_current.m_character16 < m_end.m_character16; |
| 42 } |
| 43 PathSegmentData parseSegment(); |
| 44 |
35 SVGParsingError parseError() const { return m_error; } | 45 SVGParsingError parseError() const { return m_error; } |
36 | 46 |
37 private: | 47 private: |
38 bool hasMoreData() const override; | |
39 SVGPathSegType peekSegmentType() override; | |
40 PathSegmentData parseSegment() override; | |
41 | |
42 void eatWhitespace(); | 48 void eatWhitespace(); |
43 float parseNumberWithError(); | 49 float parseNumberWithError(); |
44 bool parseArcFlagWithError(); | 50 bool parseArcFlagWithError(); |
45 void setErrorMark(SVGParseStatus); | 51 void setErrorMark(SVGParseStatus); |
46 | 52 |
47 bool m_is8BitSource; | 53 bool m_is8BitSource; |
48 | 54 |
49 union { | 55 union { |
50 const LChar* m_character8; | 56 const LChar* m_character8; |
51 const UChar* m_character16; | 57 const UChar* m_character16; |
52 } m_current; | 58 } m_current; |
53 union { | 59 union { |
54 const LChar* m_character8; | 60 const LChar* m_character8; |
55 const UChar* m_character16; | 61 const UChar* m_character16; |
56 } m_end; | 62 } m_end; |
57 | 63 |
58 SVGPathSegType m_previousCommand; | 64 SVGPathSegType m_previousCommand; |
59 SVGParsingError m_error; | 65 SVGParsingError m_error; |
60 String m_string; | 66 String m_string; |
61 }; | 67 }; |
62 | 68 |
63 } // namespace blink | 69 } // namespace blink |
64 | 70 |
65 #endif // SVGPathStringSource_h | 71 #endif // SVGPathStringSource_h |
OLD | NEW |