diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-03-17 11:29:44 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-03-17 13:00:17 +0000 |
commit | a9cfd514d33361c34d752cbea56d8a8ca9f9dede (patch) | |
tree | 7e0291e7145b6c34cd2c0c86f1c48ccf245e6e6f /ApiExtractor/typesystem.h | |
parent | 625cc465df179040356cd49668ab69481a7f290c (diff) |
Refactor the character handler of the typedatabase XML parser
The function is called from the XML parser as well as with
strings from an imported file.
Change the function to be a template taking a QString/QStringRef
and add necessary overloads to the setters.
This prevents newlines and unused content in the XML files
from unnecessarily being converted to a QString.
Change-Id: Ifbac37c9099d799a8a334f46f78050dcbd52fad1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'ApiExtractor/typesystem.h')
-rw-r--r-- | ApiExtractor/typesystem.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ApiExtractor/typesystem.h b/ApiExtractor/typesystem.h index 279d3f0de..71e7d235f 100644 --- a/ApiExtractor/typesystem.h +++ b/ApiExtractor/typesystem.h @@ -118,10 +118,8 @@ class CodeSnipAbstract public: QString code() const; - void addCode(const QString &code) - { - codeList.append(CodeSnipFragment(code)); - } + void addCode(const QString &code) { codeList.append(CodeSnipFragment(code)); } + void addCode(const QStringRef &code) { addCode(code.toString()); } void addTemplateInstance(TemplateInstance *ti) { @@ -533,10 +531,9 @@ public: DocModification(TypeSystem::DocModificationMode mode, const QString& signature, double vr) : m_mode(mode), m_signature(signature), m_version(vr) {} - void setCode(const QString& code) - { - m_code = code; - } + void setCode(const QString& code) { m_code = code; } + void setCode(const QStringRef& code) { m_code = code.toString(); } + QString code() const { return m_code; |