forked from KDAB/cxx-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
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: use std int for qset and add i64/u64
- Loading branch information
1 parent
7552bf6
commit 6892f82
Showing
7 changed files
with
154 additions
and
12 deletions.
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
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,64 @@ | ||
// 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/qset.h"); | ||
type QSet_i64 = crate::QSet<i64>; | ||
} | ||
|
||
unsafe extern "C++" { | ||
#[rust_name = "cxx_clear"] | ||
fn clear(self: &mut QSet_i64); | ||
#[rust_name = "cxx_contains"] | ||
fn contains(self: &QSet_i64, _: &i64) -> bool; | ||
#[rust_name = "cxx_remove"] | ||
fn remove(self: &mut QSet_i64, _: &i64) -> bool; | ||
} | ||
|
||
#[namespace = "rust::cxxqtlib1"] | ||
unsafe extern "C++" { | ||
include!("cxx-qt-lib/common.h"); | ||
|
||
#[rust_name = "clone_i64"] | ||
fn construct(_: &QSet_i64) -> QSet_i64; | ||
#[rust_name = "default_i64"] | ||
fn construct() -> QSet_i64; | ||
#[rust_name = "drop_i64"] | ||
fn drop(_: &mut QSet_i64); | ||
#[rust_name = "get_unchecked_i64"] | ||
#[allow(clippy::needless_lifetimes)] | ||
unsafe fn qsetGetUnchecked<'a>(set: &'a QSet_i64, pos: usize) -> &'a i64; | ||
#[rust_name = "insert_i64"] | ||
fn qsetInsert(_: &mut QSet_i64, _: &i64); | ||
#[rust_name = "len_i64"] | ||
fn qsetLen(_: &QSet_i64) -> usize; | ||
} | ||
} | ||
|
||
pub(crate) fn clone(s: &ffi::QSet_i64) -> ffi::QSet_i64 { | ||
ffi::clone_i64(s) | ||
} | ||
|
||
pub(crate) fn default() -> ffi::QSet_i64 { | ||
ffi::default_i64() | ||
} | ||
|
||
pub(crate) fn drop(s: &mut ffi::QSet_i64) { | ||
ffi::drop_i64(s); | ||
} | ||
|
||
pub(crate) unsafe fn get_unchecked(s: &ffi::QSet_i64, pos: usize) -> &i64 { | ||
ffi::get_unchecked_i64(s, pos) | ||
} | ||
|
||
pub(crate) fn insert(s: &mut ffi::QSet_i64, value: &i64) { | ||
ffi::insert_i64(s, value); | ||
} | ||
|
||
pub(crate) fn len(s: &ffi::QSet_i64) -> usize { | ||
ffi::len_i64(s) | ||
} |
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,64 @@ | ||
// 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/qset.h"); | ||
type QSet_u64 = crate::QSet<u64>; | ||
} | ||
|
||
unsafe extern "C++" { | ||
#[rust_name = "cxx_clear"] | ||
fn clear(self: &mut QSet_u64); | ||
#[rust_name = "cxx_contains"] | ||
fn contains(self: &QSet_u64, _: &u64) -> bool; | ||
#[rust_name = "cxx_remove"] | ||
fn remove(self: &mut QSet_u64, _: &u64) -> bool; | ||
} | ||
|
||
#[namespace = "rust::cxxqtlib1"] | ||
unsafe extern "C++" { | ||
include!("cxx-qt-lib/common.h"); | ||
|
||
#[rust_name = "clone_u64"] | ||
fn construct(_: &QSet_u64) -> QSet_u64; | ||
#[rust_name = "default_u64"] | ||
fn construct() -> QSet_u64; | ||
#[rust_name = "drop_u64"] | ||
fn drop(_: &mut QSet_u64); | ||
#[rust_name = "get_unchecked_u64"] | ||
#[allow(clippy::needless_lifetimes)] | ||
unsafe fn qsetGetUnchecked<'a>(set: &'a QSet_u64, pos: usize) -> &'a u64; | ||
#[rust_name = "insert_u64"] | ||
fn qsetInsert(_: &mut QSet_u64, _: &u64); | ||
#[rust_name = "len_u64"] | ||
fn qsetLen(_: &QSet_u64) -> usize; | ||
} | ||
} | ||
|
||
pub(crate) fn clone(s: &ffi::QSet_u64) -> ffi::QSet_u64 { | ||
ffi::clone_u64(s) | ||
} | ||
|
||
pub(crate) fn default() -> ffi::QSet_u64 { | ||
ffi::default_u64() | ||
} | ||
|
||
pub(crate) fn drop(s: &mut ffi::QSet_u64) { | ||
ffi::drop_u64(s); | ||
} | ||
|
||
pub(crate) unsafe fn get_unchecked(s: &ffi::QSet_u64, pos: usize) -> &u64 { | ||
ffi::get_unchecked_u64(s, pos) | ||
} | ||
|
||
pub(crate) fn insert(s: &mut ffi::QSet_u64, value: &u64) { | ||
ffi::insert_u64(s, value); | ||
} | ||
|
||
pub(crate) fn len(s: &ffi::QSet_u64) -> usize { | ||
ffi::len_u64(s) | ||
} |