Pushr (master) :  summary log tree commit diff
path: root/ExtendedAttributes.h blob: 3a3812f0866d64cd8280f2d77cde4041641c7ace
1//
2// ExtendedAttributes.h, based on UKXattrMetadataStore.h
3//
4// License: MIT <http://opensource.org/licenses/mit-license.php>
5//
6// Modified by Chris Lee <clee@mg8.org>
7// Originally created by Uli Kusterer on 12.03.06.
8// Copyright 2006 Uli Kusterer. All rights reserved.
9//
10
11#import <Foundation/Foundation.h>
12
13/*
14 This is a wrapper around The Mac OS X 10.4 and later xattr API that lets
15 you attach arbitrary metadata to a file. Currently it allows querying and
16 changing the attributes of a file, as well as retrieving a list of attribute
17 names.
18
19 It also includes some conveniences for storing/retrieving UTF8 strings,
20 and objects as XML property lists in addition to the raw data.
21
22 NOTE: keys (i.e. xattr names) are strings of 127 characters or less and
23 should be made like bundle identifiers, e.g. @"de.zathras.myattribute".
24*/
25
26#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
27// -----------------------------------------------------------------------------
28// Class declaration:
29// -----------------------------------------------------------------------------
30
31@interface ExtendedAttributes : NSObject
32{
33}
34
35+ (NSArray *)allKeysAtPath: (NSString *)path;
36
37// Store UTF8 strings:
38+ (void)setString: (NSString *)str forKey: (NSString *)key atPath: (NSString *)path;
39+ (id)stringForKey: (NSString *)key atPath: (NSString *)path;
40
41// Store raw data:
42+ (void)setData: (NSData *)data forKey: (NSString *)key atPath: (NSString *)path;
43+ (NSMutableData*)dataForKey: (NSString *)key atPath: (NSString *)path;
44
45// Store objects: (Only can get/set plist-type objects for now)
46+ (void)setObject: (id)obj forKey: (NSString *)key atPath: (NSString *)path;
47+ (id)objectForKey: (NSString *)key atPath: (NSString *)path;
48
49@end
50
51#endif /*MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4*/
52