NSSpecifierTest Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSScriptWhoseTests.h

Overview

Instances of this class represent a Boolean expression; they evaluate an object specifier and compare the resulting object to another object using a given comparison method. For more information on NSSpecifierTest, see the method description for its sole public method, its initializer, initWithObjectSpecifier:comparisonOperator:testObject:.

When an NSSpecifierTest object is properly initialized, it holds two objects:

The instance also encapsulates a selector identifying the method performing this comparison. The informal protocol NSComparisonMethods defines a set of comparison methods useful for this purpose, while NSScriptingComparisonMethods describes additional methods you may need to use for scripting.

The test object is compared, using the selector, against each object in the container. Specifiers in these tests usually have containerIsObjectBeingTested invoked on their topmost container.

You should rarely need to subclass NSSpecifierTest.

Tasks

Initializing a Specifier Test

Instance Methods

initWithObjectSpecifier:comparisonOperator:testObject:

Returns a specifier test initialized to evaluate a test object against an object specified by an object specifier using a given comparison operation.

- (id)initWithObjectSpecifier:(NSScriptObjectSpecifier *)obj1 comparisonOperator:(NSTestComparisonOperation)compOp testObject:(id)obj2
Parameters
obj1

An object specifier.

compOp

The comparison operation.

obj2

The object against which to evaluate the object specified by obj1.

Return Value

A specifier test initialized to evaluate (obj2) against an object specified by obj1 using the comparison operation compOp.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptWhoseTests.h

Constants

NSTestComparisonOperation

These are passed to initWithObjectSpecifier:comparisonOperator:testObject: to specify the comparison operator.

typedef enum {
   NSEqualToComparison = 0,
   NSLessThanOrEqualToComparison,
   NSLessThanComparison,
   NSGreaterThanOrEqualToComparison,
   NSGreaterThanComparison,
   NSBeginsWithComparison,
   NSEndsWithComparison,
   NSContainsComparison
} NSTestComparisonOperation;
Constants
NSEqualToComparison

Binary comparison operator that results in YES if the two objects are equal.

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

NSLessThanOrEqualToComparison

Binary comparison operator that results in YES if the value of the test object is equal to or less than the value of the other object.

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

NSLessThanComparison

Binary comparison operator that results in YES if the value of the test object is less than the value of the other object.

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

NSGreaterThanOrEqualToComparison

Binary comparison operator that results in YES if the value of the test object is greater than or equal to the value of the other object.

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

NSGreaterThanComparison

Binary comparison operator that results in YES if the value of the test object is greater than the value of the other object.

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

NSBeginsWithComparison

Binary containment operator that results in YES if the test object is a list or string that matches the beginning of the other object (which is also a list or string).

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

NSEndsWithComparison

Binary containment operator that results in YES if the test object is a list or string that matches the end of the other object (which is also a list or string).

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

NSContainsComparison

Binary containment operator that results in YES if the test object is a list or string that matches the other object (which is also a list or string) at any location.

Available in OS X v10.0 and later.

Declared in NSScriptWhoseTests.h.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptWhoseTests.h