KDevelop API Documentation

urlutil.h File Reference

#include <qstring.h>
#include <qvaluelist.h>
#include <kurl.h>

Include dependency graph for urlutil.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  URLUtil

Enumerations

enum  SlashesPosition { SLASH_PREFIX = 1, SLASH_SUFFIX = 2 }

Functions

QString filename (const QString &pathName)
 Returns the filename part of a pathname (i.e.
QString directory (const QString &pathName)
 Returns the directory part of a path (i.e.
QString relativePath (const KURL &parent, const KURL &child, uint slashPolicy=SLASH_PREFIX)
 Returns the relative path between a parent and child URL, or blank if the specified child is not a child of parent.
QString relativePath (const QString &parent, const QString &child, uint slashPolicy=SLASH_PREFIX)
 Returns the relative path between a parent and child URL, or blank if the specified child is not a child of parent.
QString relativePathToFile (const QString &dirUrl, const QString &fileUrl)
 Returns the relative path between a directory and file.
QString upDir (const QString &path, bool slashSuffix=false)
 Returns the path 'up one level' - the opposite of what filename returns.
KURL mergeURL (const KURL &source, const KURL &dest, const KURL &child)
 'Merges' URLs - changes a URL that starts with dest to start with source instead Example: source is /home/me/ dest is /home/you/ child is /home/you/dir1/file1 returns /home/me/dir1/fil1
QString getExtension (const QString &path)
 Returns the file extension for a filename or path.
QString extractPathNameRelative (const KURL &baseDirUrl, const KURL &url)
 Given a base directory url in baseDirUrl and the url referring to a date sub-directory or file, it will return the path relative to baseDirUrl.
QString extractPathNameRelative (const QString &basePath, const KURL &url)
QString extractPathNameRelative (const QString &basePath, const QString &absFilePath)
QString extractPathNameAbsolute (const KURL &url)
 Will return the absolute path name referred in url.
QStringList toRelativePaths (const QString &baseDir, const KURL::List &urls)
 Returns a QStringList of relative (to baseDir) paths from a list of KURLs in urls.
bool isDirectory (const KURL &url)
 If url is a directory will return true, false otherwise.
bool isDirectory (const QString &absFilePath)
void dump (const KURL::List &urls, const QString &aMessage=QString::null)
 Will dump the list of KURL urls on standard output, eventually printing @ aMessage if it is not null.
QString canonicalPath (const QString &path)
 Same as QDir::canonicalPath in later versions of QT.
QString envExpand (const QString &variable)
 Performs environment variable expansion on variable.


Enumeration Type Documentation

enum SlashesPosition
 

Enumeration values:
SLASH_PREFIX 
SLASH_SUFFIX 

Definition at line 30 of file urlutil.h.


Function Documentation

QString URLUtil::canonicalPath const QString path  ) 
 

Same as QDir::canonicalPath in later versions of QT.

Earlier versions of QT had this broken, so it's reproduced here.

Definition at line 266 of file urlutil.cpp.

Referenced by ClassViewPart::activePartChanged(), JavaSupportPart::activePartChanged(), CppSupportPart::activePartChanged(), JavaSupportPart::addedFilesToProject(), CppSupportPart::addedFilesToProject(), JavaSupportPart::changedFilesInProject(), CppSupportPart::changedFilesInProject(), CustomProjectPart::contextMenu(), PartController::editDocumentInternal(), MakeWidget::guessFileName(), ClassViewWidget::insertFile(), CppSupportPart::isValidSource(), JavaSupportPart::maybeParse(), CppSupportPart::maybeParse(), JavaSupportPart::modifiedFileList(), CppSupportPart::modifiedFileList(), JavaSupportPart::parseProject(), JavaSupportPart::partRemoved(), CppSupportPart::partRemoved(), JavaSupportPart::projectOpened(), CppSupportPart::projectOpened(), JavaSupportPart::removedFilesFromProject(), CppSupportPart::removedFilesFromProject(), ClassViewWidget::removeFile(), KDevProject::slotAddFilesToFileMap(), KDevProject::slotBuildFileMap(), TrollProjectWidget::slotDetailsContextMenu(), CppSupportPart::slotParseFiles(), ClassViewWidget::slotProjectOpened(), and StoreWalker::StoreWalker().

QString URLUtil::directory const QString pathName  ) 
 

Returns the directory part of a path (i.e.

everything up to but not including the last slash)

Definition at line 50 of file urlutil.cpp.

Referenced by AutoProjectWidget::addFiles(), FileCreatePart::createNewFile(), and KDevFileSelector::viewChanged().

void URLUtil::dump const KURL::List urls,
const QString aMessage = QString::null
 

Will dump the list of KURL urls on standard output, eventually printing @ aMessage if it is not null.

Definition at line 190 of file urlutil.cpp.

References kdDebug().

Referenced by CvsServicePartImpl::addFilesToProject(), subversionPart::contextMenu(), CvsServicePart::contextMenu(), CvsServicePartImpl::prepareOperation(), and CvsServicePartImpl::removedFilesFromProject().

QString URLUtil::envExpand const QString variable  ) 
 

Performs environment variable expansion on variable.

Parameters:
variable the string with the environment variable to expand.
Returns:
the expanded environment variable value. if the variable cannot be expanded, variable itself is returned.

