1*d5f7f405SAugustin Cavalier //
2*d5f7f405SAugustin Cavalier // TPreferences
3*d5f7f405SAugustin Cavalier // Using BMessages to save user settings.
4*d5f7f405SAugustin Cavalier //
5*d5f7f405SAugustin Cavalier // Eric Shepherd
6*d5f7f405SAugustin Cavalier //
7*d5f7f405SAugustin Cavalier /*
8*d5f7f405SAugustin Cavalier Copyright 1999, Be Incorporated. All Rights Reserved.
9*d5f7f405SAugustin Cavalier This file may be used under the terms of the Be Sample Code License.
10*d5f7f405SAugustin Cavalier
11*d5f7f405SAugustin Cavalier Modified by H. Reh "SetData" added - Dec. 2001
12*d5f7f405SAugustin Cavalier "SetRef" added - Dec. 2003
13*d5f7f405SAugustin Cavalier */
14*d5f7f405SAugustin Cavalier
15*d5f7f405SAugustin Cavalier #ifndef __TPREFS_H__
16*d5f7f405SAugustin Cavalier #define __TPREFS_H__
17*d5f7f405SAugustin Cavalier
18*d5f7f405SAugustin Cavalier #include <Path.h>
19*d5f7f405SAugustin Cavalier #include <Message.h>
20*d5f7f405SAugustin Cavalier #include <Directory.h>
21*d5f7f405SAugustin Cavalier
22*d5f7f405SAugustin Cavalier class _EXPORT TPreferences : public BMessage
23*d5f7f405SAugustin Cavalier {
24*d5f7f405SAugustin Cavalier public:
25*d5f7f405SAugustin Cavalier TPreferences(char *filename);
26*d5f7f405SAugustin Cavalier ~TPreferences();
27*d5f7f405SAugustin Cavalier
28*d5f7f405SAugustin Cavalier
29*d5f7f405SAugustin Cavalier status_t InitCheck(void);
30*d5f7f405SAugustin Cavalier
31*d5f7f405SAugustin Cavalier status_t SetBool(const char *name, bool b);
32*d5f7f405SAugustin Cavalier status_t SetInt8(const char *name, int8 i);
33*d5f7f405SAugustin Cavalier status_t SetInt16(const char *name, int16 i);
34*d5f7f405SAugustin Cavalier status_t SetInt32(const char *name, int32 i);
35*d5f7f405SAugustin Cavalier status_t SetInt64(const char *name, int64 i);
36*d5f7f405SAugustin Cavalier status_t SetFloat(const char *name, float f);
37*d5f7f405SAugustin Cavalier status_t SetDouble(const char *name, double d);
38*d5f7f405SAugustin Cavalier status_t SetString(const char *name, const char *string);
39*d5f7f405SAugustin Cavalier status_t SetPoint(const char *name, BPoint p);
40*d5f7f405SAugustin Cavalier status_t SetRect(const char *name, BRect r);
41*d5f7f405SAugustin Cavalier status_t SetMessage(const char *name, const BMessage *message);
42*d5f7f405SAugustin Cavalier status_t SetFlat(const char *name, const BFlattenable *obj);
43*d5f7f405SAugustin Cavalier status_t SetData(const char *name, type_code type, const void *data, ssize_t numBytes);
44*d5f7f405SAugustin Cavalier status_t SetRef(const char *name, entry_ref *ref);
45*d5f7f405SAugustin Cavalier
46*d5f7f405SAugustin Cavalier private:
47*d5f7f405SAugustin Cavalier BPath path;
48*d5f7f405SAugustin Cavalier BPath parent;
49*d5f7f405SAugustin Cavalier status_t status;
50*d5f7f405SAugustin Cavalier };
51*d5f7f405SAugustin Cavalier
InitCheck(void)52*d5f7f405SAugustin Cavalier inline status_t TPreferences::InitCheck(void)
53*d5f7f405SAugustin Cavalier {
54*d5f7f405SAugustin Cavalier return status;
55*d5f7f405SAugustin Cavalier }
56*d5f7f405SAugustin Cavalier
57*d5f7f405SAugustin Cavalier #endif
58