WvStreams
wvatomicfile.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2005 Net Integration Technologies, Inc.
4 *
5 * A simple class to access filesystem files using WvStreams.
6 */
7#ifndef __WVATOMFILE_H
8#define __WVATOMFILE_H
9
10#include "wvfile.h"
11
21class WvAtomicFile : public WvFile
22{
23private:
24 WvString atomic_file;
25 WvString tmp_file;
26
27public:
28 WvAtomicFile(WvStringParm filename, int flags = O_TRUNC | O_CREAT,
29 mode_t create_mode = 0666);
31
32 bool open(WvStringParm filename, int flags = O_TRUNC | O_CREAT,
33 mode_t create_mode = 0666);
34 void close();
35
36 // Like chmod(2), does *not* respect umask
37 bool chmod(mode_t mode);
38
39 bool chown(uid_t owner, gid_t group);
40
41public:
42 const char *wstype() const { return "WvAtomicFile"; }
43};
44
45#endif // __WVATOMFILE_H
WvAtomicFile implements a simple extension to wvfile to allow for atomic file creation.
Definition: wvatomicfile.h:22
void close()
Closes the file descriptors.
Definition: wvatomicfile.cc:69
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition: wvstring.h:94
WvFile implements a stream connected to a file or Unix device.
Definition: wvfile.h:29
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:330