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

Method addPath

kdevplatform/util/path.cpp:378–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378void Path::addPath(const QString& path)
379{
380 if (path.isEmpty()) {
381 return;
382 }
383
384 const auto& newData = splitPath(path);
385 if (newData.isEmpty()) {
386 if (m_data.size() == (isRemote() ? 1 : 0)) {
387 // this represents the root path, we just turned an invalid path into it
388 m_data << QString();
389 }
390 return;
391 }
392
393 auto it = newData.begin();
394 if (!m_data.isEmpty() && m_data.last().isEmpty()) {
395 // the root item is empty, set its contents and continue appending
396 m_data.last() = *it;
397 ++it;
398 }
399
400 std::copy(it, newData.end(), std::back_inserter(m_data));
401 cleanPath(&m_data, isRemote());
402}
403
404Path Path::parent() const
405{

Callers 5

mapSourceBuildMethod · 0.45
initProjectFilesMethod · 0.45
propagateRenameMethod · 0.45
testPathMethod · 0.45
test_path.cppFile · 0.45

Calls 8

splitPathFunction · 0.85
cleanPathFunction · 0.85
QStringClass · 0.70
isEmptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
lastMethod · 0.45
endMethod · 0.45

Tested by 1

testPathMethod · 0.36