OLD | NEW |
1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ | 1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ |
2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ | 2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ |
3 | 3 |
4 #include <stdint.h> | 4 #include <stdint.h> |
5 #include <string.h> | 5 #include <string.h> |
6 #include <string> | 6 #include <string> |
7 #include "SkTDArray.h" | 7 #include "SkTDArray.h" |
8 #include "SkTDict.h" | 8 #include "SkTDict.h" |
9 #include "SkRect.h" | 9 #include "SkRect.h" |
10 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 } | 520 } |
521 | 521 |
522 bool isKeywordReference() const { | 522 bool isKeywordReference() const { |
523 return fObjectType == kKeyword_PdfObjectType && fStr.fBytes == 1 && fStr
.fBuffer[0] == 'R'; | 523 return fObjectType == kKeyword_PdfObjectType && fStr.fBytes == 1 && fStr
.fBuffer[0] == 'R'; |
524 } | 524 } |
525 | 525 |
526 bool isKeyword() const { | 526 bool isKeyword() const { |
527 return fObjectType == kKeyword_PdfObjectType; | 527 return fObjectType == kKeyword_PdfObjectType; |
528 } | 528 } |
529 | 529 |
| 530 bool isKeyword(const char* keyword) const { |
| 531 if (!isKeyword()) { |
| 532 return false; |
| 533 } |
| 534 |
| 535 if (strlen(keyword) != fStr.fBytes) { |
| 536 return false; |
| 537 } |
| 538 |
| 539 if (strncmp(keyword, (const char*)fStr.fBuffer, fStr.fBytes) != 0) { |
| 540 return false; |
| 541 } |
| 542 |
| 543 return true; |
| 544 } |
| 545 |
530 bool isName() const { | 546 bool isName() const { |
531 return fObjectType == kName_PdfObjectType; | 547 return fObjectType == kName_PdfObjectType; |
532 } | 548 } |
533 | 549 |
534 bool isName(const char* name) const { | 550 bool isName(const char* name) const { |
535 return fObjectType == kName_PdfObjectType && fStr.fBytes == strlen(name)
&& strncmp((const char*)fStr.fBuffer, name, fStr.fBytes) == 0; | 551 return fObjectType == kName_PdfObjectType && fStr.fBytes == strlen(name)
&& strncmp((const char*)fStr.fBuffer, name, fStr.fBytes) == 0; |
536 } | 552 } |
537 | 553 |
538 bool isArray() const { | 554 bool isArray() const { |
539 return fObjectType == kArray_PdfObjectType; | 555 return fObjectType == kArray_PdfObjectType; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 SkPdfName() : SkPdfObject() { | 926 SkPdfName() : SkPdfObject() { |
911 SkPdfObject::makeName((const unsigned char*)"", this); | 927 SkPdfObject::makeName((const unsigned char*)"", this); |
912 } | 928 } |
913 public: | 929 public: |
914 SkPdfName(char* name) : SkPdfObject() { | 930 SkPdfName(char* name) : SkPdfObject() { |
915 this->makeName((const unsigned char*)name, this); | 931 this->makeName((const unsigned char*)name, this); |
916 } | 932 } |
917 }; | 933 }; |
918 | 934 |
919 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ | 935 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ |
OLD | NEW |