API 0.9.5
Foundation

Classes

class  CPArray
 A mutable array backed by a JavaScript Array.A mutable array class backed by a JavaScript Array. There is also a CPMutableArray class, but it is just a child class of this class with an empty implementation. All mutable functionality is implemented directly in CPArray. More...
class  CPAttributedString
 A mutable character string with attributes. More...
class  CPBundle
 Groups information about an application's code & resources. More...
class  CPCoder
 Defines methods for use when archiving & restoring (enc/decoding). More...
class  CPComparisonPredicate
 CPComparisonPredicate is a subclass of CPPredicate used to compare expressions. More...
class  CPCompoundPredicate
 CPCompoundPredicate is a subclass of CPPredicate used to represent logical “gate” operations (AND/OR/NOT) and comparison operations. More...
class  CPCountedSet
 An mutable collection which may contain a specific object numerous times. More...
class  CPData
 A Cappuccino wrapper for any data type. More...
class  CPDate
 A representation of a single point in time. More...
class  CPDecimalNumber
 Decimal floating point number. More...
class  CPDecimalNumberHandler
 Decimal floating point number exception and rounding behavior. This class is mutable. More...
class  CPDictionary
 A mutable key-value pair collection. More...
class  CPEnumerator
 Defines an interface for enumerators. More...
class  CPException
 Used to implement exception handling (creating & raising). More...
class  CPExpression
 CPExpression is used to represent expressions in a predicate. More...
class  CPFormatter
 CPFormatter is an abstract class that declares an interface for objects that create, interpret, and validate the textual representation of cell contents. The Foundation framework provides two concrete subclasses of CPFormatter to generate these objects: CPNumberFormatter and CPDateFormatter. More...
class  CPIndexSet
 A collection of unique integers. More...
class  CPInvocation
 An object representation of a message. More...
class  CPJSONPConnection
 Allows cross domain connections using JSONP protocol. More...
class  CPKeyedArchiver
 Implements keyed archiving of object graphs (e.g. for storing data). More...
class  CPKeyedUnarchiver
 Unarchives objects created using CPKeyedArchiver. More...
class  CPNotification
 A notification that can be posted to a CPNotificationCenter. More...
class  CPNotificationCenter
 Sends messages (CPNotification) between objects. More...
class  CPNull
 An object representation of nil. More...
class  CPNumber
 A bridged object to native Javascript numbers. More...
class  CPNumberFormatter
class  CPObject
 The root class from which most classes are subclassed. More...
class  CPPredicate
 The CPPredicate class is used to define logical conditions used to constrain a search either for a fetch or for in-memory filtering. More...
class  CPRunLoop
 The main run loop for the application. More...
class  CPSortDescriptor
 Holds attributes necessary to describe how to sort a set of objects. More...
class  CPString
 An immutable string (collection of characters). More...
class  CPTimer
 A timer object that can send a message after the given time interval. More...
class  CPUndoManager
 A general mechanism for user action "undo". More...
class  CPURLConnection
 Provides loading of a URL request. More...
class  CPURLRequest
 Contains data obtained during a request made with CPURLConnection. More...
class  CPURLResponse
 Protocol agnostic information about a request to a specific URL. More...
class  CPUserDefaults
class  CPValue
 A generic "value". Can be subclassed to hold specific data types. More...

Functions

function CPCopyRange (aRange)
function CPDecimalAdd (result, leftOperand, rightOperand, roundingMode, longMode)
function CPDecimalCompact (dcm)
function CPDecimalCompare (leftOperand, rightOperand)
function CPDecimalCopy (dcm)
function CPDecimalDivide (result, leftOperand, rightOperand, roundingMode)
function CPDecimalIsNotANumber (dcm)
function CPDecimalIsOne (dcm)
function CPDecimalIsZero (dcm)
function CPDecimalMakeNaN ()
function CPDecimalMakeOne ()
function CPDecimalMakeWithParts (mantissa, exponent)
function CPDecimalMakeWithString (string, locale)
function CPDecimalMakeZero ()
function CPDecimalMultiply (result, leftOperand, rightOperand, roundingMode, powerMode)
function CPDecimalMultiplyByPowerOf10 (result, dcm, power, roundingMode)
function CPDecimalNormalize (dcm1, dcm2, roundingMode, longMode)
function CPDecimalPower (result, dcm, power, roundingMode)
function CPDecimalRound (result, dcm, scale, roundingMode)
function CPDecimalString (dcm, locale)
function CPDecimalSubtract (result, leftOperand, rightOperand, roundingMode)
function CPEmptyRange (aRange)
function CPEqualRanges (lhsRange, rhsRange)
function CPIntersectionRange (lhsRange, rhsRange)
function CPLocationInRange (aLocation, aRange)
function CPMakeRange (location, length)
function CPMakeRangeCopy (aRange)
function CPMaxRange (aRange)
function CPRangeFromString (aString)
function CPRangeInRange (lhsRange, rhsRange)
function CPStringFromRange (aRange)
function CPUnionRange (lhsRange, rhsRange)

