From f8e181d875511078fa84fa27b54ced701ace0c63 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Mon, 29 Jul 2019 22:32:55 -0400 Subject: [PATCH] Add NSProgress.m... compiling. --- Headers/Foundation/NSProgress.h | 21 ++- Source/GNUmakefile | 2 + Source/NSProgress.m | 310 ++++++++++++++++++++++++++++++++ 3 files changed, 326 insertions(+), 7 deletions(-) create mode 100644 Source/NSProgress.m diff --git a/Headers/Foundation/NSProgress.h b/Headers/Foundation/NSProgress.h index 4e0d15c7f..54a1507e4 100644 --- a/Headers/Foundation/NSProgress.h +++ b/Headers/Foundation/NSProgress.h @@ -32,7 +32,7 @@ extern "C" { #endif -@class NSString, NSDictionary, NSArray; +@class NSString, NSDictionary, NSArray, NSNumber; #if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST) @@ -40,9 +40,6 @@ typedef NSString* NSProgressKind; typedef NSString* NSProgressUserInfoKey; typedef NSString* NSProgressFileOperationKind; -DEFINE_BLOCK_TYPE(NSProgressPublishingHandler, void, NSProgress*); -DEFINE_BLOCK_TYPE(NSProgressUnpublishingHandler, void, void); - @interface NSProgress : NSObject { #if GS_EXPOSE(NSProgress) @@ -62,6 +59,9 @@ GS_NSProgress_IVARS; #endif } +DEFINE_BLOCK_TYPE(NSProgressPublishingHandler, void, NSProgress*); +DEFINE_BLOCK_TYPE(NSProgressUnpublishingHandler, void, void); + // Creating progress objects... - (instancetype)initWithParent: (NSProgress *)parent userInfo: (NSDictionary *)userInfo; @@ -116,10 +116,10 @@ DEFINE_BLOCK_TYPE(GSProgressResumingHandler, void, void); forKey: (NSProgressUserInfoKey)key; // Instance property accessors... -- (void) setFileOperationKind: (NSFileOperationKind)k; -- (NSFileOperationKind) fileOperationKind; +- (void) setFileOperationKind: (NSProgressFileOperationKind)k; +- (NSProgressFileOperationKind) fileOperationKind; - (void) setFileUrl: (NSURL *)u; -- (NSURL *)fileUrl +- (NSURL *)fileUrl; - (BOOL) isFinished; - (BOOL) isOld; - (void) setEstimatedTimeRemaining: (NSNumber *)n; @@ -145,6 +145,13 @@ DEFINE_BLOCK_TYPE(GSProgressPendingUnitCountBlock, void, void); @end + +@protocol NSProgressReporting + +- (NSProgress *) progress; + +@end + #if defined(__cplusplus) } #endif diff --git a/Source/GNUmakefile b/Source/GNUmakefile index a4e22a370..510c87fd0 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -271,6 +271,7 @@ NSPortMessage.m \ NSPortNameServer.m \ NSPredicate.m \ NSProcessInfo.m \ +NSProgress.m \ NSPropertyList.m \ NSProtocolChecker.m \ NSProxy.m \ @@ -441,6 +442,7 @@ NSPortMessage.h \ NSPortNameServer.h \ NSPredicate.h \ NSProcessInfo.h \ +NSProgress.h \ NSPropertyList.h \ NSProtocolChecker.h \ NSProxy.h \ diff --git a/Source/NSProgress.m b/Source/NSProgress.m new file mode 100644 index 000000000..0843db0d1 --- /dev/null +++ b/Source/NSProgress.m @@ -0,0 +1,310 @@ +/* Definition of class NSProgress + Copyright (C) 2019 Free Software Foundation, Inc. + + Written by: Gregory Casamento + Date: July 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. +*/ + +#define GS_NSProgress_IVARS \ + NSProgressKind _kind; \ + NSProgressFileOperationKind _fileOperationKind; \ + NSURL *_fileUrl; \ + BOOL _isFinished; \ + BOOL _old; \ + NSNumber *_estimatedTimeRemaining; \ + NSNumber *_fileCompletedCount; \ + NSNumber *_fileTotalCount; \ + NSNumber *_throughput; \ + int64_t _totalUnitCount; \ + int64_t _completedUnitCount; \ + NSMutableDictionary *_userInfo; \ + BOOL _cancelled; \ + BOOL _paused; \ + BOOL _cancellable; \ + BOOL _pausable; \ + BOOL _indeterminate; \ + BOOL _finished; \ + double _fractionCompleted; \ + NSProgress *_parent; + +#define EXPOSE_NSProgress_IVARS + +#import +#import +#import +#import +#import +#import +#import + +#define GSInternal NSProgressInternal +#include "GSInternal.h" +GS_PRIVATE_INTERNAL(NSProgress) + +@implementation NSProgress + +// Creating progress objects... +- (instancetype)initWithParent: (NSProgress *)parent + userInfo: (NSDictionary *)userInfo +{ + return nil; +} + ++ (NSProgress *)discreteProgressWithTotalUnitCount:(int64_t)unitCount +{ + return nil; +} + ++ (NSProgress *)progressWithTotalUnitCount:(int64_t)unitCount +{ + return nil; +} + ++ (NSProgress *)progressWithTotalUnitCount:(int64_t)unitCount + parent:(NSProgress *)parent + pendingUnitCount:(int64_t)portionOfParentTotalUnitCount +{ + return nil; +} + + +// Current progress ++ (NSProgress *)currentProgress +{ + return nil; +} + +- (void)becomeCurrentWithPendingUnitCount:(int64_t)unitCount +{ +} + +- (void)addChild:(NSProgress *)child withPendingUnitCount: (int64_t)inUnitCount +{ +} + +- (void)resignCurrent +{ +} + +// Reporting progress +- (int64_t) totalUnitCount +{ + return internal->_totalUnitCount; +} + +- (void) setTotalUnitCount: (int64_t)count +{ + internal->_totalUnitCount = count; +} + +- (int64_t) completedUnitCount +{ + return internal->_completedUnitCount; +} + +- (void) setCompletedUnitCount: (int64_t)count +{ + internal->_completedUnitCount = count; +} + +- (NSString *) localizedDescription +{ + return nil; +} + +- (NSString *) localizedAddtionalDescription +{ + return nil; +} + +// Observing progress +- (double) fractionCompleted +{ + return internal->_fractionCompleted; +} + +// Controlling progress +- (BOOL) isCancellable +{ + return internal->_cancellable; +} + +- (BOOL) isCancelled +{ + return internal->_cancelled; +} + +- (void) cancel +{ +} + +- (void) setCancellationHandler: (GSProgressCancellationHandler) handler +{ +} + +- (BOOL) isPausable +{ + return internal->_pausable; +} + +- (BOOL) isPaused +{ + return internal->_paused; +} + +- (void) pause +{ +} + +- (void) setPausingHandler: (GSProgressPausingHandler) handler +{ +} + +- (void) resume +{ +} + +- (void) setResumingHandler: (GSProgressResumingHandler) handler +{ +} + +// Progress Information +- (BOOL) isIndeterminate +{ + return internal->_indeterminate; +} + +- (void) setIndeterminate: (BOOL)flag +{ + internal->_indeterminate = flag; +} + +- (NSProgressKind) kind +{ + return internal->_kind; +} + +- (void) setKind: (NSProgressKind)k +{ +} + +- (void)setUserInfoObject: (id)obj + forKey: (NSProgressUserInfoKey)key +{ + +} + + +// Instance property accessors... +- (void) setFileOperationKind: (NSProgressFileOperationKind)k; +{ + ASSIGN(internal->_fileOperationKind, k); +} + +- (NSProgressFileOperationKind) fileOperationKind +{ + return internal->_fileOperationKind; +} + +- (void) setFileUrl: (NSURL *)u +{ + ASSIGN(internal->_fileUrl, u); +} + +- (NSURL *)fileUrl +{ + return internal->_fileUrl; +} + +- (BOOL) isFinished +{ + return internal->_finished; +} + +- (BOOL) isOld +{ + return internal->_old; +} + +- (void) setEstimatedTimeRemaining: (NSNumber *)n +{ + ASSIGN(internal->_estimatedTimeRemaining, n); +} + +- (NSNumber *) estimatedTimeRemaining +{ + return internal->_estimatedTimeRemaining; +} + +- (void) setFileCompletedCount: (NSNumber *)n +{ +} + +- (NSNumber *) fileCompletedCount +{ + return nil; +} + +- (void) setFileTotalCount: (NSNumber *)n +{ +} + +- (NSNumber *) fileTotalCount +{ + return nil; +} + +- (void) setThroughput: (NSNumber *)n +{ +} + +- (NSNumber *) throughtput +{ + return nil; +} + +// Instance methods +- (void) publish +{ +} + +- (void) unpublish +{ +} + +- (void)performAsCurrentWithPendingUnitCount: (int64_t)unitCount + usingBlock: (GSProgressPendingUnitCountBlock)work +{ +} + +// Type methods ++ (id)addSubscriberForFileURL: (NSURL *)url + withPublishingHandler: (NSProgressPublishingHandler)publishingHandler +{ + return nil; +} + ++ (void)removeSubscriber: (id)subscriber +{ +} + +@end + +