WvStreams
uniregistrygen.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2003 Net Integration Technologies, Inc.
4  *
5  * A generator that exposes the windows registry.
6  *
7  * When linking statically, use the following #pragma to ensure this
8  * generator gets registered:
9  * #pragma comment(linker, "/include:?UniRegistryGenMoniker@@3V?$WvMoniker@VUniConfGen@@@@A")
10  */
11 #ifndef __UNICONFREGISTRY_H
12 #define __UNICONFREGISTRY_H
13 
14 #include "uniconfgen.h"
15 #include "wvlog.h"
16 #include "windows.h"
17 
24 class UniRegistryGen : public UniConfGen
25 {
26  WvLog m_log;
27  HKEY m_hRoot;
28 
29 protected:
30  virtual void flush_buffers() { }
31 
32 public:
33  UniRegistryGen(WvString _base);
34  virtual ~UniRegistryGen();
35 
36  /***** Overridden methods *****/
37 
38  virtual bool isok();
39  virtual WvString get(const UniConfKey &key);
40  virtual void set(const UniConfKey &key, WvStringParm value);
41  virtual void setv(const UniConfPairList &pairs);
42  virtual bool exists(const UniConfKey &key);
43  virtual bool haschildren(const UniConfKey &key);
44  virtual Iter *iterator(const UniConfKey &key);
45 };
46 
48 {
49 public:
50  UniRegistryGenIter(UniRegistryGen &gen, const UniConfKey &key, HKEY base);
51 
53  virtual ~UniRegistryGenIter();
54 
59  virtual void rewind();
60 
66  virtual bool next();
67 
69  virtual UniConfKey key() const;
70 
72  virtual WvString value() const;
73 
74 private:
75  LONG next_key();
76  LONG next_value();
77 
78  HKEY m_hKey;
79  enum Enumerating { KEYS, VALUES } m_enumerating;
80  unsigned m_index;
81  UniRegistryGen &gen;
82  const UniConfKey parent;
83  UniConfKey current_key;
84  const HKEY m_dontClose;
85 };
86 
87 #endif // __UNICONFREGISTRY_H
UniRegistryGen::setv
virtual void setv(const UniConfPairList &pairs)
Stores multiple key-value pairs into the registry.
Definition: uniregistrygen.cc:205
UniRegistryGenIter::rewind
virtual void rewind()
Rewinds the iterator.
Definition: uniregistrygen.cc:258
UniRegistryGenIter::key
virtual UniConfKey key() const
Returns the current key.
Definition: uniregistrygen.cc:293
UniRegistryGen::haschildren
virtual bool haschildren(const UniConfKey &key)
Returns true if a key has children.
Definition: uniregistrygen.cc:215
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
UniRegistryGen::exists
virtual bool exists(const UniConfKey &key)
Without fetching its value, returns true if a key exists.
Definition: uniregistrygen.cc:210
UniRegistryGenIter::~UniRegistryGenIter
virtual ~UniRegistryGenIter()
Destroys the iterator.
Definition: uniregistrygen.cc:251
WvLog
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition: wvlog.h:56
UniRegistryGen::get
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
Definition: uniregistrygen.cc:123
UniRegistryGenIter
Definition: uniregistrygen.h:47
UniConfKey
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
Definition: uniconfkey.h:38
UniRegistryGen::isok
virtual bool isok()
Determines if the generator is usable and working properly.
Definition: uniregistrygen.cc:118
UniRegistryGen::iterator
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
Definition: uniregistrygen.cc:223
UniRegistryGenIter::value
virtual WvString value() const
Returns the value of the current key.
Definition: uniregistrygen.cc:299
UniConfGen
A default implementation of IUniConfGen, providing various handy features that save trouble when impl...
Definition: uniconfgen.h:199
UniRegistryGenIter::next
virtual bool next()
Seeks to the next element in the sequence.
Definition: uniregistrygen.cc:266
UniRegistryGen::set
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
Definition: uniregistrygen.cc:174
UniRegistryGen::flush_buffers
virtual void flush_buffers()
Flushes any commitment/notification buffers .
Definition: uniregistrygen.h:30
UniRegistryGen
A generator that exposes the windows registry.
Definition: uniregistrygen.h:24
UniConfGen::Iter
An abstract iterator over keys and values in a generator.
Definition: uniconfgen.h:323