MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / HEnumerations

Function HEnumerations

scripts/GenerateEnums.py:35–75  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

33 return out
34
35def HEnumerations(f):
36 out = []
37 for name in f.order:
38 v = f.features[name]
39 if v["Category"] != "Deprecated":
40 # Only want non-deprecated enumerations and lexers are not part of Scintilla API
41 if v["FeatureType"] in ["enu"] and name != "Lexer":
42 out.append("")
43 prefixes = v["Value"].split()
44 out.append("enum class " + name + " {")
45 for valueName in f.order:
46 prefixMatched = ""
47 for p in prefixes:
48 if valueName.startswith(p) and valueName not in deadValues:
49 prefixMatched = p
50 if prefixMatched:
51 vEnum = f.features[valueName]
52 valueNameNoPrefix = ""
53 if valueName in f.aliases:
54 valueNameNoPrefix = f.aliases[valueName]
55 else:
56 valueNameNoPrefix = valueName[len(prefixMatched):]
57 if not valueNameNoPrefix: # Removed whole name
58 valueNameNoPrefix = valueName
59 if valueNameNoPrefix.startswith("SC_"):
60 valueNameNoPrefix = valueNameNoPrefix[len("SC_"):]
61 pascalName = Face.PascalCase(valueNameNoPrefix)
62 out.append(" " + pascalName + " = " + vEnum["Value"] + ",")
63 out.append("};")
64 out.append(f"Q_ENUM({name});")
65
66 out.append("\t")
67 out.append("\tenum class Notification {")
68 for name in f.order:
69 v = f.features[name]
70 if v["Category"] != "Deprecated":
71 if v["FeatureType"] in ["evt"]:
72 out.append("\t\t" + name + " = " + v["Value"] + ",")
73 out.append("\t};")
74 out.append(f"\tQ_ENUM(Notification);")
75 return out
76
77
78def RegenerateAll(root):

Callers 1

RegenerateAllFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected