| OLD | NEW |
| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 print | 425 print |
| 426 | 426 |
| 427 return | 427 return |
| 428 | 428 |
| 429 def generateCode(): | 429 def generateCode(): |
| 430 manager = PdfClassManager() | 430 manager = PdfClassManager() |
| 431 | 431 |
| 432 manager.addClass('Object') | 432 manager.addClass('Object') |
| 433 | 433 |
| 434 manager.addClass('Null').check('podofoObj.GetDataType() == ePdfDataType_Null') | 434 manager.addClass('Null').check('podofoObj.GetDataType() == ePdfDataType_Null') |
| 435 manager.addClass('Boolean').check('podofoObj.GetDataType() == ePdfDataType_Boo
l') | 435 manager.addClass('Boolean').check('podofoObj.GetDataType() == ePdfDataType_Boo
l')\ |
| 436 manager.addClass('Integer').check('podofoObj.GetDataType() == ePdfDataType_Num
ber') | 436 .carbonCopyPublic('bool value() const {return fPodo
foObj->GetBool();}') |
| 437 manager.addClass('Number').check('podofoObj.GetDataType() == ePdfDataType_Real
') | 437 |
| 438 manager.addClass('Name').check('podofoObj.GetDataType() == ePdfDataType_Name') | 438 manager.addClass('Integer').check('podofoObj.GetDataType() == ePdfDataType_Num
ber')\ |
| 439 .carbonCopyPublic('long value() const {return fPodo
foObj->GetNumber();}') |
| 440 |
| 441 manager.addClass('Number').check('podofoObj.GetDataType() == ePdfDataType_Real
')\ |
| 442 .carbonCopyPublic('double value() const {return fPo
dofoObj->GetReal();}') |
| 443 |
| 444 manager.addClass('Name').check('podofoObj.GetDataType() == ePdfDataType_Name')
\ |
| 445 .carbonCopyPublic('const std::string& value() const
{return fPodofoObj->GetName().GetName();}') |
| 446 |
| 439 #manager.addClass('Stream') - attached to a dictionary | 447 #manager.addClass('Stream') - attached to a dictionary |
| 440 manager.addClass('Reference').check('podofoObj.GetDataType() == ePdfDataType_R
eference') | 448 manager.addClass('Reference').check('podofoObj.GetDataType() == ePdfDataType_R
eference') |
| 441 manager.addClass('Array').check('podofoObj.GetDataType() == ePdfDataType_Array
') | 449 |
| 442 manager.addClass('String').check('podofoObj.GetDataType() == ePdfDataType_Stri
ng') | 450 manager.addClass('Array').check('podofoObj.GetDataType() == ePdfDataType_Array
')\ |
| 443 manager.addClass('HexString').check('podofoObj.GetDataType() == ePdfDataType_H
exString') | 451 .carbonCopyPublic('const int size() const {return f
PodofoObj->GetArray().GetSize();}')\ |
| 452 .carbonCopyPublic('const SkPdfObject operator[](int
i) const {return SkPdfObject(fPodofoDoc, &fPodofoObj->GetArray()[i]);}')\ |
| 453 .carbonCopyPublic('SkPdfObject operator[](int i) {r
eturn SkPdfObject(fPodofoDoc, &fPodofoObj->GetArray()[i]);}') |
| 454 |
| 455 manager.addClass('String').check('podofoObj.GetDataType() == ePdfDataType_Stri
ng')\ |
| 456 .carbonCopyPublic('const std::string& value() const
{return fPodofoObj->GetString().GetStringUtf8();}') |
| 457 |
| 458 manager.addClass('HexString').check('podofoObj.GetDataType() == ePdfDataType_H
exString')\ |
| 459 .carbonCopyPublic('const std::string& value() const
{return fPodofoObj->GetString().GetStringUtf8();}') |
| 444 | 460 |
| 445 manager.addClass('Dictionary').check('podofoObj.GetDataType() == ePdfDataType_
Dictionary') | 461 manager.addClass('Dictionary').check('podofoObj.GetDataType() == ePdfDataType_
Dictionary') |
| 446 | 462 |
| 447 # these classes are not explicitely backed by a table in the pdf spec | 463 # these classes are not explicitely backed by a table in the pdf spec |
| 448 manager.addClass('XObjectDictionary', 'Dictionary') | 464 manager.addClass('XObjectDictionary', 'Dictionary') |
| 449 | 465 |
| 450 manager.addClass('FontDictionary', 'Dictionary') | 466 manager.addClass('FontDictionary', 'Dictionary') |
| 451 | 467 |
| 452 manager.addClass('TrueTypeFontDictionary', 'FontDictionary') | 468 manager.addClass('TrueTypeFontDictionary', 'FontDictionary') |
| 453 | 469 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 464 | 480 |
| 465 | 481 |
| 466 manager.write() | 482 manager.write() |
| 467 | 483 |
| 468 return 1 | 484 return 1 |
| 469 | 485 |
| 470 if '__main__' == __name__: | 486 if '__main__' == __name__: |
| 471 sys.exit(generateCode()) | 487 sys.exit(generateCode()) |
| 472 | 488 |
| 473 | 489 |
| OLD | NEW |