Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 49 additions & 4 deletions compiler/cocoatouch/src/main/bro-gen/foundation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ classes:
NSDictionary: # DONE
protocols: [NSPropertyList, NSFastEnumeration, 'Map<K, V>']
template_parameters:
KeyType: K
ObjectType: V
properties:
'count':
Expand Down Expand Up @@ -1100,8 +1101,52 @@ classes:
name: write
'-descriptionInStringsFileFormat':
name: toStringsFileFormat
'+.*': {exclude: true}
'-.*': {exclude: true}
'-initWithObjects:forKeys:count:':
exclude: true # todo: use raw pointer arrays
'-initWithCoder:':
name: init
'-descriptionWithLocale:':
name: description
'-descriptionWithLocale:indent:':
name: description
'-objectsForKeys:notFoundMarker:':
name: objectsForKeys
'-writeToURL:error:':
name: writeToURL
throws: NSErrorException
'-getObjects:andKeys:count:':
exclude: true # todo: use raw pointer arrays
'-enumerateKeysAndObjectsWithOptions:usingBlock:':
name: enumerateKeysAndObjects
'-keysSortedByValueWithOptions:usingComparator:':
name: keysSortedByValue
'-keysOfEntriesWithOptions:passingTest:':
name: keysOfEntries
'-getObjects:andKeys:':
exclude: true # todo: use raw pointer arrays
'-initWithContentsOfFile:':
name: init
'-initWithContentsOfURL:':
exclude: true # deprecate and conflicts with '-initWithContentsOfURL:error:'
'-initWithDictionary:copyItems:':
name: init
'-initWithContentsOfURL:error:':
name: init
throws: NSErrorException
'+dictionaryWithObject:forKey:':
exclude: true
'+dictionaryWithObjects:forKeys:count:':
exclude: true
'+dictionaryWithDictionary:':
exclude: true
'+dictionaryWithObjects:forKeys:':
exclude: true
'+dictionaryWithContentsOfURL:error:':
exclude: true
'+dictionary':
exclude: true
'-countByEnumeratingWithState:objects:count:':
exclude: true # todo: use raw pointer arrays
NSDimension: # DONE
methods:
'-init.*':
Expand Down Expand Up @@ -4275,8 +4320,8 @@ classes:
'+standardUserDefaults':
property: true
'-init': {}
'-init.*':
exclude: true
'-initWithSuiteName:':
name: init
NSUUID: # DONE
properties:
'UUIDString':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ public int size() {
public NSDictionary() {}
protected NSDictionary(Handle h, long handle) { super(h, handle); }
protected NSDictionary(SkipInit skipInit) { super(skipInit); }
@Method(selector = "initWithCoder:")
public NSDictionary(NSCoder coder) { super((SkipInit) null); initObject(init(coder)); }
@Method(selector = "initWithDictionary:copyItems:")
public NSDictionary(NSDictionary<K, V> otherDictionary, boolean flag) { super((SkipInit) null); initObject(init(otherDictionary, flag)); }
/*</constructors>*/

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -415,7 +419,11 @@ public V remove(Object key) {
public boolean equals(Object obj) {
return obj instanceof NSDictionary && equalsTo((NSDictionary<K, V>) obj);
}


/**
* @deprecated Use dictionaryWithContentsOfURL:error:
*/
@Deprecated
public static NSDictionary<?, ?> read(java.io.File file) {
return read(file.getAbsolutePath());
}
Expand Down Expand Up @@ -592,8 +600,58 @@ protected NSObject getObjectForKey(Object key) {
/*<methods>*/
@Method(selector = "objectForKey:")
protected native V getObject(K aKey);
@Method(selector = "keyEnumerator")
public native NSEnumerator<K> keyEnumerator();
@Method(selector = "initWithCoder:")
protected native @Pointer long init(NSCoder coder);
@Method(selector = "allKeysForObject:")
public native NSArray<K> allKeysForObject(V anObject);
@Method(selector = "descriptionWithLocale:")
public native String description(NSObject locale);
@Method(selector = "descriptionWithLocale:indent:")
public native String description(NSObject locale, @MachineSizedUInt long level);
@Method(selector = "isEqualToDictionary:")
protected native boolean equalsTo(NSDictionary<K, V> otherDictionary);
@Method(selector = "objectEnumerator")
public native NSEnumerator<V> objectEnumerator();
@Method(selector = "objectsForKeys:notFoundMarker:")
public native NSArray<V> objectsForKeys(NSArray<K> keys, V marker);
/**
* @since Available in iOS 11.0 and later.
*/
public boolean writeToURL(NSURL url) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = writeToURL(url, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
/**
* @since Available in iOS 11.0 and later.
*/
@Method(selector = "writeToURL:error:")
private native boolean writeToURL(NSURL url, NSError.NSErrorPtr error);
@Method(selector = "keysSortedByValueUsingSelector:")
public native NSArray<K> keysSortedByValueUsingSelector(Selector comparator);
@Method(selector = "objectForKeyedSubscript:")
public native V objectForKeyedSubscript(K key);
@Method(selector = "enumerateKeysAndObjectsUsingBlock:")
public native void enumerateKeysAndObjectsUsingBlock(@Block VoidBlock3<K, V, BooleanPtr> block);
@Method(selector = "enumerateKeysAndObjectsWithOptions:usingBlock:")
public native void enumerateKeysAndObjects(NSEnumerationOptions opts, @Block VoidBlock3<K, V, BooleanPtr> block);
@Method(selector = "keysSortedByValueUsingComparator:")
public native NSArray<K> keysSortedByValueUsingComparator(@Block Block2<NSObject, NSObject, NSComparisonResult> cmptr);
@Method(selector = "keysSortedByValueWithOptions:usingComparator:")
public native NSArray<K> keysSortedByValue(NSSortOptions opts, @Block Block2<NSObject, NSObject, NSComparisonResult> cmptr);
@Method(selector = "keysOfEntriesPassingTest:")
public native NSSet<K> keysOfEntriesPassingTest(@Block Block3<K, V, BooleanPtr, Boolean> predicate);
@Method(selector = "keysOfEntriesWithOptions:passingTest:")
public native NSSet<K> keysOfEntries(NSEnumerationOptions opts, @Block Block3<K, V, BooleanPtr, Boolean> predicate);
/**
* @deprecated Use initWithContentsOfURL:error:
*/
@Deprecated
@Method(selector = "initWithContentsOfFile:")
public native NSDictionary<K, V> init(String path);
/**
* @deprecated Use writeToURL:error:
*/
Expand All @@ -620,7 +678,59 @@ protected NSObject getObjectForKey(Object key) {
public static native NSDictionary<?, ?> read(NSURL url);
@Method(selector = "initWithDictionary:")
protected native @Pointer long init(NSDictionary<K, V> otherDictionary);
@Method(selector = "initWithDictionary:copyItems:")
protected native @Pointer long init(NSDictionary<K, V> otherDictionary, boolean flag);
@Method(selector = "initWithObjects:forKeys:")
protected native @Pointer long init(NSArray<V> objects, NSArray<?> keys);
/**
* @since Available in iOS 11.0 and later.
*/
public NSDictionary<NSString, V> init(NSURL url) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
NSDictionary<NSString, V> result = init(url, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
/**
* @since Available in iOS 11.0 and later.
*/
@Method(selector = "initWithContentsOfURL:error:")
private native NSDictionary<NSString, V> init(NSURL url, NSError.NSErrorPtr error);
@Method(selector = "sharedKeySetForKeys:")
public static native NSObject sharedKeySetForKeys(NSArray<?> keys);
@Method(selector = "fileSize")
public native long fileSize();
@Method(selector = "fileModificationDate")
public native NSDate fileModificationDate();
@Method(selector = "fileType")
public native String fileType();
@Method(selector = "filePosixPermissions")
public native @MachineSizedUInt long filePosixPermissions();
@Method(selector = "fileOwnerAccountName")
public native String fileOwnerAccountName();
@Method(selector = "fileGroupOwnerAccountName")
public native String fileGroupOwnerAccountName();
@Method(selector = "fileSystemNumber")
public native @MachineSizedSInt long fileSystemNumber();
@Method(selector = "fileSystemFileNumber")
public native @MachineSizedUInt long fileSystemFileNumber();
@Method(selector = "fileExtensionHidden")
public native boolean fileExtensionHidden();
@Method(selector = "fileHFSCreatorCode")
public native int fileHFSCreatorCode();
@Method(selector = "fileHFSTypeCode")
public native int fileHFSTypeCode();
@Method(selector = "fileIsImmutable")
public native boolean fileIsImmutable();
@Method(selector = "fileIsAppendOnly")
public native boolean fileIsAppendOnly();
@Method(selector = "fileCreationDate")
public native NSDate fileCreationDate();
@Method(selector = "fileOwnerAccountID")
public native NSNumber fileOwnerAccountID();
@Method(selector = "fileGroupOwnerAccountID")
public native NSNumber fileGroupOwnerAccountID();
@Method(selector = "valueForKey:")
public native V valueForKey(String key);
/*</methods>*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,18 @@ public static <V extends NSObject> NSMutableDictionary<NSString, V> fromStringMa
}
return dictionary;
}


/**
* @deprecated Use dictionaryWithContentsOfURL:error:
*/
@Deprecated
public static NSMutableDictionary<?, ?> read(java.io.File file) {
return read(file.getAbsolutePath());
}
/**
* @deprecated Use dictionaryWithContentsOfURL:error:
*/
@Deprecated
@Method(selector = "dictionaryWithContentsOfFile:")
protected static native NSMutableDictionary<?, ?> read(String path);
@Method(selector = "dictionaryWithContentsOfURL:")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ public NSMutableURLRequest() {}
*/
@Property(selector = "setAllowsConstrainedNetworkAccess:")
public native void setAllowsConstrainedNetworkAccess(boolean v);
/**
* @since Available in iOS 26.1 and later.
*/
@Property(selector = "allowsUltraConstrainedNetworkAccess")
public native boolean allowsUltraConstrainedNetworkAccess();
/**
* @since Available in iOS 26.1 and later.
*/
@Property(selector = "setAllowsUltraConstrainedNetworkAccess:")
public native void setAllowsUltraConstrainedNetworkAccess(boolean v);
/**
* @since Available in iOS 14.5 and later.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public void invoke(NSNotification a) {
public NSUserDefaults() {}
protected NSUserDefaults(Handle h, long handle) { super(h, handle); }
protected NSUserDefaults(SkipInit skipInit) { super(skipInit); }
@Method(selector = "initWithSuiteName:")
public NSUserDefaults(String suitename) { super((SkipInit) null); initObject(init(suitename)); }
/*</constructors>*/
/*<properties>*/
@Property(selector = "standardUserDefaults")
Expand Down Expand Up @@ -165,6 +167,8 @@ public boolean isObjectForced(String key, NSUserDefaultsDomain domain) {
@GlobalValue(symbol="NSUserDefaultsDidChangeNotification", optional=true)
public static native NSString DidChangeNotification();

@Method(selector = "initWithSuiteName:")
protected native @Pointer long init(String suitename);
@Method(selector = "objectForKey:")
public native NSObject get(String defaultName);
@Method(selector = "setObject:forKey:")
Expand Down
Loading