io.qt.script.QScriptClass Maven / Gradle / Ivy
Show all versions of qtjambi-script Show documentation
package io.qt.script;
import io.qt.*;
/**
* Interface for defining custom behavior of (a class of) Qt Script objects
* Java wrapper for Qt class QScriptClass
* @since This class was introduced in Qt 4.4.
*/
public class QScriptClass extends QtObject
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QScriptClass::Extension
*/
public enum Extension implements QtEnumerator {
/**
* Representing QScriptClass:: Callable
*/
Callable(0),
/**
* Representing QScriptClass:: HasInstance
*/
HasInstance(1);
static {
QtJambi_LibraryUtilities.initialize();
}
private Extension(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
@Override
public int value() {
return value;
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull Extension resolve(int value) {
switch (value) {
case 0: return Callable;
case 1: return HasInstance;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* Java wrapper for Qt enum QScriptClass::QueryFlag
*
* @see QueryFlags
*/
public enum QueryFlag implements QtFlagEnumerator {
/**
* Representing QScriptClass:: HandlesReadAccess
*/
HandlesReadAccess(1),
/**
* Representing QScriptClass:: HandlesWriteAccess
*/
HandlesWriteAccess(2);
static {
QtJambi_LibraryUtilities.initialize();
}
private QueryFlag(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
@Override
public int value() {
return value;
}
/**
* Create a QFlags of the enum entry.
* @return QFlags
*/
@Override
public @NonNull QueryFlags asFlags() {
return new QueryFlags(value);
}
/**
* Combines this entry with other enum entry.
* @param e enum entry
* @return new flag
*/
public @NonNull QueryFlags combined(@NonNull QueryFlag e) {
return asFlags().setFlag(e, true);
}
/**
* Excludes other enum entry from a flag of this entry.
* @param e enum entry
* @return new flag
*/
public @NonNull QueryFlags cleared(@NonNull QueryFlag e) {
return asFlags().setFlag(e, false);
}
/**
* Creates a new {@link QueryFlags} from the entries.
* @param values entries
* @return new flag
*/
public static @NonNull QueryFlags flags(@Nullable QueryFlag @NonNull... values) {
return new QueryFlags(values);
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull QueryFlag resolve(int value) {
switch (value) {
case 1: return HandlesReadAccess;
case 2: return HandlesWriteAccess;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* {@link QFlags} type for enum {@link QueryFlag}
*/
public static final class QueryFlags extends QFlags implements Comparable {
private static final long serialVersionUID = 0x11b03667a4066df4L;
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Creates a new QueryFlags where the flags in args
are set.
* @param args enum entries
*/
public QueryFlags(@Nullable QueryFlag @NonNull... args){
super(args);
}
/**
* Creates a new QueryFlags with given value
.
* @param value
*/
public QueryFlags(int value) {
super(value);
}
/**
* Combines this flags with enum entry.
* @param e enum entry
* @return new QueryFlags
*/
@Override
public final @NonNull QueryFlags combined(@StrictNonNull QueryFlag e){
return new QueryFlags(value() | e.value());
}
/**
* Sets the flag e
* @param e enum entry
* @return this
*/
@Override
public final @NonNull QueryFlags setFlag(@Nullable QueryFlag e){
return setFlag(e, true);
}
/**
* Sets or clears the flag flag
* @param e enum entry
* @param on set (true) or clear (false)
* @return this
*/
@Override
public final @NonNull QueryFlags setFlag(@Nullable QueryFlag e, boolean on){
if (on) {
setValue(value() | e.value());
}else {
setValue(value() & ~e.value());
}
return this;
}
/**
* Returns an array of flag objects represented by this QueryFlags.
* @return array of enum entries
*/
@Override
public final @NonNull QueryFlag @NonNull[] flags(){
return super.flags(QueryFlag.values());
}
/**
* {@inheritDoc}
*/
@Override
public final @NonNull QueryFlags clone(){
return new QueryFlags(value());
}
/**
* {@inheritDoc}
*/
@Override
public final int compareTo(@StrictNonNull QueryFlags other){
return Integer.compare(value(), other.value());
}
}
/**
* See QScriptClass:: QScriptClass(QScriptEngine*)
* @param engine
*/
public QScriptClass(io.qt.script.@Nullable QScriptEngine engine){
super((QPrivateConstructor)null);
initialize_native(this, engine);
}
private native static void initialize_native(QScriptClass instance, io.qt.script.QScriptEngine engine);
/**
* See QScriptClass:: engine()const
* @return
*/
@QtUninvokable
public final io.qt.script.@Nullable QScriptEngine engine(){
return engine_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.script.QScriptEngine engine_native_constfct(long __this__nativeId);
/**
* See QScriptClass:: extension(QScriptClass::Extension, QVariant)
* @param extension
* @param argument
* @return
*/
@QtUninvokable
public java.lang.Object extension(io.qt.script.QScriptClass.@NonNull Extension extension, java.lang.Object argument){
return extension_native_QScriptClass_Extension_cref_QVariant(QtJambi_LibraryUtilities.internal.nativeId(this), extension.value(), argument);
}
@QtUninvokable
private native java.lang.Object extension_native_QScriptClass_Extension_cref_QVariant(long __this__nativeId, int extension, java.lang.Object argument);
/**
*
* @return
*/
@QtUninvokable
public java.lang.@NonNull String name(){
return name_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String name_native_constfct(long __this__nativeId);
/**
* See QScriptClass:: newIterator(QScriptValue)
* @param object
* @return
*/
@QtUninvokable
public io.qt.script.@NonNull QScriptClassPropertyIterator newIterator(io.qt.script.@NonNull QScriptValue object){
return newIterator_native_cref_QScriptValue(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(object));
}
@QtUninvokable
private native io.qt.script.@NonNull QScriptClassPropertyIterator newIterator_native_cref_QScriptValue(long __this__nativeId, long object);
/**
* See QScriptClass:: property(QScriptValue, QScriptString, uint)
* @param object
* @param name
* @param id
* @return
*/
@QtUninvokable
public io.qt.script.@NonNull QScriptValue property(io.qt.script.@NonNull QScriptValue object, io.qt.script.@NonNull QScriptString name, int id){
return property_native_cref_QScriptValue_cref_QScriptString_uint(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(object), QtJambi_LibraryUtilities.internal.checkedNativeId(name), id);
}
@QtUninvokable
private native io.qt.script.QScriptValue property_native_cref_QScriptValue_cref_QScriptString_uint(long __this__nativeId, long object, long name, int id);
/**
* See QScriptClass:: propertyFlags(QScriptValue, QScriptString, uint)
* @param object
* @param name
* @param id
* @return
*/
@QtUninvokable
public io.qt.script.QScriptValue.@NonNull PropertyFlags propertyFlags(io.qt.script.@NonNull QScriptValue object, io.qt.script.@NonNull QScriptString name, int id){
return new io.qt.script.QScriptValue.PropertyFlags(propertyFlags_native_cref_QScriptValue_cref_QScriptString_uint(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(object), QtJambi_LibraryUtilities.internal.checkedNativeId(name), id));
}
@QtUninvokable
private native int propertyFlags_native_cref_QScriptValue_cref_QScriptString_uint(long __this__nativeId, long object, long name, int id);
/**
* See QScriptClass:: prototype()const
* @return
*/
@QtUninvokable
public io.qt.script.@NonNull QScriptValue prototype(){
return prototype_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.script.QScriptValue prototype_native_constfct(long __this__nativeId);
/**
* See QScriptClass:: queryProperty(QScriptValue, QScriptString, QScriptClass::QueryFlags, uint*)
* @param object
* @param name
* @param flags
* @param id
* @return
*/
@QtUninvokable
public io.qt.script.QScriptClass.@NonNull QueryFlags queryProperty(io.qt.script.@NonNull QScriptValue object, io.qt.script.@NonNull QScriptString name, io.qt.script.QScriptClass.@NonNull QueryFlags flags, java.lang.@Nullable Integer id){
return new io.qt.script.QScriptClass.QueryFlags(queryProperty_native_cref_QScriptValue_cref_QScriptString_QScriptClass_QueryFlags_uint_ptr(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(object), QtJambi_LibraryUtilities.internal.checkedNativeId(name), flags.value(), id));
}
@QtUninvokable
private native int queryProperty_native_cref_QScriptValue_cref_QScriptString_QScriptClass_QueryFlags_uint_ptr(long __this__nativeId, long object, long name, int flags, java.lang.Integer id);
/**
* See QScriptClass:: setProperty(QScriptValue&, QScriptString, uint, QScriptValue)
* @param object
* @param name
* @param id
* @param value
*/
@QtUninvokable
public void setProperty(io.qt.script.@StrictNonNull QScriptValue object, io.qt.script.@NonNull QScriptString name, int id, io.qt.script.@NonNull QScriptValue value){
java.util.Objects.requireNonNull(object, "Argument 'object': null not expected.");
setProperty_native_ref_QScriptValue_cref_QScriptString_uint_cref_QScriptValue(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(object), QtJambi_LibraryUtilities.internal.checkedNativeId(name), id, QtJambi_LibraryUtilities.internal.checkedNativeId(value));
}
@QtUninvokable
private native void setProperty_native_ref_QScriptValue_cref_QScriptString_uint_cref_QScriptValue(long __this__nativeId, long object, long name, int id, long value);
/**
* See QScriptClass:: supportsExtension(QScriptClass::Extension)const
* @param extension
* @return
*/
@QtUninvokable
public boolean supportsExtension(io.qt.script.QScriptClass.@NonNull Extension extension){
return supportsExtension_native_QScriptClass_Extension_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), extension.value());
}
@QtUninvokable
private native boolean supportsExtension_native_QScriptClass_Extension_constfct(long __this__nativeId, int extension);
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QScriptClass(QPrivateConstructor p) { super(p); }
/**
* Overloaded function for {@link #extension(io.qt.script.QScriptClass.Extension, java.lang.Object)}
* with argument = null
.
*/
@QtUninvokable
public final java.lang.Object extension(io.qt.script.QScriptClass.@NonNull Extension extension) {
return extension(extension, (java.lang.Object)null);
}
}