Skip to content

Commit

Permalink
Deprecated and removed "displayIdxReadOnlyHidden" property of <varian…
Browse files Browse the repository at this point in the history
…t> field.
  • Loading branch information
arobenko committed Dec 8, 2024
1 parent 9dcd389 commit 08d9861
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/commsdsl2comms/test/test28/Schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</bundle>
</variant>

<variant name="Variant2" reuse="Variant1" defaultMember="P1" displayIdxReadOnlyHidden="true" />
<variant name="Variant2" reuse="Variant1" defaultMember="P1" />

<int name="VariantType" type="uint8" failOnInvalid="true" />
<variant name="Variant3">
Expand Down
1 change: 0 additions & 1 deletion lib/include/commsdsl/parse/VariantField.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class COMMSDSL_API VariantField : public Field

Members members() const;
std::size_t defaultMemberIdx() const;
bool displayIdxReadOnlyHidden() const;

};

Expand Down
3 changes: 2 additions & 1 deletion lib/src/parse/ProtocolImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ bool ProtocolImpl::isPropertyDeprecated(const std::string& name) const
{common::displayReadOnlyStr(), 7U},
{common::displayHiddenStr(), 7U},
{common::displaySpecialsStr(), 7U},
{common::displayExtModeCtrlStr(), 7U}
{common::displayExtModeCtrlStr(), 7U},
{common::displayIdxReadOnlyHiddenStr(), 7U},
};

auto iter = Map.find(name);
Expand Down
5 changes: 0 additions & 5 deletions lib/src/parse/VariantField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ std::size_t VariantField::defaultMemberIdx() const
return cast(m_pImpl)->defaultMemberIdx();
}

bool VariantField::displayIdxReadOnlyHidden() const
{
return cast(m_pImpl)->displayIdxReadOnlyHidden();
}

} // namespace parse

} // namespace commsdsl
3 changes: 2 additions & 1 deletion lib/src/parse/VariantFieldImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ bool VariantFieldImpl::updateDefaultMember()

bool VariantFieldImpl::updateIdxHidden()
{
return validateAndUpdateBoolPropValue(common::displayIdxReadOnlyHiddenStr(), m_state.m_idxHidden);
checkAndReportDeprecatedPropertyValue(common::displayIdxReadOnlyHiddenStr());
return true;
}

} // namespace parse
Expand Down
6 changes: 0 additions & 6 deletions lib/src/parse/VariantFieldImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ class VariantFieldImpl final : public FieldImpl
return m_state.m_defaultIdx;
}

bool displayIdxReadOnlyHidden() const
{
return m_state.m_idxHidden;
}

protected:

virtual Kind kindImpl() const override;
Expand Down Expand Up @@ -74,7 +69,6 @@ class VariantFieldImpl final : public FieldImpl
struct ReusableState
{
std::size_t m_defaultIdx = std::numeric_limits<std::size_t>::max();
bool m_idxHidden = false;
};

ReusableState m_state;
Expand Down
5 changes: 1 addition & 4 deletions lib/test/variant/Schema2.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema name="Schema2"
id="1"
endian="big">
<schema name="Schema2" endian="big">
<fields>
<variant name="Variant1">
<members>
Expand All @@ -15,7 +13,6 @@
</bundle>
</members>
<defaultMember>P1</defaultMember>
<displayIdxReadOnlyHidden value="true" />
</variant>
</fields>
</schema>
2 changes: 1 addition & 1 deletion lib/test/variant/Schema3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
id="1"
endian="big">
<fields>
<variant name="Variant1" defaultMember="1" displayIdxReadOnlyHidden="0" >
<variant name="Variant1" defaultMember="1" >
<bundle name="P1">
<int name="type" type="uint8" validValue="0" failOnInvalid="true" />
<int name="value" type="uint32" />
Expand Down
8 changes: 3 additions & 5 deletions lib/test/variant/Schema4.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema name="Schema4"
id="1"
endian="big">
<schema name="Schema4" endian="big">
<fields>
<variant name="Variant1" defaultMember="P1" displayIdxReadOnlyHidden="true" >
<variant name="Variant1" defaultMember="P1" >
<bundle name="P1">
<int name="type" type="uint8" validValue="0" failOnInvalid="true" />
<int name="value" type="uint32" />
Expand All @@ -14,6 +12,6 @@
</bundle>
</variant>

<variant reuse="Variant1" name="Variant2" defaultMember="-1" displayIdxReadOnlyHidden="0" />
<variant reuse="Variant1" name="Variant2" defaultMember="-1" />
</fields>
</schema>
5 changes: 1 addition & 4 deletions lib/test/variant/Schema5.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema name="Schema5"
id="1"
endian="big">
<schema name="Schema5" endian="big">
<fields>
<variant name="Variant1">
<bundle name="P1">
Expand All @@ -13,7 +11,6 @@
<int name="value" type="uint8" />
</bundle>
<defaultMember>P1</defaultMember>
<displayIdxReadOnlyHidden value="true" />
</variant>
</fields>
</schema>
4 changes: 0 additions & 4 deletions lib/test/variant/variantTest.th
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ void BundleTestSuite::test1()
TS_ASSERT_EQUALS(mem1.kind(), commsdsl::parse::Field::Kind::Bundle);
TS_ASSERT_EQUALS(mem2.kind(), commsdsl::parse::Field::Kind::Bundle);
TS_ASSERT_LESS_THAN_EQUALS(members.size(), variantField.defaultMemberIdx());
TS_ASSERT(!variantField.displayIdxReadOnlyHidden());
}

void BundleTestSuite::test2()
Expand Down Expand Up @@ -87,7 +86,6 @@ void BundleTestSuite::test2()
TS_ASSERT_EQUALS(mem1.kind(), commsdsl::parse::Field::Kind::Bundle);
TS_ASSERT_EQUALS(mem2.kind(), commsdsl::parse::Field::Kind::Bundle);
TS_ASSERT_EQUALS(variantField.defaultMemberIdx(), 0U);
TS_ASSERT(variantField.displayIdxReadOnlyHidden());
}

void BundleTestSuite::test3()
Expand All @@ -112,7 +110,6 @@ void BundleTestSuite::test3()
auto members = variantField.members();
TS_ASSERT_EQUALS(members.size(), 2U);
TS_ASSERT_EQUALS(variantField.defaultMemberIdx(), 1U);
TS_ASSERT(!variantField.displayIdxReadOnlyHidden());
}

void BundleTestSuite::test4()
Expand All @@ -137,7 +134,6 @@ void BundleTestSuite::test4()
auto members = variantField.members();
TS_ASSERT_EQUALS(members.size(), 2U);
TS_ASSERT_LESS_THAN_EQUALS(members.size(), variantField.defaultMemberIdx());
TS_ASSERT(!variantField.displayIdxReadOnlyHidden());
}

void BundleTestSuite::test5()
Expand Down

0 comments on commit 08d9861

Please sign in to comment.