File indexing completed on 2024-04-28 04:37:03

0001 /*
0002     SPDX-FileCopyrightText: 2010 Milian Wolff <mail@milianw.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_PROJECTHELPER_H
0008 #define KDEVPLATFORM_PROJECTHELPER_H
0009 
0010 #include "projectexport.h"
0011 
0012 class QUrl;
0013 
0014 namespace KDevelop {
0015 class IProject;
0016 class Path;
0017 
0018 /**
0019  * Deletes the url at @p url. The user is NOT asked for confirmation.
0020  * Set @p isFolder properly to get the correct messages.
0021  * @return whether url got deleted or not
0022  */
0023 bool KDEVPLATFORMPROJECT_EXPORT removeUrl(const KDevelop::IProject* project, const QUrl& url, const bool isFolder);
0024 
0025 /**
0026  * Deletes the path at @p path. The user is NOT asked for confirmation.
0027  * Set @p isFolder properly to get the correct messages.
0028  * @return whether url got deleted or not
0029  */
0030 bool KDEVPLATFORMPROJECT_EXPORT removePath(const KDevelop::IProject* project, const Path& path, const bool isFolder);
0031 
0032 /**
0033  * Creates a file at @p url. Shows the user an error message on failure.
0034  * @return whether file got created or not
0035  */
0036 bool KDEVPLATFORMPROJECT_EXPORT createFile(const QUrl& file);
0037 
0038 /**
0039  * Creates a file at @p path. Shows the user an error message on failure.
0040  * @return whether file got created or not
0041  */
0042 bool KDEVPLATFORMPROJECT_EXPORT createFile(const Path& file);
0043 
0044 /**
0045  * Creates a folder at @p url. Shows the user an error message on failure.
0046  * @return whether folder got created or not
0047  */
0048 bool KDEVPLATFORMPROJECT_EXPORT createFolder(const QUrl& folder);
0049 
0050 /**
0051  * Creates a folder at @p path. Shows the user an error message on failure.
0052  * @return whether folder got created or not
0053  */
0054 bool KDEVPLATFORMPROJECT_EXPORT createFolder(const Path& folder);
0055 
0056 /**
0057  * Renames anything at @p oldname to @p oldname
0058  * @return whether it got renamed or not
0059  */
0060 bool KDEVPLATFORMPROJECT_EXPORT renameUrl(const KDevelop::IProject* project, const QUrl& oldname, const QUrl& newname);
0061 
0062 /**
0063  * Renames anything at @p oldName to @p oldName
0064  * @return whether it got renamed or not
0065  */
0066 bool KDEVPLATFORMPROJECT_EXPORT renamePath(const KDevelop::IProject* project, const Path& oldName, const Path& newName);
0067 
0068 /**
0069  * Copies anything at @p source to @p target
0070  * @return whether it got copied or not
0071  */
0072 bool KDEVPLATFORMPROJECT_EXPORT copyUrl(const KDevelop::IProject* project, const QUrl& source, const QUrl& target);
0073 
0074 /**
0075  * Copies anything at @p source to @p target
0076  * @return whether it got copied or not
0077  */
0078 bool KDEVPLATFORMPROJECT_EXPORT copyPath(const KDevelop::IProject* project, const Path& source, const Path& target);
0079 
0080 /**
0081  * Return the proposed build folder URL for given @p sourceFolder
0082  */
0083 Path KDEVPLATFORMPROJECT_EXPORT proposedBuildFolder(const Path& sourceFolder);
0084 }
0085 
0086 #endif // KDEVPLATFORM_PROJECTHELPER_H