blob: c9de551d2ef8ab46719b4bb78b3d95cb215ecfd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* $Id$ */
/** @file
* VBox Qt GUI - UIFileManagerTable class declaration.
*/
/*
* Copyright (C) 2016-2020 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef FEQT_INCLUDED_SRC_globals_UIPathOperations_h
#define FEQT_INCLUDED_SRC_globals_UIPathOperations_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif
/* Qt includes: */
#include <QString>
/* GUI includes: */
#include "UILibraryDefs.h"
/** A collection of simple utility functions to manipulate path strings */
class SHARED_LIBRARY_STUFF UIPathOperations
{
public:
static QString removeMultipleDelimiters(const QString &path);
static QString removeTrailingDelimiters(const QString &path);
static QString addTrailingDelimiters(const QString &path);
static QString addStartDelimiter(const QString &path);
static QString sanitize(const QString &path);
/** Merges prefix and suffix by making sure they have a single '/' in between */
static QString mergePaths(const QString &path, const QString &baseName);
/** Returns the last part of the @p path. That is the filename or directory name without the path */
static QString getObjectName(const QString &path);
/** Removes the object name and return the path */
static QString getPathExceptObjectName(const QString &path);
/** Replaces the last part of the @p previusPath with newBaseName */
static QString constructNewItemPath(const QString &previousPath, const QString &newBaseName);
/** Splits the path and return it as a QStringList, top most being the 0th element. No delimiters */
static QStringList pathTrail(const QString &path);
static const QChar delimiter;
static const QChar dosDelimiter;
/** Tries to determine if the path starts with DOS style drive letters. */
static bool doesPathStartWithDriveLetter(const QString &path);
};
#endif /* !FEQT_INCLUDED_SRC_globals_UIPathOperations_h */
|