Adding new functions to Dictionaries.#65
Open
HelenMamontova wants to merge 17 commits intomadf:mainfrom
Open
Conversation
VendorDictionary, DependentDictionary.
…icDictionary, VendorDictionary, DependentDictionary.
…onaryTests, VendorDictionaryTests, DependentDictionaryTests.
attributeType. Functions attributeFindByName, attributeFindByCode, vendorFindByName, vendorFindbyCode, attributeValueFindByName, attributeValueFindByCode added to Dictionaries class.
…ype. Functions attributeFindByName, attributeFindByCode, vendorFindByName, vendorFindbyCode, attributeValueFindByName, attributeValueFindByCode definitions added to Dictionaries class.
… Dictionaries class.
…ion fixed in Dictionaries class.
…indByName, vendorFindbyCode, attributeValueFindByName, attributeValueFindByCode to Dictionaries_Tests.
madf
requested changes
Feb 5, 2026
src/attribute.cpp
Outdated
| size_t i = 0; | ||
| for (const auto& t : tok) | ||
| { | ||
| ipAddr[i] = static_cast<uint8_t>(std::stoul(t)); |
Owner
There was a problem hiding this comment.
Instead of separate ++i you can use ipAddr[i++]
src/dictionaries.cpp
Outdated
|
|
||
| bool BasicDictionary::findByName(const std::string& name) const | ||
| { | ||
| if (!m_reverseDict.count(name)) |
Owner
There was a problem hiding this comment.
Instead all this code you can just
return m_reverseDict.count(name) > 0;Same below.
src/dictionaries.cpp
Outdated
| bool DependentDictionary::findByName(const std::string& dependencyName, const std::string& name) const | ||
| { | ||
| std::pair<const std::string&, const std::string&> key = {dependencyName, name}; | ||
| auto it = m_reverseDict.find(key); |
tests/dictionaries_tests.cpp
Outdated
| BOOST_CHECK_EQUAL(b.findByName("def"), false); | ||
| } | ||
|
|
||
| BOOST_AUTO_TEST_CASE(TestFindByCode) |
Owner
There was a problem hiding this comment.
You can combine TestFindByName and TestFindByCode into a single test case. They use the same data and the assertions themselves are independent.
…case TestsFindByNameAndFindByCode in suites BasicDictionaryTests, VendorDictionaryTests, DependentDictionaryTests. The test cases for TestAttributeValueFindByName, TestAttributeValueFindByCode combined into a singl test case TestsAttributeValueFindByNameAndAttributeValueFindByCode in cuite DictionariesTests.
…ombined into a singl test case TestsAttributeFindByNameAndAttributeFindByCode in cuite DictionariesTests.
…d into a singl test case TestsVendorFindByNameAndVendorFindByCode in cuite DictionariesTests.
madf
requested changes
Feb 6, 2026
| bool DependentDictionary::findByName(const std::string& dependencyName, const std::string& name) const | ||
| { | ||
| std::pair<const std::string&, const std::string&> key = {dependencyName, name}; | ||
| return m_reverseDict.count(key) > 0; |
Owner
There was a problem hiding this comment.
Is it possible to do it like this:
return m_reverseDict.count({dependencyName, name}) > 0;?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Functions for searching by name, by code added to classes BasicDictionary, VendorDictionary, DependentDictionary, Dictionaries. Tests for these functions added.