MCPcopy Create free account
hub / github.com/KDE/kdevelop / isParentPath

Function isParentPath

kdevplatform/util/path.cpp:226–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226static bool isParentPath(const QVector<QString>& parent, const QVector<QString>& child, bool direct)
227{
228 if (direct && child.size() != parent.size() + 1) {
229 return false;
230 } else if (!direct && child.size() <= parent.size()) {
231 return false;
232 }
233 for (int i = 0; i < parent.size(); ++i) {
234 if (child.at(i) != parent.at(i)) {
235 // support for trailing '/'
236 if (i + 1 == parent.size() && parent.at(i).isEmpty()) {
237 return true;
238 }
239 // otherwise we take a different branch here
240 return false;
241 }
242 }
243
244 return true;
245}
246
247bool Path::isParentOf(const Path& path) const
248{

Callers 2

isParentOfMethod · 0.85
isDirectParentOfMethod · 0.85

Calls 3

sizeMethod · 0.45
atMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected