------------------------------------ EntityLinkResolver::UnregisterLink
| 145 | // EntityLinkResolver::UnregisterLink |
| 146 | // |
| 147 | void EntityLinkResolver::UnregisterLink(EntityLink* const link) |
| 148 | { |
| 149 | // find the list of links for the id |
| 150 | auto const foundIt = m_RegisteredLinks.find(link->id); |
| 151 | if (foundIt == m_RegisteredLinks.cend()) |
| 152 | { |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | // find the actual link |
| 157 | auto const foundLink = std::find(foundIt->second.begin(), foundIt->second.end(), link); |
| 158 | if (foundLink == foundIt->second.cend()) |
| 159 | { |
| 160 | return; |
| 161 | } |
| 162 | |
| 163 | // remove it |
| 164 | if (foundIt->second.size() > 1u) |
| 165 | { |
| 166 | std::iter_swap(foundLink, std::prev(foundIt->second.end())); |
| 167 | foundIt->second.pop_back(); |
| 168 | } |
| 169 | else |
| 170 | { |
| 171 | foundIt->second.clear(); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | //--------------------------- |
| 176 | // EntityLinkResolver::Clear |
no test coverage detected