Commit 36061f28 authored by De Boissieu Florian's avatar De Boissieu Florian

add indent function for systematic indent of multiline inputs in pre/post setters and constructor

--HG--
branch : settersOptions
parent 042c7fb1
......@@ -575,6 +575,8 @@ def showLevel(outfile, level):
for idx in range(level):
outfile.write(' ')
def indent(txt, n, ch=' '):
return re.sub( '^',ch*n, txt ,flags=re.MULTILINE )
class XschemaElementBase:
def __init__(self):
......@@ -4374,7 +4376,7 @@ def generateCtor(wrt, prefix, element):
if element.isMixed():
wrt(MixedCtorInitializers)
if PostCtor is not None:
wrt(' %s\n' % (PostCtor))
wrt('%s\n' % (indent(PostCtor, 2)))
......@@ -4792,7 +4794,7 @@ def generateGettersAndSetters(wrt, prefix, element):
wrt(' value.parent = self\n')
wrt(' self.%s[index] = value\n' % (name))
if PostSetter is not None:
wrt(' %s\n' % (PostSetter))
wrt('%s\n' % (indent(PostSetter,2)))
if GenerateProperties:
# wrt(' %sProp = property(get%s, set%s)\n' %
# (unmappedName, capName, capName))
......@@ -4813,7 +4815,7 @@ def generateGettersAndSetters(wrt, prefix, element):
gsName,))
wrt(' self.%s = value\n' %(varname))
if PostSetter is not None:
wrt(' %s\n' % (PostSetter))
wrt('%s\n' % (indent(PostSetter, 2)))
if GenerateProperties:
# wrt(' %sProp = property(get%s, set%s)\n' %
# (name, gsName, gsName))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment