dtinfo subtree dtinfo
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / UAS / Test / UserPreference.hh
1 /*
2  * $XConsortium: UserPreference.hh /main/3 1996/06/11 16:44:56 cde-hal $
3  *
4  * Copyright (c) 1992 HaL Computer Systems, Inc.  All rights reserved.
5  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
6  * States.  Use of a copyright notice is precautionary only and does not
7  * imply publication or disclosure.
8  * 
9  * This software contains confidential information and trade secrets of HaL
10  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
11  * without the prior express written permission of HaL Computer Systems, Inc.
12  * 
13  *                         RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the Government is subject to
15  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
16  * Technical Data and Computer Software clause at DFARS 252.227-7013.
17  *                        HaL Computer Systems, Inc.
18  *                  1315 Dell Avenue, Campbell, CA  95008
19  * 
20  */
21
22 class PreferenceRecord
23 {
24 public:
25   PreferenceRecord (const char *key, const char *value);
26   ~PreferenceRecord();
27
28   void set_value (const char *value);
29
30   static PreferenceRecord *lookup (const char *key);
31   static const char *form_filename();
32   static void read_prefs();
33
34   const char *f_key;
35   const char *f_value;
36
37 private:
38   PreferenceRecord *f_next;
39
40   static PreferenceRecord *g_head;
41   static PreferenceRecord *g_tail;
42   static int g_update_count;
43 };
44
45
46 class UserPreference
47 {
48 public:
49   UserPreference (const char *key);
50   virtual ~UserPreference();
51
52 protected:
53   const char *key()
54     { return (f_preference->f_key); }
55   const char *value()
56     { return (f_preference->f_value); }
57   void set_value (const char *value)
58     { f_preference->set_value (value); }
59
60 protected:
61   char g_buffer[256];
62
63 private:
64   PreferenceRecord *f_preference;
65 };