Add support for using the /Constrained/ annotation

This commit is contained in:
Robin Dunn
2017-09-14 19:53:17 -07:00
parent 9dfd7ca9c7
commit fc2c6cda57
2 changed files with 3 additions and 0 deletions

View File

@@ -596,6 +596,7 @@ class ParamDef(BaseDef):
self.transferBack = False # transfer ownership of arg from C++ to Python?
self.transferThis = False # ownership of 'this' pointer transferred to this arg
self.keepReference = False # an extra reference to the arg is held
self.constrained = False # limit auto-conversion of similar types (like float -> int)
self.__dict__.update(kw)
if element is not None:
self.extract(element)

View File

@@ -959,6 +959,8 @@ from .%s import *
annotations.append('ArraySize')
if item.keepReference:
annotations.append('KeepReference')
if item.constrained:
annotations.append('Constrained')
if isinstance(item, (extractors.ParamDef, extractors.FunctionDef)):
if item.transfer: