2014-09-16 15:58:32 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-09-16 15:58:32 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2014-09-16 15:58:32 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2014-09-16 15:58:32 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-09-16 15:58:32 +02:00
|
|
|
|
|
|
|
|
#include <utils/stringutils.h>
|
|
|
|
|
|
2015-04-02 09:26:57 +02:00
|
|
|
#include <QObject>
|
2014-09-16 15:58:32 +02:00
|
|
|
#include <QSet>
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class UtilsJsExtension : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2017-01-20 16:30:45 +01:00
|
|
|
UtilsJsExtension(QObject *parent = nullptr) : QObject(parent) { }
|
2014-09-16 15:58:32 +02:00
|
|
|
|
2020-01-03 10:48:30 +01:00
|
|
|
// General information
|
|
|
|
|
Q_INVOKABLE QString qtVersion() const;
|
|
|
|
|
Q_INVOKABLE QString qtCreatorVersion() const;
|
|
|
|
|
|
2014-09-16 15:58:32 +02:00
|
|
|
// File name conversions:
|
|
|
|
|
Q_INVOKABLE QString toNativeSeparators(const QString &in) const;
|
|
|
|
|
Q_INVOKABLE QString fromNativeSeparators(const QString &in) const;
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE QString baseName(const QString &in) const;
|
2016-11-25 14:45:59 +01:00
|
|
|
Q_INVOKABLE QString fileName(const QString &in) const;
|
2014-09-16 15:58:32 +02:00
|
|
|
Q_INVOKABLE QString completeBaseName(const QString &in) const;
|
|
|
|
|
Q_INVOKABLE QString suffix(const QString &in) const;
|
|
|
|
|
Q_INVOKABLE QString completeSuffix(const QString &in) const;
|
|
|
|
|
Q_INVOKABLE QString path(const QString &in) const;
|
|
|
|
|
Q_INVOKABLE QString absoluteFilePath(const QString &in) const;
|
|
|
|
|
|
2015-11-27 09:44:57 +01:00
|
|
|
Q_INVOKABLE QString relativeFilePath(const QString &path, const QString &base) const;
|
|
|
|
|
|
2015-05-08 10:49:11 +02:00
|
|
|
// File checks:
|
|
|
|
|
Q_INVOKABLE bool exists(const QString &in) const;
|
|
|
|
|
Q_INVOKABLE bool isDirectory(const QString &in) const;
|
|
|
|
|
Q_INVOKABLE bool isFile(const QString &in) const;
|
|
|
|
|
|
2014-09-16 15:58:32 +02:00
|
|
|
// MimeDB:
|
|
|
|
|
Q_INVOKABLE QString preferredSuffix(const QString &mimetype) const;
|
|
|
|
|
|
|
|
|
|
// Generate filename:
|
|
|
|
|
Q_INVOKABLE QString fileName(const QString &path,
|
|
|
|
|
const QString &extension) const;
|
|
|
|
|
|
|
|
|
|
// Generate temporary file:
|
|
|
|
|
Q_INVOKABLE QString mktemp(const QString &pattern) const;
|
2017-01-20 16:30:45 +01:00
|
|
|
|
|
|
|
|
// Generate a ascii-only string:
|
|
|
|
|
Q_INVOKABLE QString asciify(const QString &input) const;
|
2014-09-16 15:58:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Core
|