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

Side by Side Diff: experimental/PdfViewer/pdfparser/native/SkPdfObject.h

Issue 21096006: pdfviewer: load files with missing xref (we need in order to help with testing, as most good pdfx i… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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/pdfparser/native/SkPdfNativeTokenizer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698