From a20c6e7b7cfc66a27d396ed453c53cfa3ac44956 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Sun, 8 Apr 2007 06:55:22 +0000 Subject: [PATCH] [NEW] Add BDAlias. git-svn-id: http://rentzsch.com/svn/trunk/cocoa/BDAlias@225 34dae961-d50d-0410-846e-a203d89df655 --- About BDAlias+wolf.rtf | 59 +++++++ About BDAlias.rtf | 59 +++++++ BDAlias.h | 77 +++++++++ BDAlias.m | 347 +++++++++++++++++++++++++++++++++++++++++ BDAlias.rtf | 162 +++++++++++++++++++ License.rtf | 21 +++ 6 files changed, 725 insertions(+) create mode 100644 About BDAlias+wolf.rtf create mode 100644 About BDAlias.rtf create mode 100644 BDAlias.h create mode 100644 BDAlias.m create mode 100644 BDAlias.rtf create mode 100644 License.rtf diff --git a/About BDAlias+wolf.rtf b/About BDAlias+wolf.rtf new file mode 100644 index 0000000..6f979c8 --- /dev/null +++ b/About BDAlias+wolf.rtf @@ -0,0 +1,59 @@ +{\rtf1\mac\ansicpg10000\cocoartf102 +{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;\f2\fswiss\fcharset77 Helvetica-Oblique; +} +{\colortbl;\red255\green255\blue255;\red255\green0\blue0;} +\vieww9000\viewh9000\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\fs24 \cf0 +\f1\b\fs28 \cf2 b\cf0 Distributed.com, Inc. +\f0\b0\fs24 \ + +\fs20 2549 W. Golf Rd. #348\ + Hoffman Estates, IL 60194\ + Phone: (847) 372-3955\ + Fax: (847) 589-3738\ + Web: bdistributed.com\ + Email: info@bdistributed.com\ + +\fs24 \ + +\f1\b What is BDAlias? +\f0\b0 \ +BDAlias is a simple Cocoa class for dealing with alias records, a form of persistent file reference that is more robust and provides a better user experience than a textual path. Macintosh applications should always use alias records for persistent file references, and often for exchanging references to files with other applications.\ +\ + +\f1\b How do I use BDAlias? +\f0\b0 \ +"You've got the source."\ +\ +Seriously though, you create an instance of BDAlias using one of the \ul aliasWithXXX:\ulnone messages whenever you need to keep a persistent reference to a file around. If you're interacting with the rest of Cocoa, you'll probably use either \ul aliasWithPath:\ulnone or \ul aliasWithPath:relativeToPath:\ulnone When you're ready to "resolve" this reference to actually access a file, just send it a \ul fullPath\ulnone or \ul fullPathRelativeToPath:\ulnone message.\ +\ +Since the whole point of aliases is to +\f2\i persistently +\f0\i0 reference a file, you can easily convert an alias to an NSData object. Sending a BDAlias the \ul aliasData\ulnone message will return an autoreleased instance of NSData containing the record data ready to store wherever you can store an NSData.\ +\ + +\f1\b Who is bDistributed.com? +\f0\b0 \ +bDistributed.com is a Chicago-based consulting firm that specializes in WebObjects and Mac OS X development. If you'd like to discuss a project with bDistributed.com, email a brief overview of your project and contact information to sales@bdistributed.com.\ +\ + +\f1\b License Agreement\ + +\f0\b0 By using or downloading this software, you agree to be bound by the following license. If you do not agree to be bound by the license, please destroy all copies of this software.\ +\ +Copyright \'a9 2001-2002, bDistributed.com, Inc.\ +All rights reserved.\ +\ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\ +\ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li580\fi-580\ql\qnatural +\cf0 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\ +\ +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\ +\ +* Neither the name of bDistributed.com, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. \ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural +\cf0 \ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } \ No newline at end of file diff --git a/About BDAlias.rtf b/About BDAlias.rtf new file mode 100644 index 0000000..6f979c8 --- /dev/null +++ b/About BDAlias.rtf @@ -0,0 +1,59 @@ +{\rtf1\mac\ansicpg10000\cocoartf102 +{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;\f2\fswiss\fcharset77 Helvetica-Oblique; +} +{\colortbl;\red255\green255\blue255;\red255\green0\blue0;} +\vieww9000\viewh9000\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\fs24 \cf0 +\f1\b\fs28 \cf2 b\cf0 Distributed.com, Inc. +\f0\b0\fs24 \ + +\fs20 2549 W. Golf Rd. #348\ + Hoffman Estates, IL 60194\ + Phone: (847) 372-3955\ + Fax: (847) 589-3738\ + Web: bdistributed.com\ + Email: info@bdistributed.com\ + +\fs24 \ + +\f1\b What is BDAlias? +\f0\b0 \ +BDAlias is a simple Cocoa class for dealing with alias records, a form of persistent file reference that is more robust and provides a better user experience than a textual path. Macintosh applications should always use alias records for persistent file references, and often for exchanging references to files with other applications.\ +\ + +\f1\b How do I use BDAlias? +\f0\b0 \ +"You've got the source."\ +\ +Seriously though, you create an instance of BDAlias using one of the \ul aliasWithXXX:\ulnone messages whenever you need to keep a persistent reference to a file around. If you're interacting with the rest of Cocoa, you'll probably use either \ul aliasWithPath:\ulnone or \ul aliasWithPath:relativeToPath:\ulnone When you're ready to "resolve" this reference to actually access a file, just send it a \ul fullPath\ulnone or \ul fullPathRelativeToPath:\ulnone message.\ +\ +Since the whole point of aliases is to +\f2\i persistently +\f0\i0 reference a file, you can easily convert an alias to an NSData object. Sending a BDAlias the \ul aliasData\ulnone message will return an autoreleased instance of NSData containing the record data ready to store wherever you can store an NSData.\ +\ + +\f1\b Who is bDistributed.com? +\f0\b0 \ +bDistributed.com is a Chicago-based consulting firm that specializes in WebObjects and Mac OS X development. If you'd like to discuss a project with bDistributed.com, email a brief overview of your project and contact information to sales@bdistributed.com.\ +\ + +\f1\b License Agreement\ + +\f0\b0 By using or downloading this software, you agree to be bound by the following license. If you do not agree to be bound by the license, please destroy all copies of this software.\ +\ +Copyright \'a9 2001-2002, bDistributed.com, Inc.\ +All rights reserved.\ +\ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\ +\ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li580\fi-580\ql\qnatural +\cf0 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\ +\ +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\ +\ +* Neither the name of bDistributed.com, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. \ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural +\cf0 \ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } \ No newline at end of file diff --git a/BDAlias.h b/BDAlias.h new file mode 100644 index 0000000..13c9a5d --- /dev/null +++ b/BDAlias.h @@ -0,0 +1,77 @@ +/* + Copyright (c) 2001-2002, bDistributed.com, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + * Neither the name of bDistributed.com, Inc. nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + OF SUCH DAMAGE. +*/ + +#import +#import + +@interface BDAlias : NSObject +{ + AliasHandle _alias; +} + +- (id)initWithAliasHandle:(AliasHandle)alias; // designated initializer +- (id)initWithData:(NSData *)data; +- (id)initWithPath:(NSString *)fullPath; +- (id)initWithPath:(NSString *)fullPath error:(NSError **)outError; +- (id)initWithPath:(NSString *)path relativeToPath:(NSString *)relPath; +- (id)initWithFSRef:(FSRef *)ref; +- (id)initWithFSRef:(FSRef *)ref error:(NSError **)outError; +- (id)initWithFSRef:(FSRef *)ref relativeToFSRef:(FSRef *)relRef; +- (id)initWithFSRef:(FSRef *)ref relativeToFSRef:(FSRef *)relRef error:(NSError **)outError; +- (id)initWithCoder:(NSCoder *)coder; +- (void)encodeWithCoder:(NSCoder*)coder; + +- (void)dealloc; + +- (AliasHandle)alias; +- (void)setAlias:(AliasHandle)newAlias; + +- (NSData *)aliasData; +- (void)setAliasData:(NSData *)newAliasData; + +- (NSString *)fullPath; +- (NSString *)fullPathRelativeToPath:(NSString *)relPath; + ++ (BDAlias *)aliasWithAliasHandle:(AliasHandle)alias; ++ (BDAlias *)aliasWithData:(NSData *)data; ++ (BDAlias *)aliasWithPath:(NSString *)fullPath; ++ (BDAlias *)aliasWithPath:(NSString *)fullPath error:(NSError **)outError; ++ (BDAlias *)aliasWithPath:(NSString *)path relativeToPath:(NSString *)relPath; ++ (BDAlias *)aliasWithFSRef:(FSRef *)ref; ++ (BDAlias *)aliasWithFSRef:(FSRef *)ref relativeToFSRef:(FSRef *)relRef; + +@end diff --git a/BDAlias.m b/BDAlias.m new file mode 100644 index 0000000..c8c3e43 --- /dev/null +++ b/BDAlias.m @@ -0,0 +1,347 @@ +/* + Copyright (c) 2001-2002, bDistributed.com, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + * Neither the name of bDistributed.com, Inc. nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + OF SUCH DAMAGE. +*/ + +#include + +#import "BDAlias.h" + + +static Handle DataToHandle(CFDataRef inData); +static CFDataRef HandleToData(Handle inHandle); + +static OSStatus PathToFSRef(CFStringRef inPath, FSRef *outRef); +static CFStringRef FSRefToPathCopy(const FSRef *inRef); + + +static Handle DataToHandle(CFDataRef inData) +{ + CFIndex len; + Handle handle = NULL; + + if (inData == NULL) { + return NULL; + } + + len = CFDataGetLength(inData); + + handle = NewHandle(len); + + if ((handle != NULL) && (len > 0)) { + HLock(handle); + BlockMoveData(CFDataGetBytePtr(inData), *handle, len); + HUnlock(handle); + } + + return handle; +} + +static CFDataRef HandleToData(Handle inHandle) +{ + CFDataRef data = NULL; + CFIndex len; + SInt8 handleState; + + if (inHandle == NULL) { + return NULL; + } + + len = GetHandleSize(inHandle); + + handleState = HGetState(inHandle); + + HLock(inHandle); + + data = CFDataCreate(kCFAllocatorDefault, (const UInt8 *) *inHandle, len); + + HSetState(inHandle, handleState); + + return data; +} + +static OSStatus PathToFSRef(CFStringRef inPath, FSRef *outRef) +{ + CFURLRef tempURL = NULL; + Boolean gotRef = false; + + tempURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, inPath, + kCFURLPOSIXPathStyle, false); + + if (tempURL == NULL) { + return fnfErr; + } + + gotRef = CFURLGetFSRef(tempURL, outRef); + + CFRelease(tempURL); + + if (gotRef == false) { + return fnfErr; + } + + return noErr; +} + +static CFStringRef FSRefToPathCopy(const FSRef *inRef) +{ + CFURLRef tempURL = NULL; + CFStringRef result = NULL; + + if (inRef != NULL) { + tempURL = CFURLCreateFromFSRef(kCFAllocatorDefault, inRef); + + if (tempURL == NULL) { + return NULL; + } + + result = CFURLCopyFileSystemPath(tempURL, kCFURLPOSIXPathStyle); + + CFRelease(tempURL); + } + + return result; +} + + +@implementation BDAlias + +- (id)initWithAliasHandle:(AliasHandle)alias +{ + id ret = [super init]; + + if (ret != nil) { + _alias = alias; + } + + return ret; +} + +- (id)initWithData:(NSData *)data +{ + return [self initWithAliasHandle:(AliasHandle)DataToHandle((CFDataRef) data)]; +} + +- (id)initWithPath:(NSString *)fullPath +{ + return [self initWithPath:fullPath error:nil]; +} + +- (id)initWithPath:(NSString *)fullPath error:(NSError **)outError +{ + OSStatus anErr = noErr; + FSRef ref; + + anErr = PathToFSRef((CFStringRef) fullPath, &ref); + + if (anErr != noErr) { + if (outError) *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:anErr userInfo:nil]; + return nil; + } + + return [self initWithFSRef:&ref error:outError]; +} + +- (id)initWithPath:(NSString *)path relativeToPath:(NSString *)relPath +{ + OSStatus anErr = noErr; + FSRef ref, relRef; + + anErr = PathToFSRef((CFStringRef) [relPath stringByAppendingPathComponent:path], + &ref); + + if (anErr != noErr) { + return nil; + } + + anErr = PathToFSRef((CFStringRef) relPath, &relRef); + + if (anErr != noErr) { + return nil; + } + + return [self initWithFSRef:&ref relativeToFSRef:&relRef]; +} + +- (id)initWithFSRef:(FSRef *)ref +{ + return [self initWithFSRef:ref relativeToFSRef:NULL]; +} + +- (id)initWithFSRef:(FSRef *)ref error:(NSError **)outError +{ + return [self initWithFSRef:ref relativeToFSRef:NULL error:outError]; +} + +- (id)initWithFSRef:(FSRef *)ref relativeToFSRef:(FSRef *)relRef +{ + return [self initWithFSRef:ref relativeToFSRef:relRef error:nil]; +} + +- (id)initWithFSRef:(FSRef *)ref relativeToFSRef:(FSRef *)relRef error:(NSError **)outError +{ + OSStatus anErr = noErr; + AliasHandle alias = NULL; + + anErr = FSNewAlias(relRef, ref, &alias); + + if (anErr != noErr) { + if (outError) *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:anErr userInfo:nil]; + return nil; + } + + return [self initWithAliasHandle:alias]; +} + +- (id)initWithCoder:(NSCoder *)coder +{ + return [self initWithData:[coder decodeDataObject]]; +} + +- (void)encodeWithCoder:(NSCoder*)coder +{ + [coder encodeDataObject:[self aliasData]]; +} + +- (void)dealloc +{ + if (_alias != NULL) { + DisposeHandle((Handle) _alias); + _alias = NULL; + } + + [super dealloc]; +} + +- (AliasHandle)alias +{ + return _alias; +} + +- (void)setAlias:(AliasHandle)newAlias +{ + if (_alias != NULL) { + DisposeHandle((Handle) _alias); + } + + _alias = newAlias; +} + +- (NSData *)aliasData +{ + NSData *result; + + result = (NSData *)HandleToData((Handle) _alias); + + return [result autorelease]; +} + +- (void)setAliasData:(NSData *)newAliasData +{ + [self setAlias:(AliasHandle) DataToHandle((CFDataRef) newAliasData)]; +} + +- (NSString *)fullPath +{ + return [self fullPathRelativeToPath:nil]; +} + +- (NSString *)fullPathRelativeToPath:(NSString *)relPath +{ + OSStatus anErr = noErr; + FSRef relPathRef; + FSRef tempRef; + NSString *result = nil; + Boolean wasChanged; + + if (_alias != NULL) { + if (relPath != nil) { + anErr = PathToFSRef((CFStringRef)relPath, &relPathRef); + + if (anErr != noErr) { + return NULL; + } + + anErr = FSResolveAlias(&relPathRef, _alias, &tempRef, &wasChanged); + } else { + anErr = FSResolveAlias(NULL, _alias, &tempRef, &wasChanged); + } + + if (anErr != noErr) { + return NULL; + } + + result = (NSString *)FSRefToPathCopy(&tempRef); + } + + return [result autorelease]; +} + ++ (BDAlias *)aliasWithAliasHandle:(AliasHandle)alias +{ + return [[[BDAlias alloc] initWithAliasHandle:alias] autorelease]; +} + ++ (BDAlias *)aliasWithData:(NSData *)data +{ + return [[[BDAlias alloc] initWithData:data] autorelease]; +} + ++ (BDAlias *)aliasWithPath:(NSString *)fullPath +{ + return [[[BDAlias alloc] initWithPath:fullPath] autorelease]; +} + ++ (BDAlias *)aliasWithPath:(NSString *)fullPath error:(NSError **)outError +{ + return [[[BDAlias alloc] initWithPath:fullPath error:outError] autorelease]; +} + ++ (BDAlias *)aliasWithPath:(NSString *)path relativeToPath:(NSString *)relPath +{ + return [[[BDAlias alloc] initWithPath:path relativeToPath:relPath] autorelease]; +} + ++ (BDAlias *)aliasWithFSRef:(FSRef *)ref +{ + return [[[BDAlias alloc] initWithFSRef:ref] autorelease]; +} + ++ (BDAlias *)aliasWithFSRef:(FSRef *)ref relativeToFSRef:(FSRef *)relRef +{ + return [[[BDAlias alloc] initWithFSRef:ref relativeToFSRef:relRef] autorelease]; +} + +@end diff --git a/BDAlias.rtf b/BDAlias.rtf new file mode 100644 index 0000000..a32ca81 --- /dev/null +++ b/BDAlias.rtf @@ -0,0 +1,162 @@ +{\rtf1\mac\ansicpg10000\cocoartf102 +{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;} +{\colortbl;\red255\green255\blue255;\red255\green0\blue0;} +\margl1440\margr1440\vieww9000\viewh9000\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\fs24 \cf0 +\f1\b\fs28 \cf2 b\cf0 Distributed.com, Inc. +\f0\b0\fs24 \ + +\fs20 2549 W. Golf Rd. #348\ + Hoffman Estates, IL 60194\ + Phone: (847) 372-3955\ + Fax: (847) 589-3738\ + Web: bdistributed.com\ + Email: info@bdistributed.com\ + +\fs24 \ +Below is a quick reference for the BDAlias class.\ +\ + +\f1\b Instance Methods +\f0\b0 \ +initWithAliasHandle:\ +initWithData:\ +initWithPath:\ +initWithPath:relativeToPath:\ +initWithFSRef:\ +initWithFSRef:relativeToFSRef:\ +dealloc\ +alias\ +setAlias:\ +aliasData\ +setAliasData:\ +fullPath\ +fullPathRelativeToPath:\ +\ + +\f1\b Class Methods +\f0\b0 \ +aliasWithAliasHandle:\ +aliasWithData:\ +aliasWithPath:\ +aliasWithPath:relativeToPath:\ +aliasWithFSRef:\ +aliasWithFSRef:relativeToFSRef:\ +\ + +\f1\b - (id)initWithAliasHandle:(AliasHandle)alias +\f0\b0 \ +Initializes an alias object with the contents of a Carbon alias handle. This is the designated initializer.\ +\ + +\f1\b - (id)initWithData:(NSData *)data +\f0\b0 \ +Initializes an alias object with the contents of a data object.\ +\ + +\f1\b - (id)initWithPath:(NSString *)fullPath +\f0\b0 \ +Initializes an alias object to point to the object at the given path in the filesystem.\ +\ + +\f1\b - (id)initWithPath:(NSString *)path relativeToPath:(NSString *)relPath +\f0\b0 \ +Initializes an alias object to point to the object at the given path in the filesystem, relative to the given relative path.\ +\ + +\f1\b - (id)initWithFSRef:(FSRef *)ref +\f0\b0 \ +Initializes an alias object to point to the object represented by the given Carbon FSRef.\ +\ + +\f1\b - (id)initWithFSRef:(FSRef *)ref relativeToFSRef:(FSRef *)relRef +\f0\b0 \ +Initializes an alias object to point to the object represented by the given Carbon FSRef, relative to the given relative Carbon FSRef.\ +\ + +\f1\b - (void)dealloc +\f0\b0 \ +Releases resources held by an instance.\ +\ + +\f1\b - (AliasHandle)alias +\f0\b0 \ +Returns the internal Carbon alias handle used by an instance.\ +\ + +\f1\b - (void)setAlias:(AliasHandle)newAlias +\f0\b0 \ +Sets the internal Carbon alias handle used by an instance, releasing the previous alias handle (if any).\ +\ + +\f1\b - (NSData *)aliasData +\f0\b0 \ +Returns an autoreleased data object containing a copy of the alias data in this object.\ +\ + +\f1\b - (void)setAliasData:(NSData *)newAliasData +\f0\b0 \ +Sets the alias to use the alias record stored in the given data object. Discards any previous data.\ +\ + +\f1\b - (NSString *)fullPath +\f0\b0 \ +Returns an autoreleased string containing the full path of the object pointed to by an alias.\ +\ + +\f1\b - (NSString *)fullPathRelativeToPath:(NSString *)relPath +\f0\b0 \ +Returns an autoreleased string containing the full path of the object pointed to by an alias, resolved relative to the other given full path.\ +\ + +\f1\b + (BDAlias *)aliasWithAliasHandle:(AliasHandle)alias\ + +\f0\b0 Creates an autoreleased alias object with the contents of the given Carbon alias handle.\ +\ + +\f1\b + (BDAlias *)aliasWithData:(NSData *)data\ + +\f0\b0 Creates an autoreleased alias object with the contents of the given NSData object.\ +\ + +\f1\b + (BDAlias *)aliasWithPath:(NSString *)fullPath\ + +\f0\b0 Creates an autoreleased alias object pointing to the object at the given full path.\ +\ + +\f1\b + (BDAlias *)aliasWithPath:(NSString *)path relativeToPath:(NSString *)relPath\ + +\f0\b0 Creates an autoreleased alias object pointing to the object at the given path, relative to the given relative path.\ +\ + +\f1\b + (BDAlias *)aliasWithFSRef:(FSRef *)ref\ + +\f0\b0 Creates an autoreleased alias object pointing to the object at the given Carbon FSRef.\ +\ + +\f1\b + (BDAlias *)aliasWithFSRef:(FSREf *)ref relativeToFSRef:(FSRef *)relRef\ + +\f0\b0 Creates an autoreleased alias object pointing to the object at the given Carbon FSRef, relative to the given relative Carbon FSRef.\ +\ + +\f1\b License Agreement\ + +\f0\b0 By using or downloading this software, you agree to be bound by the following license. If you do not agree to be bound by the license, please destroy all copies of this software.\ +\ +Copyright \'a9 2001-2002, bDistributed.com, Inc.\ +All rights reserved.\ +\ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\ +\ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li580\fi-580\ql\qnatural +\cf0 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\ +\ +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\ +\ +* Neither the name of bDistributed.com, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. \ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural +\cf0 \ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ +} \ No newline at end of file diff --git a/License.rtf b/License.rtf new file mode 100644 index 0000000..3bbbb7b --- /dev/null +++ b/License.rtf @@ -0,0 +1,21 @@ +{\rtf1\mac\ansicpg10000\cocoartf102 +{\fonttbl\f0\froman\fcharset77 TimesNewRomanPSMT;} +{\colortbl;\red255\green255\blue255;} +\vieww9000\viewh9000\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\fs24 \cf0 Copyright \'a9 2001-2002, bDistributed.com, Inc.\ +All rights reserved.\ +\ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\ +\ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li580\fi-580\ql\qnatural +\cf0 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\ +\ +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\ +\ +* Neither the name of bDistributed.com, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. \ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural +\cf0 \ +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ +} \ No newline at end of file