All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bugvm.apple.foundation.NSCalendar Maven / Gradle / Ivy

/*
 * 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 com.bugvm.apple.foundation;

/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.uikit.*;
import com.bugvm.apple.coretext.*;
import com.bugvm.apple.coreanimation.*;
import com.bugvm.apple.coredata.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.coremedia.*;
import com.bugvm.apple.security.*;
import com.bugvm.apple.dispatch.*;
/**/

/**/

/**/
/**/@Library("Foundation") @NativeClass/**/
/**/public/**/ class /**/NSCalendar/**/ 
    extends /**/NSObject/**/ 
    /**//**/ {

    public static class Notifications {
        /**
         * @since Available in iOS 7.0 and later.
         */
        public static NSObject observeDayChanged(final Runnable block) {
            return NSNotificationCenter.getDefaultCenter().addObserver(DayChangedNotification(), null, NSOperationQueue.getMainQueue(), new VoidBlock1() {
                @Override
                public void invoke(NSNotification a) {
                    block.run();
                }
            });
        }
    }
    
    /**/public static class NSCalendarPtr extends Ptr {}/**/
    /**/static { ObjCRuntime.bind(NSCalendar.class); }/**/
    /**//**/
    /**/
    public NSCalendar() {}
    protected NSCalendar(SkipInit skipInit) { super(skipInit); }
    public NSCalendar(NSCalendarIdentifier ident) { super((SkipInit) null); initObject(init(ident)); }
    /**/
    /**/
    @Property(selector = "calendarIdentifier")
    public native NSCalendarIdentifier getCalendarIdentifier();
    @Property(selector = "locale")
    public native NSLocale getLocale();
    @Property(selector = "setLocale:")
    public native void setLocale(NSLocale v);
    @Property(selector = "timeZone")
    public native NSTimeZone getTimeZone();
    @Property(selector = "setTimeZone:")
    public native void setTimeZone(NSTimeZone v);
    @Property(selector = "firstWeekday")
    public native @MachineSizedUInt long getFirstWeekday();
    @Property(selector = "setFirstWeekday:")
    public native void setFirstWeekday(@MachineSizedUInt long v);
    @Property(selector = "minimumDaysInFirstWeek")
    public native @MachineSizedUInt long getMinimumDaysInFirstWeek();
    @Property(selector = "setMinimumDaysInFirstWeek:")
    public native void setMinimumDaysInFirstWeek(@MachineSizedUInt long v);
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "eraSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getEraSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "longEraSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getLongEraSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "monthSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getMonthSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "shortMonthSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getShortMonthSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "veryShortMonthSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getVeryShortMonthSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "standaloneMonthSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getStandaloneMonthSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "shortStandaloneMonthSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getShortStandaloneMonthSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "veryShortStandaloneMonthSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getVeryShortStandaloneMonthSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "weekdaySymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getWeekdaySymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "shortWeekdaySymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getShortWeekdaySymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "veryShortWeekdaySymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getVeryShortWeekdaySymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "standaloneWeekdaySymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getStandaloneWeekdaySymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "shortStandaloneWeekdaySymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getShortStandaloneWeekdaySymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "veryShortStandaloneWeekdaySymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getVeryShortStandaloneWeekdaySymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "quarterSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getQuarterSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "shortQuarterSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getShortQuarterSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "standaloneQuarterSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getStandaloneQuarterSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "shortStandaloneQuarterSymbols")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSArray.AsStringListMarshaler.class) List getShortStandaloneQuarterSymbols();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "AMSymbol")
    public native String getAMSymbol();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @Property(selector = "PMSymbol")
    public native String getPMSymbol();
    /**/
    /**//**/
    /**
     * @since Available in iOS 2.0 and later.
     */
    public NSDate getStartTime(NSCalendarUnit unit, NSDate date) {
        NSDate.NSDatePtr ptr = new NSDate.NSDatePtr();
        if (getRange(unit, ptr, new DoublePtr(), date)) {
            return ptr.get();
        }
        return null;
    }
    /**
     * @since Available in iOS 2.0 and later.
     */
    public double getDuration(NSCalendarUnit unit, NSDate date) {
        DoublePtr ptr = new DoublePtr();
        if (getRange(unit, new NSDate.NSDatePtr(), ptr, date)) {
            return ptr.get();
        }
        return 0;
    }
    /**/
    /**
     * @since Available in iOS 8.0 and later.
     */
    @GlobalValue(symbol="NSCalendarDayChangedNotification", optional=true)
    public static native NSString DayChangedNotification();
    
    @Method(selector = "initWithCalendarIdentifier:")
    protected native @Pointer long init(NSCalendarIdentifier ident);
    @Method(selector = "minimumRangeOfUnit:")
    public native @ByVal NSRange getMinimumRange(NSCalendarUnit unit);
    @Method(selector = "maximumRangeOfUnit:")
    public native @ByVal NSRange getMaximumRange(NSCalendarUnit unit);
    @Method(selector = "rangeOfUnit:inUnit:forDate:")
    public native @ByVal NSRange getRange(NSCalendarUnit smaller, NSCalendarUnit larger, NSDate date);
    @Method(selector = "ordinalityOfUnit:inUnit:forDate:")
    public native @MachineSizedUInt long getOrdinality(NSCalendarUnit smaller, NSCalendarUnit larger, NSDate date);
    /**
     * @since Available in iOS 2.0 and later.
     */
    @Method(selector = "rangeOfUnit:startDate:interval:forDate:")
    protected native boolean getRange(NSCalendarUnit unit, NSDate.NSDatePtr datep, DoublePtr tip, NSDate date);
    @Method(selector = "dateFromComponents:")
    public native NSDate newDateFromComponents(NSDateComponents comps);
    @Method(selector = "components:fromDate:")
    public native NSDateComponents getComponents(NSCalendarUnit unitFlags, NSDate date);
    @Method(selector = "dateByAddingComponents:toDate:options:")
    public native NSDate newDateByAddingComponents(NSDateComponents comps, NSDate date, NSCalendarOptions opts);
    @Method(selector = "components:fromDate:toDate:options:")
    public native NSDateComponents getComponents(NSCalendarUnit unitFlags, NSDate startingDate, NSDate resultDate, NSCalendarOptions opts);
    @Method(selector = "currentCalendar")
    public static native NSCalendar getCurrentCalendar();
    /**
     * @since Available in iOS 2.0 and later.
     */
    @Method(selector = "autoupdatingCurrentCalendar")
    public static native NSCalendar getAutoupdatingCurrentCalendar();
    /**/
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy