use crate::types::Handle;
pub trait StubObject {
fn new_stub() -> Self;
fn set_handle(&mut self, handle: Handle);
fn set_owner(&mut self, owner: Handle);
fn handle(&self) -> Handle;
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct VisualStyle {
pub handle: Handle,
pub owner: Handle,
pub description: String,
pub style_type: i16,
pub face_lighting_model: i16,
pub face_lighting_quality: i16,
pub face_color_mode: i16,
pub face_modifier: i32,
pub edge_model: i32,
pub edge_style: i32,
pub internal_use_only: bool,
}
impl VisualStyle {
pub fn new() -> Self {
VisualStyle {
handle: Handle::NULL,
owner: Handle::NULL,
description: String::new(),
style_type: 0,
face_lighting_model: 0,
face_lighting_quality: 0,
face_color_mode: 0,
face_modifier: 0,
edge_model: 0,
edge_style: 0,
internal_use_only: false,
}
}
}
impl Default for VisualStyle {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Material {
pub handle: Handle,
pub owner: Handle,
pub name: String,
pub description: String,
}
impl Material {
pub fn new() -> Self {
Material {
handle: Handle::NULL,
owner: Handle::NULL,
name: String::new(),
description: String::new(),
}
}
}
impl Default for Material {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct GeoData {
pub handle: Handle,
pub owner: Handle,
pub version: i32,
pub coordinate_type: i16,
}
impl GeoData {
pub fn new() -> Self {
GeoData {
handle: Handle::NULL,
owner: Handle::NULL,
version: 2,
coordinate_type: 0,
}
}
}
impl Default for GeoData {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SpatialFilter {
pub handle: Handle,
pub owner: Handle,
}
impl SpatialFilter {
pub fn new() -> Self {
SpatialFilter {
handle: Handle::NULL,
owner: Handle::NULL,
}
}
}
impl Default for SpatialFilter {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RasterVariables {
pub handle: Handle,
pub owner: Handle,
pub class_version: i32,
pub display_image_frame: i16,
pub image_quality: i16,
pub units: i16,
}
impl RasterVariables {
pub fn new() -> Self {
RasterVariables {
handle: Handle::NULL,
owner: Handle::NULL,
class_version: 0,
display_image_frame: 1,
image_quality: 1,
units: 0,
}
}
}
impl Default for RasterVariables {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BookColor {
pub handle: Handle,
pub owner: Handle,
pub color_name: String,
pub book_name: String,
}
impl BookColor {
pub fn new() -> Self {
BookColor {
handle: Handle::NULL,
owner: Handle::NULL,
color_name: String::new(),
book_name: String::new(),
}
}
}
impl Default for BookColor {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PlaceHolder {
pub handle: Handle,
pub owner: Handle,
}
impl PlaceHolder {
pub fn new() -> Self {
PlaceHolder {
handle: Handle::NULL,
owner: Handle::NULL,
}
}
}
impl Default for PlaceHolder {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DictionaryWithDefault {
pub handle: Handle,
pub owner: Handle,
pub entries: Vec<(String, Handle)>,
pub default_handle: Handle,
pub duplicate_cloning: i16,
pub hard_owner: bool,
}
impl DictionaryWithDefault {
pub fn new() -> Self {
DictionaryWithDefault {
handle: Handle::NULL,
owner: Handle::NULL,
entries: Vec::new(),
default_handle: Handle::NULL,
duplicate_cloning: 1,
hard_owner: false,
}
}
}
impl Default for DictionaryWithDefault {
fn default() -> Self { Self::new() }
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct WipeoutVariables {
pub handle: Handle,
pub owner: Handle,
pub display_frame: i16,
}
impl WipeoutVariables {
pub fn new() -> Self {
WipeoutVariables {
handle: Handle::NULL,
owner: Handle::NULL,
display_frame: 0,
}
}
}
impl Default for WipeoutVariables {
fn default() -> Self { Self::new() }
}
macro_rules! impl_stub_object {
($ty:ident) => {
impl StubObject for $ty {
fn new_stub() -> Self { Self::new() }
fn set_handle(&mut self, handle: Handle) { self.handle = handle; }
fn set_owner(&mut self, owner: Handle) { self.owner = owner; }
fn handle(&self) -> Handle { self.handle }
}
};
}
impl_stub_object!(GeoData);
impl_stub_object!(SpatialFilter);
impl_stub_object!(PlaceHolder);