31 const std::string &description,
32 const std::string &className,
35 if (propertyName.empty())
38 DescriptionMap &descriptions = m_Descriptions[className];
39 std::pair<DescriptionMapIterator, bool> ret = descriptions.insert(std::make_pair(propertyName, description));
41 if (!ret.second && overwrite)
43 ret.first->second = description;
51 const std::string &description,
52 const std::string &className,
55 if (propertyRegEx.empty())
60 std::regex checker(propertyRegEx);
62 catch (std::regex_error)
67 DescriptionMap &descriptions = m_DescriptionsRegEx[className];
68 std::pair<DescriptionMapIterator, bool> ret = descriptions.insert(std::make_pair(propertyRegEx, description));
70 if (!ret.second && overwrite)
72 ret.first->second = description;
80 const std::string &className,
81 bool allowNameRegEx)
const
83 if (!propertyName.empty())
85 auto descriptionsIter = m_Descriptions.find(className);
87 if (descriptionsIter != m_Descriptions.cend())
89 DescriptionMapConstIterator iter = descriptionsIter->second.find(propertyName);
91 if (iter != descriptionsIter->second.end())
96 if (allowNameRegEx && !propertyName.empty())
98 auto selector = [propertyName](
const DescriptionMap::value_type &x) {
99 std::regex ex(x.first);
100 return std::regex_match(propertyName, ex);
103 auto descriptionsIter = m_DescriptionsRegEx.find(className);
105 if (descriptionsIter != m_DescriptionsRegEx.cend())
107 auto finding = std::find_if(descriptionsIter->second.cbegin(), descriptionsIter->second.cend(), selector);
109 if (finding != descriptionsIter->second.cend())
110 return finding->second;
118 const std::string &className,
119 bool allowNameRegEx)
const
121 if (!propertyName.empty())
123 auto descriptionsIter = m_Descriptions.find(className);
125 if (descriptionsIter != m_Descriptions.cend())
127 DescriptionMapConstIterator iter = descriptionsIter->second.find(propertyName);
129 if (iter != descriptionsIter->second.end())
134 if (allowNameRegEx && !propertyName.empty())
136 auto selector = [propertyName](
const DescriptionMap::value_type &x) {
137 std::regex ex(x.first);
138 return std::regex_match(propertyName, ex);
141 auto descriptionsIter = m_DescriptionsRegEx.find(className);
143 if (descriptionsIter != m_DescriptionsRegEx.cend())
145 auto finding = std::find_if(descriptionsIter->second.cbegin(), descriptionsIter->second.cend(), selector);
147 if (finding != descriptionsIter->second.cend())
157 m_Descriptions[className].clear();
158 m_DescriptionsRegEx[className].clear();
163 if (!propertyName.empty())
165 m_Descriptions[className].erase(propertyName);
166 m_DescriptionsRegEx[className].erase(propertyName);
void RemoveAllDescriptions(const std::string &className) override
Remove all descriptions.
bool HasDescription(const std::string &propertyName, const std::string &className, bool overwrite) const override
Check if a specific property has a description.
bool AddDescription(const std::string &propertyName, const std::string &description, const std::string &className, bool overwrite) override
Add a description for a specific property.
bool AddDescriptionRegEx(const std::string &propertyRegEx, const std::string &description, const std::string &className, bool overwrite) override
Add a description for all properties matching the property regulary expression.
std::string GetDescription(const std::string &propertyName, const std::string &className, bool overwrite) const override
Get the description for a specific property.
void RemoveDescription(const std::string &propertyName, const std::string &className) override
Remove description of specific property.