BridgeSupportファイルにはどのくらいクラス定義があるか
こないだFoundation.bridgesupportにNSEnumeratorがないことがわかったので、実際どんなもんだろと確認してみた。
% ack --hh '^@interface' /System/Library/Frameworks/Foundation.framework/Headers | cut -f2 -d\ | cut -f1 -d\: | sed -e 's/(.*)//g' | sort -u > hdr-classes-foundation.txt % ack --bs 'class\sname=' /System/Library/Frameworks/Foundation.framework/ | cut -f2 -d\' > bs-classes-foundation.txt % comm -13 bs-classes-foundation.txt hdr-classes-foundation.txt NSAutoreleasePool NSCachedURLResponse NSClassDescription NSCloneCommand NSCloseCommand NSCompoundPredicate : NSUniqueIDSpecifier NSUserNotificationCenter NSWhoseSpecifier NSXPCListener NSXPCListenerEndpoint % comm -23 bs-classes-foundation.txt hdr-classes-foundation.txt
ヘッダファイルのほうにのみあるクラスは70あって、NSEnumeratorのほかにNSErrorやNSNull、NSPipe、NSURLResponseなどよく使うクラスもある。ちなみにAppKitだと59で、わりとマイナーなViewが多くFoundationのカテゴリも含むからそんなでもない感じ。
ということで、BridgeSupportに定義されてるクラスをOSX.ns_importでロードしてやってクラスをRuby側に持ってくるという作戦は現実的じゃないみたい。