Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: experimental/PdfViewer/pdf_auto_gen.h

Issue 16838002: Code generator for dinamic generation of podofo wrappers (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/generate_code.py ('k') | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 enum SkPdfObjectType {
2 kObject_SkPdfObjectType,
3 kObjectArray_SkPdfObjectType,
4 kObjectBoolean_SkPdfObjectType,
5 kObjectDictionary_SkPdfObjectType,
6 kObjectDictionaryXObject_SkPdfObjectType,
7 kObjectDictionaryXObjectForm_SkPdfObjectType,
8 kObjectDictionaryXObjectImage_SkPdfObjectType,
9 kObjectDictionaryXObject__End_SkPdfObjectType,
10 kObjectDictionary__End_SkPdfObjectType,
11 kObjectInteger_SkPdfObjectType,
12 kObjectName_SkPdfObjectType,
13 kObjectNull_SkPdfObjectType,
14 kObjectReal_SkPdfObjectType,
15 kObjectReference_SkPdfObjectType,
16 kObjectStream_SkPdfObjectType,
17 kObject__End_SkPdfObjectType,
18 };
19
20 class SkPdfObject;
21 class SkPdfNull;
22 class SkPdfBoolean;
23 class SkPdfInteger;
24 class SkPdfReal;
25 class SkPdfName;
26 class SkPdfStream;
27 class SkPdfReference;
28 class SkPdfArray;
29 class SkPdfDictionary;
30 class SkPdfXObject;
31 class SkPdfImage;
32 class SkPdfForm;
33
34 class SkPdfObject {
35 public:
36 virtual SkPdfObjectType getType() const { return kObject_SkPdfObjectType;}
37 virtual SkPdfObjectType getTypeEnd() const { return kObject__End_SkPdfObjectTy pe;}
38 public:
39 virtual SkPdfObject* asObject() {return this;}
40 virtual const SkPdfObject* asObject() const {return this;}
41
42 virtual SkPdfArray* asArray() {return NULL;}
43 virtual const SkPdfArray* asArray() const {return NULL;}
44
45 virtual SkPdfBoolean* asBoolean() {return NULL;}
46 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
47
48 virtual SkPdfDictionary* asDictionary() {return NULL;}
49 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
50
51 virtual SkPdfXObject* asXObject() {return NULL;}
52 virtual const SkPdfXObject* asXObject() const {return NULL;}
53
54 virtual SkPdfForm* asForm() {return NULL;}
55 virtual const SkPdfForm* asForm() const {return NULL;}
56
57 virtual SkPdfImage* asImage() {return NULL;}
58 virtual const SkPdfImage* asImage() const {return NULL;}
59
60 virtual SkPdfInteger* asInteger() {return NULL;}
61 virtual const SkPdfInteger* asInteger() const {return NULL;}
62
63 virtual SkPdfName* asName() {return NULL;}
64 virtual const SkPdfName* asName() const {return NULL;}
65
66 virtual SkPdfNull* asNull() {return NULL;}
67 virtual const SkPdfNull* asNull() const {return NULL;}
68
69 virtual SkPdfReal* asReal() {return NULL;}
70 virtual const SkPdfReal* asReal() const {return NULL;}
71
72 virtual SkPdfReference* asReference() {return NULL;}
73 virtual const SkPdfReference* asReference() const {return NULL;}
74
75 virtual SkPdfStream* asStream() {return NULL;}
76 virtual const SkPdfStream* asStream() const {return NULL;}
77
78 public:
79 private:
80 protected:
81 const PdfMemDocument* fPodofoDoc;
82 const PdfObject* fPodofoObj;
83
84 public:
85 SkPdfObject(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : fPo dofoDoc(podofoDoc), fPodofoObj(podofoObj) {}
86 const PdfObject* podofo() const { return fPodofoObj;}
87 virtual bool valid() const {return true;}
88 };
89
90
91 class SkPdfNull : public SkPdfObject {
92 public:
93 virtual SkPdfObjectType getType() const { return kObjectNull_SkPdfObjectType;}
94 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectN ull_SkPdfObjectType + 1);}
95 public:
96 virtual SkPdfNull* asNull() {return this;}
97 virtual const SkPdfNull* asNull() const {return this;}
98
99 private:
100 virtual SkPdfArray* asArray() {return NULL;}
101 virtual const SkPdfArray* asArray() const {return NULL;}
102
103 virtual SkPdfBoolean* asBoolean() {return NULL;}
104 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
105
106 virtual SkPdfDictionary* asDictionary() {return NULL;}
107 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
108
109 virtual SkPdfXObject* asXObject() {return NULL;}
110 virtual const SkPdfXObject* asXObject() const {return NULL;}
111
112 virtual SkPdfForm* asForm() {return NULL;}
113 virtual const SkPdfForm* asForm() const {return NULL;}
114
115 virtual SkPdfImage* asImage() {return NULL;}
116 virtual const SkPdfImage* asImage() const {return NULL;}
117
118 virtual SkPdfInteger* asInteger() {return NULL;}
119 virtual const SkPdfInteger* asInteger() const {return NULL;}
120
121 virtual SkPdfName* asName() {return NULL;}
122 virtual const SkPdfName* asName() const {return NULL;}
123
124 virtual SkPdfReal* asReal() {return NULL;}
125 virtual const SkPdfReal* asReal() const {return NULL;}
126
127 virtual SkPdfReference* asReference() {return NULL;}
128 virtual const SkPdfReference* asReference() const {return NULL;}
129
130 virtual SkPdfStream* asStream() {return NULL;}
131 virtual const SkPdfStream* asStream() const {return NULL;}
132
133 public:
134 private:
135 public:
136 SkPdfNull(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdfO bject(podofoDoc, podofoObj) {}
137 virtual bool valid() const {return true;}
138 };
139
140
141 class SkPdfBoolean : public SkPdfObject {
142 public:
143 virtual SkPdfObjectType getType() const { return kObjectBoolean_SkPdfObjectTyp e;}
144 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectB oolean_SkPdfObjectType + 1);}
145 public:
146 virtual SkPdfBoolean* asBoolean() {return this;}
147 virtual const SkPdfBoolean* asBoolean() const {return this;}
148
149 private:
150 virtual SkPdfArray* asArray() {return NULL;}
151 virtual const SkPdfArray* asArray() const {return NULL;}
152
153 virtual SkPdfDictionary* asDictionary() {return NULL;}
154 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
155
156 virtual SkPdfXObject* asXObject() {return NULL;}
157 virtual const SkPdfXObject* asXObject() const {return NULL;}
158
159 virtual SkPdfForm* asForm() {return NULL;}
160 virtual const SkPdfForm* asForm() const {return NULL;}
161
162 virtual SkPdfImage* asImage() {return NULL;}
163 virtual const SkPdfImage* asImage() const {return NULL;}
164
165 virtual SkPdfInteger* asInteger() {return NULL;}
166 virtual const SkPdfInteger* asInteger() const {return NULL;}
167
168 virtual SkPdfName* asName() {return NULL;}
169 virtual const SkPdfName* asName() const {return NULL;}
170
171 virtual SkPdfNull* asNull() {return NULL;}
172 virtual const SkPdfNull* asNull() const {return NULL;}
173
174 virtual SkPdfReal* asReal() {return NULL;}
175 virtual const SkPdfReal* asReal() const {return NULL;}
176
177 virtual SkPdfReference* asReference() {return NULL;}
178 virtual const SkPdfReference* asReference() const {return NULL;}
179
180 virtual SkPdfStream* asStream() {return NULL;}
181 virtual const SkPdfStream* asStream() const {return NULL;}
182
183 public:
184 private:
185 public:
186 SkPdfBoolean(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkP dfObject(podofoDoc, podofoObj) {}
187 virtual bool valid() const {return true;}
188 };
189
190
191 class SkPdfInteger : public SkPdfObject {
192 public:
193 virtual SkPdfObjectType getType() const { return kObjectInteger_SkPdfObjectTyp e;}
194 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectI nteger_SkPdfObjectType + 1);}
195 public:
196 virtual SkPdfInteger* asInteger() {return this;}
197 virtual const SkPdfInteger* asInteger() const {return this;}
198
199 private:
200 virtual SkPdfArray* asArray() {return NULL;}
201 virtual const SkPdfArray* asArray() const {return NULL;}
202
203 virtual SkPdfBoolean* asBoolean() {return NULL;}
204 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
205
206 virtual SkPdfDictionary* asDictionary() {return NULL;}
207 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
208
209 virtual SkPdfXObject* asXObject() {return NULL;}
210 virtual const SkPdfXObject* asXObject() const {return NULL;}
211
212 virtual SkPdfForm* asForm() {return NULL;}
213 virtual const SkPdfForm* asForm() const {return NULL;}
214
215 virtual SkPdfImage* asImage() {return NULL;}
216 virtual const SkPdfImage* asImage() const {return NULL;}
217
218 virtual SkPdfName* asName() {return NULL;}
219 virtual const SkPdfName* asName() const {return NULL;}
220
221 virtual SkPdfNull* asNull() {return NULL;}
222 virtual const SkPdfNull* asNull() const {return NULL;}
223
224 virtual SkPdfReal* asReal() {return NULL;}
225 virtual const SkPdfReal* asReal() const {return NULL;}
226
227 virtual SkPdfReference* asReference() {return NULL;}
228 virtual const SkPdfReference* asReference() const {return NULL;}
229
230 virtual SkPdfStream* asStream() {return NULL;}
231 virtual const SkPdfStream* asStream() const {return NULL;}
232
233 public:
234 private:
235 public:
236 SkPdfInteger(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkP dfObject(podofoDoc, podofoObj) {}
237 virtual bool valid() const {return true;}
238 };
239
240
241 class SkPdfReal : public SkPdfObject {
242 public:
243 virtual SkPdfObjectType getType() const { return kObjectReal_SkPdfObjectType;}
244 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectR eal_SkPdfObjectType + 1);}
245 public:
246 virtual SkPdfReal* asReal() {return this;}
247 virtual const SkPdfReal* asReal() const {return this;}
248
249 private:
250 virtual SkPdfArray* asArray() {return NULL;}
251 virtual const SkPdfArray* asArray() const {return NULL;}
252
253 virtual SkPdfBoolean* asBoolean() {return NULL;}
254 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
255
256 virtual SkPdfDictionary* asDictionary() {return NULL;}
257 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
258
259 virtual SkPdfXObject* asXObject() {return NULL;}
260 virtual const SkPdfXObject* asXObject() const {return NULL;}
261
262 virtual SkPdfForm* asForm() {return NULL;}
263 virtual const SkPdfForm* asForm() const {return NULL;}
264
265 virtual SkPdfImage* asImage() {return NULL;}
266 virtual const SkPdfImage* asImage() const {return NULL;}
267
268 virtual SkPdfInteger* asInteger() {return NULL;}
269 virtual const SkPdfInteger* asInteger() const {return NULL;}
270
271 virtual SkPdfName* asName() {return NULL;}
272 virtual const SkPdfName* asName() const {return NULL;}
273
274 virtual SkPdfNull* asNull() {return NULL;}
275 virtual const SkPdfNull* asNull() const {return NULL;}
276
277 virtual SkPdfReference* asReference() {return NULL;}
278 virtual const SkPdfReference* asReference() const {return NULL;}
279
280 virtual SkPdfStream* asStream() {return NULL;}
281 virtual const SkPdfStream* asStream() const {return NULL;}
282
283 public:
284 private:
285 public:
286 SkPdfReal(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdfO bject(podofoDoc, podofoObj) {}
287 virtual bool valid() const {return true;}
288 };
289
290
291 class SkPdfName : public SkPdfObject {
292 public:
293 virtual SkPdfObjectType getType() const { return kObjectName_SkPdfObjectType;}
294 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectN ame_SkPdfObjectType + 1);}
295 public:
296 virtual SkPdfName* asName() {return this;}
297 virtual const SkPdfName* asName() const {return this;}
298
299 private:
300 virtual SkPdfArray* asArray() {return NULL;}
301 virtual const SkPdfArray* asArray() const {return NULL;}
302
303 virtual SkPdfBoolean* asBoolean() {return NULL;}
304 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
305
306 virtual SkPdfDictionary* asDictionary() {return NULL;}
307 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
308
309 virtual SkPdfXObject* asXObject() {return NULL;}
310 virtual const SkPdfXObject* asXObject() const {return NULL;}
311
312 virtual SkPdfForm* asForm() {return NULL;}
313 virtual const SkPdfForm* asForm() const {return NULL;}
314
315 virtual SkPdfImage* asImage() {return NULL;}
316 virtual const SkPdfImage* asImage() const {return NULL;}
317
318 virtual SkPdfInteger* asInteger() {return NULL;}
319 virtual const SkPdfInteger* asInteger() const {return NULL;}
320
321 virtual SkPdfNull* asNull() {return NULL;}
322 virtual const SkPdfNull* asNull() const {return NULL;}
323
324 virtual SkPdfReal* asReal() {return NULL;}
325 virtual const SkPdfReal* asReal() const {return NULL;}
326
327 virtual SkPdfReference* asReference() {return NULL;}
328 virtual const SkPdfReference* asReference() const {return NULL;}
329
330 virtual SkPdfStream* asStream() {return NULL;}
331 virtual const SkPdfStream* asStream() const {return NULL;}
332
333 public:
334 private:
335 public:
336 SkPdfName(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdfO bject(podofoDoc, podofoObj) {}
337 virtual bool valid() const {return true;}
338 };
339
340
341 class SkPdfStream : public SkPdfObject {
342 public:
343 virtual SkPdfObjectType getType() const { return kObjectStream_SkPdfObjectType ;}
344 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectS tream_SkPdfObjectType + 1);}
345 public:
346 virtual SkPdfStream* asStream() {return this;}
347 virtual const SkPdfStream* asStream() const {return this;}
348
349 private:
350 virtual SkPdfArray* asArray() {return NULL;}
351 virtual const SkPdfArray* asArray() const {return NULL;}
352
353 virtual SkPdfBoolean* asBoolean() {return NULL;}
354 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
355
356 virtual SkPdfDictionary* asDictionary() {return NULL;}
357 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
358
359 virtual SkPdfXObject* asXObject() {return NULL;}
360 virtual const SkPdfXObject* asXObject() const {return NULL;}
361
362 virtual SkPdfForm* asForm() {return NULL;}
363 virtual const SkPdfForm* asForm() const {return NULL;}
364
365 virtual SkPdfImage* asImage() {return NULL;}
366 virtual const SkPdfImage* asImage() const {return NULL;}
367
368 virtual SkPdfInteger* asInteger() {return NULL;}
369 virtual const SkPdfInteger* asInteger() const {return NULL;}
370
371 virtual SkPdfName* asName() {return NULL;}
372 virtual const SkPdfName* asName() const {return NULL;}
373
374 virtual SkPdfNull* asNull() {return NULL;}
375 virtual const SkPdfNull* asNull() const {return NULL;}
376
377 virtual SkPdfReal* asReal() {return NULL;}
378 virtual const SkPdfReal* asReal() const {return NULL;}
379
380 virtual SkPdfReference* asReference() {return NULL;}
381 virtual const SkPdfReference* asReference() const {return NULL;}
382
383 public:
384 private:
385 public:
386 SkPdfStream(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPd fObject(podofoDoc, podofoObj) {}
387 virtual bool valid() const {return true;}
388 };
389
390
391 class SkPdfReference : public SkPdfObject {
392 public:
393 virtual SkPdfObjectType getType() const { return kObjectReference_SkPdfObjectT ype;}
394 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectR eference_SkPdfObjectType + 1);}
395 public:
396 virtual SkPdfReference* asReference() {return this;}
397 virtual const SkPdfReference* asReference() const {return this;}
398
399 private:
400 virtual SkPdfArray* asArray() {return NULL;}
401 virtual const SkPdfArray* asArray() const {return NULL;}
402
403 virtual SkPdfBoolean* asBoolean() {return NULL;}
404 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
405
406 virtual SkPdfDictionary* asDictionary() {return NULL;}
407 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
408
409 virtual SkPdfXObject* asXObject() {return NULL;}
410 virtual const SkPdfXObject* asXObject() const {return NULL;}
411
412 virtual SkPdfForm* asForm() {return NULL;}
413 virtual const SkPdfForm* asForm() const {return NULL;}
414
415 virtual SkPdfImage* asImage() {return NULL;}
416 virtual const SkPdfImage* asImage() const {return NULL;}
417
418 virtual SkPdfInteger* asInteger() {return NULL;}
419 virtual const SkPdfInteger* asInteger() const {return NULL;}
420
421 virtual SkPdfName* asName() {return NULL;}
422 virtual const SkPdfName* asName() const {return NULL;}
423
424 virtual SkPdfNull* asNull() {return NULL;}
425 virtual const SkPdfNull* asNull() const {return NULL;}
426
427 virtual SkPdfReal* asReal() {return NULL;}
428 virtual const SkPdfReal* asReal() const {return NULL;}
429
430 virtual SkPdfStream* asStream() {return NULL;}
431 virtual const SkPdfStream* asStream() const {return NULL;}
432
433 public:
434 private:
435 public:
436 SkPdfReference(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : S kPdfObject(podofoDoc, podofoObj) {}
437 virtual bool valid() const {return true;}
438 };
439
440
441 class SkPdfArray : public SkPdfObject {
442 public:
443 virtual SkPdfObjectType getType() const { return kObjectArray_SkPdfObjectType; }
444 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectA rray_SkPdfObjectType + 1);}
445 public:
446 virtual SkPdfArray* asArray() {return this;}
447 virtual const SkPdfArray* asArray() const {return this;}
448
449 private:
450 virtual SkPdfBoolean* asBoolean() {return NULL;}
451 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
452
453 virtual SkPdfDictionary* asDictionary() {return NULL;}
454 virtual const SkPdfDictionary* asDictionary() const {return NULL;}
455
456 virtual SkPdfXObject* asXObject() {return NULL;}
457 virtual const SkPdfXObject* asXObject() const {return NULL;}
458
459 virtual SkPdfForm* asForm() {return NULL;}
460 virtual const SkPdfForm* asForm() const {return NULL;}
461
462 virtual SkPdfImage* asImage() {return NULL;}
463 virtual const SkPdfImage* asImage() const {return NULL;}
464
465 virtual SkPdfInteger* asInteger() {return NULL;}
466 virtual const SkPdfInteger* asInteger() const {return NULL;}
467
468 virtual SkPdfName* asName() {return NULL;}
469 virtual const SkPdfName* asName() const {return NULL;}
470
471 virtual SkPdfNull* asNull() {return NULL;}
472 virtual const SkPdfNull* asNull() const {return NULL;}
473
474 virtual SkPdfReal* asReal() {return NULL;}
475 virtual const SkPdfReal* asReal() const {return NULL;}
476
477 virtual SkPdfReference* asReference() {return NULL;}
478 virtual const SkPdfReference* asReference() const {return NULL;}
479
480 virtual SkPdfStream* asStream() {return NULL;}
481 virtual const SkPdfStream* asStream() const {return NULL;}
482
483 public:
484 private:
485 public:
486 SkPdfArray(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdf Object(podofoDoc, podofoObj) {}
487 virtual bool valid() const {return true;}
488 };
489
490
491 class SkPdfDictionary : public SkPdfObject {
492 public:
493 virtual SkPdfObjectType getType() const { return kObjectDictionary_SkPdfObject Type;}
494 virtual SkPdfObjectType getTypeEnd() const { return kObjectDictionary__End_SkP dfObjectType;}
495 public:
496 virtual SkPdfDictionary* asDictionary() {return this;}
497 virtual const SkPdfDictionary* asDictionary() const {return this;}
498
499 private:
500 virtual SkPdfArray* asArray() {return NULL;}
501 virtual const SkPdfArray* asArray() const {return NULL;}
502
503 virtual SkPdfBoolean* asBoolean() {return NULL;}
504 virtual const SkPdfBoolean* asBoolean() const {return NULL;}
505
506 virtual SkPdfInteger* asInteger() {return NULL;}
507 virtual const SkPdfInteger* asInteger() const {return NULL;}
508
509 virtual SkPdfName* asName() {return NULL;}
510 virtual const SkPdfName* asName() const {return NULL;}
511
512 virtual SkPdfNull* asNull() {return NULL;}
513 virtual const SkPdfNull* asNull() const {return NULL;}
514
515 virtual SkPdfReal* asReal() {return NULL;}
516 virtual const SkPdfReal* asReal() const {return NULL;}
517
518 virtual SkPdfReference* asReference() {return NULL;}
519 virtual const SkPdfReference* asReference() const {return NULL;}
520
521 virtual SkPdfStream* asStream() {return NULL;}
522 virtual const SkPdfStream* asStream() const {return NULL;}
523
524 public:
525 private:
526 public:
527 SkPdfDictionary(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdfObject(podofoDoc, podofoObj) {}
528 virtual bool valid() const {return true;}
529 };
530
531
532 class SkPdfXObject : public SkPdfDictionary {
533 public:
534 virtual SkPdfObjectType getType() const { return kObjectDictionaryXObject_SkPd fObjectType;}
535 virtual SkPdfObjectType getTypeEnd() const { return kObjectDictionaryXObject__ End_SkPdfObjectType;}
536 public:
537 virtual SkPdfXObject* asXObject() {return this;}
538 virtual const SkPdfXObject* asXObject() const {return this;}
539
540 private:
541 public:
542 private:
543 public:
544 SkPdfXObject(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkP dfDictionary(podofoDoc, podofoObj) {}
545 virtual bool valid() const {return true;}
546 std::string t() const {
547 std::string ret;
548 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
549 // TODO(edisonn): warn about missing required field, assert for known good p dfs
550 return "";
551 }
552
553 };
554
555
556 class SkPdfImage : public SkPdfXObject {
557 public:
558 virtual SkPdfObjectType getType() const { return kObjectDictionaryXObjectImage _SkPdfObjectType;}
559 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectD ictionaryXObjectImage_SkPdfObjectType + 1);}
560 public:
561 virtual SkPdfImage* asImage() {return this;}
562 virtual const SkPdfImage* asImage() const {return this;}
563
564 private:
565 virtual SkPdfForm* asForm() {return NULL;}
566 virtual const SkPdfForm* asForm() const {return NULL;}
567
568 public:
569 private:
570 SkBitmap bitmap;
571 public:
572 SkPdfImage(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdf XObject(podofoDoc, podofoObj) {}
573 virtual bool valid() const {return true;}
574 std::string t() const {
575 std::string ret;
576 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
577 // TODO(edisonn): warn about missing required field, assert for known good p dfs
578 return "";
579 }
580
581 std::string s() const {
582 std::string ret;
583 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", " ", &ret)) return ret;
584 // TODO(edisonn): warn about missing required field, assert for known good p dfs
585 return "";
586 }
587
588 long w() const {
589 long ret;
590 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width", "W" , &ret)) return ret;
591 // TODO(edisonn): warn about missing required field, assert for known good p dfs
592 return -1;
593 }
594
595 long h() const {
596 long ret;
597 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Height", "H ", &ret)) return ret;
598 // TODO(edisonn): warn about missing required field, assert for known good p dfs
599 return -1;
600 }
601
602 std::string cs() const {
603 std::string ret;
604 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace" , "", &ret)) return ret;
605 // TODO(edisonn): warn about missing required field, assert for known good p dfs
606 return "";
607 }
608
609 long bpc() const {
610 long ret;
611 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsPerComp onent", "BPC", &ret)) return ret;
612 return 1;
613 }
614
615 };
616
617
618 class SkPdfForm : public SkPdfXObject {
619 public:
620 virtual SkPdfObjectType getType() const { return kObjectDictionaryXObjectForm_ SkPdfObjectType;}
621 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kObjectD ictionaryXObjectForm_SkPdfObjectType + 1);}
622 public:
623 virtual SkPdfForm* asForm() {return this;}
624 virtual const SkPdfForm* asForm() const {return this;}
625
626 private:
627 virtual SkPdfImage* asImage() {return NULL;}
628 virtual const SkPdfImage* asImage() const {return NULL;}
629
630 public:
631 void test() {}
632 private:
633 public:
634 SkPdfForm(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdfX Object(podofoDoc, podofoObj) {}
635 virtual bool valid() const {return true;}
636 std::string t() const {
637 std::string ret;
638 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
639 // TODO(edisonn): warn about missing required field, assert for known good p dfs
640 return "";
641 }
642
643 std::string s() const {
644 std::string ret;
645 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", " ", &ret)) return ret;
646 // TODO(edisonn): warn about missing required field, assert for known good p dfs
647 return "";
648 }
649
650 };
651
652
653 class PodofoMapper {
654 public:
655 static bool mapObject(const PdfMemDocument& podofoDoc, const PdfObject& podofo Obj, SkPdfObject** out) {
656 if (!isAObject(podofoDoc, podofoObj)) return false;
657
658 if (mapArray(podofoDoc, podofoObj, out)) return true;
659 if (mapBoolean(podofoDoc, podofoObj, out)) return true;
660 if (mapDictionary(podofoDoc, podofoObj, out)) return true;
661 if (mapInteger(podofoDoc, podofoObj, out)) return true;
662 if (mapName(podofoDoc, podofoObj, out)) return true;
663 if (mapNull(podofoDoc, podofoObj, out)) return true;
664 if (mapReal(podofoDoc, podofoObj, out)) return true;
665 if (mapReference(podofoDoc, podofoObj, out)) return true;
666 if (mapStream(podofoDoc, podofoObj, out)) return true;
667
668 *out = new SkPdfObject(&podofoDoc, &podofoObj);
669 return true;
670 }
671
672 static bool mapNull(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j, SkPdfObject** out) {
673 if (!isANull(podofoDoc, podofoObj)) return false;
674
675
676 *out = new SkPdfNull(&podofoDoc, &podofoObj);
677 return true;
678 }
679
680 static bool mapBoolean(const PdfMemDocument& podofoDoc, const PdfObject& podof oObj, SkPdfObject** out) {
681 if (!isABoolean(podofoDoc, podofoObj)) return false;
682
683
684 *out = new SkPdfBoolean(&podofoDoc, &podofoObj);
685 return true;
686 }
687
688 static bool mapInteger(const PdfMemDocument& podofoDoc, const PdfObject& podof oObj, SkPdfObject** out) {
689 if (!isAInteger(podofoDoc, podofoObj)) return false;
690
691
692 *out = new SkPdfInteger(&podofoDoc, &podofoObj);
693 return true;
694 }
695
696 static bool mapReal(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j, SkPdfObject** out) {
697 if (!isAReal(podofoDoc, podofoObj)) return false;
698
699
700 *out = new SkPdfReal(&podofoDoc, &podofoObj);
701 return true;
702 }
703
704 static bool mapName(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j, SkPdfObject** out) {
705 if (!isAName(podofoDoc, podofoObj)) return false;
706
707
708 *out = new SkPdfName(&podofoDoc, &podofoObj);
709 return true;
710 }
711
712 static bool mapStream(const PdfMemDocument& podofoDoc, const PdfObject& podofo Obj, SkPdfObject** out) {
713 if (!isAStream(podofoDoc, podofoObj)) return false;
714
715
716 *out = new SkPdfStream(&podofoDoc, &podofoObj);
717 return true;
718 }
719
720 static bool mapReference(const PdfMemDocument& podofoDoc, const PdfObject& pod ofoObj, SkPdfObject** out) {
721 if (!isAReference(podofoDoc, podofoObj)) return false;
722
723
724 *out = new SkPdfReference(&podofoDoc, &podofoObj);
725 return true;
726 }
727
728 static bool mapArray(const PdfMemDocument& podofoDoc, const PdfObject& podofoO bj, SkPdfObject** out) {
729 if (!isAArray(podofoDoc, podofoObj)) return false;
730
731
732 *out = new SkPdfArray(&podofoDoc, &podofoObj);
733 return true;
734 }
735
736 static bool mapDictionary(const PdfMemDocument& podofoDoc, const PdfObject& po dofoObj, SkPdfObject** out) {
737 if (!isADictionary(podofoDoc, podofoObj)) return false;
738
739 if (mapXObject(podofoDoc, podofoObj, out)) return true;
740
741 *out = new SkPdfDictionary(&podofoDoc, &podofoObj);
742 return true;
743 }
744
745 static bool mapXObject(const PdfMemDocument& podofoDoc, const PdfObject& podof oObj, SkPdfObject** out) {
746 if (!isAXObject(podofoDoc, podofoObj)) return false;
747
748 if (mapForm(podofoDoc, podofoObj, out)) return true;
749 if (mapImage(podofoDoc, podofoObj, out)) return true;
750
751 *out = new SkPdfXObject(&podofoDoc, &podofoObj);
752 return true;
753 }
754
755 static bool mapImage(const PdfMemDocument& podofoDoc, const PdfObject& podofoO bj, SkPdfObject** out) {
756 if (!isAImage(podofoDoc, podofoObj)) return false;
757
758
759 *out = new SkPdfImage(&podofoDoc, &podofoObj);
760 return true;
761 }
762
763 static bool mapForm(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j, SkPdfObject** out) {
764 if (!isAForm(podofoDoc, podofoObj)) return false;
765
766
767 *out = new SkPdfForm(&podofoDoc, &podofoObj);
768 return true;
769 }
770
771 static bool isAObject(const PdfMemDocument& podofoDoc, const PdfObject& podofo Obj) {
772 return true;
773 }
774
775 static bool isANull(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j) {
776 return false;
777 }
778
779 static bool isABoolean(const PdfMemDocument& podofoDoc, const PdfObject& podof oObj) {
780 return false;
781 }
782
783 static bool isAInteger(const PdfMemDocument& podofoDoc, const PdfObject& podof oObj) {
784 return false;
785 }
786
787 static bool isAReal(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j) {
788 return false;
789 }
790
791 static bool isAName(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j) {
792 return false;
793 }
794
795 static bool isAStream(const PdfMemDocument& podofoDoc, const PdfObject& podofo Obj) {
796 return false;
797 }
798
799 static bool isAReference(const PdfMemDocument& podofoDoc, const PdfObject& pod ofoObj) {
800 return false;
801 }
802
803 static bool isAArray(const PdfMemDocument& podofoDoc, const PdfObject& podofoO bj) {
804 return false;
805 }
806
807 static bool isADictionary(const PdfMemDocument& podofoDoc, const PdfObject& po dofoObj) {
808 return true;
809 }
810
811 static bool isAXObject(const PdfMemDocument& podofoDoc, const PdfObject& podof oObj) {
812 std::string t;
813 if (!NameFromDictionary(&podofoDoc, podofoObj.GetDictionary(), "Type", "", & t)) return false;
814 if (t != "XObject") return false;
815
816 return true;
817 }
818
819 static bool isAImage(const PdfMemDocument& podofoDoc, const PdfObject& podofoO bj) {
820 std::string t;
821 if (!NameFromDictionary(&podofoDoc, podofoObj.GetDictionary(), "Type", "", & t)) return false;
822 if (t != "XObject") return false;
823
824 std::string s;
825 if (!NameFromDictionary(&podofoDoc, podofoObj.GetDictionary(), "Subtype", "" , &s)) return false;
826 if (s != "Image") return false;
827
828 return true;
829 }
830
831 static bool isAForm(const PdfMemDocument& podofoDoc, const PdfObject& podofoOb j) {
832 std::string t;
833 if (!NameFromDictionary(&podofoDoc, podofoObj.GetDictionary(), "Type", "", & t)) return false;
834 if (t != "XObject") return false;
835
836 std::string s;
837 if (!NameFromDictionary(&podofoDoc, podofoObj.GetDictionary(), "Subtype", "" , &s)) return false;
838 if (s != "Form") return false;
839
840 return true;
841 }
842
843 };
844
OLDNEW
« no previous file with comments | « experimental/PdfViewer/generate_code.py ('k') | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698