MCPcopy Create free account
hub / github.com/FastLED/FastLED / ofstream

Class ofstream

src/fl/stl/fstream.h:207–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205// ============================================================================
206
207class ofstream {
208private:
209 filebuf_ptr mHandle;
210 bool mGood;
211 bool mEof;
212 bool mFail;
213 int mLocalError;
214
215 void updateState() {
216 if (mHandle && mHandle->is_open()) {
217 mEof = mHandle->is_eof();
218 mFail = mHandle->has_error() || (mLocalError != 0);
219 mGood = !mEof && !mFail;
220 } else {
221 mGood = false;
222 mEof = false;
223 mFail = true;
224 }
225 }
226
227public:
228 ofstream() FL_NOEXCEPT : mGood(false), mEof(false), mFail(true), mLocalError(0) {}
229
230 explicit ofstream(const char* path, ios::openmode mode = ios::out);
231
232 explicit ofstream(filebuf_ptr handle);
233
234 ~ofstream() FL_NOEXCEPT;
235
236 // Non-copyable
237 ofstream(const ofstream&) FL_NOEXCEPT = delete;
238 ofstream& operator=(const ofstream&) = delete;
239
240 // Moveable
241 ofstream(ofstream&& other) FL_NOEXCEPT
242 : mHandle(other.mHandle), mGood(other.mGood), mEof(other.mEof),
243 mFail(other.mFail), mLocalError(other.mLocalError) {
244 other.mHandle.reset();
245 other.mGood = false;
246 other.mEof = false;
247 other.mFail = true;
248 other.mLocalError = 0;
249 }
250
251 ofstream& operator=(ofstream&& other) FL_NOEXCEPT {
252 if (this != &other) {
253 close();
254 mHandle = other.mHandle;
255 mGood = other.mGood;
256 mEof = other.mEof;
257 mFail = other.mFail;
258 mLocalError = other.mLocalError;
259 other.mHandle.reset();
260 other.mGood = false;
261 other.mEof = false;
262 other.mFail = true;
263 other.mLocalError = 0;
264 }

Callers

nothing calls this directly

Calls 2

closeFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected