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

Unified Diff: experimental/PdfViewer/generate_code.py

Issue 16975013: Deal with ca and CA transparency operators in pdf. add comments to generated classes. (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
Index: experimental/PdfViewer/generate_code.py
===================================================================
--- experimental/PdfViewer/generate_code.py (revision 9684)
+++ experimental/PdfViewer/generate_code.py (working copy)
@@ -39,6 +39,7 @@
self.fEnumValues = []
self.fHasMust = False
self.fMustBe = ''
+ self.fComment = ''
def must(self, value):
self.fHasMust = True
@@ -70,6 +71,7 @@
return self
def comment(self, comment):
+ self.fComment = comment
return self
def done(self):
@@ -77,13 +79,12 @@
class PdfClassField:
- def __init__(self, parent, required, version='', inheritable=False, comment=''):
+ def __init__(self, parent, required, version='', inheritable=False):
#self.fProp = ''
self.fParent = parent
self.fRequired = required
self.fVersion = version
self.fInheritable = inheritable
- self.fComment = comment
def field(self, name, abr=''):
self.fProp = PdfField(self, name, abr)
@@ -273,12 +274,17 @@
fileClass.write('#include "SkPdfEnums_autogen.h"\n')
fileClass.write('#include "SkPdfArray_autogen.h"\n')
+ if cls.fBase != '':
+ fileClass.write('#include "SkPdf' + cls.fBase + '_autogen.h"\n')
+ fileClass.write('\n')
+ if cls.fComment != '':
+ fileClass.write('// ' + cls.fComment + '\n')
+
if cls.fBase == '':
- fileClass.write('\nclass SkPdf' + cls.fName + ' {\n')
+ fileClass.write('class SkPdf' + cls.fName + ' {\n')
else:
- fileClass.write('#include "SkPdf' + cls.fBase + '_autogen.h"\n')
- fileClass.write('\nclass SkPdf' + cls.fName + ' : public SkPdf' + cls.fBase + ' {\n')
+ fileClass.write('class SkPdf' + cls.fName + ' : public SkPdf' + cls.fBase + ' {\n')
fileClass.write('public:\n')
fileClass.write(' virtual SkPdfObjectType getType() const { return ' + cls.fEnum + ';}\n')
@@ -323,13 +329,22 @@
for field in cls.fFields:
prop = field.fProp
if prop.fCppName != '':
+
+ lines = prop.fComment.split('\n')
+ if prop.fComment != '' and len(lines) > 0:
+ fileClass.write('/** ' + lines[0] + '\n')
+ for line in lines[1:]:
+ fileClass.write(' * ' + line + '\n')
+ fileClass.write('**/\n')
+
if prop.fCppName[0] == '[':
fileClass.write('/*\n') # comment code of the atributes that can have any name
# TODO(edisonn): has_foo();
- fileClass.write(' bool has_' + prop.fCppName + '() const {\n')
- fileClass.write(' return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), \"' + prop.fName + '\", \"' + prop.fAbr + '\", NULL));\n')
- fileClass.write(' }\n')
+ fileClass.write(' bool has_' + prop.fCppName + '() const {\n')
+ fileClass.write(' return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), \"' + prop.fName + '\", \"' + prop.fAbr + '\", NULL));\n')
+ fileClass.write(' }\n')
+ fileClass.write('\n')
if len(prop.fTypes.split()) == 1:
t = prop.fTypes.strip()
« no previous file with comments | « experimental/PdfViewer/SkPdfWindowsLaunchActionDictionary_autogen.h ('k') | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698