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

Unified Diff: experimental/PdfViewer/generate_code.py

Issue 17286007: few steps in the direction of to encapsulating podofo, so the client is not aware podofo is used. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | experimental/PdfViewer/pdf_auto_gen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/generate_code.py
===================================================================
--- experimental/PdfViewer/generate_code.py (revision 9625)
+++ experimental/PdfViewer/generate_code.py (working copy)
@@ -341,11 +341,12 @@
print(' const PdfObject* fPodofoObj;')
print
print('public:')
- print(' SkPdf' + cls.fName + '(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : fPodofoDoc(podofoDoc), fPodofoObj(podofoObj) {}')
+ print(' SkPdf' + cls.fName + '(const PdfMemDocument* podofoDoc = NULL, const PdfObject* podofoObj = NULL) : fPodofoDoc(podofoDoc), fPodofoObj(podofoObj) {}')
+ print(' const PdfMemDocument* doc() const { return fPodofoDoc;}')
print(' const PdfObject* podofo() const { return fPodofoObj;}')
else:
print('public:')
- print(' SkPdf' + cls.fName + '(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdf' + cls.fBase + '(podofoDoc, podofoObj) {}')
+ print(' SkPdf' + cls.fName + '(const PdfMemDocument* podofoDoc = NULL, const PdfObject* podofoObj = NULL) : SkPdf' + cls.fBase + '(podofoDoc, podofoObj) {}')
print
#check required fieds, also, there should be an internal_valid() manually wrote for complex
@@ -354,6 +355,9 @@
print(' virtual bool valid() const {return true;}')
print
+ print(' SkPdf' + cls.fName + '& operator=(const SkPdf' + cls.fName + '& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;}')
+ print
+
for field in cls.fFields:
prop = field.fProp
if prop.fCppName != '':
@@ -392,12 +396,18 @@
for name in self.fClassesNamesInOrder:
cls = self.fClasses[name]
- print(' static bool map' + name + '(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, SkPdfObject** out) {')
+
+ print(' static bool map(const SkPdfObject& in, SkPdf' + name + '** out) {')
+ print(' return map(*in.doc(), *in.podofo(), out);')
+ print(' }')
+ print
+
+ print(' static bool map(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, SkPdf' + name + '** out) {')
print(' if (!isA' + name + '(podofoDoc, podofoObj)) return false;')
print
for sub in cls.fEnumSubclasses:
- print(' if (map' + enumToCls[sub].fName + '(podofoDoc, podofoObj, out)) return true;')
+ print(' if (map(podofoDoc, podofoObj, (SkPdf' + enumToCls[sub].fName + '**)out)) return true;')
print
@@ -424,11 +434,7 @@
print(' if (' + prop.fCppName + ' != ' + prop.fMustBe.toCpp() + ') return false;')
print
- # hack, we only care about dictionaries now, so ret tru only if there is a match
- if cntMust != 0 or len(cls.fEnumSubclasses) > 0:
- print(' return true;')
- else:
- print(' return false;')
+ print(' return true;')
print(' }')
print
« no previous file with comments | « no previous file | experimental/PdfViewer/pdf_auto_gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698