io.qt.core.QResource Maven / Gradle / Ivy
package io.qt.core;
/**
* Interface for reading directly from resources
* Java wrapper for Qt class QResource
*/
public class QResource extends io.qt.QtObject
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QResource::Compression
*/
public enum Compression implements io.qt.QtEnumerator {
NoCompression(0),
ZlibCompression(1),
ZstdCompression(2);
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 Compression resolve(int value) {
switch (value) {
case 0: return NoCompression;
case 1: return ZlibCompression;
case 2: return ZstdCompression;
default: throw new io.qt.QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* Overloaded constructor for {@link #QResource(java.lang.String, io.qt.core.QLocale)}
* with locale = new io.qt.core.QLocale()
.
*/
public QResource(java.lang.String file) {
this(file, new io.qt.core.QLocale());
}
/**
* Overloaded constructor for {@link #QResource(java.lang.String, io.qt.core.QLocale)}
* with:
* file = ""
* locale = new io.qt.core.QLocale()
*
*/
public QResource() {
this("", new io.qt.core.QLocale());
}
/**
* See QResource::QResource(QString,QLocale)
*/
public QResource(java.lang.String file, io.qt.core.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
*/
@io.qt.QtUninvokable
public final java.lang.String absoluteFilePath(){
return absoluteFilePath_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native java.lang.String absoluteFilePath_native_constfct(long __this__nativeId);
/**
* See QResource::children()const
*/
@io.qt.QtUninvokable
protected final io.qt.core.QStringList children(){
return children_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native io.qt.core.QStringList children_native_constfct(long __this__nativeId);
/**
* See QResource::compressionAlgorithm()const
*/
@io.qt.QtUninvokable
public final io.qt.core.QResource.Compression compressionAlgorithm(){
return io.qt.core.QResource.Compression.resolve(compressionAlgorithm_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)));
}
@io.qt.QtUninvokable
private native int compressionAlgorithm_native_constfct(long __this__nativeId);
/**
*
*/
@io.qt.QtUninvokable
public final java.nio.ByteBuffer data(){
return data_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native java.nio.ByteBuffer data_native_constfct(long __this__nativeId);
/**
* See QResource::fileName()const
*/
@io.qt.QtUninvokable
public final java.lang.String fileName(){
return fileName_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native java.lang.String fileName_native_constfct(long __this__nativeId);
/**
*
*/
@io.qt.QtUninvokable
protected final boolean isDir(){
return isDir_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native boolean isDir_native_constfct(long __this__nativeId);
/**
*
*/
@io.qt.QtUninvokable
protected final boolean isFile(){
return isFile_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native boolean isFile_native_constfct(long __this__nativeId);
/**
*
*/
@io.qt.QtUninvokable
public final boolean isValid(){
return isValid_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native boolean isValid_native_constfct(long __this__nativeId);
/**
* See QResource::lastModified()const
*/
@io.qt.QtUninvokable
public final io.qt.core.QDateTime lastModified(){
return lastModified_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native io.qt.core.QDateTime lastModified_native_constfct(long __this__nativeId);
/**
*
*/
@io.qt.QtUninvokable
public final io.qt.core.QLocale locale(){
return locale_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native io.qt.core.QLocale locale_native_constfct(long __this__nativeId);
/**
* See QResource::setFileName(QString)
*/
@io.qt.QtUninvokable
public final void setFileName(java.lang.String file){
setFileName_native_cref_QString(QtJambi_LibraryUtilities.internal.nativeId(this), file);
}
@io.qt.QtUninvokable
private native void setFileName_native_cref_QString(long __this__nativeId, java.lang.String file);
/**
* See QResource::setLocale(QLocale)
*/
@io.qt.QtUninvokable
public final void setLocale(io.qt.core.QLocale locale){
setLocale_native_cref_QLocale(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(locale));
}
@io.qt.QtUninvokable
private native void setLocale_native_cref_QLocale(long __this__nativeId, long locale);
/**
*
*/
@io.qt.QtUninvokable
public final long size(){
return size_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native long size_native_constfct(long __this__nativeId);
/**
* See QResource::uncompressedData()const
*/
@io.qt.QtUninvokable
public final io.qt.core.QByteArray uncompressedData(){
return uncompressedData_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native io.qt.core.QByteArray uncompressedData_native_constfct(long __this__nativeId);
/**
* See QResource::uncompressedSize()const
*/
@io.qt.QtUninvokable
public final long uncompressedSize(){
return uncompressedSize_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native long uncompressedSize_native_constfct(long __this__nativeId);
/**
* Overloaded function for {@link #registerResource(java.lang.String, java.lang.String)}
* with resourceRoot = ""
.
*/
public static boolean registerResource(java.lang.String rccFilename) {
return registerResource(rccFilename, "");
}
/**
* See QResource::registerResource(QString,QString)
*/
public native static boolean registerResource(java.lang.String rccFilename, java.lang.String resourceRoot);
/**
* Overloaded function for {@link #registerResource(java.nio.ByteBuffer, java.lang.String)}
* with resourceRoot = ""
.
*/
public static boolean registerResource(java.nio.ByteBuffer rccData) {
return registerResource(rccData, "");
}
public static boolean registerResource(java.nio.ByteBuffer rccData, java.lang.String resourceRoot){
if(!rccData.isDirect()){
throw new IllegalArgumentException("Only direct buffers allowed.");
}
boolean __qt_return_value = registerResource_native_const_unsigned_char_ptr_cref_QString(rccData, resourceRoot);
if(__qt_return_value){
registeredBuffers.add(rccData);
}
return __qt_return_value;
}
private native static boolean registerResource_native_const_unsigned_char_ptr_cref_QString(java.nio.ByteBuffer rccData, java.lang.String resourceRoot);
/**
* Overloaded function for {@link #unregisterResource(java.lang.String, java.lang.String)}
* with resourceRoot = ""
.
*/
public static boolean unregisterResource(java.lang.String rccFilename) {
return unregisterResource(rccFilename, "");
}
/**
* See QResource::unregisterResource(QString,QString)
*/
public native static boolean unregisterResource(java.lang.String rccFilename, java.lang.String resourceRoot);
/**
* Overloaded function for {@link #unregisterResource(java.nio.ByteBuffer, java.lang.String)}
* with resourceRoot = ""
.
*/
public static boolean unregisterResource(java.nio.ByteBuffer rccData) {
return unregisterResource(rccData, "");
}
public static boolean unregisterResource(java.nio.ByteBuffer rccData, java.lang.String resourceRoot){
if(!rccData.isDirect()){
throw new IllegalArgumentException("Only direct buffers allowed.");
}
boolean __qt_return_value = unregisterResource_native_const_unsigned_char_ptr_cref_QString(rccData, resourceRoot);
if(__qt_return_value){
registeredBuffers.remove(rccData);
}
return __qt_return_value;
}
private native static boolean unregisterResource_native_const_unsigned_char_ptr_cref_QString(java.nio.ByteBuffer rccData, java.lang.String resourceRoot);
/**
* Constructor for internal use only.
* @param p expected to be null
.
*/
@io.qt.NativeAccess
protected QResource(QPrivateConstructor p) { super(p); }
/**
* Adds path
to the set of classpaths in which Qt Jambi should search for resources.
* Resources can be accessed using the "classpath:" scheme.
*/
public static void addClassPath(String path) {
io.qt.internal.QtJambiResources.addSearchPath(path);
}
/**
* Removes path
from the set of classpaths in which Qt Jambi searches
* for resources.
*/
public static void removeClassPath(String path) {
io.qt.internal.QtJambiResources.removeSearchPath(path);
}
private static final java.util.List registeredBuffers = new java.util.ArrayList<>();
}