OLD | NEW |
1 #ifndef __DEFINED__SkPdfPodofoMapper | 1 #ifndef __DEFINED__SkPdfPodofoMapper |
2 #define __DEFINED__SkPdfPodofoMapper | 2 #define __DEFINED__SkPdfPodofoMapper |
3 | 3 |
4 #include "SkPdfHeaders_autogen.h" | 4 #include "SkPdfHeaders_autogen.h" |
5 class PodofoMapper { | 5 class PodofoMapper { |
6 public: | 6 public: |
7 static bool map(const SkPdfObject& in, SkPdfObject** out) { | 7 static bool map(const SkPdfObject& in, SkPdfObject** out) { |
8 return map(*in.doc(), *in.podofo(), out); | 8 return map(*in.doc(), *in.podofo(), out); |
9 } | 9 } |
10 | 10 |
11 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfObject** out) { | 11 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfObject** out) { |
12 if (!isObject(podofoDoc, podofoObj)) return false; | 12 if (!isObject(podofoDoc, podofoObj)) return false; |
13 | 13 |
14 if (map(podofoDoc, podofoObj, (SkPdfArray**)out)) return true; | 14 if (map(podofoDoc, podofoObj, (SkPdfArray**)out)) return true; |
15 if (map(podofoDoc, podofoObj, (SkPdfBoolean**)out)) return true; | 15 if (map(podofoDoc, podofoObj, (SkPdfBoolean**)out)) return true; |
16 if (map(podofoDoc, podofoObj, (SkPdfDictionary**)out)) return true; | 16 if (map(podofoDoc, podofoObj, (SkPdfDictionary**)out)) return true; |
17 if (map(podofoDoc, podofoObj, (SkPdfHexString**)out)) return true; | |
18 if (map(podofoDoc, podofoObj, (SkPdfInteger**)out)) return true; | 17 if (map(podofoDoc, podofoObj, (SkPdfInteger**)out)) return true; |
19 if (map(podofoDoc, podofoObj, (SkPdfName**)out)) return true; | 18 if (map(podofoDoc, podofoObj, (SkPdfName**)out)) return true; |
20 if (map(podofoDoc, podofoObj, (SkPdfNull**)out)) return true; | 19 if (map(podofoDoc, podofoObj, (SkPdfNull**)out)) return true; |
21 if (map(podofoDoc, podofoObj, (SkPdfNumber**)out)) return true; | |
22 if (map(podofoDoc, podofoObj, (SkPdfReference**)out)) return true; | 20 if (map(podofoDoc, podofoObj, (SkPdfReference**)out)) return true; |
23 if (map(podofoDoc, podofoObj, (SkPdfString**)out)) return true; | 21 if (map(podofoDoc, podofoObj, (SkPdfString**)out)) return true; |
24 | 22 |
25 *out = new SkPdfObject(&podofoDoc, &podofoObj); | 23 *out = new SkPdfObject(&podofoDoc, &podofoObj); |
26 return true; | 24 return true; |
27 } | 25 } |
28 | 26 |
29 static bool map(const SkPdfObject& in, SkPdfNull** out) { | 27 static bool map(const SkPdfObject& in, SkPdfNull** out) { |
30 return map(*in.doc(), *in.podofo(), out); | 28 return map(*in.doc(), *in.podofo(), out); |
31 } | 29 } |
(...skipping 18 matching lines...) Expand all Loading... |
50 return true; | 48 return true; |
51 } | 49 } |
52 | 50 |
53 static bool map(const SkPdfObject& in, SkPdfInteger** out) { | 51 static bool map(const SkPdfObject& in, SkPdfInteger** out) { |
54 return map(*in.doc(), *in.podofo(), out); | 52 return map(*in.doc(), *in.podofo(), out); |
55 } | 53 } |
56 | 54 |
57 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfInteger** out) { | 55 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfInteger** out) { |
58 if (!isInteger(podofoDoc, podofoObj)) return false; | 56 if (!isInteger(podofoDoc, podofoObj)) return false; |
59 | 57 |
| 58 if (map(podofoDoc, podofoObj, (SkPdfNumber**)out)) return true; |
60 | 59 |
61 *out = new SkPdfInteger(&podofoDoc, &podofoObj); | 60 *out = new SkPdfInteger(&podofoDoc, &podofoObj); |
62 return true; | 61 return true; |
63 } | 62 } |
64 | 63 |
65 static bool map(const SkPdfObject& in, SkPdfNumber** out) { | 64 static bool map(const SkPdfObject& in, SkPdfNumber** out) { |
66 return map(*in.doc(), *in.podofo(), out); | 65 return map(*in.doc(), *in.podofo(), out); |
67 } | 66 } |
68 | 67 |
69 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfNumber** out) { | 68 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfNumber** out) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return true; | 109 return true; |
111 } | 110 } |
112 | 111 |
113 static bool map(const SkPdfObject& in, SkPdfString** out) { | 112 static bool map(const SkPdfObject& in, SkPdfString** out) { |
114 return map(*in.doc(), *in.podofo(), out); | 113 return map(*in.doc(), *in.podofo(), out); |
115 } | 114 } |
116 | 115 |
117 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfString** out) { | 116 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfString** out) { |
118 if (!isString(podofoDoc, podofoObj)) return false; | 117 if (!isString(podofoDoc, podofoObj)) return false; |
119 | 118 |
| 119 if (map(podofoDoc, podofoObj, (SkPdfHexString**)out)) return true; |
120 | 120 |
121 *out = new SkPdfString(&podofoDoc, &podofoObj); | 121 *out = new SkPdfString(&podofoDoc, &podofoObj); |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
125 static bool map(const SkPdfObject& in, SkPdfHexString** out) { | 125 static bool map(const SkPdfObject& in, SkPdfHexString** out) { |
126 return map(*in.doc(), *in.podofo(), out); | 126 return map(*in.doc(), *in.podofo(), out); |
127 } | 127 } |
128 | 128 |
129 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfHexString** out) { | 129 static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, S
kPdfHexString** out) { |
(...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 | 2323 |
2324 static bool isNull(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj
) { | 2324 static bool isNull(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj
) { |
2325 return podofoObj.GetDataType() == ePdfDataType_Null; | 2325 return podofoObj.GetDataType() == ePdfDataType_Null; |
2326 } | 2326 } |
2327 | 2327 |
2328 static bool isBoolean(const PdfMemDocument& podofoDoc, const PdfObject& podofo
Obj) { | 2328 static bool isBoolean(const PdfMemDocument& podofoDoc, const PdfObject& podofo
Obj) { |
2329 return podofoObj.GetDataType() == ePdfDataType_Bool; | 2329 return podofoObj.GetDataType() == ePdfDataType_Bool; |
2330 } | 2330 } |
2331 | 2331 |
2332 static bool isInteger(const PdfMemDocument& podofoDoc, const PdfObject& podofo
Obj) { | 2332 static bool isInteger(const PdfMemDocument& podofoDoc, const PdfObject& podofo
Obj) { |
2333 return podofoObj.GetDataType() == ePdfDataType_Number; | 2333 return podofoObj.GetDataType() == ePdfDataType_Number || podofoObj.GetDataTy
pe() == ePdfDataType_Real; |
2334 } | 2334 } |
2335 | 2335 |
2336 static bool isNumber(const PdfMemDocument& podofoDoc, const PdfObject& podofoO
bj) { | 2336 static bool isNumber(const PdfMemDocument& podofoDoc, const PdfObject& podofoO
bj) { |
2337 return podofoObj.GetDataType() == ePdfDataType_Real; | 2337 return podofoObj.GetDataType() == ePdfDataType_Number || podofoObj.GetDataTy
pe() == ePdfDataType_Real; |
2338 } | 2338 } |
2339 | 2339 |
2340 static bool isName(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj
) { | 2340 static bool isName(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj
) { |
2341 return podofoObj.GetDataType() == ePdfDataType_Name; | 2341 return podofoObj.GetDataType() == ePdfDataType_Name; |
2342 } | 2342 } |
2343 | 2343 |
2344 static bool isReference(const PdfMemDocument& podofoDoc, const PdfObject& podo
foObj) { | 2344 static bool isReference(const PdfMemDocument& podofoDoc, const PdfObject& podo
foObj) { |
2345 return podofoObj.GetDataType() == ePdfDataType_Reference; | 2345 return podofoObj.GetDataType() == ePdfDataType_Reference; |
2346 } | 2346 } |
2347 | 2347 |
2348 static bool isArray(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb
j) { | 2348 static bool isArray(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb
j) { |
2349 return podofoObj.GetDataType() == ePdfDataType_Array; | 2349 return podofoObj.GetDataType() == ePdfDataType_Array; |
2350 } | 2350 } |
2351 | 2351 |
2352 static bool isString(const PdfMemDocument& podofoDoc, const PdfObject& podofoO
bj) { | 2352 static bool isString(const PdfMemDocument& podofoDoc, const PdfObject& podofoO
bj) { |
2353 return podofoObj.GetDataType() == ePdfDataType_String; | 2353 return podofoObj.GetDataType() == ePdfDataType_String || podofoObj.GetDataTy
pe() == ePdfDataType_HexString; |
2354 } | 2354 } |
2355 | 2355 |
2356 static bool isHexString(const PdfMemDocument& podofoDoc, const PdfObject& podo
foObj) { | 2356 static bool isHexString(const PdfMemDocument& podofoDoc, const PdfObject& podo
foObj) { |
2357 return podofoObj.GetDataType() == ePdfDataType_HexString; | 2357 return podofoObj.GetDataType() == ePdfDataType_HexString; |
2358 } | 2358 } |
2359 | 2359 |
2360 static bool isDictionary(const PdfMemDocument& podofoDoc, const PdfObject& pod
ofoObj) { | 2360 static bool isDictionary(const PdfMemDocument& podofoDoc, const PdfObject& pod
ofoObj) { |
2361 return podofoObj.GetDataType() == ePdfDataType_Dictionary; | 2361 return podofoObj.GetDataType() == ePdfDataType_Dictionary; |
2362 } | 2362 } |
2363 | 2363 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3037 std::string Subtype; | 3037 std::string Subtype; |
3038 if (!NameFromDictionary(&podofoDoc, podofoObj.GetDictionary(), "Subtype", ""
, &Subtype)) return false; | 3038 if (!NameFromDictionary(&podofoDoc, podofoObj.GetDictionary(), "Subtype", ""
, &Subtype)) return false; |
3039 if (Subtype != "MMType1") return false; | 3039 if (Subtype != "MMType1") return false; |
3040 | 3040 |
3041 return true; | 3041 return true; |
3042 } | 3042 } |
3043 | 3043 |
3044 }; | 3044 }; |
3045 | 3045 |
3046 #endif // __DEFINED__SkPdfPodofoMapper | 3046 #endif // __DEFINED__SkPdfPodofoMapper |
OLD | NEW |