summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/ntfsp.cpp
blob: 18f9bd0c5ec135aeb8983e2666443891e3b3e77b (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause


//! [0]
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
//! [0]

//! [1]
qt_ntfs_permission_lookup++; // turn checking on
qt_ntfs_permission_lookup--; // turn it off again
//! [1]

//! [raii]
void complexFunction()
{
    QNtfsPermissionCheckGuard permissionGuard;  // check is enabled

    // do complex things here that need permission check enabled

}   // as the guard goes out of scope the check is disabled
//! [raii]

//! [free-funcs]
qAreNtfsPermissionChecksEnabled();   // check status
qEnableNtfsPermissionChecks();       // turn checking on
qDisableNtfsPermissionChecks();      // turn it off again
//! [free-funcs]