Definition at line 287 of file urlutil.cpp.

References len.

Referenced by DocQtPlugin::autoSetupPlugin(), DocDoxygenPlugin::autoSetupPlugin(), and DocTreeViewWidget::DocTreeViewWidget().

QString URLUtil::extractPathNameAbsolute const KURL url  ) 
 

Will return the absolute path name referred in url.

Look at above for an example.

Definition at line 157 of file urlutil.cpp.

References URLUtil::isDirectory(), and KURL::path().

Referenced by URLUtil::extractPathNameRelative().

QString URLUtil::extractPathNameRelative const QString basePath,
const QString absFilePath
 

Definition at line 143 of file urlutil.cpp.

References URLUtil::extractPathNameRelative(), and KURL::fromPathOrURL().

QString URLUtil::extractPathNameRelative const QString basePath,
const KURL url
 

Definition at line 131 of file urlutil.cpp.

References URLUtil::extractPathNameRelative(), and KURL::fromPathOrURL().

QString URLUtil::extractPathNameRelative const KURL baseDirUrl,
const KURL url
 

Given a base directory url in baseDirUrl and the url referring to a date sub-directory or file, it will return the path relative to baseDirUrl.

If baseDirUrl == url.path() then it will return ".". KURL baseUrl, dirUrl; baseUrl.setPath( "/home/mario/src/kdevelop/" ); dirUrl.setPath( "/home/mario/src/kdevelop/parts/cvs/" ); QString relPathName = extractDirPathRelative( baseUrl, url ); // == "parts/cvs/" QString absPathName = extractDirPathAbsolute( url ); // == "/home/mario/src/kdevelop/parts/cvs/" Note that if you pass a file name in url (instead of a directory) or the baseUrl is not contained in url then the function will return "" (void string).

Definition at line 114 of file urlutil.cpp.

References URLUtil::extractPathNameAbsolute().

Referenced by VCSFileTreeBranchItem::createTreeViewItem(), URLUtil::extractPathNameRelative(), DocumentationPart::saveProjectDocumentationInfo(), AddExistingDirectoriesDialog::slotAddAll(), AddExistingDirectoriesDialog::slotAddSelected(), AddExistingDirectoriesDialog::slotDropped(), VCSFileTreeWidgetImpl::slotSyncWithRepository(), and URLUtil::toRelativePaths().

QString URLUtil::filename const QString pathName  ) 
 

Returns the filename part of a pathname (i.e.

everything past the last slash)

Definition at line 43 of file urlutil.cpp.

Referenced by FileCreatePart::createNewFile().

QString URLUtil::getExtension const QString path  ) 
 

Returns the file extension for a filename or path.

Definition at line 106 of file urlutil.cpp.

bool URLUtil::isDirectory const QString absFilePath  ) 
 

Definition at line 183 of file urlutil.cpp.

bool URLUtil::isDirectory const KURL url  ) 
 

If url is a directory will return true, false otherwise.

Definition at line 176 of file urlutil.cpp.

References KURL::path().

Referenced by URLUtil::extractPathNameAbsolute(), and FileContext::Private::Private().

KURL URLUtil::mergeURL const KURL source,
const KURL dest,
const KURL child
 

'Merges' URLs - changes a URL that starts with dest to start with source instead Example: source is /home/me/ dest is /home/you/ child is /home/you/dir1/file1 returns /home/me/dir1/fil1

Definition at line 85 of file urlutil.cpp.

References KURL::cmp(), KURL::isParentOf(), and KURL::url().

QString URLUtil::relativePath const QString parent,
const QString child,
uint  slashPolicy = SLASH_PREFIX
 

Returns the relative path between a parent and child URL, or blank if the specified child is not a child of parent.

Definition at line 71 of file urlutil.cpp.

References URLUtil::relativePath().

QString URLUtil::relativePath const KURL parent,
const KURL child,
uint  slashPolicy = SLASH_PREFIX
 

Returns the relative path between a parent and child URL, or blank if the specified child is not a child of parent.

Definition at line 57 of file urlutil.cpp.

References KURL::cmp(), KURL::isParentOf(), and KURL::path().

Referenced by TrollProjectWidget::addFiles(), AutoProjectWidget::allFiles(), RunOptionsWidget::browseMainProgram(), FileCreatePart::createNewFile(), and URLUtil::relativePath().

QString URLUtil::relativePathToFile const QString dirUrl,
const QString fileUrl
 

Returns the relative path between a directory and file.

Should never return empty path. Example: dirUrl: /home/test/src fileUrl: /home/test/lib/mylib.cpp returns: ../lib/mylib.cpp

Definition at line 221 of file urlutil.cpp.

References file.

QStringList URLUtil::toRelativePaths const QString baseDir,
const KURL::List urls
 

Returns a QStringList of relative (to baseDir) paths from a list of KURLs in urls.

Definition at line 207 of file urlutil.cpp.

References URLUtil::extractPathNameRelative().

Referenced by CvsServicePartImpl::fileList().

QString URLUtil::upDir const QString path,
bool  slashSuffix = false
 

Returns the path 'up one level' - the opposite of what filename returns.

Definition at line 77 of file urlutil.cpp.

KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:29:55 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003