Fixed MYAddressLookup to allocate an NSSet, and to send correct KV notifications. (Based on Jim Roepke's patch, but outsourcing the KV grunge to CollectionUtils.)
5 // Created by Jens Alfke on 5/13/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
9 #import <Foundation/Foundation.h>
12 /** A key/value property store, like a set of MIME or RFC822 headers (but without the weird details).
13 It can be written to or read from a block of data; the data is binary, not the textual
14 format that MIME uses. */
15 @interface BLIPProperties : NSObject <NSCopying, NSMutableCopying>
17 /** Parse properties from a block of data.
18 On success, returns a Properties object and sets *usedLength to the number of bytes of
20 If the data doesn't contain the complete properties, returns nil and sets *usedLength to zero.
21 If the properties are syntactically invalid, returns nil and sets *usedLength to a negative number.
23 + (BLIPProperties*) propertiesWithEncodedData: (NSData*)data
24 usedLength: (ssize_t*)usedLength;
26 /** Returns an empty autoreleased instance. */
27 + (BLIPProperties*) properties;
29 /** Property value lookup. (Case-sensitive, like NSDictionary, but unlike RFC822.) */
30 - (NSString*) valueOfProperty: (NSString*)prop;
32 /** Returns all the properties/values as a dictionary. */
33 @property (readonly) NSDictionary* allProperties;
35 /** The number of properties. */
36 @property (readonly) NSUInteger count;
38 /** The raw data representation of the properties. */
39 @property (readonly) NSData *encodedData;
45 /** Mutable subclass of BLIPProperties, used for creating new instances. */
46 @interface BLIPMutableProperties : BLIPProperties
49 NSMutableDictionary *_properties;
52 /** Initializes a new instance, adding all the key/value pairs from the given NSDictionary. */
53 - (id) initWithDictionary: (NSDictionary*)dict;
55 /** Sets the value of a property. A nil value is allowed, and removes the property. */
56 - (void) setValue: (NSString*)value ofProperty: (NSString*)prop;
58 /** Sets the receiver's key/value pairs from the given NSDictionary.
59 All previously existing properties are removed first. */
60 - (void) setAllProperties: (NSDictionary*)properties;