CFMutableCharacterSet Reference

Derived from
Framework
CoreFoundation/CoreFoundation.h
Companion guide
Declared in
CFCharacterSet.h

Overview

CFMutableCharacterSet manages dynamic character sets. The basic interface for managing character sets is provided by CFCharacterSet. CFMutableCharacterSet adds functions to modify the contents of a character set.

You create a mutable character set object using either the CFCharacterSetCreateMutable or CFCharacterSetCreateMutableCopy function.

CFMutableCharacterSet is “toll-free bridged” with its Cocoa Foundation counterpart, NSMutableCharacterSet. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an NSMutableCharacterSet * parameter, you can pass in a CFMutableCharacterSetRef, and in a function where you see a CFMutableCharacterSetRef parameter, you can pass in an NSMutableCharacterSet instance. This capability also applies to concrete subclasses of NSMutableCharacterSet. See “Toll-Free Bridged Types” for more information on toll-free bridging.

Functions by Task

Creating a Mutable Character Set

Adding Characters

Removing Characters

Logical Operations

Functions

CFCharacterSetAddCharactersInRange

Adds a given range to a character set.

void CFCharacterSetAddCharactersInRange (
   CFMutableCharacterSetRef theSet,
   CFRange theRange
);
Parameters
theSet

The character set to modify.

theRange

The range to add to the character set. The range is specified in 32-bits in UTF-32 format, and must lie within the valid Unicode character range (from 0x00000 to 0x10FFFF).

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

CFCharacterSetAddCharactersInString

Adds the characters in a given string to a character set.

void CFCharacterSetAddCharactersInString (
   CFMutableCharacterSetRef theSet,
   CFStringRef theString
);
Parameters
theSet

The character set to modify.

theString

A string containing the characters to add to theSet.

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

CFCharacterSetCreateMutable

Creates a new empty mutable character set.

CFMutableCharacterSetRef CFCharacterSetCreateMutable (
   CFAllocatorRef alloc
);
Parameters
alloc

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

Return Value

A new empty mutable character set. Ownership follows the Create Rule.

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

CFCharacterSetCreateMutableCopy

Creates a new mutable character set with the values from another character set.

CFMutableCharacterSetRef CFCharacterSetCreateMutableCopy (
   CFAllocatorRef alloc,
   CFCharacterSetRef theSet
);
Parameters
alloc

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

theSet

The character set to copy.

Return Value

A new mutable character set containing the same characters as theSet. Ownership follows the Create Rule.

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

CFCharacterSetIntersect

Forms an intersection of two character sets.

void CFCharacterSetIntersect (
   CFMutableCharacterSetRef theSet,
   CFCharacterSetRef theOtherSet
);
Parameters
theSet

The source character set, modified by intersection with theOtherSet.

theOtherSet

The character set with which the intersection is formed.

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

CFCharacterSetInvert

Inverts the content of a given character set.

void CFCharacterSetInvert (
   CFMutableCharacterSetRef theSet
);
Parameters
theSet

The character set to invert.

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

CFCharacterSetRemoveCharactersInRange

Removes a given range of Unicode characters from a character set.

void CFCharacterSetRemoveCharactersInRange (
   CFMutableCharacterSetRef theSet,
   CFRange theRange
);
Parameters
theSet

The character set to modify.

theRange

The range to remove from the character set. The range is specified in 32-bits in UTF-32 format, and must lie within the valid Unicode character range (from 0x00000 to 0x10FFFF).

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

CFCharacterSetRemoveCharactersInString

Removes the characters in a given string from a character set.

void CFCharacterSetRemoveCharactersInString (
   CFMutableCharacterSetRef theSet,
   CFStringRef theString
);
Parameters
theSet

The character set to modify.

theString

A string containing the characters to remove from theSet.

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

CFCharacterSetUnion

Forms the union of two character sets.

void CFCharacterSetUnion (
   CFMutableCharacterSetRef theSet,
   CFCharacterSetRef theOtherSet
);
Parameters
theSet

The source character set, modified by union with theOtherSet.

theOtherSet

The character set with which the union is formed.

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

Data Types

CFMutableCharacterSetRef

A reference to a mutable character set object.

typedef struct __CFCharacterSet *CFMutableCharacterSetRef;
Availability
  • Available in OS X v10.0 and later.
Declared In
CFCharacterSet.h