• Eike Ziller's avatar
    Simplify text format handling in syntax highlighters · cf57965e
    Eike Ziller authored
    Pass the mapping from custom enum to text style in form of a function,
    which then can use a switch which is checked by compilers, and
    avoids the need to lookup a different enum somewhere else to find
    out what the mapping actually is.
    That mapping is cached to keep performance as before.
    Also, most highlighters created an enum just for the purpose of mapping
    to text styles, basically creating duplicated subsets of text style like
    enums everywhere. Instead provide a default, identity mapping from text
    styles to text styles.
    Change-Id: I2ea1ca702b99e36b8742dfda510b1b2753f0a1c2
    Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
qmljshighlighter.cpp 11.7 KB