1 /* -*- c++ -*-
2 FILE: Preferences.cpp
3 RCS REVISION: $Revision: 1.7 $
4 
5 COPYRIGHT: (c) 1999 -- 2003 Melinda Green, Don Hatch, and Jay Berkenbilt - Superliminal Software
6 
7 LICENSE: Free to use and modify for non-commercial purposes as long as the
8     following conditions are adhered to:
9     1) Obvious credit for the source of this code and the designs it embodies
10        are clearly made, and
11     2) Ports and derived versions of 4D Magic Cube programs are not distributed
12        without the express written permission of the authors.
13 
14 DESCRIPTION:
15     Implementation of Preferences class
16 */
17 
18 #include "Preferences.h"
19 
Preferences()20 Preferences::Preferences() :
21     length(3)
22 {
23     // nothing needed
24 }
25 
26 bool
getBoolProperty(char * name,bool def)27 Preferences::getBoolProperty(char* name, bool def)
28 {
29     return (getenv(name) ? true : def);
30 }
31 
32 char*
getStringProperty(char * name,char * def)33 Preferences::getStringProperty(char* name, char* def)
34 {
35     return (getenv(name) ? getenv(name) : def);
36 }
37 
38 int
getIntProperty(char * name,int def)39 Preferences::getIntProperty(char* name, int def)
40 {
41     return (getenv(name) ? atoi(getenv(name)) : def);
42 }
43 
44 real
getRealProperty(char * name,real def)45 Preferences::getRealProperty(char* name, real def)
46 {
47     return (getenv(name) ? atof(getenv(name)) : def);
48 }
49 
50 void
setLength(int length)51 Preferences::setLength(int length)
52 {
53     this->length = length;
54 }
55 
56 int
getLength()57 Preferences::getLength()
58 {
59     return this->length;
60 }
61 
62 // Local Variables:
63 // c-basic-offset: 4
64 // c-comment-only-line-offset: 0
65 // c-file-offsets: ((defun-block-intro . +) (block-open . 0) (substatement-open . 0) (statement-cont . +) (statement-case-open . +4) (arglist-intro . +) (arglist-close . +) (inline-open . 0))
66 // indent-tabs-mode: nil
67 // End:
68