dtinfo subtree dtinfo
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / UAS / Test / StringPref.hh
1 /*
2  * $XConsortium: StringPref.hh /main/3 1996/06/11 16:44:41 cde-hal $
3  *
4  * Copyright (c) 1992 HAL Computer Systems International, Ltd.
5  * All rights reserved.  Unpublished -- rights reserved under
6  * the Copyright Laws of the United States.  USE OF A COPYRIGHT
7  * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
8  * OR DISCLOSURE.
9  * 
10  * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
11  * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.  USE,
12  * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
13  * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
14  * INTERNATIONAL, LTD.
15  * 
16  *                         RESTRICTED RIGHTS LEGEND
17  * Use, duplication, or disclosure by the Government is subject
18  * to the restrictions as set forth in subparagraph (c)(l)(ii)
19  * of the Rights in Technical Data and Computer Software clause
20  * at DFARS 252.227-7013.
21  *
22  *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
23  *                  1315 Dell Avenue
24  *                  Campbell, CA  95008
25  * 
26  */
27
28 #include "UserPreference.hh"
29
30 #include <unistd.h>
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <ctype.h>
34 #include <string.h>
35
36 class StringPref : public UserPreference
37 {
38 public:
39   StringPref (const char *name);
40   ~StringPref();
41
42   const char *value()
43     { return (f_value); }
44
45   void value (const char *v)
46     { free ((char *) f_value); f_value = strdup(v); save(); }
47
48 private:
49   void save();
50   void restore();
51
52   const char *f_value;
53 };
54
55
56 inline
57 StringPref::StringPref (const char *name)
58 : UserPreference(name)
59 {
60   restore();
61 }