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

Side by Side Diff: experimental/PdfViewer/generate_code.py

Issue 17063014: map podofo to SkPdfObject for SkPdfArray::operator[] (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/SkPdfFont.cpp ('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
1 1
2 2
3 import sys 3 import sys
4 4
5 import datatypes 5 import datatypes
6 import pdfspec_autogen 6 import pdfspec_autogen
7 7
8 knowTypes = { 8 knowTypes = {
9 '(any)': ['SkPdfObject*', 'ObjectFromDictionary', datatypes.CppNull(), 'true'], 9 '(any)': ['SkPdfObject*', 'ObjectFromDictionary', datatypes.CppNull(), 'true'],
10 '(undefined)': ['SkPdfObject*', 'ObjectFromDictionary', datatypes.CppNull(), 'tr ue'], 10 '(undefined)': ['SkPdfObject*', 'ObjectFromDictionary', datatypes.CppNull(), 'tr ue'],
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 manager.addClass('Number', 'Integer').check('podofoObj.GetDataType() == ePdfDa taType_Number || podofoObj.GetDataType() == ePdfDataType_Real')\ 519 manager.addClass('Number', 'Integer').check('podofoObj.GetDataType() == ePdfDa taType_Number || podofoObj.GetDataType() == ePdfDataType_Real')\
520 .carbonCopyPublic('double value() const {return fPo dofoObj->GetReal();}') 520 .carbonCopyPublic('double value() const {return fPo dofoObj->GetReal();}')
521 521
522 manager.addClass('Name').check('podofoObj.GetDataType() == ePdfDataType_Name') \ 522 manager.addClass('Name').check('podofoObj.GetDataType() == ePdfDataType_Name') \
523 .carbonCopyPublic('const std::string& value() const {return fPodofoObj->GetName().GetName();}') 523 .carbonCopyPublic('const std::string& value() const {return fPodofoObj->GetName().GetName();}')
524 524
525 manager.addClass('Reference').check('podofoObj.GetDataType() == ePdfDataType_R eference') 525 manager.addClass('Reference').check('podofoObj.GetDataType() == ePdfDataType_R eference')
526 526
527 manager.addClass('Array').check('podofoObj.GetDataType() == ePdfDataType_Array ')\ 527 manager.addClass('Array').check('podofoObj.GetDataType() == ePdfDataType_Array ')\
528 .carbonCopyPublic('const int size() const {return f PodofoObj->GetArray().GetSize();}')\ 528 .carbonCopyPublic('const int size() const {return f PodofoObj->GetArray().GetSize();}')\
529 .carbonCopyPublic('SkPdfObject* operator[](int i) c onst {return new SkPdfObject(fPodofoDoc, &fPodofoObj->GetArray()[i]);}')\ 529 .carbonCopyPublic('SkPdfObject* operator[](int i) c onst { SkPdfObject* ret = NULL; skpdfmap(*fPodofoDoc, fPodofoObj->GetArray()[i] , &ret); return ret; }')\
530 530
531 manager.addClass('String').check('podofoObj.GetDataType() == ePdfDataType_Stri ng || podofoObj.GetDataType() == ePdfDataType_HexString')\ 531 manager.addClass('String').check('podofoObj.GetDataType() == ePdfDataType_Stri ng || podofoObj.GetDataType() == ePdfDataType_HexString')\
532 .carbonCopyPublic('const std::string& value() const {return fPodofoObj->GetString().GetStringUtf8();}') 532 .carbonCopyPublic('const std::string& value() const {return fPodofoObj->GetString().GetStringUtf8();}')
533 533
534 manager.addClass('HexString', 'String').check('podofoObj.GetDataType() == ePdf DataType_HexString')\ 534 manager.addClass('HexString', 'String').check('podofoObj.GetDataType() == ePdf DataType_HexString')\
535 .carbonCopyPublic('const std::string& value() const {return fPodofoObj->GetString().GetStringUtf8();}') 535 .carbonCopyPublic('const std::string& value() const {return fPodofoObj->GetString().GetStringUtf8();}')
536 536
537 manager.addClass('Dictionary').check('podofoObj.GetDataType() == ePdfDataType_ Dictionary')\ 537 manager.addClass('Dictionary').check('podofoObj.GetDataType() == ePdfDataType_ Dictionary')\
538 .carbonCopyPublic('const SkPdfObject get(const c har* dictionaryKeyName) const {return SkPdfObject(fPodofoDoc, resolveReferenceOb ject(fPodofoDoc, fPodofoObj->GetDictionary().GetKey(PdfName(dictionaryKeyName))) );}')\ 538 .carbonCopyPublic('const SkPdfObject get(const c har* dictionaryKeyName) const {return SkPdfObject(fPodofoDoc, resolveReferenceOb ject(fPodofoDoc, fPodofoObj->GetDictionary().GetKey(PdfName(dictionaryKeyName))) );}')\
539 .carbonCopyPublic('SkPdfObject get(const char* d ictionaryKeyName) {return SkPdfObject(fPodofoDoc, resolveReferenceObject(fPodofo Doc, fPodofoObj->GetDictionary().GetKey(PdfName(dictionaryKeyName))));}')\ 539 .carbonCopyPublic('SkPdfObject get(const char* d ictionaryKeyName) {return SkPdfObject(fPodofoDoc, resolveReferenceObject(fPodofo Doc, fPodofoObj->GetDictionary().GetKey(PdfName(dictionaryKeyName))));}')\
(...skipping 30 matching lines...) Expand all
570 manager.write() 570 manager.write()
571 571
572 fileHeaders.write('#endif // __DEFINED__SkPdfHeaders\n') 572 fileHeaders.write('#endif // __DEFINED__SkPdfHeaders\n')
573 fileHeaders.close() 573 fileHeaders.close()
574 574
575 return 1 575 return 1
576 576
577 if '__main__' == __name__: 577 if '__main__' == __name__:
578 sys.exit(generateCode()) 578 sys.exit(generateCode())
579 579
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfFont.cpp ('k') | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698