Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qtemporaryfile.cpp File Reference
#include "qtemporaryfile.h"
#include "qplatformdefs.h"
#include "qrandom.h"
#include "private/qtemporaryfile_p.h"
#include "private/qfile_p.h"
#include "private/qsystemerror_p.h"
#include "private/qcore_unix_p.h"
#include <errno.h>
#include "moc_qtemporaryfile.cpp"
+ Include dependency graph for qtemporaryfile.cpp:

Go to the source code of this file.

Macros

#define tr(X)   QString::fromLatin1(X)
 

Typedefs

typedef char Char
 
typedef char Latin1Char
 
typedef int NativeFileHandle
 

Enumerations

enum class  CreateUnnamedFileStatus { Success = 0 , NotSupported , OtherError }
 

Functions

static bool createFileFromTemplate (NativeFileHandle &file, QTemporaryFileName &templ, quint32 mode, int flags, QSystemError &error)
 
static CreateUnnamedFileStatus createUnnamedFile (NativeFileHandle &file, QTemporaryFileName &tfn, quint32 mode, QSystemError *error)
 

Macro Definition Documentation

◆ tr

#define tr (   X)    QString::fromLatin1(X)

Definition at line 21 of file qtemporaryfile.cpp.

Typedef Documentation

◆ Char

typedef char Char

Definition at line 39 of file qtemporaryfile.cpp.

◆ Latin1Char

typedef char Latin1Char

Definition at line 40 of file qtemporaryfile.cpp.

◆ NativeFileHandle

typedef int NativeFileHandle

Definition at line 41 of file qtemporaryfile.cpp.

Enumeration Type Documentation

◆ CreateUnnamedFileStatus

enum class CreateUnnamedFileStatus
strong
Enumerator
Success 
NotSupported 
OtherError 

Definition at line 230 of file qtemporaryfile.cpp.

Function Documentation

◆ createFileFromTemplate()

static bool createFileFromTemplate ( NativeFileHandle file,
QTemporaryFileName templ,
quint32  mode,
int  flags,
QSystemError error 
)
static

Generates a unique file path from the template templ and creates a new file based on those parameters: the templ.length characters in templ.path starting at templ.pos will be replaced by a random sequence of characters. mode specifies the file mode bits (not used on Windows).

Returns true on success and sets the file handle on file. On error, returns false, sets an invalid handle on handle and sets the error condition in error. In both cases, the string in templ will be changed and contain the generated path name.

Definition at line 175 of file qtemporaryfile.cpp.

References error, file, QTemporaryFileName::generateNext(), INVALID_FILE_ATTRIBUTES, QSystemError::NativeError, Q_UNUSED, QT_OPEN, and QTemporaryFileEngine::Win32NonShared.

Referenced by QTemporaryFileEngine::open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createUnnamedFile()

static CreateUnnamedFileStatus createUnnamedFile ( NativeFileHandle file,
QTemporaryFileName tfn,
quint32  mode,
QSystemError error 
)
static

Definition at line 237 of file qtemporaryfile.cpp.

References QByteArray::data(), error, file, QByteArray::lastIndexOf(), QSystemError::NativeError, NotSupported, OtherError, QTemporaryFileName::path, Q_UNUSED, qt_haveLinuxProcfs(), QT_OPEN, and Success.

Referenced by QTemporaryFileEngine::open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: