Differences From Artifact [b5f01ad0ba]:
- File
src/XMPPFileStorage.m
— part of check-in
[c9bb52e823]
at
2013-02-23 13:49:32
on branch trunk
— Rename XMPPJSONFileStorage to XMPPFileStorage.
It uses BinaryPack instead of JSON now. (user: js, size: 5372) [annotate] [blame] [check-ins using]
To Artifact [e283a67940]:
- File src/XMPPFileStorage.m — part of check-in [543fb8b84d] at 2013-06-23 14:19:42 on branch trunk — Adjust to reworked exception API. (user: js, size: 5381) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #import <ObjFW/OFString.h> #import <ObjFW/OFArray.h> #import <ObjFW/OFDictionary.h> #import <ObjFW/OFNumber.h> #import <ObjFW/OFDataArray.h> #import <ObjFW/OFAutoreleasePool.h> #import <ObjFW/OFNotImplementedException.h> #import "XMPPFileStorage.h" @implementation XMPPFileStorage - init { | > > > | > | | > | > | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <stdlib.h> #import <ObjFW/OFString.h> #import <ObjFW/OFArray.h> #import <ObjFW/OFDictionary.h> #import <ObjFW/OFNumber.h> #import <ObjFW/OFDataArray.h> #import <ObjFW/OFAutoreleasePool.h> #import <ObjFW/OFNotImplementedException.h> #import "XMPPFileStorage.h" @implementation XMPPFileStorage - init { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; } abort(); } - initWithFile: (OFString*)file { self = [super init]; @try { OFAutoreleasePool *pool = [OFAutoreleasePool new]; _file = [file copy]; @try { _data = [[[OFDataArray dataArrayWithContentsOfFile: file] messagePackValue] retain]; } @catch (id e) { _data = [OFMutableDictionary new]; } [pool release]; } @catch (id e) { [self release]; |
︙ | ︙ | |||
74 75 76 77 78 79 80 | [_data release]; [super dealloc]; } - (void)save { | | | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | [_data release]; [super dealloc]; } - (void)save { [[_data messagePackRepresentation] writeToFile: _file]; } - (void)XMPP_setObject: (id)object forPath: (OFString*)path { OFArray *pathComponents = [path componentsSeparatedByString: @"."]; OFMutableDictionary *iter = _data; |
︙ | ︙ |