API  0.9.6
 All Classes Files Functions Variables Macros Modules Pages
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  CPDateFormatter
 
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 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 CPIntersectionRange (lhsRange, rhsRange)
 
return CPMakeRange (location, MAX(CPMaxRange(lhsRange), CPMaxRange(rhsRange))-location)
 
function CPRangeFromString (aString)
 
function CPRangeInRange (lhsRange, rhsRange)
 
function CPStringFromRange (aRange)
 

Variables

 rhsRange
 

Detailed Description

Function Documentation

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 519 of file CPDecimal.j.

function CPDecimalCompact ( dcm  )

Remove trailing and leading zeros from mantissa.

Parameters
dcmthe CPDecimal operand

Definition at line 1403 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 367 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 349 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 858 of file CPDecimal.j.

function CPDecimalIsNotANumber ( dcm  )

Checks to see if a CPDecimal is Not A Number.

Returns
TRUE on NaN.

Definition at line 338 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 292 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 272 of file CPDecimal.j.

function CPDecimalMakeNaN ( )

Creates a CPDecimal NaN.

Returns
A CPDecimal object containing the value NaN

Definition at line 239 of file CPDecimal.j.

function CPDecimalMakeOne ( )

Creates a CPDecimal 1.

Returns
A CPDecimal object containing the value 1.

Definition at line 228 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 182 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 218 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 997 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 1094 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 1173 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 1121 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 1295 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 1444 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 666 of file CPDecimal.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 107 of file CPRange.j.

return CPMakeRange ( location  ,
MAX(CPMaxRange(lhsRange), CPMaxRange(rhsRange))-  location 
)
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 146 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 124 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 135 of file CPRange.j.

Variable Documentation

rhsRange
Initial value:
{
return ((lhsRange.location === rhsRange.location) && (lhsRange.length === rhsRange.length))
rhsRange
Definition: CPRange.j:72

Definition at line 72 of file CPRange.j.