Files
cappuccino/Foundation/Foundation.j
T
David Richardson 021e9935aa Foundation: Add CPProgress and cancellable item provider loading
Partial implementation, gaps and impossibilities noted internally as TODO comments.

* CPProgress.j: Introduce CPProgress, modelled on NSProgress.
  - Count units of work, with fraction completed, finished and indeterminate states.
  - Compose progress trees through explicit children and the current progress object.
  - Cancel, pause and resume, with handlers, propagating to children.
  - Announce unit-count changes through key-value observing across the tree.

* CPError.j: Add CPUserCancelledError.

* CPItemProvider.j:
  - Return a CPProgress from each load, counting bytes read for files and aborting the read on cancellation.
  - Pass file contents to CPData as a binary string rather than a byte array.
  - Implement -canLoadObjectOfClass: and -loadObjectOfClass:completionHandler:.
  - Add the CPString (CPItemProvider) reading category.

* CPString+Encoding.j: Decode data held as a binary string through a Uint8Array, without building a byte array.

* Foundation.j: Import CPProgress.j.

* CPProgressTest.j: Add unit tests covering counts, children, the current progress object, cancellation, pausing, observation and user information.

* CPItemProviderTest.j: Add unit tests covering read progress, cancellation, completion and string loading.
2026-11-02 15:29:21 -06:00

106 lines
2.9 KiB
Plaintext
Executable File

/*
* Foundation.j
* Foundation
*
* Created by Francisco Tolmasky.
* Copyright 2008, 280 North, Inc.
*
* 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.1 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
* Lesser 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 02110-1301 USA
*/
@import "_CGGeometry.j"
@import "_CPFoundationUtilities.j"
@import "CPArray.j"
@import "CPBundle.j"
@import "CPByteCountFormatter.j"
@import "CPCache.j"
@import "CPCharacterSet.j"
@import "CPCoder.j"
@import "CPComparisonPredicate.j"
@import "CPCompoundPredicate.j"
@import "CPData.j"
@import "CPDate.j"
@import "CPDateFormatter.j"
@import "CPDecimal.j"
@import "CPDecimalNumber.j"
@import "CPDelayedPerform.j"
@import "CPDictionary.j"
@import "CPEnumerator.j"
@import "CPError.j"
@import "CPException.j"
@import "CPExpression.j"
@import "CPFormatter.j"
@import "CPIndexPath.j"
@import "CPIndexSet.j"
@import "CPInvocation.j"
@import "CPItemProvider.j"
@import "CPJSONPConnection.j"
@import "CPKeyedArchiver.j"
@import "CPKeyedUnarchiver.j"
@import "CPKeyValueCoding.j"
@import "CPKeyValueObserving.j"
@import "CPLocale.j"
@import "CPMutableArray.j"
@import "CPMutableSet.j"
@import "CPNotification.j"
@import "CPNotificationCenter.j"
@import "CPNotificationQueue.j"
@import "CPNull.j"
@import "CPNumber.j"
@import "CPNumberFormatter.j"
@import "CPObject.j"
@import "CPObjJRuntime.j"
@import "CPOperation.j"
@import "CPOperationQueue.j"
@import "CPPredicate.j"
@import "CPProgress.j"
@import "CPPropertyListSerialization.j"
@import "CPRange.j"
@import "CPRunLoop.j"
@import "CPScanner.j"
@import "CPSet.j"
@import "CPSortDescriptor.j"
@import "CPString.j"
@import "CPString+Encoding.j"
@import "CPTimer.j"
@import "CPTimeZone.j"
@import "CPUndoManager.j"
@import "CPURL.j"
@import "CPURLConnection.j"
@import "CPURLError.j"
@import "CPURLRequest.j"
@import "CPURLResponse.j"
@import "CPUserDefaults.j"
@import "CPUserNotification.j"
@import "CPUserNotificationCenter.j"
@import "CPUserSessionManager.j"
@import "CPValue.j"
@import "CPValueTransformer.j"
/*! @mainpage
Cappuccino is distributed under the @ref license "GNU LGPL".
@htmlinclude README.html
@page license License
@htmlonly <pre>@endhtmlonly
@htmlinclude LICENSE
@htmlonly </pre>@endhtmlonly
@defgroup appkit AppKit
@defgroup foundation Foundation
@defgroup compatability Cocoa Compatability
*/