/* * Copyright (C) 2013-2015 RoboVM AB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.robovm.apple.addressbook; /*<imports>*/ import java.io.*; import java.nio.*; import java.util.*; import org.robovm.objc.*; import org.robovm.objc.annotation.*; import org.robovm.objc.block.*; import org.robovm.rt.*; import org.robovm.rt.annotation.*; import org.robovm.rt.bro.*; import org.robovm.rt.bro.annotation.*; import org.robovm.rt.bro.ptr.*; import org.robovm.apple.foundation.*; import org.robovm.apple.corefoundation.*; /*</imports>*/ /*<javadoc>*/ /*</javadoc>*/ /*<annotations>*/@Library("AddressBook")/*</annotations>*/ /*<visibility>*/public/*</visibility>*/ class /*<name>*/ABGroup/*</name>*/ extends /*<extends>*/ABRecord/*</extends>*/ /*<implements>*//*</implements>*/ { public static class AsListMarshaler { @MarshalsPointer public static List<ABGroup> toObject(Class<? extends CFType> cls, long handle, long flags) { CFArray o = (CFArray) CFType.Marshaler.toObject(CFArray.class, handle, flags); if (o == null) { return null; } List<ABGroup> list = new ArrayList<>(); for (long i = 0, n = o.size(); i < n; i++) { ABRecord record = o.get(i, ABRecord.class); list.add((ABGroup)NativeObject.Marshaler.toObject(ABGroup.class, record.getHandle(), flags)); } return list; } @MarshalsPointer public static long toNative(List<ABGroup> l, long flags) { if (l == null) { return 0L; } CFArray array = CFMutableArray.create(); for (ABGroup i : l) { array.add(i); } return CFType.Marshaler.toNative(array, flags); } } /*<ptr>*/ /*</ptr>*/ /*<bind>*/static { Bro.bind(ABGroup.class); }/*</bind>*/ /*<constants>*//*</constants>*/ /*<constructors>*//*</constructors>*/ /*<properties>*//*</properties>*/ /*<members>*//*</members>*/ public String getName() { CFString val = getValue(ABGroupProperty.Name, CFString.class); if (val != null) return val.toString(); return null; } public ABGroup setName(String name) throws NSErrorException { if (name == null) { setValue(ABGroupProperty.Name, null); } else { setValue(ABGroupProperty.Name, new CFString(name)); } return this; } /*<methods>*/ /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated @Bridge(symbol="ABGroupCreate", optional=true) public static native @org.robovm.rt.bro.annotation.Marshaler(ABRecord.NoRetainMarshaler.class) ABGroup create(); /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated @Bridge(symbol="ABGroupCreateInSource", optional=true) public static native @org.robovm.rt.bro.annotation.Marshaler(ABRecord.NoRetainMarshaler.class) ABGroup create(ABSource source); /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated @Bridge(symbol="ABGroupCopySource", optional=true) public native @org.robovm.rt.bro.annotation.Marshaler(ABRecord.NoRetainMarshaler.class) ABSource getSource(); /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated @Bridge(symbol="ABGroupCopyArrayOfAllMembers", optional=true) public native @org.robovm.rt.bro.annotation.Marshaler(ABPerson.AsListMarshaler.class) List<ABPerson> getAllMembers(); /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated @Bridge(symbol="ABGroupCopyArrayOfAllMembersWithSortOrdering", optional=true) public native @org.robovm.rt.bro.annotation.Marshaler(ABPerson.AsListMarshaler.class) List<ABPerson> getAllMembers(ABPersonSortOrdering sortOrdering); /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated public boolean addMember(ABPerson person) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); boolean result = addMember(person, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated @Bridge(symbol="ABGroupAddMember", optional=true) private native boolean addMember(ABPerson person, NSError.NSErrorPtr error); /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated public boolean removeMember(ABPerson member) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); boolean result = removeMember(member, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /** * @since Available in iOS 2.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated @Bridge(symbol="ABGroupRemoveMember", optional=true) private native boolean removeMember(ABPerson member, NSError.NSErrorPtr error); /*</methods>*/ }