2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2005 SKYRIX Software AG
|
2009-02-24 02:54:59 +01:00
|
|
|
Copyright (C) 2008-2009 Inverse inc.
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2009-02-24 02:54:59 +01:00
|
|
|
This file is part of SOGo.
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2009-02-24 02:54:59 +01:00
|
|
|
SOGo is free software; you can redistribute it and/or modify it under
|
2006-06-15 21:34:10 +02:00
|
|
|
the terms of the GNU Lesser General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
later version.
|
|
|
|
|
2009-02-24 02:54:59 +01:00
|
|
|
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
2006-06-15 21:34:10 +02:00
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with OGo; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-07-25 19:52:49 +02:00
|
|
|
#ifndef __SOGoUserDefaults_H_
|
|
|
|
#define __SOGoUserDefaults_H_
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
#import <Foundation/NSObject.h>
|
|
|
|
|
|
|
|
/*
|
2008-07-25 19:52:49 +02:00
|
|
|
SOGoUserDefaults
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
An object with the same API like NSUserDefaults which retrieves profile
|
|
|
|
information for users in the database.
|
2009-03-03 20:08:02 +01:00
|
|
|
|
|
|
|
It does NOT store values internally but rather uses an external
|
|
|
|
mutable dictionary for this (generally coming from SOGoCache)
|
2006-06-15 21:34:10 +02:00
|
|
|
*/
|
|
|
|
|
2009-03-03 20:08:02 +01:00
|
|
|
@class NSString, NSURL, NSUserDefaults, NSArray, NSDictionary;
|
|
|
|
@class NSData, NSCalendarDate, NSMutableDictionary;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2008-07-25 19:52:49 +02:00
|
|
|
@interface SOGoUserDefaults : NSObject
|
2006-06-15 21:34:10 +02:00
|
|
|
{
|
|
|
|
NSURL *url;
|
|
|
|
NSString *uid;
|
2007-03-27 20:12:02 +02:00
|
|
|
NSString *fieldName;
|
|
|
|
NSCalendarDate *lastFetch;
|
2009-03-03 20:08:02 +01:00
|
|
|
NSMutableDictionary *values;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-03-27 20:12:02 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int modified: 1;
|
|
|
|
int isNew: 1;
|
2009-03-20 23:24:31 +01:00
|
|
|
int ready: 1;
|
2006-06-15 21:34:10 +02:00
|
|
|
} defFlags;
|
|
|
|
}
|
|
|
|
|
2009-03-03 20:08:02 +01:00
|
|
|
- (id) initWithTableURL: (NSURL *) theURL
|
|
|
|
uid: (NSString *) theUID
|
|
|
|
fieldName: (NSString *) theFieldName;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
/* value access */
|
2008-11-05 22:04:16 +01:00
|
|
|
- (void) setValues: (NSDictionary *) theValues;
|
2009-02-24 02:54:59 +01:00
|
|
|
- (NSDictionary *) values;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-03-27 20:12:02 +02:00
|
|
|
- (void) setObject: (id) value
|
|
|
|
forKey: (NSString *) key;
|
|
|
|
- (id) objectForKey: (NSString *) key;
|
|
|
|
- (void) removeObjectForKey: (NSString *) key;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
/* typed accessors */
|
|
|
|
|
2007-03-27 20:12:02 +02:00
|
|
|
- (NSArray *) arrayForKey: (NSString *)key;
|
|
|
|
- (NSDictionary *) dictionaryForKey: (NSString *)key;
|
|
|
|
- (NSData *) dataForKey: (NSString *)key;
|
|
|
|
- (NSString *) stringForKey: (NSString *)key;
|
|
|
|
- (BOOL) boolForKey: (NSString *) key;
|
|
|
|
- (float) floatForKey: (NSString *) key;
|
|
|
|
- (int) integerForKey: (NSString *) key;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-03-27 20:12:02 +02:00
|
|
|
- (void) setBool: (BOOL) value forKey: (NSString *) key;
|
|
|
|
- (void) setFloat: (float) value forKey: (NSString *) key;
|
|
|
|
- (void) setInteger: (int) value forKey: (NSString *) key;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2007-06-19 19:59:09 +02:00
|
|
|
- (NSString *) jsonRepresentation;
|
|
|
|
|
2009-04-01 15:49:24 +02:00
|
|
|
- (BOOL) fetchProfile;
|
|
|
|
|
2006-06-15 21:34:10 +02:00
|
|
|
/* saving changes */
|
|
|
|
|
2007-03-27 20:12:02 +02:00
|
|
|
- (BOOL) synchronize;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2008-07-25 19:52:49 +02:00
|
|
|
#endif /* __SOGoUserDefaults_H__ */
|