Function Documentation

function CPCopyRange ( aRange  )

Makes a copy of a CPRange.

Parameters:
aRangethe CPRange to copy CPRange
Returns:
CPRange the copy of the range

Definition at line 46 of file CPRange.j.

function CPDecimalAdd ( result  ,
leftOperand  ,
rightOperand  ,
roundingMode  ,
longMode   
)

Performs the addition of 2 CPDecimal numbers.

Parameters:
resultthe CPDecimal object in which to put the result
leftOperandthe left CPDecimal operand
rightOperandthe right CPDecimal operand
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 514 of file CPDecimal.j.

function CPDecimalCompact ( dcm  )

Remove trailing and leading zeros from mantissa.

Parameters:
dcmthe CPDecimal operand

Definition at line 1398 of file CPDecimal.j.

function CPDecimalCompare ( leftOperand  ,
rightOperand   
)

Compare two CPDecimal objects. Order is left to right (i.e. Ascending would mean left is smaller than right operand).

Parameters:
leftOperandthe left CPDecimal
rightOperandthe right CPDecimal
Returns:
CPOrderedAscending, CPOrderedDescending or CPOrderedSame.

Definition at line 362 of file CPDecimal.j.

function CPDecimalCopy ( dcm  )

Create a copy of a CPDecimal object

Parameters:
dcmthe CPDecimal number to copy.
Returns:
a new CPDecimal.

Definition at line 344 of file CPDecimal.j.

function CPDecimalDivide ( result  ,
leftOperand  ,
rightOperand  ,
roundingMode   
)

Performs a division of 2 CPDecimal numbers.

Parameters:
resultthe CPDecimal object in which to put the result
leftOperandthe left CPDecimal operand
rightOperandthe right CPDecimal operand
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 853 of file CPDecimal.j.

function CPDecimalIsNotANumber ( dcm  )

Checks to see if a CPDecimal is Not A Number.

Returns:
TRUE on NaN.

Definition at line 333 of file CPDecimal.j.

function CPDecimalIsOne ( dcm  )

Checks to see if a CPDecimal is 1. Can handle uncompacted strings (it compacts them).

Returns:
TRUE on 1.

Definition at line 287 of file CPDecimal.j.

function CPDecimalIsZero ( dcm  )

Checks to see if a CPDecimal is zero. Can handle uncompacted strings.

Returns:
TRUE on zero.

Definition at line 267 of file CPDecimal.j.

function CPDecimalMakeNaN ( )

Creates a CPDecimal NaN.

Returns:
A CPDecimal object containing the value NaN

Definition at line 234 of file CPDecimal.j.

function CPDecimalMakeOne ( )

Creates a CPDecimal 1.

Returns:
A CPDecimal object containing the value 1.

Definition at line 223 of file CPDecimal.j.

function CPDecimalMakeWithParts ( mantissa  ,
exponent   
)

Creates a CPDecimal object from a given mantissa and exponent. The sign is taken from the sign of the mantissa. This cant do a full 34 digit mantissa representation as JS's 32 bits or 64bit binary FP numbers cant represent that. So use the CPDecimalMakeWithString if you want longer mantissa.

Parameters:
mantissathe mantissa (though see above note)
exponentthe exponent
Returns:
A CPDecimal object, or nil on error.

Definition at line 177 of file CPDecimal.j.

function CPDecimalMakeWithString ( string  ,
locale   
)

Creates a CPDecimal object from a string representation of the decimal number.

Parameters:
decimalStringCPString of number
roundingModeRounding mode for when number is too large to fit in mantissa.
Returns:
A CPDecimal object, or nil on error.

Definition at line 101 of file CPDecimal.j.

function CPDecimalMakeZero ( )

Creates a CPDecimal 0.

Returns:
A CPDecimal object containing the value 0.

Definition at line 213 of file CPDecimal.j.

function CPDecimalMultiply ( result  ,
leftOperand  ,
rightOperand  ,
roundingMode  ,
powerMode   
)

Performs multiplication of 2 CPDecimal numbers.

Parameters:
resultthe CPDecimal object in which to put the result
leftOperandthe left CPDecimal operand
rightOperandthe right CPDecimal operand
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 992 of file CPDecimal.j.

function CPDecimalMultiplyByPowerOf10 ( result  ,
dcm  ,
power  ,
roundingMode   
)

Raises a CPDecimal number to a power of 10.

Parameters:
resultthe CPDecimal object in which to put the result
dcmthe CPDecimal operand
powerthe power to raise to
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 1089 of file CPDecimal.j.

