# Generate createFunction:
function = "";
- function += ("CharacterClass* %sCreate()\n" % name)
+ function += ("std::unique_ptr<CharacterClass> %sCreate()\n" % name)
function += ("{\n")
if emitTables and classes["UseTable"]:
if "Inverse" in classes:
- function += (" CharacterClass* characterClass = new CharacterClass(_%sData, true);\n" % (classes["Inverse"]))
+ function += (" auto characterClass = std::make_unique<CharacterClass>(_%sData, true);\n" % (classes["Inverse"]))
else:
- function += (" CharacterClass* characterClass = new CharacterClass(_%sData, false);\n" % (name))
+ function += (" auto characterClass = std::make_unique<CharacterClass>(_%sData, false);\n" % (name))
else:
- function += (" CharacterClass* characterClass = new CharacterClass;\n")
+ function += (" auto characterClass = std::make_unique<CharacterClass>();\n")
for (min, max) in ranges:
if (min == max):
if (min > 127):
function += (" characterClass->m_rangesUnicode.append(CharacterRange(0x%04x, 0x%04x));\n" % (min, max))
else:
function += (" characterClass->m_ranges.append(CharacterRange(0x%02x, 0x%02x));\n" % (min, max))
- function += (" return characterClass;\n")
+ function += (" return WTF::move(characterClass);\n")
function += ("}\n\n")
functions += function