| 79 | */ |
| 80 | template<typename Folder> |
| 81 | static bool folderIsSelfOrDescendant(const std::vector<Folder>& folders, |
| 82 | int folderId, |
| 83 | int candidate) |
| 84 | { |
| 85 | const int kMax = static_cast<int>(folders.size()); |
| 86 | int p = candidate; |
| 87 | for (int i = 0; i <= kMax && p != -1; ++i) { |
| 88 | if (p == folderId) |
| 89 | return true; |
| 90 | |
| 91 | int parent = -1; |
| 92 | for (const auto& f : folders) |
| 93 | if (f.folderId == p) { |
| 94 | parent = f.parentFolderId; |
| 95 | break; |
| 96 | } |
| 97 | |
| 98 | p = parent; |
| 99 | } |
| 100 | |
| 101 | return false; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @brief Detaches cyclic or dangling folder parents and resets entities pointing at a missing |
no test coverage detected