mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Merge pull request #74 from gnustep/NSFile_changes_branch
NSFile changes branch
This commit is contained in:
commit
f8bdca966f
37 changed files with 2360 additions and 28 deletions
|
@ -37,6 +37,7 @@
|
|||
#import <Foundation/NSObject.h>
|
||||
|
||||
#import <Foundation/NSAffineTransform.h>
|
||||
#import <Foundation/NSAppleScript.h>
|
||||
#import <Foundation/NSArchiver.h>
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSAttributedString.h>
|
||||
|
@ -98,6 +99,8 @@
|
|||
#import <Foundation/NSOperation.h>
|
||||
#import <Foundation/NSOrderedSet.h>
|
||||
#import <Foundation/NSPathUtilities.h>
|
||||
#import <Foundation/NSPersonNameComponents.h>
|
||||
#import <Foundation/NSPersonNameComponentsFormatter.h>
|
||||
#import <Foundation/NSPointerArray.h>
|
||||
#import <Foundation/NSPointerFunctions.h>
|
||||
#import <Foundation/NSPortCoder.h>
|
||||
|
@ -112,6 +115,15 @@
|
|||
#import <Foundation/NSRegularExpression.h>
|
||||
#import <Foundation/NSRunLoop.h>
|
||||
#import <Foundation/NSScanner.h>
|
||||
#import <Foundation/NSScriptClassDescription.h>
|
||||
#import <Foundation/NSScriptCoercionHandler.h>
|
||||
#import <Foundation/NSScriptCommand.h>
|
||||
#import <Foundation/NSScriptCommandDescription.h>
|
||||
#import <Foundation/NSScriptExecutionContext.h>
|
||||
#import <Foundation/NSScriptKeyValueCoding.h>
|
||||
#import <Foundation/NSScriptObjectSpecifiers.h>
|
||||
#import <Foundation/NSScriptStandardSuiteCommands.h>
|
||||
#import <Foundation/NSScriptSuiteRegistry.h>
|
||||
#import <Foundation/NSScriptWhoseTests.h>
|
||||
#import <Foundation/NSSerialization.h>
|
||||
#import <Foundation/NSSet.h>
|
||||
|
|
|
@ -17,46 +17,21 @@ Missing headers:
|
|||
<NSAppleEventDescriptor.h>
|
||||
<NSAppleEventManager.h>
|
||||
<NSAppleScript.h>
|
||||
<NSFileCoordinator.h>
|
||||
<NSFilePresenter.h>
|
||||
<NSFileVersion.h>
|
||||
<NSHFSFileTypes.h>
|
||||
<NSLinguisticTagger.h>
|
||||
<NSObjectScripting.h>
|
||||
<NSOrthography.h>
|
||||
<NSScriptClassDescription.h>
|
||||
<NSScriptCoercionHandler.h>
|
||||
<NSScriptCommand.h>
|
||||
<NSScriptCommandDescription.h>
|
||||
<NSScriptExecutionContext.h>
|
||||
<NSScriptKeyValueCoding.h>
|
||||
<NSScriptObjectSpecifiers.h>
|
||||
<NSScriptStandardSuiteCommands.h>
|
||||
<NSScriptSuiteRegistry.h>>
|
||||
<NSUserNotification.h>
|
||||
<NSUserScriptTask.h>
|
||||
<NSXPCConnection.h>
|
||||
-------------------------------------------------------------
|
||||
Foundation:
|
||||
<NSOrthography.h>
|
||||
<NSFileCoordinator.h>
|
||||
<NSFilePresenter.h>
|
||||
<NSFileVersion.h>
|
||||
<NSLinguisticTagger.h>
|
||||
<NSAppleEventDescriptor.h>
|
||||
<NSAppleEventManager.h>
|
||||
<NSAppleScript.h>
|
||||
<NSHFSFileTypes.h>
|
||||
<NSObjectScripting.h>
|
||||
<NSScriptClassDescription.h>
|
||||
<NSScriptCoercionHandler.h>
|
||||
<NSScriptCommand.h>
|
||||
<NSScriptCommandDescription.h>
|
||||
<NSScriptExecutionContext.h>
|
||||
<NSScriptKeyValueCoding.h>
|
||||
<NSScriptObjectSpecifiers.h>
|
||||
<NSScriptStandardSuiteCommands.h>
|
||||
<NSScriptSuiteRegistry.h>
|
||||
<NSUserScriptTask.h>
|
||||
<NSXPCConnection.h>
|
||||
-------------------------------------------------------------
|
||||
|
|
48
Headers/Foundation/NSAppleScript.h
Normal file
48
Headers/Foundation/NSAppleScript.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSAppleScript
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Thu Sep 26 09:49:55 EDT 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSAppleScript_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSAppleScript_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSAppleScript : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSAppleScript_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
@ -1,15 +1,131 @@
|
|||
/* Definition of class NSFileCoordinator
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
Original File by: Daniel Ferreira
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSFileCoordinator_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSFileCoordinator_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
|
||||
|
||||
@class NSArray, NSError, NSMutableDictionary, NSOperationQueue, NSSet;
|
||||
|
||||
@protocol NSFilePresenter;
|
||||
|
||||
enum {
|
||||
NSFileCoordinatorReadingWithoutChanges = 1 << 0,
|
||||
NSFileCoordinatorReadingResolvesSymbolicLink = 1 << 1,
|
||||
NSFileCoordinatorReadingImmediatelyAvailableMetadataOnly = 1 << 2,
|
||||
NSFileCoordinatorReadingForUploading = 1 << 3,
|
||||
};
|
||||
typedef NSUInteger NSFileCoordinatorReadingOptions;
|
||||
|
||||
enum {
|
||||
NSFileCoordinatorWritingForDeleting = 1 << 0,
|
||||
NSFileCoordinatorWritingForMoving = 1 << 1,
|
||||
NSFileCoordinatorWritingForMerging = 1 << 2,
|
||||
NSFileCoordinatorWritingForReplacing = 1 << 3,
|
||||
NSFileCoordinatorWritingContentIndependentMetadataOnly = 1 << 4,
|
||||
};
|
||||
typedef NSUInteger NSFileCoordinatorWritingOptions;
|
||||
|
||||
@interface NSFileAccessIntent : NSObject
|
||||
{
|
||||
NSURL *_url;
|
||||
BOOL _isRead;
|
||||
NSInteger _options;
|
||||
}
|
||||
+ (instancetype) readingIntentWithURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorReadingOptions)options;
|
||||
+ (instancetype) writingIntentWithURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorWritingOptions)options;
|
||||
- (NSURL *) URL;
|
||||
@end
|
||||
|
||||
DEFINE_BLOCK_TYPE(GSNoEscapeReadWriteHandler, void, NSURL*, NSURL*);
|
||||
DEFINE_BLOCK_TYPE(GSNoEscapeNewURLHandler, void, NSURL*);
|
||||
DEFINE_BLOCK_TYPE(GSAccessorCallbackHandler, void, NSError*);
|
||||
DEFINE_BLOCK_TYPE(GSDualWriteURLCallbackHandler, void, NSURL*, NSURL*);
|
||||
DEFINE_BLOCK_TYPE_NO_ARGS(GSBatchAccessorCompletionHandler, void);
|
||||
DEFINE_BLOCK_TYPE(GSBatchAccessorCompositeBlock, void, GSBatchAccessorCompletionHandler);
|
||||
|
||||
@interface NSFileCoordinator : NSObject
|
||||
@end
|
||||
{
|
||||
id _purposeIdentifier;
|
||||
BOOL _isCancelled;
|
||||
}
|
||||
|
||||
+ (NSArray *) filePresenters;
|
||||
|
||||
- (NSString *) purposeIdentifier;
|
||||
|
||||
- (void) setPurposeIdentifier: (NSString *)ident; // copy
|
||||
|
||||
- (void)cancel;
|
||||
|
||||
- (void)coordinateAccessWithIntents: (NSArray *)intents
|
||||
queue: (NSOperationQueue *)queue
|
||||
byAccessor: (GSAccessorCallbackHandler)accessor;
|
||||
|
||||
- (void)coordinateReadingItemAtURL: (NSURL *)readingURL
|
||||
options: (NSFileCoordinatorReadingOptions)readingOptions
|
||||
writingItemAtURL: (NSURL *)writingURL
|
||||
options: (NSFileCoordinatorWritingOptions)writingOptions
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSNoEscapeReadWriteHandler)readerWriter;
|
||||
|
||||
- (void)coordinateReadingItemAtURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorReadingOptions)options
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSNoEscapeNewURLHandler)reader;
|
||||
|
||||
- (void)coordinateWritingItemAtURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorWritingOptions)options error:(NSError **)outError
|
||||
byAccessor: (GSNoEscapeNewURLHandler)writer;
|
||||
|
||||
- (void)coordinateWritingItemAtURL: (NSURL *)url1
|
||||
options: (NSFileCoordinatorWritingOptions)options1
|
||||
writingItemAtURL: (NSURL *)url2
|
||||
options: (NSFileCoordinatorWritingOptions)options2
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSDualWriteURLCallbackHandler)writer;
|
||||
|
||||
- (void)itemAtURL: (NSURL *)oldURL didMoveToURL: (NSURL *)newURL;
|
||||
|
||||
- (void)itemAtURL: (NSURL *)oldURL willMoveToURL: (NSURL *)newURL;
|
||||
|
||||
- (void)itemAtURL: (NSURL *)url didChangeUbiquityAttributes: (NSSet *)attributes;
|
||||
|
||||
- (void)prepareForReadingItemsAtURLs: (NSArray *)readingURLs
|
||||
options: (NSFileCoordinatorReadingOptions)readingOptions
|
||||
writingItemsAtURLs: (NSArray *)writingURLs
|
||||
options: (NSFileCoordinatorWritingOptions)writingOptions
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSBatchAccessorCompositeBlock)batchAccessor;
|
||||
@end
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,70 @@
|
|||
#ifndef __NSFileCoordinator_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSFileCoordinator_h_GNUSTEP_BASE_INCLUDE
|
||||
/* Definition of class NSFilePresenter
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
Original File by: Daniel Ferreira
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSFilePresenter_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSFilePresenter_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSError, NSFileVersion, NSOperationQueue, NSSet;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
|
||||
|
||||
DEFINE_BLOCK_TYPE_NO_ARGS(GSFilePresenterCompletionHandler, void);
|
||||
DEFINE_BLOCK_TYPE(GSFilePresenterSubitemDeletionHandler, void, NSError*);
|
||||
DEFINE_BLOCK_TYPE_NO_ARGS(GSFilePresenterReacquirer, void);
|
||||
DEFINE_BLOCK_TYPE(GSFilePresentedItemChangesWithCompletionHandler, void, NSError*);
|
||||
|
||||
@protocol NSFilePresenter <NSObject>
|
||||
|
||||
@required
|
||||
- (NSURL *) presentedItemURL;
|
||||
- (NSOperationQueue *) presentedItemOperationQueue;
|
||||
|
||||
@optional
|
||||
- (NSURL *) primaryPresentedItemURL;
|
||||
- (NSString *) observedPresentedItemUbiquityAttributes;
|
||||
|
||||
- (void) accommodatePresentedItemDeletionWithCompletionHandler: (GSFilePresenterCompletionHandler)completionHandler;
|
||||
- (void) accommodatePresentedSubitemDeletionAtURL:(NSURL *)url completionHandler: (GSFilePresenterSubitemDeletionHandler)completionHandler;
|
||||
- (void) presentedItemDidChange;
|
||||
- (void) presentedItemDidChangeUbiquityAttributes: (NSSet *)attributes; // 10.13
|
||||
- (void) presentedItemDidGainVersion: (NSFileVersion *)version;
|
||||
- (void) presentedItemDidLoseVersion: (NSFileVersion *)version;
|
||||
- (void) presentedItemDidMoveToURL: (NSURL *)newURL;
|
||||
- (void) presentedItemDidResolveConflictVersion: (NSFileVersion *)version;
|
||||
- (void) presentedSubitemAtURL: (NSURL *)oldURL didMoveToURL: (NSURL *)newURL;
|
||||
- (void) presentedSubitemAtURL: (NSURL *)url didGainVersion: (NSFileVersion *)version;
|
||||
- (void) presentedSubitemAtURL: (NSURL *)url didLoseVersion: (NSFileVersion *)version;
|
||||
- (void) presentedSubitemAtURL: (NSURL *)url didResolveConflictVersion: (NSFileVersion *)version;
|
||||
- (void) presentedSubitemDidAppearAtURL: (NSURL *)url;
|
||||
- (void) presentedSubitemDidChangeAtURL: (NSURL *)url;
|
||||
- (void) relinquishPresentedItemToReader: (GSFilePresenterReacquirer)reader;
|
||||
- (void) relinquishPresentedItemToWriter: (GSFilePresenterReacquirer)writer;
|
||||
- (void) savePresentedItemChangesWithCompletionHandler: (GSFilePresentedItemChangesWithCompletionHandler)completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,98 @@
|
|||
/* Definition of class NSFileVersion
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
Original File by: Daniel Ferreira
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSFileVersion_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSFileVersion_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSArray, NSDate, NSDictionary, NSError, NSString, NSURL, NSPersonNameComponents;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
|
||||
|
||||
enum {
|
||||
NSFileVersionReplacingByMoving = 1 << 0
|
||||
};
|
||||
typedef NSUInteger NSFileVersionReplacingOptions;
|
||||
|
||||
enum {
|
||||
NSFileVersionAddingByMoving = 1 << 0
|
||||
};
|
||||
typedef NSUInteger NSFileVersionAddingOptions;
|
||||
|
||||
@interface NSFileVersion : NSObject
|
||||
{
|
||||
@private
|
||||
NSURL *_fileURL;
|
||||
NSURL *_contentsURL;
|
||||
id _persistentIdentifier;
|
||||
id _nonLocalVersion;
|
||||
BOOL _isResolved;
|
||||
BOOL _isDiscardable;
|
||||
BOOL _hasThumbnail;
|
||||
BOOL _hasLocalContents;
|
||||
BOOL _conflict;
|
||||
NSString *_localizedName;
|
||||
NSString *_localizedNameOfSavingComputer;
|
||||
NSDate *_modificationDate;
|
||||
}
|
||||
|
||||
// Initializers
|
||||
+ (NSFileVersion *)currentVersionOfItemAtURL: (NSURL *)url;
|
||||
+ (NSArray *)otherVersionsOfItemAtURL: (NSURL *)url;
|
||||
+ (NSFileVersion *)versionOfItemAtURL: (NSURL *)url
|
||||
forPersistentIdentifier: (id)persistentIdentifier;
|
||||
+ (NSURL *)temporaryDirectoryURLForNewVersionOfItemAtURL: (NSURL *)url;
|
||||
+ (NSFileVersion *)addVersionOfItemAtURL: (NSURL *)url
|
||||
withContentsOfURL: (NSURL *)contentsURL
|
||||
options: (NSFileVersionAddingOptions)options
|
||||
error: (NSError **)outError;
|
||||
+ (NSArray *)unresolvedConflictVersionsOfItemAtURL: (NSURL *)url;
|
||||
+ (BOOL)removeOtherVersionsOfItemAtURL: (NSURL *)url
|
||||
error: (NSError **)outError;
|
||||
|
||||
// instance methods...
|
||||
- (BOOL) isDiscardable;
|
||||
- (void) setDiscardable: (BOOL)flag;
|
||||
- (BOOL) isResolved;
|
||||
- (void) setResolved: (BOOL)flag;
|
||||
- (NSDate *) modificationDate;
|
||||
- (NSPersonNameComponents *) originatorNameComponents;
|
||||
- (NSString *) localizedName;
|
||||
- (NSString *) localizedNameOfSavingComputer;
|
||||
- (BOOL) hasLocalContents;
|
||||
- (BOOL) hasThumbnail;
|
||||
- (NSURL *) URL;
|
||||
- (BOOL) conflict;
|
||||
- (id<NSCoding>) persistentIdentifier;
|
||||
|
||||
- (BOOL) removeAndReturnError: (NSError **)outError;
|
||||
- (NSURL *) replaceItemAtURL: (NSURL *)url
|
||||
options: (NSFileVersionReplacingOptions)options
|
||||
error: (NSError **)error;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
65
Headers/Foundation/NSPersonNameComponents.h
Normal file
65
Headers/Foundation/NSPersonNameComponents.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* Definition of class NSPersonNameComponents
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSString;
|
||||
|
||||
@interface NSPersonNameComponents : NSObject <NSCopying, NSCoding>
|
||||
{
|
||||
@private
|
||||
NSString *_namePrefix;
|
||||
NSString *_givenName;
|
||||
NSString *_middleName;
|
||||
NSString *_familyName;
|
||||
NSString *_nameSuffix;
|
||||
NSString *_nickname;
|
||||
NSPersonNameComponents *_phoneticRepresentation;
|
||||
}
|
||||
|
||||
- (NSString *) namePrefix;
|
||||
- (void) setNamePrefix: (NSString *)namePrefix;
|
||||
- (NSString *) givenName;
|
||||
- (void) setGivenName: (NSString *)givenName;
|
||||
- (NSString *) middleName;
|
||||
- (void) setMiddleName: (NSString *)middleName;
|
||||
- (NSString *) familyName;
|
||||
- (void) setFamilyName: (NSString *)familyName;
|
||||
- (NSString *) nameSuffix;
|
||||
- (void) setNameSuffix: (NSString *)nameSuffix;
|
||||
- (NSString *) nickname;
|
||||
- (void) setNickname: (NSString *)nickname;
|
||||
|
||||
- (NSPersonNameComponents *) phoneticRepresentation;
|
||||
- (void) setPhoneticRepresentation: (NSPersonNameComponents *)pr;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
#endif
|
90
Headers/Foundation/NSPersonNameComponentsFormatter.h
Normal file
90
Headers/Foundation/NSPersonNameComponentsFormatter.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/* Definition of class NSPersonNameComponents
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSPersonNameComponentsFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSPersonNameComponentsFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
|
||||
#import <Foundation/NSFormatter.h>
|
||||
#import <Foundation/NSPersonNameComponents.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11,GS_API_LATEST)
|
||||
|
||||
// Style...
|
||||
enum {
|
||||
NSPersonNameComponentsFormatterStyleDefault = 0,
|
||||
NSPersonNameComponentsFormatterStyleShort,
|
||||
NSPersonNameComponentsFormatterStyleMedium,
|
||||
NSPersonNameComponentsFormatterStyleLong,
|
||||
NSPersonNameComponentsFormatterStyleAbbreviated
|
||||
};
|
||||
typedef NSUInteger NSPersonNameComponentsFormatterStyle;
|
||||
|
||||
// Options...
|
||||
enum { NSPersonNameComponentsFormatterPhonetic = (1UL << 1) };
|
||||
typedef NSUInteger NSPersonNameComponentsFormatterOptions;
|
||||
|
||||
@class NSString;
|
||||
|
||||
@interface NSPersonNameComponentsFormatter : NSFormatter
|
||||
{
|
||||
@private
|
||||
BOOL _phonetic;
|
||||
NSPersonNameComponentsFormatterStyle _style;
|
||||
NSPersonNameComponentsFormatterOptions _nameOptions;
|
||||
}
|
||||
|
||||
// Designated init...
|
||||
+ (NSString *) localizedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||
style: (NSPersonNameComponentsFormatterStyle)nameFormatStyle
|
||||
options: (NSPersonNameComponentsFormatterOptions)nameOptions;
|
||||
|
||||
// Setters
|
||||
- (NSPersonNameComponentsFormatterStyle) style;
|
||||
- (void) setStyle: (NSPersonNameComponentsFormatterStyle)style;
|
||||
- (BOOL) isPhonetic;
|
||||
- (void) setPhonetic: (BOOL)flag;
|
||||
|
||||
// Convenience methods...
|
||||
- (NSString *) stringFromPersonNameComponents: (NSPersonNameComponents *)components;
|
||||
- (NSAttributedString *) annotatedStringFromPersonNameComponents: (NSPersonNameComponents *)components;
|
||||
- (NSPersonNameComponents *) personNameComponentsFromString: (NSString *)string;
|
||||
- (BOOL)getObjectValue: (id *)obj
|
||||
forString: (NSString *)string
|
||||
errorDescription: (NSString **)error;
|
||||
|
||||
@end
|
||||
|
||||
// components for attributed strings;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentKey;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentGivenName;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentFamilyName;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentMiddleName;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentPrefix;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentSuffix;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentNickname;
|
||||
GS_EXPORT NSString * const NSPersonNameComponentDelimiter;
|
||||
|
||||
#endif
|
||||
#endif
|
48
Headers/Foundation/NSScriptClassDescription.h
Normal file
48
Headers/Foundation/NSScriptClassDescription.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptClassDescription
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptClassDescription_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptClassDescription_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSClassDescription.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptClassDescription : NSClassDescription
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptClassDescription_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptCoercionHandler.h
Normal file
48
Headers/Foundation/NSScriptCoercionHandler.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptCoercionHandler
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptCoercionHandler_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptCoercionHandler_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptCoercionHandler : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptCoercionHandler_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptCommand.h
Normal file
48
Headers/Foundation/NSScriptCommand.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptCommand
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptCommand_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptCommand_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptCommand : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptCommand_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptCommandDescription.h
Normal file
48
Headers/Foundation/NSScriptCommandDescription.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptCommandDescription
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptCommandDescription_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptCommandDescription_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptCommandDescription : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptCommandDescription_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptExecutionContext.h
Normal file
48
Headers/Foundation/NSScriptExecutionContext.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptExecutionContext
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptExecutionContext_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptExecutionContext_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptExecutionContext : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptExecutionContext_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptKeyValueCoding.h
Normal file
48
Headers/Foundation/NSScriptKeyValueCoding.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptKeyValueCoding
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptKeyValueCoding_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptKeyValueCoding_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptKeyValueCoding : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptKeyValueCoding_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptObjectSpecifiers.h
Normal file
48
Headers/Foundation/NSScriptObjectSpecifiers.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptObjectSpecifiers
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptObjectSpecifiers_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptObjectSpecifiers_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptObjectSpecifiers : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptObjectSpecifiers_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptStandardSuiteCommands.h
Normal file
48
Headers/Foundation/NSScriptStandardSuiteCommands.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptStandardSuiteCommands
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptStandardSuiteCommands_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptStandardSuiteCommands_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptStandardSuiteCommands : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptStandardSuiteCommands_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSScriptSuiteRegistry.h
Normal file
48
Headers/Foundation/NSScriptSuiteRegistry.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSScriptSuiteRegistry
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSScriptSuiteRegistry_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSScriptSuiteRegistry_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSScriptSuiteRegistry : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSScriptSuiteRegistry_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
48
Headers/Foundation/NSUserScriptTask.h
Normal file
48
Headers/Foundation/NSUserScriptTask.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
/* Definition of class NSUserScriptTask
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSUserScriptTask_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSUserScriptTask_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
@interface NSUserScriptTask : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSUserScriptTask_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
@ -189,6 +189,7 @@ GSSocksParser/GSSocksParserPrivate.m \
|
|||
GSSocksParser/GSSocks4Parser.m \
|
||||
GSSocksParser/GSSocks5Parser.m \
|
||||
NSAffineTransform.m \
|
||||
NSAppleScript.m \
|
||||
NSArchiver.m \
|
||||
NSArray.m \
|
||||
NSAssertionHandler.m \
|
||||
|
@ -262,6 +263,8 @@ NSOperation.m \
|
|||
NSOrderedSet.m \
|
||||
NSPage.m \
|
||||
NSPathUtilities.m \
|
||||
NSPersonNameComponents.m \
|
||||
NSPersonNameComponentsFormatter.m \
|
||||
NSPipe.m \
|
||||
NSPointerArray.m \
|
||||
NSPointerFunctions.m \
|
||||
|
@ -280,6 +283,16 @@ NSRange.m \
|
|||
NSRegularExpression.m\
|
||||
NSRunLoop.m \
|
||||
NSScanner.m \
|
||||
NSScriptClassDescription.m \
|
||||
NSScriptCoercionHandler.m \
|
||||
NSScriptCommand.m \
|
||||
NSScriptCommandDescription.m \
|
||||
NSScriptExecutionContext.m \
|
||||
NSScriptKeyValueCoding.m \
|
||||
NSScriptObjectSpecifiers.m \
|
||||
NSScriptStandardSuiteCommands.m \
|
||||
NSScriptSuiteRegistry.m \
|
||||
NSUserScriptTask.m \
|
||||
NSSerializer.m \
|
||||
NSSet.m \
|
||||
NSSocketPort.m \
|
||||
|
@ -369,6 +382,7 @@ FOUNDATION_HEADERS = \
|
|||
Foundation.h \
|
||||
FoundationErrors.h \
|
||||
NSAffineTransform.h \
|
||||
NSAppleScript.h \
|
||||
NSArchiver.h \
|
||||
NSArray.h \
|
||||
NSAttributedString.h \
|
||||
|
@ -436,6 +450,8 @@ NSObject.h \
|
|||
NSOperation.h \
|
||||
NSOrderedSet.h \
|
||||
NSPathUtilities.h \
|
||||
NSPersonNameComponents.h \
|
||||
NSPersonNameComponentsFormatter.h \
|
||||
NSPointerArray.h \
|
||||
NSPointerFunctions.h \
|
||||
NSPortCoder.h \
|
||||
|
@ -452,6 +468,16 @@ NSRange.h \
|
|||
NSRegularExpression.h\
|
||||
NSRunLoop.h \
|
||||
NSScanner.h \
|
||||
NSScriptClassDescription.h \
|
||||
NSScriptCoercionHandler.h \
|
||||
NSScriptCommand.h \
|
||||
NSScriptCommandDescription.h \
|
||||
NSScriptExecutionContext.h \
|
||||
NSScriptKeyValueCoding.h \
|
||||
NSScriptObjectSpecifiers.h \
|
||||
NSScriptStandardSuiteCommands.h \
|
||||
NSScriptSuiteRegistry.h \
|
||||
NSUserScriptTask.h \
|
||||
NSScriptWhoseTests.h \
|
||||
NSSerialization.h \
|
||||
NSSet.h \
|
||||
|
|
31
Source/NSAppleScript.m
Normal file
31
Source/NSAppleScript.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSAppleScript
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Thu Sep 26 09:49:55 EDT 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSAppleScript.h>
|
||||
|
||||
@implementation NSAppleScript
|
||||
|
||||
@end
|
||||
|
|
@ -67,6 +67,12 @@ GS_PRIVATE_INTERNAL(NSByteCountFormatter)
|
|||
return [formatter stringFromByteCount: byteCount];
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue: (id)obj
|
||||
{
|
||||
long long byteCount = [obj longLongValue];
|
||||
return [self stringFromByteCount: byteCount];
|
||||
}
|
||||
|
||||
- (NSByteCountFormatterUnits) _adaptiveSettings: (double)byteCount
|
||||
{
|
||||
NSByteCountFormatterUnits units = NSByteCountFormatterUseDefault;
|
||||
|
|
|
@ -1,7 +1,288 @@
|
|||
/* Definition of class NSFileCoordinator
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
Original File by: Daniel Ferreira
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSFileCoordinator.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSFilePresenter.h>
|
||||
#import <Foundation/NSOperation.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
static NSMutableArray *__presenters = nil;
|
||||
static NSMutableDictionary *__presenterMap = nil;
|
||||
static unsigned int __pid = 0;
|
||||
static NSMutableDictionary *__presenterIdDict = nil;
|
||||
|
||||
@implementation NSFileAccessIntent
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
_url = nil;
|
||||
_isRead = NO;
|
||||
_options = 0L;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype) readingIntentWithURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorReadingOptions)options
|
||||
{
|
||||
NSFileAccessIntent *result = [[self alloc] init];
|
||||
ASSIGNCOPY(result->_url, url);
|
||||
result->_options = options;
|
||||
result->_isRead = YES;
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (instancetype) writingIntentWithURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorWritingOptions)options
|
||||
{
|
||||
NSFileAccessIntent *result = [[self alloc] init];
|
||||
ASSIGNCOPY(result->_url, url);
|
||||
result->_options = options;
|
||||
result->_isRead = NO;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSURL *) URL
|
||||
{
|
||||
return _url;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSFileCoordinator
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if(self == [NSFileCoordinator class])
|
||||
{
|
||||
__presenters = [[NSMutableArray alloc] init];
|
||||
__presenterMap = [[NSMutableDictionary alloc] init];
|
||||
__presenterIdDict = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray *) filePresenters
|
||||
{
|
||||
return __presenters;
|
||||
}
|
||||
|
||||
+ (void) addFilePresenter: (id)presenter
|
||||
{
|
||||
[__presenters addObject: presenter];
|
||||
[__presenterMap setObject: presenter forKey: [presenter presentedItemURL]];
|
||||
[__presenterIdDict setObject: presenter forKey: [presenter purposeIdentifier]];
|
||||
}
|
||||
|
||||
+ (void) removeFilePresenter: (id)presenter
|
||||
{
|
||||
[__presenters removeObject: presenter];
|
||||
[__presenterMap removeObjectForKey: [presenter presentedItemURL]];
|
||||
[__presenterIdDict removeObjectForKey: [presenter purposeIdentifier]];
|
||||
}
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
NSString *p = nil;
|
||||
|
||||
__pid++;
|
||||
p = [NSString stringWithFormat: @"%d",__pid];
|
||||
_purposeIdentifier = RETAIN(p);
|
||||
_isCancelled = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *) purposeIdentifier
|
||||
{
|
||||
return _purposeIdentifier;
|
||||
}
|
||||
|
||||
- (void) setPurposeIdentifier: (NSString *)ident // copy
|
||||
{
|
||||
ASSIGNCOPY(_purposeIdentifier, ident);
|
||||
}
|
||||
|
||||
- (void)cancel
|
||||
{
|
||||
NSEnumerator *en = [__presenters objectEnumerator];
|
||||
id obj = nil;
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
id<NSFilePresenter> o = (id<NSFilePresenter>)obj;
|
||||
NSOperationQueue *q = [o presentedItemOperationQueue];
|
||||
[q cancelAllOperations];
|
||||
}
|
||||
_isCancelled = YES;
|
||||
}
|
||||
|
||||
- (void)coordinateAccessWithIntents: (NSArray *)intents
|
||||
queue: (NSOperationQueue *)queue
|
||||
byAccessor: (GSAccessorCallbackHandler)accessor
|
||||
{
|
||||
NSEnumerator *en = [intents objectEnumerator];
|
||||
id obj = nil;
|
||||
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock: accessor];
|
||||
[queue addOperation: op];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)coordinateReadingItemAtURL: (NSURL *)readingURL
|
||||
options: (NSFileCoordinatorReadingOptions)readingOptions
|
||||
writingItemAtURL: (NSURL *)writingURL
|
||||
options: (NSFileCoordinatorWritingOptions)writingOptions
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSNoEscapeReadWriteHandler)readerWriter
|
||||
{
|
||||
if(readingOptions == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: readingURL];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
if(writingOptions == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: writingURL];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
CALL_BLOCK(readerWriter, readingURL, writingURL);
|
||||
}
|
||||
|
||||
- (void)coordinateReadingItemAtURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorReadingOptions)options
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSNoEscapeNewURLHandler)reader
|
||||
{
|
||||
if(options == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
CALL_BLOCK(reader, url);
|
||||
}
|
||||
|
||||
- (void)coordinateWritingItemAtURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorWritingOptions)options
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSNoEscapeNewURLHandler)writer
|
||||
{
|
||||
if(options == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
CALL_BLOCK(writer, url);
|
||||
}
|
||||
|
||||
- (void)coordinateWritingItemAtURL: (NSURL *)url1
|
||||
options: (NSFileCoordinatorWritingOptions)options1
|
||||
writingItemAtURL: (NSURL *)url2
|
||||
options: (NSFileCoordinatorWritingOptions)options2
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSDualWriteURLCallbackHandler)writer
|
||||
{
|
||||
if(options1 == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url1];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
if(options2 == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url2];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
CALL_BLOCK(writer, url1, url2);
|
||||
}
|
||||
|
||||
- (void)itemAtURL: (NSURL *)oldURL didMoveToURL: (NSURL *)newURL
|
||||
{
|
||||
id<NSFilePresenter> presenter = [__presenterMap objectForKey: oldURL];
|
||||
[presenter presentedItemDidMoveToURL: newURL];
|
||||
}
|
||||
|
||||
- (void)itemAtURL: (NSURL *)oldURL willMoveToURL: (NSURL *)newURL
|
||||
{
|
||||
id<NSFilePresenter> presenter = [__presenterMap objectForKey: oldURL];
|
||||
[presenter presentedItemDidChange]; // there is no "Will" method for this, so I am a bit perplexed.
|
||||
}
|
||||
|
||||
- (void)itemAtURL: (NSURL *)url didChangeUbiquityAttributes: (NSSet *)attributes
|
||||
{
|
||||
id<NSFilePresenter> presenter = [__presenterMap objectForKey: url];
|
||||
[presenter presentedItemDidChangeUbiquityAttributes: attributes];
|
||||
}
|
||||
|
||||
- (void)prepareForReadingItemsAtURLs: (NSArray *)readingURLs
|
||||
options: (NSFileCoordinatorReadingOptions)readingOptions
|
||||
writingItemsAtURLs: (NSArray *)writingURLs
|
||||
options: (NSFileCoordinatorWritingOptions)writingOptions
|
||||
error: (NSError **)outError
|
||||
byAccessor: (GSBatchAccessorCompositeBlock)batchAccessor
|
||||
{
|
||||
if(readingOptions == 0L)
|
||||
{
|
||||
NSEnumerator *en = [readingURLs objectEnumerator];
|
||||
NSURL *aurl = nil;
|
||||
while((aurl = [en nextObject]) != nil)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: aurl];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler:NULL];
|
||||
}
|
||||
}
|
||||
}
|
||||
// CALL_BLOCK(batchAccessor, batchAccessor.argTys[0]); // NOT SURE HOW TO CALL COMPOSITE BLOCK
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,4 +1,253 @@
|
|||
/* Definition of class NSFileVersion
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
Original File by: Daniel Ferreira
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSFileVersion.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSDate.h>
|
||||
#include <Foundation/NSError.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSURL.h>
|
||||
#include <Foundation/NSPersonNameComponents.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSData.h>
|
||||
|
||||
@interface NSFileVersion (Private)
|
||||
- (void) _setURL: (NSURL *)u;
|
||||
- (void) _setContentsURL: (NSURL *)u;
|
||||
- (void) _setConflict: (BOOL)f;
|
||||
- (void) _setLocalizedName: (NSString *)name;
|
||||
- (void) _initWithURL: (NSURL *)url;
|
||||
@end
|
||||
|
||||
@implementation NSFileVersion (Private)
|
||||
- (void) _setURL: (NSURL *)u
|
||||
{
|
||||
ASSIGNCOPY(_fileURL, u);
|
||||
}
|
||||
|
||||
- (void) _setContentsURL: (NSURL *)u
|
||||
{
|
||||
ASSIGNCOPY(_contentsURL, u);
|
||||
}
|
||||
|
||||
- (void) _setConflict: (BOOL)f
|
||||
{
|
||||
_conflict = f;
|
||||
}
|
||||
|
||||
- (void) _setLocalizedName: (NSString *)name
|
||||
{
|
||||
ASSIGNCOPY(_localizedName, name);
|
||||
}
|
||||
|
||||
- (void) _initWithURL: (NSURL *)url
|
||||
{
|
||||
[self _setURL: url];
|
||||
[self _setContentsURL: url];
|
||||
[self _setConflict: NO];
|
||||
[self _setLocalizedName: [url path]];
|
||||
[self setDiscardable: NO];
|
||||
[self setResolved: YES];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSFileVersion
|
||||
|
||||
// Initializers
|
||||
+ (NSFileVersion *)currentVersionOfItemAtURL: (NSURL *)url
|
||||
{
|
||||
NSFileVersion *fileVersion = AUTORELEASE([[NSFileVersion alloc] init]);
|
||||
if (fileVersion != nil)
|
||||
{
|
||||
[fileVersion _initWithURL: url];
|
||||
}
|
||||
return fileVersion;
|
||||
}
|
||||
|
||||
+ (NSArray *)otherVersionsOfItemAtURL: (NSURL *)url
|
||||
{
|
||||
NSArray *array = AUTORELEASE([[NSArray alloc] init]);
|
||||
return array;
|
||||
}
|
||||
|
||||
+ (NSFileVersion *)versionOfItemAtURL: (NSURL *)url
|
||||
forPersistentIdentifier: (id)persistentIdentifier
|
||||
{
|
||||
return [NSFileVersion currentVersionOfItemAtURL: url];
|
||||
}
|
||||
|
||||
+ (NSURL *)temporaryDirectoryURLForNewVersionOfItemAtURL: (NSURL *)url
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSFileVersion *)addVersionOfItemAtURL: (NSURL *)url
|
||||
withContentsOfURL: (NSURL *)contentsURL
|
||||
options: (NSFileVersionAddingOptions)options
|
||||
error: (NSError **)outError
|
||||
{
|
||||
NSFileVersion *fileVersion = AUTORELEASE([[NSFileVersion alloc] init]);
|
||||
if (fileVersion != nil)
|
||||
{
|
||||
NSData *data = [NSData dataWithContentsOfURL: contentsURL];
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
|
||||
[fileVersion _initWithURL: url];
|
||||
|
||||
// Create new file...
|
||||
[mgr createFileAtPath: [url path]
|
||||
contents: data
|
||||
attributes: nil];
|
||||
}
|
||||
return fileVersion;
|
||||
}
|
||||
|
||||
+ (NSArray *)unresolvedConflictVersionsOfItemAtURL: (NSURL *)url
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (BOOL)removeOtherVersionsOfItemAtURL: (NSURL *)url
|
||||
error: (NSError **)outError
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
return [mgr removeItemAtPath: [url path] error: outError];
|
||||
}
|
||||
|
||||
// Instance methods...
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
_isDiscardable = NO;
|
||||
_isResolved = NO;
|
||||
_modificationDate = [[NSDate alloc] init];
|
||||
_fileURL = nil;
|
||||
_contentsURL = nil;
|
||||
_persistentIdentifier = nil;
|
||||
_nonLocalVersion = nil;
|
||||
_hasThumbnail = NO;
|
||||
_hasLocalContents = YES;
|
||||
_conflict = NO;
|
||||
_localizedName = nil;
|
||||
_localizedNameOfSavingComputer = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isDiscardable
|
||||
{
|
||||
return _isDiscardable;
|
||||
}
|
||||
|
||||
- (void) setDiscardable: (BOOL)flag
|
||||
{
|
||||
_isDiscardable = flag;
|
||||
}
|
||||
|
||||
- (BOOL) isResolved
|
||||
{
|
||||
return _isResolved;
|
||||
}
|
||||
|
||||
- (void) setResolved: (BOOL)flag
|
||||
{
|
||||
_isResolved = flag;
|
||||
}
|
||||
|
||||
- (NSDate *) modificationDate
|
||||
{
|
||||
return _modificationDate;
|
||||
}
|
||||
|
||||
- (NSPersonNameComponents *) originatorNameComponents
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) localizedName
|
||||
{
|
||||
return _localizedName;
|
||||
}
|
||||
|
||||
- (NSString *) localizedNameOfSavingComputer
|
||||
{
|
||||
return _localizedNameOfSavingComputer;
|
||||
}
|
||||
|
||||
- (BOOL) hasLocalContents
|
||||
{
|
||||
return _hasLocalContents;
|
||||
}
|
||||
|
||||
- (BOOL) hasThumbnail
|
||||
{
|
||||
return _hasThumbnail;
|
||||
}
|
||||
|
||||
- (NSURL *) URL
|
||||
{
|
||||
return _fileURL;
|
||||
}
|
||||
|
||||
- (BOOL) conflict
|
||||
{
|
||||
return _conflict;
|
||||
}
|
||||
|
||||
- (id<NSCoding>) persistentIdentifier
|
||||
{
|
||||
return _persistentIdentifier;
|
||||
}
|
||||
|
||||
- (BOOL) removeAndReturnError: (NSError **)outError
|
||||
{
|
||||
NSURL *url = [self URL];
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
return [mgr removeItemAtPath: [url path] error: outError];
|
||||
}
|
||||
|
||||
- (NSURL *) replaceItemAtURL: (NSURL *)url
|
||||
options: (NSFileVersionReplacingOptions)options
|
||||
error: (NSError **)error
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
if([mgr removeItemAtPath: [url path] error: error])
|
||||
{
|
||||
NSData *data = [NSData dataWithContentsOfURL: _contentsURL];
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
|
||||
// Create new file...
|
||||
[mgr createFileAtPath: [url path]
|
||||
contents: data
|
||||
attributes: nil];
|
||||
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
206
Source/NSPersonNameComponents.m
Normal file
206
Source/NSPersonNameComponents.m
Normal file
|
@ -0,0 +1,206 @@
|
|||
/* Definition of class NSPersonNameComponents
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#import "common.h"
|
||||
#import "Foundation/NSCoder.h"
|
||||
#import "Foundation/NSString.h"
|
||||
#import "Foundation/NSPersonNameComponents.h"
|
||||
|
||||
@implementation NSPersonNameComponents
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
if((self = [super init]) != nil)
|
||||
{
|
||||
_namePrefix = nil;
|
||||
_givenName = nil;
|
||||
_middleName = nil;
|
||||
_familyName = nil;
|
||||
_nameSuffix = nil;
|
||||
_nickname = nil;
|
||||
_phoneticRepresentation = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
if((self = [self init]) != nil)
|
||||
{
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
_namePrefix = [aCoder decodeObjectForKey: @"namePrefix"];
|
||||
_givenName = [aCoder decodeObjectForKey: @"givenName"];
|
||||
_middleName = [aCoder decodeObjectForKey: @"middleName"];
|
||||
_familyName = [aCoder decodeObjectForKey: @"familyName"];
|
||||
_nameSuffix = [aCoder decodeObjectForKey: @"nameSuffix"];
|
||||
_nickname = [aCoder decodeObjectForKey: @"nickname"];
|
||||
_phoneticRepresentation = [aCoder decodeObjectForKey: @"phoneticRepresentation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_namePrefix = [aCoder decodeObject];
|
||||
_givenName = [aCoder decodeObject];
|
||||
_middleName = [aCoder decodeObject];
|
||||
_familyName = [aCoder decodeObject];
|
||||
_nameSuffix = [aCoder decodeObject];
|
||||
_nickname = [aCoder decodeObject];
|
||||
_phoneticRepresentation = [aCoder decodeObject];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: _namePrefix
|
||||
forKey: @"namePrefix"];
|
||||
[aCoder encodeObject: _givenName
|
||||
forKey: @"givenName"];
|
||||
[aCoder encodeObject: _middleName
|
||||
forKey: @"middleName"];
|
||||
[aCoder encodeObject: _familyName
|
||||
forKey: @"familyName"];
|
||||
[aCoder encodeObject: _nameSuffix
|
||||
forKey: @"nameSuffix"];
|
||||
[aCoder encodeObject: _nameSuffix
|
||||
forKey: @"nameSuffix"];
|
||||
[aCoder encodeObject: _phoneticRepresentation
|
||||
forKey: @"phoneticRepresentation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _namePrefix];
|
||||
[aCoder encodeObject: _givenName];
|
||||
[aCoder encodeObject: _middleName];
|
||||
[aCoder encodeObject: _familyName];
|
||||
[aCoder encodeObject: _nameSuffix];
|
||||
[aCoder encodeObject: _nameSuffix];
|
||||
[aCoder encodeObject: _phoneticRepresentation];
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype) copyWithZone: (NSZone *)zone
|
||||
{
|
||||
NSPersonNameComponents *copy =
|
||||
[[NSPersonNameComponents allocWithZone: zone] init];
|
||||
|
||||
[copy setNamePrefix: [self namePrefix]];
|
||||
[copy setGivenName: [self givenName]];
|
||||
[copy setMiddleName: [self middleName]];
|
||||
[copy setFamilyName: [self familyName]];
|
||||
[copy setNameSuffix: [self nameSuffix]];
|
||||
[copy setNickname: [self nickname]];
|
||||
[copy setPhoneticRepresentation: [self phoneticRepresentation]];
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_namePrefix);
|
||||
RELEASE(_givenName);
|
||||
RELEASE(_middleName);
|
||||
RELEASE(_familyName);
|
||||
RELEASE(_nameSuffix);
|
||||
RELEASE(_nickname);
|
||||
RELEASE(_phoneticRepresentation);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) namePrefix
|
||||
{
|
||||
return _namePrefix;
|
||||
}
|
||||
|
||||
- (void) setNamePrefix: (NSString *)namePrefix
|
||||
{
|
||||
ASSIGNCOPY(_namePrefix, namePrefix);
|
||||
}
|
||||
|
||||
- (NSString *) givenName
|
||||
{
|
||||
return _givenName;
|
||||
}
|
||||
|
||||
- (void) setGivenName: (NSString *)givenName
|
||||
{
|
||||
ASSIGNCOPY(_givenName, givenName);
|
||||
}
|
||||
|
||||
- (NSString *) middleName
|
||||
{
|
||||
return _middleName;
|
||||
}
|
||||
|
||||
- (void) setMiddleName: (NSString *)middleName
|
||||
{
|
||||
ASSIGNCOPY(_middleName, middleName);
|
||||
}
|
||||
|
||||
- (NSString *) familyName
|
||||
{
|
||||
return _familyName;
|
||||
}
|
||||
|
||||
- (void) setFamilyName: (NSString *)familyName
|
||||
{
|
||||
ASSIGNCOPY(_familyName, familyName);
|
||||
}
|
||||
|
||||
- (NSString *) nameSuffix
|
||||
{
|
||||
return _nameSuffix;
|
||||
}
|
||||
|
||||
- (void) setNameSuffix: (NSString *)nameSuffix
|
||||
{
|
||||
ASSIGNCOPY(_nameSuffix, nameSuffix);
|
||||
}
|
||||
|
||||
- (NSString *) nickname
|
||||
{
|
||||
return _nickname;
|
||||
}
|
||||
|
||||
- (void) setNickname: (NSString *)nickname
|
||||
{
|
||||
ASSIGNCOPY(_nickname, nickname);
|
||||
}
|
||||
|
||||
- (NSPersonNameComponents *) phoneticRepresentation
|
||||
{
|
||||
return _phoneticRepresentation;
|
||||
}
|
||||
|
||||
- (void) setPhoneticRepresentation: (NSPersonNameComponents *)pr
|
||||
{
|
||||
ASSIGNCOPY(_phoneticRepresentation, pr);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
236
Source/NSPersonNameComponentsFormatter.m
Normal file
236
Source/NSPersonNameComponentsFormatter.m
Normal file
|
@ -0,0 +1,236 @@
|
|||
/* Definition of class NSPersonNameComponentsFormatter
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#import "Foundation/NSString.h"
|
||||
#import "Foundation/NSAttributedString.h"
|
||||
#import "Foundation/NSPersonNameComponents.h"
|
||||
#import "Foundation/NSPersonNameComponentsFormatter.h"
|
||||
|
||||
@implementation NSPersonNameComponentsFormatter
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
_phonetic = NO;
|
||||
_style = NSPersonNameComponentsFormatterStyleDefault;
|
||||
_nameOptions = 0L;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) _setNameOptions: (NSPersonNameComponentsFormatterOptions)opts
|
||||
{
|
||||
_nameOptions = opts;
|
||||
}
|
||||
|
||||
// Designated init...
|
||||
+ (NSString *) localizedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||
style: (NSPersonNameComponentsFormatterStyle)nameFormatStyle
|
||||
options: (NSPersonNameComponentsFormatterOptions)nameOptions
|
||||
{
|
||||
NSPersonNameComponentsFormatter *fmt = [[NSPersonNameComponentsFormatter alloc] init];
|
||||
[fmt setStyle: nameFormatStyle];
|
||||
[fmt _setNameOptions: nameOptions];
|
||||
return [fmt stringForObjectValue: components] ;
|
||||
}
|
||||
|
||||
// Setters
|
||||
- (NSPersonNameComponentsFormatterStyle) style
|
||||
{
|
||||
return _style;
|
||||
}
|
||||
|
||||
- (void) setStyle: (NSPersonNameComponentsFormatterStyle)style
|
||||
{
|
||||
_style = style;
|
||||
}
|
||||
|
||||
- (BOOL) isPhonetic
|
||||
{
|
||||
return _phonetic;
|
||||
}
|
||||
|
||||
- (void) setPhonetic: (BOOL)flag
|
||||
{
|
||||
_phonetic = flag;
|
||||
}
|
||||
|
||||
// Convenience methods...
|
||||
- (NSString *) stringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||
{
|
||||
NSString *result = @"";
|
||||
|
||||
switch (_style)
|
||||
{
|
||||
case NSPersonNameComponentsFormatterStyleDefault:
|
||||
case NSPersonNameComponentsFormatterStyleMedium:
|
||||
result = [result stringByAppendingString: [components givenName]];
|
||||
result = [result stringByAppendingString: @" "];
|
||||
result = [result stringByAppendingString: [components familyName]];
|
||||
break;
|
||||
case NSPersonNameComponentsFormatterStyleShort:
|
||||
result = [result stringByAppendingString: [components givenName]];
|
||||
break;
|
||||
case NSPersonNameComponentsFormatterStyleLong:
|
||||
result = [result stringByAppendingString: [components namePrefix]];
|
||||
result = [result stringByAppendingString: @" "];
|
||||
result = [result stringByAppendingString: [components givenName]];
|
||||
result = [result stringByAppendingString: @" "];
|
||||
result = [result stringByAppendingString: [components familyName]];
|
||||
result = [result stringByAppendingString: @" "];
|
||||
result = [result stringByAppendingString: [components nameSuffix]];
|
||||
break;
|
||||
case NSPersonNameComponentsFormatterStyleAbbreviated:
|
||||
result = [result stringByAppendingString: [[components givenName] substringToIndex: 1]];
|
||||
result = [result stringByAppendingString: [[components familyName] substringToIndex: 1]];
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSAttributedString *) annotatedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||
{
|
||||
NSAttributedString *result = AUTORELEASE([[NSAttributedString alloc] initWithString:
|
||||
[self stringFromPersonNameComponents: components]]);
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSPersonNameComponents *) personNameComponentsFromString: (NSString *)string
|
||||
{
|
||||
NSPersonNameComponents *pnc = AUTORELEASE([[NSPersonNameComponents alloc] init]);
|
||||
NSArray *nameArray = [string componentsSeparatedByString: @" "];
|
||||
NSUInteger count = [nameArray count];
|
||||
|
||||
switch(count)
|
||||
{
|
||||
case 1:
|
||||
[pnc setNickname: [nameArray objectAtIndex: 0]];
|
||||
case 2:
|
||||
[pnc setGivenName: [nameArray objectAtIndex: 0]];
|
||||
[pnc setFamilyName: [nameArray objectAtIndex: 1]];
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
NSString *first = [[nameArray objectAtIndex: 0] lowercaseString];
|
||||
if([first isEqualToString: @"mr"] ||
|
||||
[first isEqualToString: @"ms"] ||
|
||||
[first isEqualToString: @"mrs"] ||
|
||||
[first isEqualToString: @"dr"])
|
||||
{
|
||||
[pnc setNamePrefix: [nameArray objectAtIndex: 0]];
|
||||
[pnc setGivenName: [nameArray objectAtIndex: 1]];
|
||||
[pnc setFamilyName: [nameArray objectAtIndex: 2]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[pnc setGivenName: [nameArray objectAtIndex: 0]];
|
||||
[pnc setMiddleName: [nameArray objectAtIndex: 1]];
|
||||
[pnc setFamilyName: [nameArray objectAtIndex: 2]];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
NSString *first = [[nameArray objectAtIndex: 0] lowercaseString];
|
||||
if([first isEqualToString: @"mr."] ||
|
||||
[first isEqualToString: @"ms."] ||
|
||||
[first isEqualToString: @"mrs."] ||
|
||||
[first isEqualToString: @"dr."])
|
||||
{
|
||||
[pnc setNamePrefix: [nameArray objectAtIndex: 0]];
|
||||
[pnc setGivenName: [nameArray objectAtIndex: 1]];
|
||||
[pnc setMiddleName: [nameArray objectAtIndex: 2]];
|
||||
[pnc setFamilyName: [nameArray objectAtIndex: 3]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[pnc setGivenName: [nameArray objectAtIndex: 0]];
|
||||
[pnc setMiddleName: [nameArray objectAtIndex: 1]];
|
||||
[pnc setFamilyName: [nameArray objectAtIndex: 2]];
|
||||
[pnc setNameSuffix: [nameArray objectAtIndex: 3]];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
NSString *first = [[nameArray objectAtIndex: 0] lowercaseString];
|
||||
if([first isEqualToString: @"mr."] ||
|
||||
[first isEqualToString: @"ms."] ||
|
||||
[first isEqualToString: @"mrs."] ||
|
||||
[first isEqualToString: @"dr."])
|
||||
{
|
||||
[pnc setNamePrefix: [nameArray objectAtIndex: 0]];
|
||||
[pnc setGivenName: [nameArray objectAtIndex: 1]];
|
||||
[pnc setMiddleName: [nameArray objectAtIndex: 2]];
|
||||
[pnc setFamilyName: [nameArray objectAtIndex: 3]];
|
||||
[pnc setNameSuffix: [nameArray objectAtIndex: 4]];
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NSLog(@"Not sure how to parse %@", string);
|
||||
pnc = nil;
|
||||
break;
|
||||
}
|
||||
return pnc;
|
||||
}
|
||||
|
||||
- (BOOL) getObjectValue: (id *)obj
|
||||
forString: (NSString *)string
|
||||
errorDescription: (NSString **)error
|
||||
{
|
||||
NSPersonNameComponents *pnc = [self personNameComponentsFromString: string];
|
||||
if(pnc != nil)
|
||||
{
|
||||
*obj = pnc;
|
||||
*error = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
*obj = nil;
|
||||
*error = @"Could not parse string into NSPersonNameComponents object";
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue: (id)obj
|
||||
{
|
||||
NSPersonNameComponents *pnc = (NSPersonNameComponents *)obj;
|
||||
return [self stringFromPersonNameComponents: pnc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// components for attributed strings;
|
||||
NSString * const NSPersonNameComponentKey = @"NSPersonNameComponentKey";
|
||||
NSString * const NSPersonNameComponentGivenName = @"NSPersonNameComponentGivenName";
|
||||
NSString * const NSPersonNameComponentFamilyName = @"NSPersonNameComponentFamilyName";
|
||||
NSString * const NSPersonNameComponentMiddleName = @"NSPersonNameComponentMiddleName";
|
||||
NSString * const NSPersonNameComponentPrefix = @"NSPersonNameComponentPrefix";
|
||||
NSString * const NSPersonNameComponentSuffix = @"NSPersonNameComponentSuffix";
|
||||
NSString * const NSPersonNameComponentNickname = @"NSPersonNameComponentNickname";
|
||||
NSString * const NSPersonNameComponentDelimiter = @"NSPersonNameComponentDelimiter";
|
31
Source/NSScriptClassDescription.m
Normal file
31
Source/NSScriptClassDescription.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptClassDescription
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptClassDescription.h>
|
||||
|
||||
@implementation NSScriptClassDescription
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptCoercionHandler.m
Normal file
31
Source/NSScriptCoercionHandler.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptCoercionHandler
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptCoercionHandler.h>
|
||||
|
||||
@implementation NSScriptCoercionHandler
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptCommand.m
Normal file
31
Source/NSScriptCommand.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptCommand
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptCommand.h>
|
||||
|
||||
@implementation NSScriptCommand
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptCommandDescription.m
Normal file
31
Source/NSScriptCommandDescription.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptCommandDescription
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptCommandDescription.h>
|
||||
|
||||
@implementation NSScriptCommandDescription
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptExecutionContext.m
Normal file
31
Source/NSScriptExecutionContext.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptExecutionContext
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptExecutionContext.h>
|
||||
|
||||
@implementation NSScriptExecutionContext
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptKeyValueCoding.m
Normal file
31
Source/NSScriptKeyValueCoding.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptKeyValueCoding
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptKeyValueCoding.h>
|
||||
|
||||
@implementation NSScriptKeyValueCoding
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptObjectSpecifiers.m
Normal file
31
Source/NSScriptObjectSpecifiers.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptObjectSpecifiers
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptObjectSpecifiers.h>
|
||||
|
||||
@implementation NSScriptObjectSpecifiers
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptStandardSuiteCommands.m
Normal file
31
Source/NSScriptStandardSuiteCommands.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptStandardSuiteCommands
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptStandardSuiteCommands.h>
|
||||
|
||||
@implementation NSScriptStandardSuiteCommands
|
||||
|
||||
@end
|
||||
|
31
Source/NSScriptSuiteRegistry.m
Normal file
31
Source/NSScriptSuiteRegistry.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSScriptSuiteRegistry
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSScriptSuiteRegistry.h>
|
||||
|
||||
@implementation NSScriptSuiteRegistry
|
||||
|
||||
@end
|
||||
|
31
Source/NSUserScriptTask.m
Normal file
31
Source/NSUserScriptTask.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/* Implementation of class NSUserScriptTask
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Sep 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSUserScriptTask.h>
|
||||
|
||||
@implementation NSUserScriptTask
|
||||
|
||||
@end
|
||||
|
0
Tests/base/NSPersonNameComponentsFormatter/TestInfo
Normal file
0
Tests/base/NSPersonNameComponentsFormatter/TestInfo
Normal file
54
Tests/base/NSPersonNameComponentsFormatter/basic.m
Normal file
54
Tests/base/NSPersonNameComponentsFormatter/basic.m
Normal file
|
@ -0,0 +1,54 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSPersonNameComponentsFormatter.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
START_SET("NSPersonNameComponentsFormatter base");
|
||||
|
||||
NSPersonNameComponents *pnc = [[NSPersonNameComponents alloc] init];
|
||||
[pnc setGivenName: @"Gregory"];
|
||||
[pnc setMiddleName: @"John"];
|
||||
[pnc setFamilyName: @"Casamento"];
|
||||
[pnc setNameSuffix: @"PhD"];
|
||||
[pnc setNamePrefix: @"Dr."];
|
||||
|
||||
NSPersonNameComponentsFormatter *fmt = [[NSPersonNameComponentsFormatter alloc] init];
|
||||
NSPersonNameComponents *pnc2 = [fmt personNameComponentsFromString:
|
||||
@"Dr. Gregory John Casamento PhD"];
|
||||
PASS([[pnc givenName] isEqualToString:
|
||||
[pnc2 givenName]], "First name matches");
|
||||
PASS([[pnc middleName] isEqualToString:
|
||||
[pnc2 middleName]], "Middle name matches");
|
||||
PASS([[pnc familyName] isEqualToString:
|
||||
[pnc2 familyName]], "Family name matches");
|
||||
PASS([[pnc nameSuffix] isEqualToString:
|
||||
[pnc2 nameSuffix]], "Suffix name matches");
|
||||
PASS([[pnc namePrefix] isEqualToString:
|
||||
[pnc2 namePrefix]], "Prefix name matches");
|
||||
|
||||
fmt = [[NSPersonNameComponentsFormatter alloc] init];
|
||||
pnc2 = [fmt personNameComponentsFromString:
|
||||
@"Gregory John Casamento PhD"];
|
||||
PASS([[pnc givenName] isEqualToString:
|
||||
[pnc2 givenName]], "First name matches");
|
||||
PASS([[pnc middleName] isEqualToString:
|
||||
[pnc2 middleName]], "Middle name matches");
|
||||
PASS([[pnc familyName] isEqualToString:
|
||||
[pnc2 familyName]], "Family name matches");
|
||||
PASS([[pnc nameSuffix] isEqualToString:
|
||||
[pnc2 nameSuffix]], "Suffix name matches");
|
||||
|
||||
fmt = [[NSPersonNameComponentsFormatter alloc] init];
|
||||
pnc2 = [fmt personNameComponentsFromString:
|
||||
@"Gregory John Casamento"];
|
||||
PASS([[pnc givenName] isEqualToString:
|
||||
[pnc2 givenName]], "First name matches");
|
||||
PASS([[pnc middleName] isEqualToString:
|
||||
[pnc2 middleName]], "Middle name matches");
|
||||
PASS([[pnc familyName] isEqualToString:
|
||||
[pnc2 familyName]], "Family name matches");
|
||||
|
||||
END_SET("NSPersonNameComponentsFormatter base");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue