1 | /* $Id: UIPathOperations.h 102378 2023-11-29 12:06:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIFileManagerTable class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_globals_UIPathOperations_h
|
---|
29 | #define FEQT_INCLUDED_SRC_globals_UIPathOperations_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QString>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UILibraryDefs.h"
|
---|
39 |
|
---|
40 | /** A collection of simple utility functions to manipulate path strings */
|
---|
41 | class SHARED_LIBRARY_STUFF UIPathOperations
|
---|
42 | {
|
---|
43 | public:
|
---|
44 | static QString removeMultipleDelimiters(const QString &path);
|
---|
45 | static QString removeTrailingDelimiters(const QString &path);
|
---|
46 | static QString addTrailingDelimiters(const QString &path);
|
---|
47 | static QString addStartDelimiter(const QString &path);
|
---|
48 | static QString sanitize(const QString &path);
|
---|
49 | /** Merges prefix and suffix by making sure they have a single '/' in between */
|
---|
50 | static QString mergePaths(const QString &path, const QString &baseName);
|
---|
51 | /** Returns the last part of the @p path. That is the filename or directory name without the path */
|
---|
52 | static QString getObjectName(const QString &path);
|
---|
53 | /** Removes the object name and return the path */
|
---|
54 | static QString getPathExceptObjectName(const QString &path);
|
---|
55 | /** Replaces the last part of the @p previusPath with newBaseName */
|
---|
56 | static QString constructNewItemPath(const QString &previousPath, const QString &newBaseName);
|
---|
57 | /** Splits the path and return it as a QStringList, top most being the 0th element. No delimiters */
|
---|
58 | static QStringList pathTrail(const QString &path);
|
---|
59 | static const QChar delimiter;
|
---|
60 | static const QChar dosDelimiter;
|
---|
61 | /** Tries to determine if the path starts with DOS style drive letters. */
|
---|
62 | static bool doesPathStartWithDriveLetter(const QString &path);
|
---|
63 | static const QString replaceDosDelimeter(const QString &path);
|
---|
64 | };
|
---|
65 |
|
---|
66 | #endif /* !FEQT_INCLUDED_SRC_globals_UIPathOperations_h */
|
---|