io.qt.core.QResource Maven / Gradle / Ivy
Show all versions of qtjambi Show documentation
package io.qt.core;
import io.qt.*;
/**
* Interface for reading directly from resources
* Java wrapper for Qt class QResource
*/
public class QResource extends QtObject
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QResource::Compression
*/
public enum Compression implements QtEnumerator {
/**
* Representing QResource:: NoCompression
*/
NoCompression(0),
/**
* Representing QResource:: ZlibCompression
*/
ZlibCompression(1),
/**
* Representing QResource:: ZstdCompression
*/
ZstdCompression(2);
static {
QtJambi_LibraryUtilities.initialize();
}
private Compression(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
public int value() {
return value;
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull Compression resolve(int value) {
switch (value) {
case 0: return NoCompression;
case 1: return ZlibCompression;
case 2: return ZstdCompression;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* See QResource:: QResource(QString, QLocale)
*/
public QResource(java.lang.@NonNull String file, io.qt.core.@NonNull QLocale locale){
super((QPrivateConstructor)null);
initialize_native(this, file, locale);
}
private native static void initialize_native(QResource instance, java.lang.String file, io.qt.core.QLocale locale);
/**
* See QResource:: absoluteFilePath()const
*/
@QtUninvokable
public final java.lang.@NonNull String absoluteFilePath(){
return absoluteFilePath_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String absoluteFilePath_native_constfct(long __this__nativeId);
/**
* See QResource:: children()const
*/
@QtUninvokable
protected final io.qt.core.@NonNull QStringList children(){
return children_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QStringList children_native_constfct(long __this__nativeId);
/**
* See QResource:: compressionAlgorithm()const
*/
@QtUninvokable
public final io.qt.core.QResource.@NonNull Compression compressionAlgorithm(){
return io.qt.core.QResource.Compression.resolve(compressionAlgorithm_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)));
}
@QtUninvokable
private native int compressionAlgorithm_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final java.nio.@Nullable ByteBuffer data(){
return data_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.nio.ByteBuffer data_native_constfct(long __this__nativeId);
/**
* See QResource:: fileName()const
*/
@QtUninvokable
public final java.lang.@NonNull String fileName(){
return fileName_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String fileName_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
protected final boolean isDir(){
return isDir_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isDir_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
protected final boolean isFile(){
return isFile_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isFile_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final boolean isValid(){
return isValid_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isValid_native_constfct(long __this__nativeId);
/**
* See QResource:: lastModified()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QDateTime lastModified(){
return lastModified_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QDateTime lastModified_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QLocale locale(){
return locale_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QLocale locale_native_constfct(long __this__nativeId);
/**
* See QResource:: setFileName(QString)
*/
@QtUninvokable
public final void setFileName(java.lang.@NonNull String file){
setFileName_native_cref_QString(QtJambi_LibraryUtilities.internal.nativeId(this), file);
}
@QtUninvokable
private native void setFileName_native_cref_QString(long __this__nativeId, java.lang.String file);
/**
* See QResource:: setLocale(QLocale)
*/
@QtUninvokable
public final void setLocale(io.qt.core.@NonNull QLocale locale){
setLocale_native_cref_QLocale(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(locale));
}
@QtUninvokable
private native void setLocale_native_cref_QLocale(long __this__nativeId, long locale);
/**
*
*/
@QtUninvokable
public final long size(){
return size_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native long size_native_constfct(long __this__nativeId);
/**
* See QResource:: uncompressedData()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QByteArray uncompressedData(){
return uncompressedData_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QByteArray uncompressedData_native_constfct(long __this__nativeId);
/**
* See QResource:: uncompressedSize()const
*/
@QtUninvokable
public final long uncompressedSize(){
return uncompressedSize_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native long uncompressedSize_native_constfct(long __this__nativeId);
/**
* See QResource:: registerResource(QString, QString)
*/
public native static boolean registerResource(java.lang.@NonNull String rccFilename, java.lang.@NonNull String resourceRoot);
/**
* See QResource:: registerResource(const uchar*, QString)
*/
public static boolean registerResource(java.nio.@StrictNonNull ByteBuffer rccData, java.lang.@NonNull String resourceRoot){
if(!rccData.isDirect()){
throw new IllegalArgumentException("Only direct buffers allowed.");
}
java.util.Objects.requireNonNull(rccData, "Argument 'rccData': null not expected.");
boolean __qt_return_value = registerResource_native_const_uchar_ptr_cref_QString(rccData, resourceRoot);
if(__qt_return_value){
registeredBuffers.add(rccData);
}
return __qt_return_value;
}
private native static boolean registerResource_native_const_uchar_ptr_cref_QString(java.nio.ByteBuffer rccData, java.lang.String resourceRoot);
/**
* See QResource:: unregisterResource(QString, QString)
*/
public native static boolean unregisterResource(java.lang.@NonNull String rccFilename, java.lang.@NonNull String resourceRoot);
/**
* See QResource:: unregisterResource(const uchar*, QString)
*/
public static boolean unregisterResource(java.nio.@StrictNonNull ByteBuffer rccData, java.lang.@NonNull String resourceRoot){
if(!rccData.isDirect()){
throw new IllegalArgumentException("Only direct buffers allowed.");
}
java.util.Objects.requireNonNull(rccData, "Argument 'rccData': null not expected.");
boolean __qt_return_value = unregisterResource_native_const_uchar_ptr_cref_QString(rccData, resourceRoot);
if(__qt_return_value){
registeredBuffers.remove(rccData);
}
return __qt_return_value;
}
private native static boolean unregisterResource_native_const_uchar_ptr_cref_QString(java.nio.ByteBuffer rccData, java.lang.String resourceRoot);
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QResource(QPrivateConstructor p) { super(p); }
private static class CoreUtility extends io.qt.internal.CoreUtility{
protected static void addClassPath(String path) {
io.qt.internal.CoreUtility.addClassPath(path);
}
protected static void removeClassPath(String path) {
io.qt.internal.CoreUtility.removeClassPath(path);
}
protected static void addClassPath(java.net.URL path) {
io.qt.internal.CoreUtility.addClassPath(path);
}
}
/**
* Adds path
to the set of classpaths in which QtJambi should search for resources.
*/
public static void addClassPath(String path) {
CoreUtility.addClassPath(path);
}
/**
* Removes path
from the set of classpaths in which QtJambi searches
* for resources.
*/
public static void removeClassPath(String path) {
CoreUtility.removeClassPath(path);
}
static void addClassPath(java.net.URL url) {
CoreUtility.addClassPath(url);
}
private static final java.util.List registeredBuffers = new java.util.ArrayList<>();
/**
* Overloaded constructor for {@link #QResource(java.lang.String, io.qt.core.QLocale)}
* with locale = new io.qt.core.QLocale()
.
*/
public QResource(java.lang.@NonNull String file) {
this(file, new io.qt.core.QLocale());
}
/**
* Overloaded constructor for {@link #QResource(java.lang.String, io.qt.core.QLocale)}
* with:
* file = (String)null
* locale = new io.qt.core.QLocale()
*
*/
public QResource() {
this((String)null, new io.qt.core.QLocale());
}
/**
* Overloaded constructor for {@link #QResource(java.lang.String, io.qt.core.QLocale)}.
*/
public QResource(java.lang.@NonNull String file, io.qt.core.QLocale.@NonNull Language locale) {
this(file, new io.qt.core.QLocale(locale));
}
/**
* Overloaded function for {@link #setLocale(io.qt.core.QLocale)}.
*/
@QtUninvokable
public final void setLocale(io.qt.core.QLocale.@NonNull Language locale) {
setLocale(new io.qt.core.QLocale(locale));
}
/**
* Overloaded function for {@link #registerResource(java.lang.String, java.lang.String)}
* with resourceRoot = (String)null
.
*/
public static boolean registerResource(java.lang.@NonNull String rccFilename) {
return registerResource(rccFilename, (String)null);
}
/**
* Overloaded function for {@link #registerResource(java.nio.ByteBuffer, java.lang.String)}
* with resourceRoot = (String)null
.
*/
public static boolean registerResource(java.nio.@StrictNonNull ByteBuffer rccData) {
return registerResource(rccData, (String)null);
}
/**
* Overloaded function for {@link #registerResource(byte[], java.lang.String)}
* with resourceRoot = (String)null
.
*/
public static boolean registerResource(byte @StrictNonNull[] rccData) {
return registerResource(rccData==null ? null : java.nio.ByteBuffer.wrap(rccData), (String)null);
}
/**
* Overloaded function for {@link #registerResource(java.nio.ByteBuffer, java.lang.String)}.
*/
public static boolean registerResource(byte @StrictNonNull[] rccData, java.lang.@NonNull String resourceRoot) {
return registerResource(rccData==null ? null : java.nio.ByteBuffer.wrap(rccData), resourceRoot);
}
/**
* Overloaded function for {@link #unregisterResource(java.lang.String, java.lang.String)}
* with resourceRoot = (String)null
.
*/
public static boolean unregisterResource(java.lang.@NonNull String rccFilename) {
return unregisterResource(rccFilename, (String)null);
}
/**
* Overloaded function for {@link #unregisterResource(java.nio.ByteBuffer, java.lang.String)}
* with resourceRoot = (String)null
.
*/
public static boolean unregisterResource(java.nio.@StrictNonNull ByteBuffer rccData) {
return unregisterResource(rccData, (String)null);
}
/**
* Overloaded function for {@link #unregisterResource(byte[], java.lang.String)}
* with resourceRoot = (String)null
.
*/
public static boolean unregisterResource(byte @StrictNonNull[] rccData) {
return unregisterResource(rccData==null ? null : java.nio.ByteBuffer.wrap(rccData), (String)null);
}
/**
* Overloaded function for {@link #unregisterResource(java.nio.ByteBuffer, java.lang.String)}.
*/
public static boolean unregisterResource(byte @StrictNonNull[] rccData, java.lang.@NonNull String resourceRoot) {
return unregisterResource(rccData==null ? null : java.nio.ByteBuffer.wrap(rccData), resourceRoot);
}
}