dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
dfileerror.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DFILEERROR_H
6#define DFILEERROR_H
7
8#include <QString>
9
10#include "dtkio_global.h"
11
12DIO_BEGIN_NAMESPACE
13
14// TODO: refactor it
75
76inline const QString IOErrorMessage(IOErrorCode errorCode)
77{
78 switch (errorCode) {
79 case Failed:
80 return QString("Generic error condition for when an operation fails and no more specific DFMIOErrorEnum value is defined");
81 case NoError:
82 return QString("No error");
83 case FileNotFound:
84 return QString("File not found");
85 case FileExists:
86 return QString("File already exists");
87 case FileIsDirectory:
88 return QString("File is a directory");
90 return QString("File is not a directory");
92 return QString("File is a directory that isn't empty");
93 case FileNotRegular:
94 return QString("File is not a regular file");
96 return QString("File is not a symbolic link");
98 return QString("File cannot be mounted");
99 case FileNameTooLong:
100 return QString("Filename is too many characters");
101 case FileNameInvalid:
102 return QString("Filename is invalid or contains invalid characters");
103 case FileTooManyLinks:
104 return QString("File contains too many symbolic links");
105 case DriveNoSpace:
106 return QString("No space left on drive");
107 case InvalidArgument:
108 return QString("Invalid argument");
109 case PermissionDenied:
110 return QString("Permission denied");
111 case NotSupported:
112 return QString("Operation (or one of its parameters) not supported");
113 case FileNotMounted:
114 return QString("File isn't mounted");
116 return QString("File is already mounted");
117 case FileClosed:
118 return QString("File was closed");
120 return QString("Operation was cancelled");
121 case OperationPending:
122 return QString("Operations are still pending");
123 case FileReadOnly:
124 return QString("File is read only");
125 case CantCreateBackup:
126 return QString("Backup couldn't be created");
127 case FileWrongEtag:
128 return QString("File's Entity Tag was incorrect");
129 case TimedOut:
130 return QString("Operation timed out");
131 case WouldRecurse:
132 return QString("Operation would be recursive");
133 case FileBusy:
134 return QString("File is busy");
135 case WouldBlock:
136 return QString("Operation would block");
137 case HostNotFound:
138 return QString("Host couldn't be found (remote operations)");
139 case WouldMerge:
140 return QString("Operation would merge files");
141 case FailedHandled:
142 return QString("Operation failed and a helper program has already interacted with the user. Do not display any error dialog");
143 case TooManyOpenFiles:
144 return QString("The current process has too many files open and can't open any more. Duplicate descriptors do count toward this limit");
145 case NotInitialized:
146 return QString("The object has not been initialized");
147 case AddressInUse:
148 return QString("The requested address is already in use");
149 case PartialInput:
150 return QString("Need more input to finish operation");
151 case InvalidData:
152 return QString("The input data was invalid");
153 case DbusError:
154 return QString("A remote object generated an error(dbus)");
155 case HostUnreachable:
156 return QString("Host unreachable");
158 return QString("Network unreachable");
160 return QString("Connection refused");
161 case ProxyFailed:
162 return QString("Connection to proxy server failed");
163 case ProxyAuthFailed:
164 return QString("Proxy authentication failed");
165 case ProxyNeedAuth:
166 return QString("Proxy server needs authentication");
167 case ProxyNotAllowed:
168 return QString("Proxy connection is not allowed by ruleset");
169 case BrokenPipe:
170 return QString("Broken pipe");
171 case ConnectionClosed:
172 return QString("Connection closed by peer");
173 case NotConnected:
174 return QString("Transport endpoint is not connected");
175 case MessageTooLarge:
176 return QString("Message too large");
177 case CustomFailed:
178 return QString("Custom failed");
179 case OpenFailed:
180 return QString("File open failed");
181 case OpenFlagError:
182 return QString("File open flag error");
184 return QString("File is already opened");
185 case InfoNoAttribute:
186 return QString("File info has no attribute");
187 }
188
189 return QString("Unknown error");
190}
191
192DIO_END_NAMESPACE
193#endif // DFILEERROR_H
const QString IOErrorMessage(IOErrorCode errorCode)
根据错误信息码返回对应的字符串
Definition dfileerror.h:76
IOErrorCode
文件IO相关错误码
Definition dfileerror.h:15
@ DriveNoSpace
Definition dfileerror.h:30
@ FileNotFound
!<
Definition dfileerror.h:19
@ BrokenPipe
Definition dfileerror.h:64
@ FileNotMountable
Definition dfileerror.h:26
@ TooManyOpenFiles
Definition dfileerror.h:50
@ OperationCancelled
Definition dfileerror.h:37
@ NoError
Definition dfileerror.h:16
@ FileNotDirectory
Definition dfileerror.h:22
@ FileAlreadyOpened
Definition dfileerror.h:72
@ DirectoryNotEmpty
Definition dfileerror.h:23
@ NotInitialized
Definition dfileerror.h:52
@ FileNameInvalid
Definition dfileerror.h:28
@ FileTooManyLinks
Definition dfileerror.h:29
@ FileBusy
Definition dfileerror.h:44
@ DbusError
Definition dfileerror.h:56
@ HostNotFound
Definition dfileerror.h:46
@ NetworkUnreachable
Definition dfileerror.h:58
@ FileExists
Definition dfileerror.h:20
@ PermissionDenied
Definition dfileerror.h:32
@ FileNotSymbolicLink
Definition dfileerror.h:25
@ FileNameTooLong
Definition dfileerror.h:27
@ CantCreateBackup
Definition dfileerror.h:40
@ InvalidArgument
Definition dfileerror.h:31
@ WouldRecurse
Definition dfileerror.h:43
@ FileClosed
Definition dfileerror.h:36
@ OpenFailed
Definition dfileerror.h:70
@ FileReadOnly
Definition dfileerror.h:39
@ FileWrongEtag
Definition dfileerror.h:41
@ NotConnected
Definition dfileerror.h:66
@ ConnectionClosed
Definition dfileerror.h:65
@ ProxyNeedAuth
Definition dfileerror.h:62
@ OpenFlagError
Definition dfileerror.h:71
@ FileAlreadyMounted
Definition dfileerror.h:35
@ FileNotMounted
Definition dfileerror.h:34
@ WouldMerge
Definition dfileerror.h:47
@ InvalidData
Definition dfileerror.h:55
@ HostUnreachable
Definition dfileerror.h:57
@ ProxyAuthFailed
Definition dfileerror.h:61
@ WouldBlock
Definition dfileerror.h:45
@ TimedOut
Definition dfileerror.h:42
@ ProxyFailed
Definition dfileerror.h:60
@ FileNotRegular
Definition dfileerror.h:24
@ ProxyNotAllowed
Definition dfileerror.h:63
@ Failed
Definition dfileerror.h:18
@ FileIsDirectory
Definition dfileerror.h:21
@ ConnectionRefused
Definition dfileerror.h:59
@ MessageTooLarge
Definition dfileerror.h:67
@ AddressInUse
Definition dfileerror.h:53
@ InfoNoAttribute
Definition dfileerror.h:73
@ NotSupported
Definition dfileerror.h:33
@ PartialInput
Definition dfileerror.h:54
@ FailedHandled
Definition dfileerror.h:48
@ OperationPending
Definition dfileerror.h:38