refactor: refactor semantic types to use PIMPL pattern#319
Conversation
Refactored semantic types MatchSpan, TimeConstraint, and SizeConstraint to use PIMPL pattern for better ABI stability and encapsulation. Changed all direct member access to use getter/setter methods. 1. Moved all internal data members to Private classes 2. Added proper copy/move constructors and operators 3. Maintained all existing functionality while improving encapsulation Influence: 1. All test cases need to be updated to use getter methods 2. Client code needs to be updated to use getter/setter methods instead of direct member access refactor: 重构语义类型使用PIMPL模式 将语义类型MatchSpan、TimeConstraint和SizeConstraint重构为使用PIMPL模式, 以提高ABI稳定性和封装性。将所有直接成员访问改为使用getter/setter方法。 1. 将所有内部数据成员移至Private类 2. 添加了正确的拷贝/移动构造函数和运算符 3. 在提高封装性的同时保持了所有现有功能 影响: 1. 需要更新所有测试用例以使用getter方法 2. 需要更新客户端代码以使用getter/setter方法而非直接成员访问
There was a problem hiding this comment.
Sorry @Johnson-zs, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/src/dfm-search/dfm-search-lib/utils/semanticvalue.cpp b/src/dfm-search/dfm-search-lib/utils/semanticvalue.cpp
--- a/src/dfm-search/dfm-search-lib/utils/semanticvalue.cpp
+++ b/src/dfm-search/dfm-search-lib/utils/semanticvalue.cpp
@@ -30,10 +30,18 @@ MatchSpan &MatchSpan::operator=(MatchSpan &&other) noexcept = default;
int MatchSpan::start() const { return d->start; }
-void MatchSpan::setStart(int start) { d->start = start; }
+void MatchSpan::setStart(int start)
+{
+ if (start >= 0)
+ d->start = start;
+}
+
int MatchSpan::end() const { return d->end; }
-void MatchSpan::setEnd(int end) { d->end = end; }
+void MatchSpan::setEnd(int end)
+{
+ if (end >= 0)
+ d->end = end;
+}
QString MatchSpan::ruleId() const { return d->ruleId; }
void MatchSpan::setRuleId(const QString &ruleId) { d->ruleId = ruleId; } |
Refactored semantic types MatchSpan, TimeConstraint, and SizeConstraint
to use PIMPL pattern for better ABI stability and encapsulation. Changed
all direct member access to use getter/setter methods.
Influence:
of direct member access
refactor: 重构语义类型使用PIMPL模式
将语义类型MatchSpan、TimeConstraint和SizeConstraint重构为使用PIMPL模式,
以提高ABI稳定性和封装性。将所有直接成员访问改为使用getter/setter方法。
影响: