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 
52 
54  other
55  };
56 
57 #if FZ_WINDOWS
58  typedef uint32_t raw_t; // DWORD alternative without windows.h
59 #else
60  typedef int raw_t;
61 #endif
62 
63  explicit operator bool() const { return error_ == 0; }
64 
65  error error_{};
66 
67  raw_t raw_{};
68 };
69 
79 class FZ_PUBLIC_SYMBOL rwresult final
80 {
81 public:
82 #if FZ_WINDOWS
83  typedef uint32_t raw_t; // DWORD alternative without windows.h
84 #else
85  typedef int raw_t;
86 #endif
87 
88  enum error {
89  none,
90 
93 
96 
99 
101  other
102  };
103 
104  rwresult() = default;
105 
106  explicit rwresult(error e, raw_t raw)
107  : error_(e)
108  , raw_(raw)
109  {}
110  explicit rwresult(error e) = delete;
111 
112  explicit rwresult(size_t value)
113  : value_(value)
114  {}
115 
116  explicit operator bool() const { return error_ == 0; }
117 
118  error error_{};
119 
120  union {
122  raw_t raw_;
123 
125  size_t value_{};
126  };
127 };
128 }
129 
130 #endif
error
Definition: fsresult.hpp:88
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:98
error
Definition: fsresult.hpp:28
Out of disk space.
Definition: fsresult.hpp:95
Holds the result of read/write operations.
Definition: fsresult.hpp:79
Small class to return filesystem errors.
Definition: fsresult.hpp:25
raw_t raw_
Undefined if error_ is none.
Definition: fsresult.hpp:122
The namespace used by libfilezilla.
Definition: apply.hpp:17
Requested file does not exist or is not a file.
Definition: fsresult.hpp:39
File already exists when asked to explicitly create a new file.
Definition: fsresult.hpp:51
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:92
Permission denied.
Definition: fsresult.hpp:36
Operationf failed.