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

Side by Side Diff: experimental/PdfViewer/autogen/SkPdfStreamCommonDictionary_autogen.h

Issue 17856004: refactoring for pdf viewer lib (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
OLDNEW
1 #ifndef __DEFINED__SkPdfStreamCommonDictionary 1 #ifndef __DEFINED__SkPdfStreamCommonDictionary
2 #define __DEFINED__SkPdfStreamCommonDictionary 2 #define __DEFINED__SkPdfStreamCommonDictionary
3 3
4 #include "SkPdfUtils.h" 4 #include "SkPdfUtils.h"
5 #include "SkPdfEnums_autogen.h" 5 #include "SkPdfEnums_autogen.h"
6 #include "SkPdfArray_autogen.h" 6 #include "SkPdfArray_autogen.h"
7 #include "SkPdfDictionary_autogen.h" 7 #include "SkPdfDictionary_autogen.h"
8 8
9 // Entries common to all stream dictionaries 9 // Entries common to all stream dictionaries
10 class SkPdfStreamCommonDictionary : public SkPdfDictionary { 10 class SkPdfStreamCommonDictionary : public SkPdfDictionary {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 * lowing the keyword stream to the last byte just before the keyword 529 * lowing the keyword stream to the last byte just before the keyword
530 * endstream. (There may be an additional EOL marker, preceding 530 * endstream. (There may be an additional EOL marker, preceding
531 * endstream, that is not included in the count and is not logically part 531 * endstream, that is not included in the count and is not logically part
532 * of the stream data.) See "Stream Extent," above, for further discus- 532 * of the stream data.) See "Stream Extent," above, for further discus-
533 * sion. 533 * sion.
534 **/ 534 **/
535 bool has_Length() const { 535 bool has_Length() const {
536 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Lengt h", "", NULL)); 536 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Lengt h", "", NULL));
537 } 537 }
538 538
539 long Length() const { 539 long Length() const;
540 long ret;
541 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Length", "" , &ret)) return ret;
542 // TODO(edisonn): warn about missing required field, assert for known good p dfs
543 return 0;
544 }
545
546 /** (Optional) The name of a filter to be applied in processing the stream 540 /** (Optional) The name of a filter to be applied in processing the stream
547 * data found between the keywords stream and endstream, or an array 541 * data found between the keywords stream and endstream, or an array
548 * of such names. Multiple filters should be specified in the order in 542 * of such names. Multiple filters should be specified in the order in
549 * which they are to be applied. 543 * which they are to be applied.
550 **/ 544 **/
551 bool has_Filter() const { 545 bool has_Filter() const {
552 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filte r", "", NULL)); 546 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filte r", "", NULL));
553 } 547 }
554 548
555 bool isFilterAName() const { 549 bool isFilterAName() const {
556 SkPdfObject* ret = NULL; 550 SkPdfObject* ret = NULL;
557 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filter", "", &ret)) return false; 551 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filter", "", &ret)) return false;
558 return ret->podofo()->GetDataType() == ePdfDataType_Name; 552 return ret->podofo()->GetDataType() == ePdfDataType_Name;
559 } 553 }
560 554
561 std::string getFilterAsName() const { 555 std::string getFilterAsName() const;
562 std::string ret = "";
563 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filter", "" , &ret)) return ret;
564 // TODO(edisonn): warn about missing required field, assert for known good p dfs
565 return "";
566 }
567
568 bool isFilterAArray() const { 556 bool isFilterAArray() const {
569 SkPdfObject* ret = NULL; 557 SkPdfObject* ret = NULL;
570 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filter", "", &ret)) return false; 558 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filter", "", &ret)) return false;
571 return ret->podofo()->GetDataType() == ePdfDataType_Array; 559 return ret->podofo()->GetDataType() == ePdfDataType_Array;
572 } 560 }
573 561
574 SkPdfArray* getFilterAsArray() const { 562 SkPdfArray* getFilterAsArray() const;
575 SkPdfArray* ret = NULL;
576 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Filter", " ", &ret)) return ret;
577 // TODO(edisonn): warn about missing required field, assert for known good p dfs
578 return NULL;
579 }
580
581 /** (Optional) A parameter dictionary, or an array of such dictionaries, 563 /** (Optional) A parameter dictionary, or an array of such dictionaries,
582 * used by the filters specified by Filter. If there is only one filter and tha t 564 * used by the filters specified by Filter. If there is only one filter and tha t
583 * filter has parameters, DecodeParms must be set to the filter's parame- 565 * filter has parameters, DecodeParms must be set to the filter's parame-
584 * ter dictionary unless all the filter's parameters have their default 566 * ter dictionary unless all the filter's parameters have their default
585 * values, in which case the DecodeParms entry may be omitted. If there 567 * values, in which case the DecodeParms entry may be omitted. If there
586 * are multiple filters and any of the filters has parameters set to non- 568 * are multiple filters and any of the filters has parameters set to non-
587 * default values, DecodeParms must be an array with one entry for 569 * default values, DecodeParms must be an array with one entry for
588 * each filter: either the parameter dictionary for that filter, or the null 570 * each filter: either the parameter dictionary for that filter, or the null
589 * object if that filter has no parameters (or if all of its parameters have 571 * object if that filter has no parameters (or if all of its parameters have
590 * their default values). If none of the filters have parameters, or if all 572 * their default values). If none of the filters have parameters, or if all
591 * their parameters have default values, the DecodeParms entry may be 573 * their parameters have default values, the DecodeParms entry may be
592 * omitted. (See implementation note 7 in Appendix H.) 574 * omitted. (See implementation note 7 in Appendix H.)
593 **/ 575 **/
594 bool has_DecodeParms() const { 576 bool has_DecodeParms() const {
595 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Decod eParms", "", NULL)); 577 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Decod eParms", "", NULL));
596 } 578 }
597 579
598 bool isDecodeParmsADictionary() const { 580 bool isDecodeParmsADictionary() const {
599 SkPdfObject* ret = NULL; 581 SkPdfObject* ret = NULL;
600 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DecodePa rms", "", &ret)) return false; 582 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DecodePa rms", "", &ret)) return false;
601 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; 583 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary;
602 } 584 }
603 585
604 SkPdfDictionary* getDecodeParmsAsDictionary() const { 586 SkPdfDictionary* getDecodeParmsAsDictionary() const;
605 SkPdfDictionary* ret = NULL;
606 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Decod eParms", "", &ret)) return ret;
607 // TODO(edisonn): warn about missing required field, assert for known good p dfs
608 return NULL;
609 }
610
611 bool isDecodeParmsAArray() const { 587 bool isDecodeParmsAArray() const {
612 SkPdfObject* ret = NULL; 588 SkPdfObject* ret = NULL;
613 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DecodePa rms", "", &ret)) return false; 589 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DecodePa rms", "", &ret)) return false;
614 return ret->podofo()->GetDataType() == ePdfDataType_Array; 590 return ret->podofo()->GetDataType() == ePdfDataType_Array;
615 } 591 }
616 592
617 SkPdfArray* getDecodeParmsAsArray() const { 593 SkPdfArray* getDecodeParmsAsArray() const;
618 SkPdfArray* ret = NULL;
619 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DecodeParm s", "", &ret)) return ret;
620 // TODO(edisonn): warn about missing required field, assert for known good p dfs
621 return NULL;
622 }
623
624 /** (Optional; PDF 1.2) The file containing the stream data. If this entry 594 /** (Optional; PDF 1.2) The file containing the stream data. If this entry
625 * is present, the bytes between stream and endstream are ignored, the 595 * is present, the bytes between stream and endstream are ignored, the
626 * filters are specified by FFilter rather than Filter, and the filter parame- 596 * filters are specified by FFilter rather than Filter, and the filter parame-
627 * ters are specified by FDecodeParms rather than DecodeParms. How- 597 * ters are specified by FDecodeParms rather than DecodeParms. How-
628 * ever, the Length entry should still specify the number of those bytes. 598 * ever, the Length entry should still specify the number of those bytes.
629 * (Usually there are no bytes and Length is 0.) 599 * (Usually there are no bytes and Length is 0.)
630 **/ 600 **/
631 bool has_F() const { 601 bool has_F() const {
632 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", " ", NULL)); 602 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", " ", NULL));
633 } 603 }
634 604
635 SkPdfFileSpec F() const { 605 SkPdfFileSpec F() const;
636 SkPdfFileSpec ret;
637 if (FileSpecFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", "", &ret)) return ret;
638 // TODO(edisonn): warn about missing required field, assert for known good p dfs
639 return SkPdfFileSpec();
640 }
641
642 /** (Optional; PDF 1.2) The name of a filter to be applied in processing 606 /** (Optional; PDF 1.2) The name of a filter to be applied in processing
643 * the data found in the stream's external file, or an array of such names. 607 * the data found in the stream's external file, or an array of such names.
644 * The same rules apply as for Filter. 608 * The same rules apply as for Filter.
645 **/ 609 **/
646 bool has_FFilter() const { 610 bool has_FFilter() const {
647 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilt er", "", NULL)); 611 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilt er", "", NULL));
648 } 612 }
649 613
650 bool isFFilterAName() const { 614 bool isFFilterAName() const {
651 SkPdfObject* ret = NULL; 615 SkPdfObject* ret = NULL;
652 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilter" , "", &ret)) return false; 616 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilter" , "", &ret)) return false;
653 return ret->podofo()->GetDataType() == ePdfDataType_Name; 617 return ret->podofo()->GetDataType() == ePdfDataType_Name;
654 } 618 }
655 619
656 std::string getFFilterAsName() const { 620 std::string getFFilterAsName() const;
657 std::string ret = "";
658 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilter", " ", &ret)) return ret;
659 // TODO(edisonn): warn about missing required field, assert for known good p dfs
660 return "";
661 }
662
663 bool isFFilterAArray() const { 621 bool isFFilterAArray() const {
664 SkPdfObject* ret = NULL; 622 SkPdfObject* ret = NULL;
665 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilter" , "", &ret)) return false; 623 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilter" , "", &ret)) return false;
666 return ret->podofo()->GetDataType() == ePdfDataType_Array; 624 return ret->podofo()->GetDataType() == ePdfDataType_Array;
667 } 625 }
668 626
669 SkPdfArray* getFFilterAsArray() const { 627 SkPdfArray* getFFilterAsArray() const;
670 SkPdfArray* ret = NULL;
671 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FFilter", "", &ret)) return ret;
672 // TODO(edisonn): warn about missing required field, assert for known good p dfs
673 return NULL;
674 }
675
676 /** (Optional; PDF 1.2) A parameter dictionary, or an array of such dic- 628 /** (Optional; PDF 1.2) A parameter dictionary, or an array of such dic-
677 * tionaries, used by the filters specified by FFilter. The same rules apply 629 * tionaries, used by the filters specified by FFilter. The same rules apply
678 * as for DecodeParms. 630 * as for DecodeParms.
679 **/ 631 **/
680 bool has_FDecodeParms() const { 632 bool has_FDecodeParms() const {
681 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDeco deParms", "", NULL)); 633 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDeco deParms", "", NULL));
682 } 634 }
683 635
684 bool isFDecodeParmsADictionary() const { 636 bool isFDecodeParmsADictionary() const {
685 SkPdfObject* ret = NULL; 637 SkPdfObject* ret = NULL;
686 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDecodeP arms", "", &ret)) return false; 638 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDecodeP arms", "", &ret)) return false;
687 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; 639 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary;
688 } 640 }
689 641
690 SkPdfDictionary* getFDecodeParmsAsDictionary() const { 642 SkPdfDictionary* getFDecodeParmsAsDictionary() const;
691 SkPdfDictionary* ret = NULL;
692 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDeco deParms", "", &ret)) return ret;
693 // TODO(edisonn): warn about missing required field, assert for known good p dfs
694 return NULL;
695 }
696
697 bool isFDecodeParmsAArray() const { 643 bool isFDecodeParmsAArray() const {
698 SkPdfObject* ret = NULL; 644 SkPdfObject* ret = NULL;
699 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDecodeP arms", "", &ret)) return false; 645 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDecodeP arms", "", &ret)) return false;
700 return ret->podofo()->GetDataType() == ePdfDataType_Array; 646 return ret->podofo()->GetDataType() == ePdfDataType_Array;
701 } 647 }
702 648
703 SkPdfArray* getFDecodeParmsAsArray() const { 649 SkPdfArray* getFDecodeParmsAsArray() const;
704 SkPdfArray* ret = NULL;
705 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FDecodePar ms", "", &ret)) return ret;
706 // TODO(edisonn): warn about missing required field, assert for known good p dfs
707 return NULL;
708 }
709
710 }; 650 };
711 651
712 #endif // __DEFINED__SkPdfStreamCommonDictionary 652 #endif // __DEFINED__SkPdfStreamCommonDictionary
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698