OLD | NEW |
1 | 1 |
2 | 2 |
3 import os | 3 import os |
4 import sys | 4 import sys |
5 | 5 |
6 import datatypes | 6 import datatypes |
7 from pdfspec_autogen import * | 7 from pdfspec_autogen import * |
8 | 8 |
9 # TODO(edisonn): date and some other types are in fact strings, with a custom fo
rmat!!! | 9 # TODO(edisonn): date and some other types are in fact strings, with a custom fo
rmat!!! |
10 # TODO(edisonn): refer to page 99 (PDF data types) | 10 # TODO(edisonn): refer to page 99 (PDF data types) |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 475 |
476 fileMapperNative.write(' SkPdfMapper(SkNativeParsedPDF* doc) : fParsedDoc(d
oc) {}\n') | 476 fileMapperNative.write(' SkPdfMapper(SkNativeParsedPDF* doc) : fParsedDoc(d
oc) {}\n') |
477 fileMapperNative.write('\n') | 477 fileMapperNative.write('\n') |
478 | 478 |
479 for name in self.fClassesNamesInOrder: | 479 for name in self.fClassesNamesInOrder: |
480 cls = self.fClasses[name] | 480 cls = self.fClasses[name] |
481 | 481 |
482 fileMapperNative.write(' SkPdfObjectType map' + name + '(const SkPdfObjec
t* in) const;\n') | 482 fileMapperNative.write(' SkPdfObjectType map' + name + '(const SkPdfObjec
t* in) const;\n') |
483 | 483 |
484 fileMapperNativeCpp.write('SkPdfObjectType SkPdfMapper::map' + name + '(co
nst SkPdfObject* in) const {\n') | 484 fileMapperNativeCpp.write('SkPdfObjectType SkPdfMapper::map' + name + '(co
nst SkPdfObject* in) const {\n') |
485 fileMapperNativeCpp.write(' if (!is' + name + '(in)) return kNone_SkPdfOb
jectType;\n') | 485 fileMapperNativeCpp.write(' if (in == NULL || !is' + name + '(in)) return
kNone_SkPdfObjectType;\n') |
486 fileMapperNativeCpp.write('\n') | 486 fileMapperNativeCpp.write('\n') |
487 if len(cls.fEnumSubclasses) > 0: | 487 if len(cls.fEnumSubclasses) > 0: |
488 fileMapperNativeCpp.write(' SkPdfObjectType ret;\n') | 488 fileMapperNativeCpp.write(' SkPdfObjectType ret;\n') |
489 | 489 |
490 # stream must be last one | 490 # stream must be last one |
491 hasStream = False | 491 hasStream = False |
492 for sub in cls.fEnumSubclasses: | 492 for sub in cls.fEnumSubclasses: |
493 fileMapperNativeCpp.write(' if (kNone_SkPdfObjectType != (ret = map' +
enumToCls[sub].fName + '(in))) return ret;\n') | 493 fileMapperNativeCpp.write(' if (kNone_SkPdfObjectType != (ret = map' +
enumToCls[sub].fName + '(in))) return ret;\n') |
494 | 494 |
495 fileMapperNativeCpp.write('\n') | 495 fileMapperNativeCpp.write('\n') |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 622 |
623 fileHeadersNative.write('#endif // __DEFINED__SkPdfHeaders\n') | 623 fileHeadersNative.write('#endif // __DEFINED__SkPdfHeaders\n') |
624 | 624 |
625 fileHeadersNative.close() | 625 fileHeadersNative.close() |
626 fileHeadersNativeCpp.close() | 626 fileHeadersNativeCpp.close() |
627 | 627 |
628 if '__main__' == __name__: | 628 if '__main__' == __name__: |
629 #print sys.argv | 629 #print sys.argv |
630 sys.exit(generateCode()) | 630 sys.exit(generateCode()) |
631 | 631 |
OLD | NEW |