libfilezilla
fsresult.hpp
Go to the documentation of this file.
1 #ifndef LIBFILEZILLA_FSRESULT_HEADER
2 #define LIBFILEZILLA_FSRESULT_HEADER
3 
8 #include "private/visibility.hpp"
9 
10 #include <stdint.h>
11 #include <stddef.h>
12 
13 namespace fz {
14 
25 class FZ_PUBLIC_SYMBOL result
26 {
27 public:
28  enum error {
29  ok,
30  none = ok,
31 
34 
37 
40 
43 
46 
49 
51  other
52  };
53 
54 #if FZ_WINDOWS
55  typedef uint32_t raw_t; // DWORD alternative without windows.h
56 #else
57  typedef int raw_t;
58 #endif
59 
60  explicit operator bool() const { return error_ == 0; }
61 
62  error error_{};
63 
64  raw_t raw_{};
65 };
66 
76 class FZ_PUBLIC_SYMBOL rwresult final
77 {
78 public:
79 #if FZ_WINDOWS
80  typedef uint32_t raw_t; // DWORD alternative without windows.h
81 #else
82  typedef int raw_t;
83 #endif
84 
85  enum error {
86  none,
87 
90 
93 
96 
98  other
99  };
100 
101  rwresult() = default;
102 
103  explicit rwresult(error e, raw_t raw)
104  : error_(e)
105  , raw_(raw)
106  {}
107 
108  explicit rwresult(size_t value)
109  : value_(value)
110  {}
111 
112  explicit operator bool() const { return error_ == 0; }
113 
114  error error_{};
115 
116  union {
118  raw_t raw_;
119 
121  size_t value_{};
122  };
123 };
124 }
125 
126 #endif
error
Definition: fsresult.hpp:85
Dynamic resource utilization, like too many open files.
Definition: fsresult.hpp:48
The operation would have blocked, but the file descriptor is marked non-blocking. ...
Definition: fsresult.hpp:95
error
Definition: fsresult.hpp:28
Out of disk space.
Definition: fsresult.hpp:92
Holds the result of read/write operations.
Definition: fsresult.hpp:76
Small class to return filesystem errors.
Definition: fsresult.hpp:25
raw_t raw_
Undefined if error_ is none.
Definition: fsresult.hpp:118
The namespace used by libfilezilla.
Definition: apply.hpp:17
Requested file does not exist or is not a file.
Definition: fsresult.hpp:39
Success, proceed.
Requested dir does not exist or is not a dir.
Definition: fsresult.hpp:42
Invalid arguments, syntax error.
Definition: fsresult.hpp:33
Out of disk space (physical, or space quota)
Definition: fsresult.hpp:45
Invalid arguments, syntax error.
Definition: fsresult.hpp:89
Permission denied.
Definition: fsresult.hpp:36
Operationf failed.