diff options
author | Neil <nyamatongwe@gmail.com> | 2023-12-20 09:24:23 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2023-12-20 09:24:23 +1100 |
commit | 1b153f8d8d4b2f09afc2d039256c958e94bd3b05 (patch) | |
tree | 00cdb1c67b137efb5715e90cc29640a78773b7a3 /scripts/ScintillaAPIFacer.py | |
parent | ef42bb46c5182037e276ceb251e604b1bcff8f38 (diff) | |
download | scintilla-mirror-1b153f8d8d4b2f09afc2d039256c958e94bd3b05.tar.gz |
Add IDocumentEditable interface for efficient interaction with document objects.
Diffstat (limited to 'scripts/ScintillaAPIFacer.py')
-rw-r--r-- | scripts/ScintillaAPIFacer.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/ScintillaAPIFacer.py b/scripts/ScintillaAPIFacer.py index f26389abb..9caa1ea7f 100644 --- a/scripts/ScintillaAPIFacer.py +++ b/scripts/ScintillaAPIFacer.py @@ -55,7 +55,9 @@ deadValues = [ ] def ActualTypeName(type, identifier=None): - if type in typeAliases: + if type == "pointer" and identifier in ["doc", "DocPointer", "CreateDocument"]: + return "IDocumentEditable *" + elif type in typeAliases: return typeAliases[type] else: return type @@ -63,6 +65,8 @@ def ActualTypeName(type, identifier=None): def IsEnumeration(s): if s in ["Position", "Line", "Colour", "ColourAlpha"]: return False + if s.endswith("*"): + return False return s[:1].isupper() def JoinTypeAndIdentifier(type, identifier): @@ -219,7 +223,7 @@ def HMethods(f): if v["FeatureType"] in ["fun", "get", "set"]: if v["FeatureType"] == "get" and name.startswith("Get"): name = name[len("Get"):] - retType = ActualTypeName(v["ReturnType"]) + retType = ActualTypeName(v["ReturnType"], name) if IsEnumeration(retType): retType = namespace + retType parameters, args, callName = ParametersArgsCallname(v) @@ -241,21 +245,21 @@ def CXXMethods(f): msgName = "Message::" + name if v["FeatureType"] == "get" and name.startswith("Get"): name = name[len("Get"):] - retType = ActualTypeName(v["ReturnType"]) + retType = ActualTypeName(v["ReturnType"], name) parameters, args, callName = ParametersArgsCallname(v) returnIfNeeded = "return " if retType != "void" else "" out.append(JoinTypeAndIdentifier(retType, "ScintillaCall::" + name) + "(" + parameters + ")" + " {") retCast = "" retCastEnd = "" - if retType not in basicTypes or retType in ["int", "Colour", "ColourAlpha"]: + if retType.endswith("*"): + retCast = "reinterpret_cast<" + retType + ">(" + retCastEnd = ")" + elif retType not in basicTypes or retType in ["int", "Colour", "ColourAlpha"]: if IsEnumeration(retType): retType = namespace + retType retCast = "static_cast<" + retType + ">(" retCastEnd = ")" - elif retType in ["void *"]: - retCast = "reinterpret_cast<" + retType + ">(" - retCastEnd = ")" out.append("\t" + returnIfNeeded + retCast + callName + "(" + msgName + args + ")" + retCastEnd + ";") out.append("}") out.append("") |