mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Add NSProgress.m... compiling.
This commit is contained in:
parent
5a0a7ba9c0
commit
f8e181d875
3 changed files with 326 additions and 7 deletions
|
@ -32,7 +32,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@class NSString, NSDictionary, NSArray;
|
@class NSString, NSDictionary, NSArray, NSNumber;
|
||||||
|
|
||||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
|
#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* NSProgressUserInfoKey;
|
||||||
typedef NSString* NSProgressFileOperationKind;
|
typedef NSString* NSProgressFileOperationKind;
|
||||||
|
|
||||||
DEFINE_BLOCK_TYPE(NSProgressPublishingHandler, void, NSProgress*);
|
|
||||||
DEFINE_BLOCK_TYPE(NSProgressUnpublishingHandler, void, void);
|
|
||||||
|
|
||||||
@interface NSProgress : NSObject
|
@interface NSProgress : NSObject
|
||||||
{
|
{
|
||||||
#if GS_EXPOSE(NSProgress)
|
#if GS_EXPOSE(NSProgress)
|
||||||
|
@ -62,6 +59,9 @@ GS_NSProgress_IVARS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_BLOCK_TYPE(NSProgressPublishingHandler, void, NSProgress*);
|
||||||
|
DEFINE_BLOCK_TYPE(NSProgressUnpublishingHandler, void, void);
|
||||||
|
|
||||||
// Creating progress objects...
|
// Creating progress objects...
|
||||||
- (instancetype)initWithParent: (NSProgress *)parent
|
- (instancetype)initWithParent: (NSProgress *)parent
|
||||||
userInfo: (NSDictionary *)userInfo;
|
userInfo: (NSDictionary *)userInfo;
|
||||||
|
@ -116,10 +116,10 @@ DEFINE_BLOCK_TYPE(GSProgressResumingHandler, void, void);
|
||||||
forKey: (NSProgressUserInfoKey)key;
|
forKey: (NSProgressUserInfoKey)key;
|
||||||
|
|
||||||
// Instance property accessors...
|
// Instance property accessors...
|
||||||
- (void) setFileOperationKind: (NSFileOperationKind)k;
|
- (void) setFileOperationKind: (NSProgressFileOperationKind)k;
|
||||||
- (NSFileOperationKind) fileOperationKind;
|
- (NSProgressFileOperationKind) fileOperationKind;
|
||||||
- (void) setFileUrl: (NSURL *)u;
|
- (void) setFileUrl: (NSURL *)u;
|
||||||
- (NSURL *)fileUrl
|
- (NSURL *)fileUrl;
|
||||||
- (BOOL) isFinished;
|
- (BOOL) isFinished;
|
||||||
- (BOOL) isOld;
|
- (BOOL) isOld;
|
||||||
- (void) setEstimatedTimeRemaining: (NSNumber *)n;
|
- (void) setEstimatedTimeRemaining: (NSNumber *)n;
|
||||||
|
@ -145,6 +145,13 @@ DEFINE_BLOCK_TYPE(GSProgressPendingUnitCountBlock, void, void);
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@protocol NSProgressReporting
|
||||||
|
|
||||||
|
- (NSProgress *) progress;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -271,6 +271,7 @@ NSPortMessage.m \
|
||||||
NSPortNameServer.m \
|
NSPortNameServer.m \
|
||||||
NSPredicate.m \
|
NSPredicate.m \
|
||||||
NSProcessInfo.m \
|
NSProcessInfo.m \
|
||||||
|
NSProgress.m \
|
||||||
NSPropertyList.m \
|
NSPropertyList.m \
|
||||||
NSProtocolChecker.m \
|
NSProtocolChecker.m \
|
||||||
NSProxy.m \
|
NSProxy.m \
|
||||||
|
@ -441,6 +442,7 @@ NSPortMessage.h \
|
||||||
NSPortNameServer.h \
|
NSPortNameServer.h \
|
||||||
NSPredicate.h \
|
NSPredicate.h \
|
||||||
NSProcessInfo.h \
|
NSProcessInfo.h \
|
||||||
|
NSProgress.h \
|
||||||
NSPropertyList.h \
|
NSPropertyList.h \
|
||||||
NSProtocolChecker.h \
|
NSProtocolChecker.h \
|
||||||
NSProxy.h \
|
NSProxy.h \
|
||||||
|
|
310
Source/NSProgress.m
Normal file
310
Source/NSProgress.m
Normal file
|
@ -0,0 +1,310 @@
|
||||||
|
/* Definition of class NSProgress
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Written by: Gregory Casamento <greg.casamento@gmail.com>
|
||||||
|
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 <Foundation/NSObject.h>
|
||||||
|
#import <Foundation/NSDictionary.h>
|
||||||
|
#import <Foundation/NSArray.h>
|
||||||
|
#import <Foundation/NSProgress.h>
|
||||||
|
#import <Foundation/NSValue.h>
|
||||||
|
#import <Foundation/NSURL.h>
|
||||||
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue