WvStreams
debian/libwvstreams-dev/usr/include/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...
A plain UniConfTree that holds keys and values.
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
Definition uniinigen.cc:39
UniIniGen(WvStringParm filename, int _create_mode=0666, SaveCallback _save_cb=SaveCallback())
Creates a generator which can load/modify/save a .ini file.
Definition uniinigen.cc:30
virtual void commit()
Commits any changes.
Definition uniinigen.cc:294
virtual bool refresh()
Refreshes information about a key recursively.
Definition uniinigen.cc:55
WvFile implements a stream connected to a file or Unix device.
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
WvString is an implementation of a simple and efficient printable-string class.