diff --git a/pkg/macos/foundation/character_set.zig b/pkg/macos/foundation/character_set.zig index 60d1843a9..ace4b1953 100644 --- a/pkg/macos/foundation/character_set.zig +++ b/pkg/macos/foundation/character_set.zig @@ -14,6 +14,15 @@ pub const CharacterSet = opaque { ))) orelse Allocator.Error.OutOfMemory; } + pub fn createWithCharactersInRange( + range: foundation.Range, + ) Allocator.Error!*CharacterSet { + return @intToPtr(?*CharacterSet, @ptrToInt(c.CFCharacterSetCreateWithCharactersInRange( + null, + range.cval(), + ))) orelse Allocator.Error.OutOfMemory; + } + pub fn release(self: *CharacterSet) void { c.CFRelease(self); } @@ -28,3 +37,13 @@ test "character set" { const cs = try CharacterSet.createWithCharactersInString(str); defer cs.release(); } + +test "character set range" { + //const testing = std.testing; + + const cs = try CharacterSet.createWithCharactersInRange(.{ + .location = 'A', + .length = 1, + }); + defer cs.release(); +}