diff --git a/src/lib/context.cpp b/src/lib/context.cpp --- a/src/lib/context.cpp +++ b/src/lib/context.cpp @@ -28,17 +28,6 @@ using namespace KSyntaxHighlighting; -Context::Context() - : m_resolveState(Unknown) - , m_fallthrough(false) - , m_noIndentationBasedFolding(false) -{ -} - -Context::~Context() -{ -} - Definition Context::definition() const { return m_def.definition(); diff --git a/src/lib/context_p.h b/src/lib/context_p.h --- a/src/lib/context_p.h +++ b/src/lib/context_p.h @@ -33,8 +33,8 @@ class Context { public: - Context(); - ~Context(); + Context() = default; + ~Context() = default; Definition definition() const; void setDefinition(const DefinitionRef &def); @@ -85,9 +85,9 @@ QVector m_rules; - ResolveState m_resolveState; - bool m_fallthrough; - bool m_noIndentationBasedFolding; + ResolveState m_resolveState = Unknown; + bool m_fallthrough = false; + bool m_noIndentationBasedFolding = false; }; } diff --git a/src/lib/contextswitch.cpp b/src/lib/contextswitch.cpp --- a/src/lib/contextswitch.cpp +++ b/src/lib/contextswitch.cpp @@ -24,16 +24,6 @@ using namespace KSyntaxHighlighting; -ContextSwitch::ContextSwitch() : - m_context(nullptr), - m_popCount(0) -{ -} - -ContextSwitch::~ContextSwitch() -{ -} - bool ContextSwitch::isStay() const { return m_popCount == 0 && !m_context && m_contextName.isEmpty() && m_defName.isEmpty(); diff --git a/src/lib/contextswitch_p.h b/src/lib/contextswitch_p.h --- a/src/lib/contextswitch_p.h +++ b/src/lib/contextswitch_p.h @@ -28,8 +28,8 @@ class ContextSwitch { public: - ContextSwitch(); - ~ContextSwitch(); + ContextSwitch() = default; + ~ContextSwitch() = default; bool isStay() const; @@ -42,8 +42,8 @@ private: QString m_defName; QString m_contextName; - Context *m_context; - int m_popCount; + Context *m_context = nullptr; + int m_popCount = 0; }; } diff --git a/src/lib/definition.cpp b/src/lib/definition.cpp --- a/src/lib/definition.cpp +++ b/src/lib/definition.cpp @@ -43,14 +43,8 @@ using namespace KSyntaxHighlighting; -DefinitionData::DefinitionData() : - repo(nullptr), - delimiters(QStringLiteral("\t !%&()*+,-./:;<=>?[\\]^{|}~")), // must be sorted! - indentationBasedFolding(false), - caseSensitive(Qt::CaseSensitive), - version(0.0f), - priority(0), - hidden(false) +DefinitionData::DefinitionData() + : delimiters(QStringLiteral("\t !%&()*+,-./:;<=>?[\\]^{|}~")) // must be sorted! { } diff --git a/src/lib/definition_p.h b/src/lib/definition_p.h --- a/src/lib/definition_p.h +++ b/src/lib/definition_p.h @@ -69,12 +69,12 @@ DefinitionRef q; - Repository *repo; + Repository *repo = nullptr; QHash keywordLists; QVector contexts; QHash formats; QString delimiters; - bool indentationBasedFolding; + bool indentationBasedFolding = false; QStringList foldingIgnoreList; QString fileName; @@ -86,10 +86,10 @@ QString license; QVector mimetypes; QVector extensions; - Qt::CaseSensitivity caseSensitive; - int version; - int priority; - bool hidden; + Qt::CaseSensitivity caseSensitive = Qt::CaseSensitive; + int version = 0; + int priority = 0; + bool hidden = false; }; } diff --git a/src/lib/format.cpp b/src/lib/format.cpp --- a/src/lib/format.cpp +++ b/src/lib/format.cpp @@ -46,13 +46,6 @@ return static_cast(value); } -FormatPrivate::FormatPrivate() - : defaultStyle(Theme::Normal) - , id(0) - , spellCheck(true) -{ -} - FormatPrivate* FormatPrivate::get(const Format &format) { return format.d.data(); diff --git a/src/lib/format_p.h b/src/lib/format_p.h --- a/src/lib/format_p.h +++ b/src/lib/format_p.h @@ -30,18 +30,18 @@ class FormatPrivate : public QSharedData { public: - FormatPrivate(); + FormatPrivate() = default; static FormatPrivate* get(const Format &format); TextStyleData styleOverride(const Theme &theme) const; void load(QXmlStreamReader &reader); DefinitionRef definition; QString name; TextStyleData style; - Theme::TextStyle defaultStyle; - quint16 id; - bool spellCheck; + Theme::TextStyle defaultStyle = Theme::Normal; + quint16 id = 0; + bool spellCheck = true; }; } diff --git a/src/lib/keywordlist.cpp b/src/lib/keywordlist.cpp --- a/src/lib/keywordlist.cpp +++ b/src/lib/keywordlist.cpp @@ -22,15 +22,6 @@ using namespace KSyntaxHighlighting; -KeywordList::KeywordList() : - m_caseSensitive(Qt::CaseSensitive) -{ -} - -KeywordList::~KeywordList() -{ -} - bool KeywordList::isEmpty() const { return m_keywords.isEmpty(); diff --git a/src/lib/keywordlist_p.h b/src/lib/keywordlist_p.h --- a/src/lib/keywordlist_p.h +++ b/src/lib/keywordlist_p.h @@ -29,8 +29,8 @@ class KeywordList { public: - KeywordList(); - ~KeywordList(); + KeywordList() = default; + ~KeywordList() = default; bool isEmpty() const; @@ -48,7 +48,7 @@ QString m_name; QSet m_keywords; mutable QSet m_lowerCaseKeywords; - Qt::CaseSensitivity m_caseSensitive; + Qt::CaseSensitivity m_caseSensitive = Qt::CaseSensitive; }; } diff --git a/src/lib/matchresult.cpp b/src/lib/matchresult.cpp --- a/src/lib/matchresult.cpp +++ b/src/lib/matchresult.cpp @@ -19,10 +19,9 @@ using namespace KSyntaxHighlighting; -MatchResult::MatchResult(int offset, const QStringList &captures) : - m_captures(captures), - m_offset(offset), - m_skipOffset(0) +MatchResult::MatchResult(int offset, const QStringList &captures) + : m_captures(captures) + , m_offset(offset) { } diff --git a/src/lib/matchresult_p.h b/src/lib/matchresult_p.h --- a/src/lib/matchresult_p.h +++ b/src/lib/matchresult_p.h @@ -35,7 +35,7 @@ private: QStringList m_captures; int m_offset; - int m_skipOffset; + int m_skipOffset = 0; }; } diff --git a/src/lib/repository.cpp b/src/lib/repository.cpp --- a/src/lib/repository.cpp +++ b/src/lib/repository.cpp @@ -41,12 +41,6 @@ Q_INIT_RESOURCE(syntax_data); } -RepositoryPrivate::RepositoryPrivate() : - m_foldingRegionId(0), - m_formatId(0) -{ -} - RepositoryPrivate* RepositoryPrivate::get(Repository *repo) { return repo->d.get(); diff --git a/src/lib/repository_p.h b/src/lib/repository_p.h --- a/src/lib/repository_p.h +++ b/src/lib/repository_p.h @@ -32,13 +32,14 @@ class RepositoryPrivate { public: - RepositoryPrivate(); + RepositoryPrivate() = default; static RepositoryPrivate* get(Repository *repo); void load(Repository *repo); void loadSyntaxFolder(Repository *repo, const QString &path); bool loadSyntaxFolderFromIndex(Repository *repo, const QString &path); + void addDefinition(const Definition &def); void loadThemeFolder(const QString &path); @@ -55,8 +56,8 @@ QVector m_themes; QHash, quint16> m_foldingRegionIds; - quint16 m_foldingRegionId; - quint16 m_formatId; + quint16 m_foldingRegionId = 0; + quint16 m_formatId = 0; }; } diff --git a/src/lib/rule.cpp b/src/lib/rule.cpp --- a/src/lib/rule.cpp +++ b/src/lib/rule.cpp @@ -85,18 +85,6 @@ return result; } -Rule::Rule() : - m_column(-1), - m_firstNonSpace(false), - m_lookAhead(false), - m_dynamic(false) -{ -} - -Rule::~Rule() -{ -} - Definition Rule::definition() const { return m_def.definition(); diff --git a/src/lib/rule_p.h b/src/lib/rule_p.h --- a/src/lib/rule_p.h +++ b/src/lib/rule_p.h @@ -38,8 +38,8 @@ class Rule { public: - Rule(); - virtual ~Rule(); + Rule() = default; + virtual ~Rule() = default; typedef std::shared_ptr Ptr; @@ -76,12 +76,12 @@ QString m_attribute; ContextSwitch m_context; QVector m_subRules; - int m_column; + int m_column = -1; FoldingRegion m_beginRegion; FoldingRegion m_endRegion; - bool m_firstNonSpace; - bool m_lookAhead; - bool m_dynamic; + bool m_firstNonSpace = false; + bool m_lookAhead = false; + bool m_dynamic = false; }; diff --git a/src/lib/state.cpp b/src/lib/state.cpp --- a/src/lib/state.cpp +++ b/src/lib/state.cpp @@ -24,11 +24,6 @@ using namespace KSyntaxHighlighting; -StateData::StateData() : - m_defData(nullptr) -{ -} - StateData* StateData::get(State &state) { state.d.detach(); diff --git a/src/lib/state_p.h b/src/lib/state_p.h --- a/src/lib/state_p.h +++ b/src/lib/state_p.h @@ -34,7 +34,7 @@ class StateData : public QSharedData { public: - StateData(); + StateData() = default; static StateData* get(State &state); bool isEmpty() const; @@ -45,7 +45,7 @@ Context* topContext() const; QStringList topCaptures() const; - DefinitionData *m_defData; + DefinitionData *m_defData = nullptr; private: friend class State; QStack m_contextStack; diff --git a/src/lib/textstyledata_p.h b/src/lib/textstyledata_p.h --- a/src/lib/textstyledata_p.h +++ b/src/lib/textstyledata_p.h @@ -27,11 +27,7 @@ public: // Constructor initializing all data. TextStyleData() - : textColor(0x0) - , backgroundColor(0x0) - , selectedTextColor(0x0) - , selectedBackgroundColor(0x0) - , bold(false) + : bold(false) , italic(false) , underline(false) , strikeThrough(false) @@ -41,10 +37,10 @@ , hasStrikeThrough(false) {} - QRgb textColor; - QRgb backgroundColor; - QRgb selectedTextColor; - QRgb selectedBackgroundColor; + QRgb textColor = 0x0; + QRgb backgroundColor = 0x0; + QRgb selectedTextColor = 0x0; + QRgb selectedBackgroundColor = 0x0; bool bold :1; bool italic :1; bool underline :1; diff --git a/src/lib/themedata.cpp b/src/lib/themedata.cpp --- a/src/lib/themedata.cpp +++ b/src/lib/themedata.cpp @@ -36,7 +36,6 @@ } ThemeData::ThemeData() - : m_revision(0) { memset(m_editorColors, 0, sizeof(m_editorColors)); } diff --git a/src/lib/themedata_p.h b/src/lib/themedata_p.h --- a/src/lib/themedata_p.h +++ b/src/lib/themedata_p.h @@ -136,7 +136,7 @@ TextStyleData textStyleOverride(const QString &definitionName, const QString &attributeName) const; private: - int m_revision; + int m_revision = 0; QString m_name; //! Path to the file where the theme came from.