-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cxx-qt-lib: implement QSetElement for QByteArray
- Loading branch information
1 parent
2d3028b
commit a6e1b07
Showing
6 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
use crate::{QDate, QDateTime, QString, QTime, QUrl}; | ||
use crate::{QByteArray, QDate, QDateTime, QString, QTime, QUrl}; | ||
use core::{marker::PhantomData, mem::MaybeUninit}; | ||
use cxx::{type_id, ExternType}; | ||
|
||
|
@@ -13,6 +13,7 @@ mod qset_i16; | |
mod qset_i32; | ||
mod qset_i64; | ||
mod qset_i8; | ||
mod qset_qbytearray; | ||
mod qset_qdate; | ||
mod qset_qdatetime; | ||
mod qset_qstring; | ||
|
@@ -251,6 +252,7 @@ impl_qset_element!(i8, qset_i8, "QSet_i8"); | |
impl_qset_element!(i16, qset_i16, "QSet_i16"); | ||
impl_qset_element!(i32, qset_i32, "QSet_i32"); | ||
impl_qset_element!(i64, qset_i64, "QSet_i64"); | ||
impl_qset_element!(QByteArray, qset_qbytearray, "QSet_QByteArray"); | ||
impl_qset_element!(QDate, qset_qdate, "QSet_QDate"); | ||
impl_qset_element!(QDateTime, qset_qdatetime, "QSet_QDateTime"); | ||
impl_qset_element!(QString, qset_qstring, "QSet_QString"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-FileCopyrightText: 2022 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
#[cxx::bridge] | ||
pub mod ffi { | ||
unsafe extern "C++" { | ||
include!("cxx-qt-lib/qbytearray.h"); | ||
type QByteArray = crate::QByteArray; | ||
|
||
include!("cxx-qt-lib/qset.h"); | ||
type QSet_QByteArray = crate::QSet<QByteArray>; | ||
} | ||
|
||
unsafe extern "C++" { | ||
#[rust_name = "cxx_clear"] | ||
fn clear(self: &mut QSet_QByteArray); | ||
#[rust_name = "cxx_contains"] | ||
fn contains(self: &QSet_QByteArray, _: &QByteArray) -> bool; | ||
#[rust_name = "cxx_remove"] | ||
fn remove(self: &mut QSet_QByteArray, _: &QByteArray) -> bool; | ||
} | ||
|
||
#[namespace = "rust::cxxqtlib1"] | ||
unsafe extern "C++" { | ||
include!("cxx-qt-lib/common.h"); | ||
|
||
#[rust_name = "clone_QByteArray"] | ||
fn construct(_: &QSet_QByteArray) -> QSet_QByteArray; | ||
#[rust_name = "default_QByteArray"] | ||
fn construct() -> QSet_QByteArray; | ||
#[rust_name = "drop_QByteArray"] | ||
fn drop(_: &mut QSet_QByteArray); | ||
#[rust_name = "get_unchecked_QByteArray"] | ||
unsafe fn qsetGetUnchecked(set: &QSet_QByteArray, pos: usize) -> &QByteArray; | ||
#[rust_name = "insert_QByteArray"] | ||
fn qsetInsert(_: &mut QSet_QByteArray, _: &QByteArray); | ||
#[rust_name = "len_QByteArray"] | ||
fn qsetLen(_: &QSet_QByteArray) -> usize; | ||
} | ||
} | ||
|
||
pub(crate) fn clone(s: &ffi::QSet_QByteArray) -> ffi::QSet_QByteArray { | ||
ffi::clone_QByteArray(s) | ||
} | ||
|
||
pub(crate) fn default() -> ffi::QSet_QByteArray { | ||
ffi::default_QByteArray() | ||
} | ||
|
||
pub(crate) fn drop(s: &mut ffi::QSet_QByteArray) { | ||
ffi::drop_QByteArray(s); | ||
} | ||
|
||
pub(crate) unsafe fn get_unchecked(s: &ffi::QSet_QByteArray, pos: usize) -> &ffi::QByteArray { | ||
ffi::get_unchecked_QByteArray(s, pos) | ||
} | ||
|
||
pub(crate) fn insert(s: &mut ffi::QSet_QByteArray, value: &ffi::QByteArray) { | ||
ffi::insert_QByteArray(s, value); | ||
} | ||
|
||
pub(crate) fn len(s: &ffi::QSet_QByteArray) -> usize { | ||
ffi::len_QByteArray(s) | ||
} |