]> err.no Git - scalable-opengroupware.org/blob - SoObjects/SOGo/AgenorUserDefaults.h
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1034 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SoObjects / SOGo / AgenorUserDefaults.h
1 /*
2   Copyright (C) 2005 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __AgenorUserDefaults_H_
23 #define __AgenorUserDefaults_H_
24
25 #import <Foundation/NSObject.h>
26
27 /*
28   AgenorUserDefaults
29   
30   An object with the same API like NSUserDefaults which retrieves profile
31   information for users in the database.
32 */
33
34 @class NSString, NSURL, NSUserDefaults, NSArray, NSDictionary, NSData;
35 @class NSCalendarDate, NSMutableDictionary;
36
37 @interface AgenorUserDefaults :  NSObject
38 {
39   NSUserDefaults *parent;
40   NSURL    *url;
41   NSString *uid;
42   NSString *fieldName;
43   
44   NSArray *fieldNames;
45   NSMutableDictionary *values;
46   NSCalendarDate *lastFetch;
47
48   struct
49   {
50     int modified: 1;
51     int isNew: 1;
52     int reserved: 30;
53   } defFlags;
54 }
55
56 - (id) initWithTableURL: (NSURL *) url
57                     uid: (NSString *) uid
58               fieldName: (NSString *) fieldName;
59
60 /* value access */
61
62 - (void) setObject: (id) value
63             forKey: (NSString *) key;
64 - (id) objectForKey: (NSString *) key;
65 - (void) removeObjectForKey: (NSString *) key;
66
67 /* typed accessors */
68
69 - (NSArray *) arrayForKey: (NSString *)key;
70 - (NSDictionary *) dictionaryForKey: (NSString *)key;
71 - (NSData *) dataForKey: (NSString *)key;
72 - (NSString *) stringForKey: (NSString *)key;
73 - (BOOL) boolForKey: (NSString *) key;
74 - (float) floatForKey: (NSString *) key;
75 - (int) integerForKey: (NSString *) key;
76
77 - (void) setBool: (BOOL) value   forKey: (NSString *) key;
78 - (void) setFloat: (float) value forKey: (NSString *) key;
79 - (void) setInteger: (int) value forKey: (NSString *) key;
80
81 /* saving changes */
82
83 - (BOOL) synchronize;
84
85 @end
86
87 #endif /* __AgenorUserDefaults_H__ */