io.qt.core.QJsonDocument Maven / Gradle / Ivy
Show all versions of qtjambi Show documentation
package io.qt.core;
import io.qt.*;
/**
* Way to read and write JSON documents
* Java wrapper for Qt class QJsonDocument
*/
public class QJsonDocument extends QtObject
implements java.lang.Cloneable
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QJsonDocument::JsonFormat
*/
public enum JsonFormat implements QtEnumerator {
/**
* Representing QJsonDocument:: Indented
*/
Indented(0),
/**
* Representing QJsonDocument:: Compact
*/
Compact(1);
static {
QtJambi_LibraryUtilities.initialize();
}
private JsonFormat(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 JsonFormat resolve(int value) {
switch (value) {
case 0: return Indented;
case 1: return Compact;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* See QJsonDocument:: QJsonDocument()
*/
public QJsonDocument(){
super((QPrivateConstructor)null);
initialize_native(this);
}
private native static void initialize_native(QJsonDocument instance);
/**
* See QJsonDocument:: QJsonDocument(QJsonArray)
*/
public QJsonDocument(io.qt.core.@NonNull QJsonArray array){
super((QPrivateConstructor)null);
initialize_native(this, array);
}
private native static void initialize_native(QJsonDocument instance, io.qt.core.QJsonArray array);
/**
* See QJsonDocument:: QJsonDocument(QJsonDocument)
*/
public QJsonDocument(io.qt.core.@NonNull QJsonDocument other){
super((QPrivateConstructor)null);
initialize_native(this, other);
}
private native static void initialize_native(QJsonDocument instance, io.qt.core.QJsonDocument other);
/**
* See QJsonDocument:: QJsonDocument(QJsonObject)
*/
public QJsonDocument(io.qt.core.@NonNull QJsonObject object){
super((QPrivateConstructor)null);
initialize_native(this, object);
}
private native static void initialize_native(QJsonDocument instance, io.qt.core.QJsonObject object);
/**
* See QJsonDocument:: array()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonArray array(){
return array_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QJsonArray array_native_constfct(long __this__nativeId);
/**
* See QJsonDocument:: isArray()const
*/
@QtUninvokable
public final boolean isArray(){
return isArray_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isArray_native_constfct(long __this__nativeId);
/**
* See QJsonDocument:: isEmpty()const
*/
@QtUninvokable
public final boolean isEmpty(){
return isEmpty_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isEmpty_native_constfct(long __this__nativeId);
/**
* See QJsonDocument:: isNull()const
*/
@QtUninvokable
public final boolean isNull(){
return isNull_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isNull_native_constfct(long __this__nativeId);
/**
* See QJsonDocument:: isObject()const
*/
@QtUninvokable
public final boolean isObject(){
return isObject_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isObject_native_constfct(long __this__nativeId);
/**
* See QJsonDocument:: object()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonObject object(){
return object_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QJsonObject object_native_constfct(long __this__nativeId);
/**
* See operator<<(QDataStream&, QJsonDocument)
*/
@QtUninvokable
public void writeTo(io.qt.core.@StrictNonNull QDataStream arg__1){
java.util.Objects.requireNonNull(arg__1, "Argument 'arg__1': null not expected.");
writeTo_native_ref_QDataStream(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(arg__1));
}
@QtUninvokable
private native void writeTo_native_ref_QDataStream(long __this__nativeId, long arg__1);
/**
* See QJsonDocument:: operator=(QJsonDocument)
*/
@QtUninvokable
public final void assign(io.qt.core.@NonNull QJsonDocument other){
assign_native_cref_QJsonDocument(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(other));
}
@QtUninvokable
private native void assign_native_cref_QJsonDocument(long __this__nativeId, long other);
/**
* See QJsonDocument:: operator==(QJsonDocument)const
*/
@QtUninvokable
public final boolean equals(io.qt.core.@NonNull QJsonDocument other){
return equals_native_cref_QJsonDocument_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(other));
}
@QtUninvokable
private native boolean equals_native_cref_QJsonDocument_constfct(long __this__nativeId, long other);
/**
* See operator>>(QDataStream&, QJsonDocument&)
*/
@QtUninvokable
public void readFrom(io.qt.core.@StrictNonNull QDataStream arg__1){
java.util.Objects.requireNonNull(arg__1, "Argument 'arg__1': null not expected.");
readFrom_native_ref_QDataStream(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(arg__1));
}
@QtUninvokable
private native void readFrom_native_ref_QDataStream(long __this__nativeId, long arg__1);
/**
* See QJsonDocument:: operator[](QStringView)const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonValue get(java.lang.@NonNull String key){
return get_native_QStringView_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), key);
}
@QtUninvokable
private native io.qt.core.QJsonValue get_native_QStringView_constfct(long __this__nativeId, java.lang.String key);
/**
* See QJsonDocument:: operator[](qsizetype)const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonValue get(long i){
return get_native_qsizetype_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), i);
}
@QtUninvokable
private native io.qt.core.QJsonValue get_native_qsizetype_constfct(long __this__nativeId, long i);
/**
* See QJsonDocument:: setArray(QJsonArray)
*/
@QtUninvokable
public final void setArray(io.qt.core.@NonNull QJsonArray array){
setArray_native_cref_QJsonArray(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(array));
}
@QtUninvokable
private native void setArray_native_cref_QJsonArray(long __this__nativeId, long array);
/**
* See QJsonDocument:: setObject(QJsonObject)
*/
@QtUninvokable
public final void setObject(io.qt.core.@NonNull QJsonObject object){
setObject_native_cref_QJsonObject(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(object));
}
@QtUninvokable
private native void setObject_native_cref_QJsonObject(long __this__nativeId, long object);
/**
* See QJsonDocument:: swap(QJsonDocument&)
*/
@QtUninvokable
public final void swap(io.qt.core.@StrictNonNull QJsonDocument other){
java.util.Objects.requireNonNull(other, "Argument 'other': null not expected.");
swap_native_ref_QJsonDocument(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(other));
}
@QtUninvokable
private native void swap_native_ref_QJsonDocument(long __this__nativeId, long other);
/**
* See QJsonDocument:: toJson(QJsonDocument::JsonFormat)const
*/
@QtUninvokable
public final io.qt.core.@NonNull QByteArray toJson(io.qt.core.QJsonDocument.@NonNull JsonFormat format){
return toJson_native_QJsonDocument_JsonFormat_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), format.value());
}
@QtUninvokable
private native io.qt.core.QByteArray toJson_native_QJsonDocument_JsonFormat_constfct(long __this__nativeId, int format);
/**
* See QJsonDocument:: toVariant()const
*/
@QtUninvokable
public final java.lang.Object toVariant(){
return toVariant_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.Object toVariant_native_constfct(long __this__nativeId);
/**
* See QJsonDocument:: fromJson(QByteArray, QJsonParseError*)
*/
public static io.qt.core.QJsonDocument.@StrictNonNull FromJsonResult fromJson(io.qt.core.@NonNull QByteArray json){
return fromJson_native_cref_QByteArray_QJsonParseError_ptr(QtJambi_LibraryUtilities.internal.checkedNativeId(json));
}
private native static io.qt.core.QJsonDocument.FromJsonResult fromJson_native_cref_QByteArray_QJsonParseError_ptr(long json);
/**
* See QJsonDocument:: fromVariant(QVariant)
*/
public native static io.qt.core.@NonNull QJsonDocument fromVariant(java.lang.Object variant);
/**
* See QJsonDocument:: BinaryFormatTag
*/
private native static int BinaryFormatTag();
/**
* See QJsonDocument:: BinaryFormatTag
*/
public static final int BinaryFormatTag = BinaryFormatTag();
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QJsonDocument(QPrivateConstructor p) { super(p); }
/**
* See QJsonDocument:: operator==(QJsonDocument)const
*/
@Override
@QtUninvokable
public boolean equals(Object other) {
if (other instanceof io.qt.core.QJsonDocument) {
return equals((io.qt.core.QJsonDocument) other);
}
return false;
}
/**
* Returns the objects's hash code computed by qHash(QJsonDocument)
.
*/
@QtUninvokable
@Override
public int hashCode() {
return hashCode_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native static int hashCode_native(long __this_nativeId);
/**
* Result class for {@link #fromJson(QByteArray)}
*/
public static final class FromJsonResult{
private FromJsonResult(QJsonDocument document, QJsonParseError error) {
super();
this.document = document;
this.error = error;
}
public final @NonNull QJsonDocument document;
public final @NonNull QJsonParseError error;
}
/**
* See operator<<(QDebug, QJsonDocument)
*/
@QtUninvokable
@Override
public @NonNull String toString() {
return toString_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private static native String toString_native(long __this_nativeId);
/**
* Creates and returns a copy of this object.
See QJsonDocument:: QJsonDocument(QJsonDocument)
*/
@QtUninvokable
@Override
public QJsonDocument clone() {
return clone_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
private static native QJsonDocument clone_native(long __this_nativeId);
/**
* Delegate for {@link #get(java.lang.String)}.
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonValue getObjectValue(java.lang.@NonNull String key) {
return get(key);
}
/**
* Delegate for {@link #get(long)}.
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonValue getArrayValue(long i) {
return get(i);
}
/**
* Overloaded function for {@link #toJson(io.qt.core.QJsonDocument.JsonFormat)}
* with format = io.qt.core.QJsonDocument.JsonFormat.Indented
.
*/
@QtUninvokable
public final io.qt.core.@NonNull QByteArray toJson() {
return toJson(io.qt.core.QJsonDocument.JsonFormat.Indented);
}
/**
* Overloaded function for {@link #fromJson(io.qt.core.QByteArray)}.
*/
public static io.qt.core.QJsonDocument.@StrictNonNull FromJsonResult fromJson(byte @NonNull[] json) {
return fromJson(new io.qt.core.QByteArray(json));
}
/**
* @hidden
* Kotlin property getter. In Java use {@link #BinaryFormatTag()} instead.
*/
private static int getBinaryFormatTag() {
return BinaryFormatTag();
}
}