OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkSVGAttributeParser_DEFINED | 8 #ifndef SkSVGAttributeParser_DEFINED |
9 #define SkSVGAttributeParser_DEFINED | 9 #define SkSVGAttributeParser_DEFINED |
10 | 10 |
11 #include "SkSVGTypes.h" | 11 #include "SkSVGTypes.h" |
12 | 12 |
13 class SkSVGAttributeParser : public SkNoncopyable { | 13 class SkSVGAttributeParser : public SkNoncopyable { |
14 public: | 14 public: |
15 SkSVGAttributeParser(const char[]); | 15 SkSVGAttributeParser(const char[]); |
16 | 16 |
17 bool parseColor(SkSVGColorType*); | 17 bool parseColor(SkSVGColorType*); |
18 bool parseNumber(SkSVGNumberType*); | 18 bool parseNumber(SkSVGNumberType*); |
19 bool parseLength(SkSVGLength*); | 19 bool parseLength(SkSVGLength*); |
20 bool parseViewBox(SkSVGViewBoxType*); | 20 bool parseViewBox(SkSVGViewBoxType*); |
21 bool parseTransform(SkSVGTransformType*); | 21 bool parseTransform(SkSVGTransformType*); |
22 bool parsePaint(SkSVGPaint*); | 22 bool parsePaint(SkSVGPaint*); |
23 bool parseLineCap(SkSVGLineCap*); | 23 bool parseLineCap(SkSVGLineCap*); |
24 bool parseLineJoin(SkSVGLineJoin*); | 24 bool parseLineJoin(SkSVGLineJoin*); |
25 bool parsePoints(SkSVGPointsType*); | 25 bool parsePoints(SkSVGPointsType*); |
| 26 bool parseIRI(SkSVGStringType*); |
26 | 27 |
27 private: | 28 private: |
28 // Stack-only | 29 // Stack-only |
29 void* operator new(size_t) = delete; | 30 void* operator new(size_t) = delete; |
30 void* operator new(size_t, void*) = delete; | 31 void* operator new(size_t, void*) = delete; |
31 | 32 |
32 template <typename F> | 33 template <typename F> |
33 bool advanceWhile(F func); | 34 bool advanceWhile(F func); |
34 | 35 |
35 bool parseWSToken(); | 36 bool parseWSToken(); |
36 bool parseEOSToken(); | 37 bool parseEOSToken(); |
37 bool parseSepToken(); | 38 bool parseSepToken(); |
38 bool parseExpectedStringToken(const char*); | 39 bool parseExpectedStringToken(const char*); |
39 bool parseScalarToken(SkScalar*); | 40 bool parseScalarToken(SkScalar*); |
40 bool parseHexToken(uint32_t*); | 41 bool parseHexToken(uint32_t*); |
41 bool parseLengthUnitToken(SkSVGLength::Unit*); | 42 bool parseLengthUnitToken(SkSVGLength::Unit*); |
42 bool parseNamedColorToken(SkColor*); | 43 bool parseNamedColorToken(SkColor*); |
43 bool parseHexColorToken(SkColor*); | 44 bool parseHexColorToken(SkColor*); |
| 45 bool parseColorComponentToken(int32_t*); |
| 46 bool parseRGBColorToken(SkColor*); |
| 47 bool parseFuncIRI(SkSVGStringType*); |
44 | 48 |
45 // Transform helpers | 49 // Transform helpers |
46 bool parseMatrixToken(SkMatrix*); | 50 bool parseMatrixToken(SkMatrix*); |
47 bool parseTranslateToken(SkMatrix*); | 51 bool parseTranslateToken(SkMatrix*); |
48 bool parseScaleToken(SkMatrix*); | 52 bool parseScaleToken(SkMatrix*); |
49 bool parseRotateToken(SkMatrix*); | 53 bool parseRotateToken(SkMatrix*); |
50 bool parseSkewXToken(SkMatrix*); | 54 bool parseSkewXToken(SkMatrix*); |
51 bool parseSkewYToken(SkMatrix*); | 55 bool parseSkewYToken(SkMatrix*); |
52 | 56 |
53 // Parses a sequence of 'WS* <prefix> WS* (<nested>)', where the nested sequ
ence | 57 // Parses a sequence of 'WS* <prefix> WS* (<nested>)', where the nested sequ
ence |
54 // is handled by the passed functor. | 58 // is handled by the passed functor. |
55 template <typename Func, typename T> | 59 template <typename Func, typename T> |
56 bool parseParenthesized(const char* prefix, Func, T* result); | 60 bool parseParenthesized(const char* prefix, Func, T* result); |
57 | 61 |
58 // The current position in the input string. | 62 // The current position in the input string. |
59 const char* fCurPos; | 63 const char* fCurPos; |
60 | 64 |
61 typedef SkNoncopyable INHERITED; | 65 typedef SkNoncopyable INHERITED; |
62 }; | 66 }; |
63 | 67 |
64 #endif // SkSVGAttributeParser_DEFINED | 68 #endif // SkSVGAttributeParser_DEFINED |
OLD | NEW |