use cxx::{type_id, ExternType};
use std::fmt;
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
include!("cxx-qt-lib/qpoint.h");
include!("cxx-qt-lib/qstring.h");
type QPoint = super::QPoint;
type QString = crate::QString;
include!("cxx-qt-lib/qpointf.h");
#[allow(dead_code)]
type QPointF = crate::QPointF;
#[Self = "QPoint"]
#[rust_name = "dot_product"]
fn dotProduct(p1: &QPoint, p2: &QPoint) -> i32;
#[rust_name = "is_null"]
fn isNull(self: &QPoint) -> bool;
#[rust_name = "manhattan_length"]
fn manhattanLength(self: &QPoint) -> i32;
#[rust_name = "set_x"]
fn setX(self: &mut QPoint, x: i32);
#[rust_name = "set_y"]
fn setY(self: &mut QPoint, y: i32);
#[cfg(any(cxxqt_qt_version_at_least_7, cxxqt_qt_version_at_least_6_4))]
#[rust_name = "to_pointf"]
fn toPointF(self: &QPoint) -> QPointF;
fn transposed(self: &QPoint) -> QPoint;
fn x(self: &QPoint) -> i32;
fn y(self: &QPoint) -> i32;
}
#[namespace = "rust::cxxqtlib1"]
unsafe extern "C++" {
include!("cxx-qt-lib/common.h");
#[doc(hidden)]
#[rust_name = "qpoint_init_default"]
fn construct() -> QPoint;
#[doc(hidden)]
#[rust_name = "qpoint_init"]
fn construct(x: i32, y: i32) -> QPoint;
#[doc(hidden)]
#[rust_name = "qpoint_to_debug_qstring"]
fn toDebugQString(value: &QPoint) -> QString;
#[doc(hidden)]
#[rust_name = "qpoint_plus"]
fn operatorPlus(a: &QPoint, b: &QPoint) -> QPoint;
#[doc(hidden)]
#[rust_name = "qpoint_minus"]
fn operatorMinus(a: &QPoint, b: &QPoint) -> QPoint;
#[doc(hidden)]
#[rust_name = "qpoint_mul_f32"]
fn operatorMul(a: f32, b: &QPoint) -> QPoint;
#[doc(hidden)]
#[rust_name = "qpoint_mul_f64"]
fn operatorMul(a: f64, b: &QPoint) -> QPoint;
#[doc(hidden)]
#[rust_name = "qpoint_mul_i32"]
fn operatorMul(a: i32, b: &QPoint) -> QPoint;
#[doc(hidden)]
#[rust_name = "qpoint_div"]
fn operatorDiv(a: f64, b: &QPoint) -> QPoint;
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[repr(C)]
pub struct QPoint {
x: i32,
y: i32,
}
impl QPoint {
pub fn new(xpos: i32, ypos: i32) -> Self {
ffi::qpoint_init(xpos, ypos)
}
}
impl Default for QPoint {
fn default() -> Self {
ffi::qpoint_init_default()
}
}
impl fmt::Display for QPoint {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
ffi::qpoint_to_debug_qstring(self).fmt(f)
}
}
impl std::ops::Add for QPoint {
type Output = Self;
fn add(self, other: Self) -> Self {
ffi::qpoint_plus(&self, &other)
}
}
impl std::ops::Sub for QPoint {
type Output = Self;
fn sub(self, other: Self) -> Self {
ffi::qpoint_minus(&self, &other)
}
}
impl std::ops::Mul<f32> for QPoint {
type Output = Self;
fn mul(self, rhs: f32) -> Self {
ffi::qpoint_mul_f32(rhs, &self)
}
}
impl std::ops::Mul<f64> for QPoint {
type Output = Self;
fn mul(self, rhs: f64) -> Self {
ffi::qpoint_mul_f64(rhs, &self)
}
}
impl std::ops::Mul<i32> for QPoint {
type Output = Self;
fn mul(self, rhs: i32) -> Self {
ffi::qpoint_mul_i32(rhs, &self)
}
}
impl std::ops::Div<f64> for QPoint {
type Output = Self;
fn div(self, rhs: f64) -> Self {
ffi::qpoint_div(rhs, &self)
}
}
unsafe impl ExternType for QPoint {
type Id = type_id!("QPoint");
type Kind = cxx::kind::Trivial;
}