VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPathOperations.h@ 82781

Last change on this file since 82781 was 76621, checked in by vboxsync, 5 years ago

FE/Qt: 6699: Manage tree item path correctly

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

© 2023 Oracle
ContactPrivacy policyTerms of Use