diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-10-21 15:14:53 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-10-24 20:58:44 +0200 |
commit | d377d1f3a921488525f6e75c850632f559707747 (patch) | |
tree | e351fc46db44119a6499f1c4543084b1c83c27dd /src/concurrent/qtconcurrent_global.h | |
parent | 5edf34848a51c7678031aeb9576b8f3b7b5fceab (diff) |
Enforce QTextDocument::MarkdownFeature compatibility at compile time
We use md4c for parsing markdown. It provides flags to control the
feature set that will be supported when parsing particular documents.
QTextMarkdownImporter::Feature is a fine-grained set of flags that
exactly match the md4c feature flags that we support in Qt so far.
QTextMarkdownImporter is a private exported class (new in 5.14).
We don't expect the corresponding flags in md4c to change in
incompatible ways in the future: the md4c authors have as much respect
for avoiding compatibility issues as we do, and likely will only add
features, not remove them.
We now enforce QTextMarkdownImporter::Features compatibility with
QTextDocument::MarkdownFeatures by setting them directly. We check
QTextMarkdownImporter::Features compatibility with md4c's #define'd
feature flags using static asserts, so that any hypothetical
incompatibility would be detected at compile time.
The enum conversion from QTextDocument::MarkdownFeatures to
QTextMarkdownImporter::Features is moved to a new QTextMarkdownImporter
constructor; thus the conversions from QTextDocument::MarkdownFeatures
to QTextMarkdownImporter::Features, and then to unsigned (in
QTextMarkdownImporter::import()) are adjacent in the same private class
implementation. If incompatibility ever occurred, we would need to
replace one or both of those with another suitable conversion function.
Change-Id: I0bf8a21eb7559df1d38406b948ef657f9060c67b
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrent_global.h')
0 files changed, 0 insertions, 0 deletions