LCOV - code coverage report
Current view: top level - home/aheinecke/dev/main/qt5/include/QtCore - qfile.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 6 0.0 %
Date: 2018-11-14 16:53:58 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /****************************************************************************
       2             : **
       3             : ** Copyright (C) 2016 The Qt Company Ltd.
       4             : ** Copyright (C) 2016 Intel Corporation.
       5             : ** Contact: https://www.qt.io/licensing/
       6             : **
       7             : ** This file is part of the QtCore module of the Qt Toolkit.
       8             : **
       9             : ** $QT_BEGIN_LICENSE:LGPL$
      10             : ** Commercial License Usage
      11             : ** Licensees holding valid commercial Qt licenses may use this file in
      12             : ** accordance with the commercial license agreement provided with the
      13             : ** Software or, alternatively, in accordance with the terms contained in
      14             : ** a written agreement between you and The Qt Company. For licensing terms
      15             : ** and conditions see https://www.qt.io/terms-conditions. For further
      16             : ** information use the contact form at https://www.qt.io/contact-us.
      17             : **
      18             : ** GNU Lesser General Public License Usage
      19             : ** Alternatively, this file may be used under the terms of the GNU Lesser
      20             : ** General Public License version 3 as published by the Free Software
      21             : ** Foundation and appearing in the file LICENSE.LGPL3 included in the
      22             : ** packaging of this file. Please review the following information to
      23             : ** ensure the GNU Lesser General Public License version 3 requirements
      24             : ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
      25             : **
      26             : ** GNU General Public License Usage
      27             : ** Alternatively, this file may be used under the terms of the GNU
      28             : ** General Public License version 2.0 or (at your option) the GNU General
      29             : ** Public license version 3 or any later version approved by the KDE Free
      30             : ** Qt Foundation. The licenses are as published by the Free Software
      31             : ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
      32             : ** included in the packaging of this file. Please review the following
      33             : ** information to ensure the GNU General Public License requirements will
      34             : ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
      35             : ** https://www.gnu.org/licenses/gpl-3.0.html.
      36             : **
      37             : ** $QT_END_LICENSE$
      38             : **
      39             : ****************************************************************************/
      40             : 
      41             : #ifndef QFILE_H
      42             : #define QFILE_H
      43             : 
      44             : #include <QtCore/qfiledevice.h>
      45             : #include <QtCore/qstring.h>
      46             : #include <stdio.h>
      47             : 
      48             : #ifdef open
      49             : #error qfile.h must be included before any header file that defines open
      50             : #endif
      51             : 
      52             : QT_BEGIN_NAMESPACE
      53             : 
      54             : class QTemporaryFile;
      55             : class QFilePrivate;
      56             : 
      57             : class Q_CORE_EXPORT QFile : public QFileDevice
      58             : {
      59             : #ifndef QT_NO_QOBJECT
      60             :     Q_OBJECT
      61             : #endif
      62             :     Q_DECLARE_PRIVATE(QFile)
      63             : 
      64             : public:
      65             :     QFile();
      66             :     QFile(const QString &name);
      67             : #ifndef QT_NO_QOBJECT
      68             :     explicit QFile(QObject *parent);
      69             :     QFile(const QString &name, QObject *parent);
      70             : #endif
      71             :     ~QFile();
      72             : 
      73             :     QString fileName() const Q_DECL_OVERRIDE;
      74             :     void setFileName(const QString &name);
      75             : 
      76             : #if defined(Q_OS_DARWIN)
      77             :     // Mac always expects filenames in UTF-8... and decomposed...
      78             :     static inline QByteArray encodeName(const QString &fileName)
      79             :     {
      80             :         return fileName.normalized(QString::NormalizationForm_D).toUtf8();
      81             :     }
      82             :     static QString decodeName(const QByteArray &localFileName)
      83             :     {
      84             :         // note: duplicated in qglobal.cpp (qEnvironmentVariable)
      85             :         return QString::fromUtf8(localFileName).normalized(QString::NormalizationForm_C);
      86             :     }
      87             : #else
      88           0 :     static inline QByteArray encodeName(const QString &fileName)
      89             :     {
      90           0 :         return fileName.toLocal8Bit();
      91             :     }
      92           0 :     static QString decodeName(const QByteArray &localFileName)
      93             :     {
      94           0 :         return QString::fromLocal8Bit(localFileName);
      95             :     }
      96             : #endif
      97           0 :     inline static QString decodeName(const char *localFileName)
      98           0 :         { return decodeName(QByteArray(localFileName)); }
      99             : 
     100             : #if QT_DEPRECATED_SINCE(5,0)
     101             :     typedef QByteArray (*EncoderFn)(const QString &fileName);
     102             :     typedef QString (*DecoderFn)(const QByteArray &localfileName);
     103             :     QT_DEPRECATED static void setEncodingFunction(EncoderFn) {}
     104             :     QT_DEPRECATED static void setDecodingFunction(DecoderFn) {}
     105             : #endif
     106             : 
     107             :     bool exists() const;
     108             :     static bool exists(const QString &fileName);
     109             : 
     110             :     QString readLink() const;
     111             :     static QString readLink(const QString &fileName);
     112             :     inline QString symLinkTarget() const { return readLink(); }
     113             :     inline static QString symLinkTarget(const QString &fileName) { return readLink(fileName); }
     114             : 
     115             :     bool remove();
     116             :     static bool remove(const QString &fileName);
     117             : 
     118             :     bool rename(const QString &newName);
     119             :     static bool rename(const QString &oldName, const QString &newName);
     120             : 
     121             :     bool link(const QString &newName);
     122             :     static bool link(const QString &oldname, const QString &newName);
     123             : 
     124             :     bool copy(const QString &newName);
     125             :     static bool copy(const QString &fileName, const QString &newName);
     126             : 
     127             :     bool open(OpenMode flags) Q_DECL_OVERRIDE;
     128             :     bool open(FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle);
     129             :     bool open(int fd, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle);
     130             : 
     131             :     qint64 size() const Q_DECL_OVERRIDE;
     132             : 
     133             :     bool resize(qint64 sz) Q_DECL_OVERRIDE;
     134             :     static bool resize(const QString &filename, qint64 sz);
     135             : 
     136             :     Permissions permissions() const Q_DECL_OVERRIDE;
     137             :     static Permissions permissions(const QString &filename);
     138             :     bool setPermissions(Permissions permissionSpec) Q_DECL_OVERRIDE;
     139             :     static bool setPermissions(const QString &filename, Permissions permissionSpec);
     140             : 
     141             : protected:
     142             : #ifdef QT_NO_QOBJECT
     143             :     QFile(QFilePrivate &dd);
     144             : #else
     145             :     QFile(QFilePrivate &dd, QObject *parent = Q_NULLPTR);
     146             : #endif
     147             : 
     148             : private:
     149             :     friend class QTemporaryFile;
     150             :     Q_DISABLE_COPY(QFile)
     151             : };
     152             : 
     153             : QT_END_NAMESPACE
     154             : 
     155             : #endif // QFILE_H

Generated by: LCOV version 1.13