WvStreams
uniinigen.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * A generator for .ini files.
6 */
7#ifndef __UNICONFINI_H
8#define __UNICONFINI_H
9
10#include "unitempgen.h"
11#include "wvlog.h"
12#include <sys/stat.h>
13
14class WvFile;
15
25class UniIniGen : public UniTempGen
26{
27public:
28 typedef wv::function<void()> SaveCallback;
29
30private:
31 WvString filename;
32 int create_mode;
33 WvLog log;
34 struct stat old_st;
35 SaveCallback save_cb;
36
37public:
42 UniIniGen(WvStringParm filename, int _create_mode = 0666,
43 SaveCallback _save_cb = SaveCallback());
44
45 virtual ~UniIniGen();
46
47 /***** Overridden members *****/
48
49 virtual void commit();
50 virtual bool refresh();
51 virtual void set(const UniConfKey &key, WvStringParm value);
52
53private:
54#ifndef _WIN32
55 // helper methods for commit
56 bool commit_atomic(WvStringParm real_filename);
57#endif
58
59 void save(WvStream &file, UniConfValueTree &parent);
60 bool refreshcomparator(const UniConfValueTree *a,
61 const UniConfValueTree *b);
62};
63
64
65#endif // __UNICONFINI_H
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
Definition uniconfkey.h:39
A plain UniConfTree that holds keys and values.
Loads and saves ".ini"-style files similar to those used by Windows, but adapted to represent keys an...
Definition uniinigen.h:26
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
Definition uniinigen.cc:39
virtual void commit()
Commits any changes.
Definition uniinigen.cc:294
virtual bool refresh()
Refreshes information about a key recursively.
Definition uniinigen.cc:55
A UniConf generator that stores keys in memory.
Definition unitempgen.h:21
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
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition wvlog.h:57
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition wvstream.h:25
WvString is an implementation of a simple and efficient printable-string class.
Definition wvstring.h:330