Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file_p.h
Show All 15 Lines | 1 | /*** | |||
---|---|---|---|---|---|
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | ***/ | 19 | ***/ | ||
20 | 20 | | |||
21 | #ifndef FILE_P_H | 21 | #ifndef FILE_P_H | ||
22 | #define FILE_P_H | 22 | #define FILE_P_H | ||
23 | 23 | | |||
24 | enum ActionType { | 24 | enum ActionType { | ||
dfaure: #define is for 1990, these days we have a proper C++ language where preprocessor hacks are less… | |||||
25 | CHMOD = 1, | 25 | CHMOD = 1, | ||
26 | CHOWN, | 26 | CHOWN, | ||
27 | DEL, | 27 | DEL, | ||
28 | MKDIR, | 28 | MKDIR, | ||
29 | OPEN, | 29 | OPEN, | ||
30 | OPENDIR, | 30 | OPENDIR, | ||
31 | RENAME, | 31 | RENAME, | ||
32 | RMDIR, | 32 | RMDIR, | ||
33 | SYMLINK, | 33 | SYMLINK, | ||
34 | UTIME, | 34 | UTIME, | ||
35 | }; | 35 | }; | ||
36 | 36 | | |||
37 | class PrivilegeOperationReturnValue | ||||
38 | { | ||||
39 | public: | ||||
40 | static PrivilegeOperationReturnValue success() { return PrivilegeOperationReturnValue{true, false, false}; } | ||||
41 | static PrivilegeOperationReturnValue failure() { return PrivilegeOperationReturnValue{false, true, false}; } | ||||
42 | static PrivilegeOperationReturnValue canceled() { return PrivilegeOperationReturnValue{false, false, true}; } | ||||
43 | operator bool() const { return m_success; } | ||||
44 | bool failed() const { return m_failure; } | ||||
45 | bool wasCanceled() const { return m_canceled; } | ||||
46 | private: | ||||
47 | PrivilegeOperationReturnValue(bool success, bool failure, bool canceled) : m_success(success), m_failure(failure), m_canceled(canceled) {} | ||||
48 | const bool m_success; | ||||
49 | const bool m_failure; | ||||
50 | const bool m_canceled; | ||||
51 | }; | ||||
52 | | ||||
53 | class QString; | ||||
54 | const QString socketPath(); | ||||
55 | | ||||
37 | #endif | 56 | #endif |
#define is for 1990, these days we have a proper C++ language where preprocessor hacks are less and less needed.
An enum value is probably the cleanest way here (to avoid the whole issue of "in which .cpp file to implement it", if it was an actual int variable).
The naming EFOO is very libc-like, I wouldn't use this here.
In fact, why not use KIO::ERR_USER_CANCELED? (note that it has a value of 1, don't use 1 for something else ;)