Пример #1
0
 /**
  * @throws OSStatusException
  * @since Available in iOS 2.0 and later.
  */
 public int getPropertySize(Struct<?> specifier) throws OSStatusException {
   IntPtr ptr = new IntPtr();
   OSStatus status =
       getPropertyInfo0(
           this,
           specifier == null ? 0 : Struct.sizeOf(specifier),
           specifier == null ? null : specifier.as(VoidPtr.class),
           ptr);
   OSStatusException.throwIfNecessary(status);
   return ptr.get();
 }
Пример #2
0
 /**
  * @throws OSStatusException
  * @since Available in iOS 2.0 and later.
  */
 public <T extends Struct<T>> T getProperty(Struct<?> specifier, Class<T> type)
     throws OSStatusException {
   T data = Struct.allocate(type);
   IntPtr dataSize = new IntPtr(Struct.sizeOf(data));
   OSStatus status =
       getProperty0(
           this,
           specifier == null ? 0 : Struct.sizeOf(specifier),
           specifier == null ? null : specifier.as(VoidPtr.class),
           dataSize,
           data.as(VoidPtr.class));
   OSStatusException.throwIfNecessary(status);
   return data;
 }
Пример #3
0
 public CIVector(double[] values) {
   super((SkipInit) null);
   if (values == null) {
     throw new NullPointerException("values");
   }
   MachineSizedFloatPtr p = Struct.allocate(MachineSizedFloatPtr.class, values.length);
   p.set(values);
   initObject(initWithValues$count$(p, values.length));
 }
Пример #4
0
  /**
   * Constructs a <code>SerialStruct</code> object from the given <code>Struct</code> object, using
   * the given <code>java.util.Map</code> object for custom mapping the SQL structured type or any
   * of its attributes that are SQL structured types.
   *
   * @param map a <code>java.util.Map</code> object in which each entry consists of 1) a <code>
   *     String</code> object giving the fully qualified name of a UDT and 2) the <code>Class</code>
   *     object for the <code>SQLData</code> implementation that defines how the UDT is to be mapped
   * @throws SerialException if an error occurs
   * @see java.sql.Struct
   */
  public SerialStruct(Struct in, Map<String, Class<?>> map) throws SerialException {

    try {

      // get the type name
      SQLTypeName = new String(in.getSQLTypeName());
      System.out.println("SQLTypeName: " + SQLTypeName);

      // get the attributes of the struct
      attribs = in.getAttributes(map);

      /*
       * the array may contain further Structs
       * and/or classes that have been mapped,
       * other types that we have to serialize
       */
      mapToSerial(map);

    } catch (SQLException e) {
      throw new SerialException(e.getMessage());
    }
  }
Пример #5
0
 private static CGGradient create(CGColorSpace space, CGColor[] colors, Object locations) {
   if (colors == null) {
     throw new NullPointerException("colors");
   }
   try (CFMutableArray colorsArray =
       CFMutableArray.createMutable(null, colors.length, CoreFoundation.TypeArrayCallBacks())) {
     for (CGColor c : colors) {
       colorsArray.appendValue(Struct.toStruct(VoidPtr.class, c.getHandle()));
     }
     return create(
         space,
         colorsArray,
         locations != null
             ? VM.getArrayValuesAddress(CoreGraphics.toMachineSizedFloatArray(locations))
             : 0);
   }
 }
Пример #6
0
 public static MKPolyline create(CLLocationCoordinate2D[] coords) {
   CLLocationCoordinate2D first = Struct.allocate(CLLocationCoordinate2D.class, coords.length);
   first.update(coords);
   return create(first, coords.length);
 }
Пример #7
0
 /*</members>*/
 public static MKPolyline create(MKMapPoint[] points) {
   MKMapPoint first = Struct.allocate(MKMapPoint.class, points.length);
   first.update(points);
   return create(first, points.length);
 }