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

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

There is a newer version: 1.2.9
Show newest version
/*
 * 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.*;
/**/

/**/
/**
 * @since Available in iOS 5.0 and later.
 */
/**/
/**/@Library("Foundation") @NativeClass/**/
/**/public/**/ class /**/NSMetadataQuery/**/ 
    extends /**/NSObject/**/ 
    /**//**/ {

    public static class Notifications {
        /**
         * @since Available in iOS 5.0 and later.
         */
        public static NSObject observeDidStartGathering(NSMetadataQuery object, final VoidBlock2 block) {
            return NSNotificationCenter.getDefaultCenter().addObserver(DidStartGatheringNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1() {
                @Override
                public void invoke(NSNotification a) {
                    block.invoke((NSMetadataQuery)a.getObject(), new NSMetadataQueryUpdatedItems(a.getUserInfo()));
                }
            });
        }
        /**
         * @since Available in iOS 5.0 and later.
         */
        public static NSObject observeGatheringProgress(NSMetadataQuery object, final VoidBlock2 block) {
            return NSNotificationCenter.getDefaultCenter().addObserver(GatheringProgressNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1() {
                @Override
                public void invoke(NSNotification a) {
                    block.invoke((NSMetadataQuery)a.getObject(), new NSMetadataQueryUpdatedItems(a.getUserInfo()));
                }
            });
        }
        /**
         * @since Available in iOS 5.0 and later.
         */
        public static NSObject observeDidFinishGathering(NSMetadataQuery object, final VoidBlock2 block) {
            return NSNotificationCenter.getDefaultCenter().addObserver(DidFinishGatheringNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1() {
                @Override
                public void invoke(NSNotification a) {
                    block.invoke((NSMetadataQuery)a.getObject(), new NSMetadataQueryUpdatedItems(a.getUserInfo()));
                }
            });
        }
        /**
         * @since Available in iOS 5.0 and later.
         */
        public static NSObject observeDidUpdate(NSMetadataQuery object, final VoidBlock2 block) {
            return NSNotificationCenter.getDefaultCenter().addObserver(DidUpdateNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1() {
                @Override
                public void invoke(NSNotification a) {
                    block.invoke((NSMetadataQuery)a.getObject(), new NSMetadataQueryUpdatedItems(a.getUserInfo()));
                }
            });
        }
    }
    
    /**/public static class NSMetadataQueryPtr extends Ptr {}/**/
    /**/static { ObjCRuntime.bind(NSMetadataQuery.class); }/**/
    /**//**/
    /**/
    public NSMetadataQuery() {}
    protected NSMetadataQuery(SkipInit skipInit) { super(skipInit); }
    /**/
    /**/
    @Property(selector = "delegate")
    public native NSMetadataQueryDelegate getDelegate();
    @Property(selector = "setDelegate:", strongRef = true)
    public native void setDelegate(NSMetadataQueryDelegate v);
    @Property(selector = "predicate")
    public native NSPredicate getPredicate();
    @Property(selector = "setPredicate:")
    public native void setPredicate(NSPredicate v);
    @Property(selector = "sortDescriptors")
    public native NSArray getSortDescriptors();
    @Property(selector = "setSortDescriptors:")
    public native void setSortDescriptors(NSArray v);
    @Property(selector = "valueListAttributes")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSMetadataItemAttribute.AsListMarshaler.class) List getValueListAttributes();
    @Property(selector = "setValueListAttributes:")
    public native void setValueListAttributes(@com.bugvm.rt.bro.annotation.Marshaler(NSMetadataItemAttribute.AsListMarshaler.class) List v);
    @Property(selector = "groupingAttributes")
    public native @com.bugvm.rt.bro.annotation.Marshaler(NSMetadataItemAttribute.AsListMarshaler.class) List getGroupingAttributes();
    @Property(selector = "setGroupingAttributes:")
    public native void setGroupingAttributes(@com.bugvm.rt.bro.annotation.Marshaler(NSMetadataItemAttribute.AsListMarshaler.class) List v);
    @Property(selector = "notificationBatchingInterval")
    public native double getNotificationBatchingInterval();
    @Property(selector = "setNotificationBatchingInterval:")
    public native void setNotificationBatchingInterval(double v);
    @Property(selector = "searchScopes")
    protected native NSArray getSearchScopes0();
    @Property(selector = "setSearchScopes:")
    protected native void setSearchScopes0(NSArray v);
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Property(selector = "searchItems")
    protected native NSArray getSearchItems0();
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Property(selector = "setSearchItems:")
    protected native void setSearchItems0(NSArray v);
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Property(selector = "operationQueue")
    public native NSOperationQueue getOperationQueue();
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Property(selector = "setOperationQueue:")
    public native void setOperationQueue(NSOperationQueue v);
    @Property(selector = "isStarted")
    public native boolean isStarted();
    @Property(selector = "isGathering")
    public native boolean isGathering();
    @Property(selector = "isStopped")
    public native boolean isStopped();
    @Property(selector = "resultCount")
    public native @MachineSizedUInt long getResultCount();
    @Property(selector = "results")
    public native NSArray getResults();
    @Property(selector = "valueLists")
    protected native NSDictionary getValueLists0();
    @Property(selector = "groupedResults")
    public native NSArray getGroupedResults();
    /**/
    /**//**/
    public void setSearchScopes(NSArray scopes) {
        setSearchScopes0(scopes);
    }
    public void setSearchScopes(List scopes) {
        setSearchScopes0(NSArray.fromStrings(scopes));
    }
    public void setSearchScopes(NSMetadataQueryScope...scopes) {
        NSMutableArray array = new NSMutableArray<>();
        for (NSMetadataQueryScope scope : scopes) {
            array.add(scope.value());
        }
        setSearchScopes0(array);
    }
    public List getSearchScopes() {
        return getSearchScopes0().asStringList();
    }
    public void setSearchItems(NSArray items) {
        setSearchItems0(items);
    }
    public void setSearchItemURLs(NSArray urls) {
        setSearchItems0(urls);
    }
    public NSArray getSearchItems() {
        return (NSArray) getSearchItems0();
    }
    public Map getValueLists() {
        Map values = new HashMap<>();
        NSDictionary valueLists = getValueLists0();
        for (Map.Entry entry : valueLists.entrySet()) {
            values.put(NSMetadataItemAttribute.valueOf(entry.getKey()), entry.getValue());
        }
        return values;
    }
    /**/
    /**
     * @since Available in iOS 5.0 and later.
     */
    @GlobalValue(symbol="NSMetadataQueryDidStartGatheringNotification", optional=true)
    public static native NSString DidStartGatheringNotification();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @GlobalValue(symbol="NSMetadataQueryGatheringProgressNotification", optional=true)
    public static native NSString GatheringProgressNotification();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @GlobalValue(symbol="NSMetadataQueryDidFinishGatheringNotification", optional=true)
    public static native NSString DidFinishGatheringNotification();
    /**
     * @since Available in iOS 5.0 and later.
     */
    @GlobalValue(symbol="NSMetadataQueryDidUpdateNotification", optional=true)
    public static native NSString DidUpdateNotification();
    
    @Method(selector = "startQuery")
    public native boolean startQuery();
    @Method(selector = "stopQuery")
    public native void stopQuery();
    @Method(selector = "disableUpdates")
    public native void disableUpdates();
    @Method(selector = "enableUpdates")
    public native void enableUpdates();
    @Method(selector = "resultAtIndex:")
    public native NSMetadataItem getResult(@MachineSizedUInt long idx);
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Method(selector = "enumerateResultsUsingBlock:")
    public native void enumerateResults(@Block("(,@MachineSizedUInt,)") VoidBlock3 block);
    /**
     * @since Available in iOS 7.0 and later.
     */
    @Method(selector = "enumerateResultsWithOptions:usingBlock:")
    public native void enumerateResults(NSEnumerationOptions opts, @Block("(,@MachineSizedUInt,)") VoidBlock3 block);
    @Method(selector = "indexOfResult:")
    public native @MachineSizedUInt long indexOfResult(NSMetadataItem result);
    @Method(selector = "valueOfAttribute:forResultAtIndex:")
    public native NSObject getValueForResult(NSMetadataItemAttribute attrName, @MachineSizedUInt long idx);
    /**/
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy