1use crate::tables::TableEntry;
2use crate::types::Handle;
3
4#[derive(Debug, Clone, PartialEq)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10pub struct VxTableRecord {
11 pub handle: Handle,
12 pub name: String,
13 pub is_xref_reference: bool,
14 pub is_xref_resolved: bool,
15 pub is_xref_dependent: bool,
16 pub xref_handle: Handle,
17 pub is_on: bool,
18 pub viewport: Handle,
19 pub previous_entry: Handle,
20 pub legacy_viewport_entity_address: u16,
22 pub legacy_viewport_index: i16,
24 pub legacy_previous_entry_index: i16,
26}
27
28impl VxTableRecord {
29 pub fn new(name: impl Into<String>) -> Self {
30 Self {
31 handle: Handle::NULL,
32 name: name.into(),
33 is_xref_reference: false,
34 is_xref_resolved: false,
35 is_xref_dependent: false,
36 xref_handle: Handle::NULL,
37 is_on: false,
38 viewport: Handle::NULL,
39 previous_entry: Handle::NULL,
40 legacy_viewport_entity_address: 0,
41 legacy_viewport_index: 0,
42 legacy_previous_entry_index: 0,
43 }
44 }
45}
46
47impl Default for VxTableRecord {
48 fn default() -> Self {
49 Self::new("")
50 }
51}
52
53impl TableEntry for VxTableRecord {
54 fn handle(&self) -> Handle {
55 self.handle
56 }
57
58 fn set_handle(&mut self, handle: Handle) {
59 self.handle = handle;
60 }
61
62 fn name(&self) -> &str {
63 &self.name
64 }
65
66 fn set_name(&mut self, name: String) {
67 self.name = name;
68 }
69}