function CPDecimalNormalize ( dcm1  ,
dcm2  ,
roundingMode  ,
longMode   
)

Normalises 2 CPDecimals. Normalisation is the process of modifying a numbers mantissa to ensure that both CPDecimals have the same exponent.

Parameters:
dcm1the first CPDecimal
dcm2the second CPDecimal
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 1168 of file CPDecimal.j.

function CPDecimalPower ( result  ,
dcm  ,
power  ,
roundingMode   
)

Raises a CPDecimal number to the given power.

Parameters:
resultthe CPDecimal object in which to put the result
dcmthe CPDecimal operand
powerthe power to raise to
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 1116 of file CPDecimal.j.

function CPDecimalRound ( result  ,
dcm  ,
scale  ,
roundingMode   
)

Rounds a CPDecimal off at a given decimal position. scale specifies the position. Negative values of scale imply rounding in the whole numbers and positive values rounding in the decimal places. A scale of 0 rounds to the first whole number.

Parameters:
resultthe CPDecimal object in which to put the result
dcmthe CPDecimal operand
scalethe position to round to
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 1290 of file CPDecimal.j.

function CPDecimalString ( dcm  ,
locale   
)

Convert a CPDecimal to a string representation.

Parameters:
dcmthe CPDecimal operand
localethe locale to use for the conversion
Returns:
a CPString

Definition at line 1440 of file CPDecimal.j.

function CPDecimalSubtract ( result  ,
leftOperand  ,
rightOperand  ,
roundingMode   
)

Performs the subtraction of 2 CPDecimal numbers.

Parameters:
resultthe CPDecimal object in which to put the result
leftOperandthe left CPDecimal operand
rightOperandthe right CPDecimal operand
roundingModethe rounding mode for the operation
Returns:
a CPCalculationError status value.

Definition at line 661 of file CPDecimal.j.

function CPEmptyRange ( aRange  )

Determines if a range is empty length is 0.

Parameters:
aRangethe range to test CPRange
Returns:
YES if the range is empty

Definition at line 68 of file CPRange.j.

function CPEqualRanges ( lhsRange  ,
rhsRange   
)

Determines if two CPRanges are equal.

Parameters:
lhsRangethe first CPRange
rhsRangethe second CPRange
Returns:
BOOL YES if the two CPRanges are equal.

Definition at line 90 of file CPRange.j.

function CPIntersectionRange ( lhsRange  ,
rhsRange   
)

Creates a new CPRange that spans the common range of two CPRanges

Parameters:
lhsRangethe first CPRange
rhsRangethe second CPRange CPRange
Returns:
CPRange the new CPRange

Definition at line 129 of file CPRange.j.

function CPLocationInRange ( aLocation  ,
aRange   
)

Determines if a number is within a specified CPRange.

Parameters:
aLocationthe number to check
aRangethe CPRange to check within CPRange
Returns:
BOOL YES if aLocation is within the range

Definition at line 102 of file CPRange.j.

function CPMakeRange ( location  ,
length   
)

Makes a CPRange.

Parameters:
locationthe location for new range
lengththe length of the new range CPRange
Returns:
CPRange the new range object

Definition at line 35 of file CPRange.j.

function CPMakeRangeCopy ( aRange  )

Makes a copy of a CPRange.

Parameters:
aRangethe CPRange to copy CPRange
Returns:
CPRange the copy of the range

Definition at line 57 of file CPRange.j.

function CPMaxRange ( aRange  )

Finds the range maximum. (location + length)

Parameters:
aRangethe range to calculate a maximum from CPRange
Returns:
int the range maximum

Definition at line 79 of file CPRange.j.

function CPRangeFromString ( aString  )

Creates a CPRange from the contents of a CPString.

Parameters:
aStringthe string to create a CPRange from CPRange
Returns:
CPRange the new range

Definition at line 168 of file CPRange.j.

function CPRangeInRange ( lhsRange  ,
rhsRange   
)

Checks if a range completely contains another range. In other words, if one range is the "super range" of another.

Parameters:
lhsRangethe containing range
rhsRangethe range we are testing to see if lhsRange contains it CPRange
Returns:
BOOL whether or not lhsRange completely contains rhsRange

Definition at line 146 of file CPRange.j.

function CPStringFromRange ( aRange  )

Returns a string describing a range.

Parameters:
aRangethe range to describe CPRange
Returns:
CPString a describing string

Definition at line 157 of file CPRange.j.

function CPUnionRange ( lhsRange  ,
rhsRange   
)

Creates a new range with the minimum location and a length that extends to the maximum length.

Parameters:
lhsRangethe first CPRange
rhsRangethe second CPRange CPRange
Returns:
CPRange the new CPRange

Definition at line 115 of file CPRange.j.

 All Classes Files Functions Variables Defines