fm_plugin/ffi/
calc_engine.rs

1use super::*;
2use std::fmt::{self, Display, Formatter};
3use std::ops::BitOr;
4#[repr(C)]
5#[derive(Debug, Copy, Clone)]
6pub struct fmx_DataVect {
7    _address: u8,
8}
9
10#[repr(C)]
11#[derive(Debug, Copy, Clone)]
12pub struct fmx_ExprEnv {
13    _address: u8,
14}
15
16#[repr(C)]
17#[derive(Debug, Copy, Clone)]
18pub struct fmx_RowVect {
19    _address: u8,
20}
21
22#[cfg_attr(target_os = "macos", link(kind = "framework", name = "FMWrapper"))]
23#[cfg_attr(target_os = "windows", link(kind = "static", name = "FMWrapper"))]
24#[cfg_attr(target_os = "linux", link(kind = "dylib", name = "FMWrapper"))]
25extern "C" {
26    fn FM_ExprEnv_Constructor1(_x: *mut fmx__fmxcpt) -> *mut fmx_ExprEnv;
27
28    pub(crate) fn FM_ExprEnv_RegisterScriptStep(
29        pluginId: *const fmx_QuadChar,
30        scriptStepId: i16,
31        scriptStepName: *const fmx_Text,
32        scriptStepDefinition: *const fmx_Text,
33        scriptStepDescription: *const fmx_Text,
34        compatibleOnFlags: u32,
35        funcPtr: fmx_ExtPluginType,
36        _x: *mut fmx__fmxcpt,
37    ) -> FMError;
38
39    pub(crate) fn FM_ExprEnv_RegisterExternalFunctionEx(
40        pluginId: *const fmx_QuadChar,
41        functionId: i16,
42        functionName: *const fmx_Text,
43        functionPrototype: *const fmx_Text,
44        functionDescription: *const fmx_Text,
45        minArgs: i16,
46        maxArgs: i16,
47        compatibleOnFlags: u32,
48        funcPtr: fmx_ExtPluginType,
49        _x: *mut fmx__fmxcpt,
50    ) -> FMError;
51
52    pub(crate) fn FM_ExprEnv_UnRegisterExternalFunction(
53        pluginId: *const fmx_QuadChar,
54        functionId: i16,
55        _x: *mut fmx__fmxcpt,
56    ) -> FMError;
57
58    fn FM_ExprEnv_ExecuteFileSQLTextResult(
59        _self: *const fmx_ExprEnv,
60        expression: *const fmx_Text,
61        filename: *const fmx_Text,
62        parameters: *const fmx_DataVect,
63        result: *mut fmx_Data,
64        colSep: u16,
65        rowSep: u16,
66        _x: *mut fmx__fmxcpt,
67    ) -> FMError;
68
69    fn FM_ExprEnv_ExecuteFileSQL(
70        _self: *const fmx_ExprEnv,
71        expression: *const fmx_Text,
72        filename: *const fmx_Text,
73        parameters: *const fmx_DataVect,
74        result: *mut fmx_RowVect,
75        _x: *mut fmx__fmxcpt,
76    ) -> FMError;
77
78    fn FM_ExprEnv_Delete(_self: *mut fmx_ExprEnv, _x: *mut fmx__fmxcpt);
79
80    fn FM_ExprEnv_Evaluate(
81        _self: *const fmx_ExprEnv,
82        expression: *const fmx_Text,
83        result: *mut fmx_Data,
84        _x: *mut fmx__fmxcpt,
85    ) -> FMError;
86
87    fn FM_ExprEnv_EvaluateGetFunction(
88        _self: *const fmx_ExprEnv,
89        functionValue: GetFunction,
90        result: *mut fmx_Data,
91        _x: *mut fmx__fmxcpt,
92    ) -> FMError;
93
94    fn FM_ExprEnv_EvaluateConvertToFileMakerPath(
95        _self: *const fmx_ExprEnv,
96        inPath: *const fmx_Text,
97        inFormat: FilePathFormat,
98        outFMPath: *mut fmx_Text,
99        _x: *mut fmx__fmxcpt,
100    ) -> FMError;
101
102    fn FM_ExprEnv_EvaluateConvertFromFileMakerPath(
103        _self: *const fmx_ExprEnv,
104        inFMPath: *const fmx_Text,
105        inFormat: FilePathFormat,
106        outPath: *mut fmx_Text,
107        _x: *mut fmx__fmxcpt,
108    ) -> FMError;
109
110    #[deprecated]
111    #[allow(dead_code)]
112    fn FM_ExprEnv_RegisterExternalFunction(
113        pluginId: *const fmx_QuadChar,
114        functionId: i16,
115        functionName: *const fmx_Text,
116        functionPrototype: *const fmx_Text,
117        minArgs: i16,
118        maxArgs: i16,
119        compatibleOnFlags: u32,
120        funcPtr: fmx_ExtPluginType,
121        _x: *mut fmx__fmxcpt,
122    ) -> FMError;
123
124    fn FM_ExprEnv_SessionID(_self: *const fmx_ExprEnv, _x: *mut fmx__fmxcpt) -> fmx_ptrtype;
125
126    fn FM_ExprEnv_FileID(_self: *const fmx_ExprEnv, _x: *mut fmx__fmxcpt) -> fmx_ptrtype;
127
128    pub(crate) fn FM_ExprEnv_UnRegisterScriptStep(
129        pluginId: *const fmx_QuadChar,
130        scriptStepId: i16,
131        _x: *mut fmx__fmxcpt,
132    ) -> FMError;
133
134    fn FM_DataVect_Constructor1(_x: *mut fmx__fmxcpt) -> *mut fmx_DataVect;
135
136    fn FM_DataVect_Size(_self: *const fmx_DataVect, _x: *mut fmx__fmxcpt) -> u32;
137
138    fn FM_DataVect_At(
139        _self: *const fmx_DataVect,
140        position: u32,
141        _x: *mut fmx__fmxcpt,
142    ) -> *const fmx_Data;
143
144    fn FM_DataVect_AtAsText(
145        _self: *const fmx_DataVect,
146        position: u32,
147        _x: *mut fmx__fmxcpt,
148    ) -> *const fmx_Text;
149
150    fn FM_DataVect_AtAsNumber(
151        _self: *const fmx_DataVect,
152        position: u32,
153        _x: *mut fmx__fmxcpt,
154    ) -> *const fmx_FixPt;
155
156    fn FM_DataVect_PushBack(_self: *mut fmx_DataVect, data: *const fmx_Data, _x: *mut fmx__fmxcpt);
157
158    fn FM_DataVect_Delete(_self: *mut fmx_DataVect, _x: *mut fmx__fmxcpt);
159
160    fn FM_DataVect_Clear(_self: *mut fmx_DataVect, _x: *mut fmx__fmxcpt);
161
162    fn FM_DataVect_IsEmpty(_self: *const fmx_DataVect, _x: *mut fmx__fmxcpt) -> bool;
163
164    fn FM_DataVect_PopBack(_self: *mut fmx_DataVect, _x: *mut fmx__fmxcpt) -> *mut fmx_Data;
165
166    fn FM_DataVect_AtAsDate(
167        _self: *const fmx_DataVect,
168        position: u32,
169        _x: *mut fmx__fmxcpt,
170    ) -> *const fmx_DateTime;
171
172    fn FM_DataVect_AtAsTime(
173        _self: *const fmx_DataVect,
174        position: u32,
175        _x: *mut fmx__fmxcpt,
176    ) -> *const fmx_DateTime;
177
178    fn FM_DataVect_AtAsTimeStamp(
179        _self: *const fmx_DataVect,
180        position: u32,
181        _x: *mut fmx__fmxcpt,
182    ) -> *const fmx_DateTime;
183
184    fn FM_DataVect_AtAsBoolean(
185        _self: *const fmx_DataVect,
186        position: u32,
187        _x: *mut fmx__fmxcpt,
188    ) -> bool;
189
190    fn FM_DataVect_AtAsBinaryData(
191        _self: *const fmx_DataVect,
192        position: u32,
193        _x: *mut fmx__fmxcpt,
194    ) -> *const fmx_BinaryData;
195
196    fn FM_RowVect_Constructor1(_x: *mut fmx__fmxcpt) -> *mut fmx_RowVect;
197
198    fn FM_RowVect_Delete(_self: *mut fmx_RowVect, _x: *mut fmx__fmxcpt);
199
200    fn FM_RowVect_Size(_self: *const fmx_RowVect, _x: *mut fmx__fmxcpt) -> u32;
201
202    fn FM_RowVect_IsEmpty(_self: *const fmx_RowVect, _x: *mut fmx__fmxcpt) -> bool;
203
204    fn FM_RowVect_At(
205        _self: *const fmx_RowVect,
206        position: u32,
207        _x: *mut fmx__fmxcpt,
208    ) -> *const fmx_DataVect;
209
210}
211
212#[repr(u32)]
213pub enum Compatibility {
214    Mac = 0x00000002,
215    Win = 0x00000004,
216    Server = 0x00000008,
217    IOS = 0x00000010,
218    CustomWeb = 0x00000020,
219    WebDirect = 0x00000040,
220    AllDevice = 0x0000007E,
221    Future = 0x00FF0000,
222}
223
224impl BitOr for Compatibility {
225    type Output = u32;
226
227    fn bitor(self, rhs: Self) -> Self::Output {
228        self as u32 | rhs as u32
229    }
230}
231
232pub struct ExprEnv {
233    pub(crate) ptr: *mut fmx_ExprEnv,
234    drop: bool,
235}
236
237impl ExprEnv {
238    pub fn new() -> Self {
239        let mut _x = fmx__fmxcpt::new();
240        let ptr = unsafe { FM_ExprEnv_Constructor1(&mut _x) };
241        _x.check();
242        ExprEnv { ptr, drop: true }
243    }
244
245    pub fn from_ptr(ptr: *const fmx_ExprEnv) -> Self {
246        Self {
247            ptr: ptr as *mut fmx_ExprEnv,
248            drop: false,
249        }
250    }
251
252    pub fn session_id(&self) -> u64 {
253        let mut _x = fmx__fmxcpt::new();
254        let session_id = unsafe { FM_ExprEnv_SessionID(self.ptr, &mut _x) };
255        _x.check();
256        session_id
257    }
258
259    pub fn file_id(&self) -> u64 {
260        let mut _x = fmx__fmxcpt::new();
261        let file_id = unsafe { FM_ExprEnv_FileID(self.ptr, &mut _x) };
262        _x.check();
263        file_id
264    }
265
266    pub fn execute_file_sql_text_result<E: ToText, F: ToText>(
267        &self,
268        expression: E,
269        file_name: F,
270        parameters: DataVect,
271        result: &mut Data,
272        col_sep: u16,
273        row_sep: u16,
274    ) -> FMError {
275        let mut _x = fmx__fmxcpt::new();
276        let expr = expression.to_text();
277        let fn_text = file_name.to_text();
278        let error = unsafe {
279            FM_ExprEnv_ExecuteFileSQLTextResult(
280                self.ptr,
281                expr.ptr,
282                fn_text.ptr,
283                parameters.ptr,
284                result.ptr,
285                col_sep,
286                row_sep,
287                &mut _x,
288            )
289        };
290        _x.check();
291        error
292    }
293
294    pub fn execute_file_sql<E: ToText, F: ToText>(
295        &self,
296        expression: E,
297        file_name: F,
298        parameters: DataVect,
299        result: &mut RowVect,
300    ) -> FMError {
301        let mut _x = fmx__fmxcpt::new();
302        let expr = expression.to_text();
303        let fn_text = file_name.to_text();
304        let error = unsafe {
305            FM_ExprEnv_ExecuteFileSQL(
306                self.ptr,
307                expr.ptr,
308                fn_text.ptr,
309                parameters.ptr,
310                result.ptr,
311                &mut _x,
312            )
313        };
314        _x.check();
315        error
316    }
317
318    pub fn eval_get(&self, func: GetFunction) -> Data {
319        let mut _x = fmx__fmxcpt::new();
320        let result = Data::new();
321        unsafe { FM_ExprEnv_EvaluateGetFunction(self.ptr, func, result.ptr, &mut _x) };
322        _x.check();
323        result
324    }
325
326    pub fn evaluate<T: ToText>(&self, expression: T) -> Data {
327        let expr_txt = expression.to_text();
328        let mut _x = fmx__fmxcpt::new();
329        let result = Data::new();
330        unsafe { FM_ExprEnv_Evaluate(self.ptr, expr_txt.ptr, result.ptr, &mut _x) };
331        _x.check();
332        result
333    }
334
335    pub fn from_fm_path<T: ToText>(&self, path: T, format: FilePathFormat) -> Text {
336        let mut _x = fmx__fmxcpt::new();
337        let text = path.to_text();
338        let result = Text::new();
339        unsafe {
340            FM_ExprEnv_EvaluateConvertFromFileMakerPath(
341                self.ptr, text.ptr, format, result.ptr, &mut _x,
342            )
343        };
344        _x.check();
345        result
346    }
347
348    pub fn to_fm_path<T: ToText>(&self, path: T, format: FilePathFormat) -> Text {
349        let mut _x = fmx__fmxcpt::new();
350        let text = path.to_text();
351        let result = Text::new();
352        unsafe {
353            FM_ExprEnv_EvaluateConvertToFileMakerPath(
354                self.ptr, text.ptr, format, result.ptr, &mut _x,
355            )
356        };
357        _x.check();
358        result
359    }
360}
361
362impl Drop for ExprEnv {
363    fn drop(&mut self) {
364        if self.drop {
365            let mut _x = fmx__fmxcpt::new();
366            unsafe { FM_ExprEnv_Delete(self.ptr, &mut _x) };
367            _x.check();
368        }
369    }
370}
371
372impl Default for ExprEnv {
373    fn default() -> Self {
374        Self::new()
375    }
376}
377
378#[repr(i16)]
379pub enum GetFunction {
380    ApplicationVersion = 1001,
381    CurrentDate = 1002,
382    LastError = 1003,
383    ActiveFieldName = 1004,
384    FileName = 1005,
385    FileSize = 1006,
386    FoundCount = 1007,
387    HostName = 1008,
388    LayoutCount = 1009,
389    LayoutName = 1010,
390    LayoutNumber = 1011,
391    SystemLanguage = 1012,
392    WindowMode = 1013,
393    MultiUserState = 1014,
394    PageNumber = 1015,
395    SystemPlatform = 1016,
396    ActivePortalRowNumber = 1017,
397    PrinterName = 1018,
398    TotalRecordCount = 1019,
399    RecordNumber = 1020,
400    ActiveRepetitionNumber = 1021,
401    RequestCount = 1022,
402    ScreenDepth = 1023,
403    ScreenHeight = 1024,
404    ScreenWidth = 1025,
405    ScriptName = 1026,
406    SortState = 1027,
407    SystemVersion = 1028,
408    CurrentTime = 1029,
409    UserCount = 1030,
410    UserName = 1031,
411    AccountName = 1032,
412    LastMessageChoice = 1033,
413    CurrentPrivilegeSetName = 1034,
414    ActiveModifierKeys = 1035,
415    NetworkProtocol = 1036,
416    RecordID = 1037,
417    RecordModificationCount = 1038,
418    ActiveFieldContents = 1039,
419    FilePath = 1040,
420    LastExternalErrorDetail = 1041,
421    LayoutAccess = 1042,
422    RecordAccess = 1043,
423    HighContrastState = 1044,
424    HighContrastColor = 1045,
425    StatusAreaState = 1046,
426    LayoutViewState = 1047,
427    WindowName = 1048,
428    WindowHeight = 1049,
429    WindowLeft = 1050,
430    WindowTop = 1051,
431    WindowVisible = 1052,
432    WindowWidth = 1053,
433    SystemNICAddress = 1054,
434    SystemIpAddress = 1055,
435    ActiveFieldTableName = 1056,
436    ActiveSelectionSize = 1057,
437    ActiveSelectionStart = 1058,
438    ApplicationLanguage = 1059,
439    CurrentHostTimestamp = 1060,
440    LayoutTableName = 1061,
441    ScriptParameter = 1062,
442    CurrentTimeStamp = 1063,
443    WindowDesktopHeight = 1064,
444    WindowDesktopWidth = 1065,
445    WindowContentHeight = 1066,
446    WindowContentWidth = 1067,
447    CalculationRepetitionNumber = 1068,
448    CurrentExtendedPrivileges = 1069,
449    AllowAbortState = 1070,
450    ErrorCaptureState = 1071,
451    DesktopPath = 1072,
452    DocumentsPath = 1073,
453    FileMakerPath = 1074,
454    HostIPAddress = 1075,
455    RequestOmitState = 1076,
456    PreferencesPath = 1077,
457    RecordOpenCount = 1078,
458    RecordOpenState = 1079,
459    ScriptResult = 1080,
460    SystemDrive = 1081,
461    TextRulerVisible = 1082,
462    AllowFormattingBarState = 1083,
463    UseSystemFormatsState = 1084,
464    WindowZoomLevel = 1085,
465    CustomMenuSetName = 1086,
466    ActiveLayoutObjectName = 1088,
467    TemporaryPath = 1089,
468    HostApplicationVersion = 1090,
469    TriggerModifierKeys = 1091,
470    TriggerKeystroke = 1092,
471    DocumentsPathListing = 1093,
472    AccountPrivilegeSet = 1094,
473    AccountExtendedPrivileges = 1095,
474    QuickFindText = 1096,
475    TriggerCurrentPanel = 1097,
476    TriggerTargetPanel = 1098,
477    WindowStyle = 1099,
478    InstalledFMPlugins = 1100,
479    UUID = 1101,
480    PersistentID = 1102,
481    ConnectionState = 1103,
482    CurrentTimeUTCMilliseconds = 1104,
483    Device = 1105,
484    WindowOrientation = 1106,
485    TriggerGestureInfo = 1107,
486    EncryptionState = 1108,
487    ScriptAnimation = 1109,
488    ModifiedFields = 1110,
489    NetworkType = 1111,
490    ConnectionAttributes = 1112,
491    ScreenScaleFactor = 1113,
492    ApplicationArchitecture = 1115,
493    TriggerExternalEvent = 1116,
494    TouchKeyboardState = 1117,
495    MenubarState = 1118,
496    RegionMonitorEvents = 1119,
497    AccountGroupName = 1120,
498    ActiveRecordNumber = 1121,
499    UUIDNumber = 1122,
500    OpenDataFileInfo = 1123,
501    AccountType = 1124,
502    PageCount = 1125,
503}
504
505pub struct RowVect {
506    pub(crate) ptr: *mut fmx_RowVect,
507    drop: bool,
508}
509
510impl RowVect {
511    pub fn new() -> Self {
512        let mut _x = fmx__fmxcpt::new();
513        let ptr = unsafe { FM_RowVect_Constructor1(&mut _x) };
514        _x.check();
515        Self { ptr, drop: true }
516    }
517
518    pub fn size(&self) -> u32 {
519        let mut _x = fmx__fmxcpt::new();
520        let size = unsafe { FM_RowVect_Size(self.ptr, &mut _x) };
521        _x.check();
522        size
523    }
524
525    pub fn at(&self, position: u32) -> DataVect {
526        let mut _x = fmx__fmxcpt::new();
527        let ptr = unsafe { FM_RowVect_At(self.ptr, position, &mut _x) };
528        _x.check();
529        DataVect::from_ptr(ptr)
530    }
531
532    pub fn is_empty(&self) -> bool {
533        let mut _x = fmx__fmxcpt::new();
534        let empty = unsafe { FM_RowVect_IsEmpty(self.ptr, &mut _x) };
535        _x.check();
536        empty
537    }
538}
539
540impl Drop for RowVect {
541    fn drop(&mut self) {
542        if self.drop {
543            let mut _x = fmx__fmxcpt::new();
544            unsafe { FM_RowVect_Delete(self.ptr, &mut _x) };
545            _x.check();
546        }
547    }
548}
549
550impl Default for RowVect {
551    fn default() -> Self {
552        Self::new()
553    }
554}
555
556pub struct DataVect {
557    pub(crate) ptr: *mut fmx_DataVect,
558    drop: bool,
559}
560
561impl DataVect {
562    pub fn new() -> Self {
563        let mut _x = fmx__fmxcpt::new();
564        let ptr = unsafe { FM_DataVect_Constructor1(&mut _x) };
565        _x.check();
566        Self { ptr, drop: true }
567    }
568
569    pub fn from_ptr(ptr: *const fmx_DataVect) -> Self {
570        Self {
571            ptr: ptr as *mut fmx_DataVect,
572            drop: false,
573        }
574    }
575
576    pub fn size(&self) -> u32 {
577        let mut _x = fmx__fmxcpt::new();
578        let size = unsafe { FM_DataVect_Size(self.ptr, &mut _x) };
579        _x.check();
580        size
581    }
582
583    pub fn at(&self, position: u32) -> Data {
584        let mut _x = fmx__fmxcpt::new();
585        let data_ptr = unsafe { FM_DataVect_At(self.ptr, position, &mut _x) };
586        _x.check();
587        Data::from_ptr(data_ptr)
588    }
589
590    pub fn at_as_text(&self, position: u32) -> Text {
591        let mut _x = fmx__fmxcpt::new();
592        let ptr = unsafe { FM_DataVect_AtAsText(self.ptr, position, &mut _x) };
593        _x.check();
594        Text::from_ptr(ptr)
595    }
596
597    pub fn at_as_string(&self, position: u32) -> String {
598        let mut _x = fmx__fmxcpt::new();
599        let ptr = unsafe { FM_DataVect_AtAsText(self.ptr, position, &mut _x) };
600        _x.check();
601        Text::from_ptr(ptr).to_string()
602    }
603
604    pub fn at_as_number(&self, position: u32) -> FixPt {
605        let mut _x = fmx__fmxcpt::new();
606        let ptr = unsafe { FM_DataVect_AtAsNumber(self.ptr, position, &mut _x) };
607        _x.check();
608        FixPt::from_ptr(ptr)
609    }
610
611    pub fn at_as_date(&self, position: u32) -> DateTime {
612        let mut _x = fmx__fmxcpt::new();
613        let ptr = unsafe { FM_DataVect_AtAsDate(self.ptr, position, &mut _x) };
614        _x.check();
615        DateTime::from_ptr(ptr)
616    }
617
618    pub fn at_as_time(&self, position: u32) -> DateTime {
619        let mut _x = fmx__fmxcpt::new();
620        let ptr = unsafe { FM_DataVect_AtAsTime(self.ptr, position, &mut _x) };
621        _x.check();
622        DateTime::from_ptr(ptr)
623    }
624
625    pub fn at_as_timestamp(&self, position: u32) -> DateTime {
626        let mut _x = fmx__fmxcpt::new();
627        let ptr = unsafe { FM_DataVect_AtAsTimeStamp(self.ptr, position, &mut _x) };
628        _x.check();
629        DateTime::from_ptr(ptr)
630    }
631
632    pub fn at_as_binary(&self, position: u32) -> BinaryData {
633        let mut _x = fmx__fmxcpt::new();
634        let ptr = unsafe { FM_DataVect_AtAsBinaryData(self.ptr, position, &mut _x) };
635        _x.check();
636        BinaryData::from_ptr(ptr)
637    }
638
639    pub fn at_as_bool(&self, position: u32) -> bool {
640        let mut _x = fmx__fmxcpt::new();
641        let result = unsafe { FM_DataVect_AtAsBoolean(self.ptr, position, &mut _x) };
642        _x.check();
643        result
644    }
645
646    pub fn push(&mut self, data: Data) {
647        let mut _x = fmx__fmxcpt::new();
648        unsafe { FM_DataVect_PushBack(self.ptr, data.ptr, &mut _x) };
649        _x.check();
650    }
651
652    pub fn clear(&mut self) {
653        let mut _x = fmx__fmxcpt::new();
654        unsafe { FM_DataVect_Clear(self.ptr, &mut _x) };
655        _x.check();
656    }
657
658    pub fn is_empty(&mut self) -> bool {
659        let mut _x = fmx__fmxcpt::new();
660        let empty = unsafe { FM_DataVect_IsEmpty(self.ptr, &mut _x) };
661        _x.check();
662        empty
663    }
664
665    pub fn pop(&mut self) -> Data {
666        let mut _x = fmx__fmxcpt::new();
667        let result = unsafe { FM_DataVect_PopBack(self.ptr, &mut _x) };
668        _x.check();
669        Data::from_ptr(result)
670    }
671}
672
673impl Drop for DataVect {
674    fn drop(&mut self) {
675        if self.drop {
676            let mut _x = fmx__fmxcpt::new();
677            unsafe { FM_DataVect_Delete(self.ptr, &mut _x) };
678            _x.check();
679        }
680    }
681}
682
683impl Default for DataVect {
684    fn default() -> Self {
685        Self::new()
686    }
687}
688
689impl<'a> IntoIterator for &'a DataVect {
690    type Item = Data;
691    type IntoIter = DataVectIterator<'a>;
692
693    fn into_iter(self) -> Self::IntoIter {
694        DataVectIterator {
695            data_vect: self,
696            index: 0,
697        }
698    }
699}
700
701pub struct DataVectIterator<'a> {
702    data_vect: &'a DataVect,
703    index: usize,
704}
705
706impl<'a> Iterator for DataVectIterator<'a> {
707    type Item = Data;
708    fn next(&mut self) -> Option<Data> {
709        let result = self.data_vect.at(self.index as u32);
710        self.index += 1;
711        Some(result)
712    }
713}
714
715#[repr(i32)]
716pub enum FilePathFormat {
717    PosixPath = 1,
718    WinPath = 2,
719    URLPath = 3,
720}
721
722#[derive(PartialEq, Debug)]
723#[repr(i16)]
724pub enum FMError {
725    Unknown = -1,
726    NoError = 0,
727    UserCanceledAction = 1,
728    MemoryError = 2,
729    CommandUnavailable = 3,
730    CommandUnknown = 4,
731    CommandInvalid = 5,
732    FileReadOnly = 6,
733    RunningOutOfMemory = 7,
734    EmptyResult = 8,
735    InsufficientPrivileges = 9,
736    RequestedDataMissing = 10,
737    NameNotValid = 11,
738    NameAlreadyExists = 12,
739    FileInUse = 13,
740    OutOfRange = 14,
741    DivideByZero = 15,
742    OperationFailed = 16,
743    ConversionFailed = 17,
744    AccountInformationMissing = 18,
745    InvalidString = 19,
746    CancelledByTriggeredScript = 20,
747    FileMissing = 100,
748    RecordMissing = 101,
749    FieldMissing = 102,
750    RelationshipMissing = 103,
751    ScriptMissing = 104,
752    LayoutMissing = 105,
753    TableMissing = 106,
754    IndexMissing = 107,
755    ValueListMissing = 108,
756    PrivilegeSetMissing = 109,
757    RelatedTablesMissing = 110,
758    FieldRepetitionInvalid = 111,
759    WindowMissing = 112,
760    FunctionMissing = 113,
761    FileReferenceMissing = 114,
762    MenuSetMissing = 115,
763    LayoutObjectMissing = 116,
764    DataSourceMissing = 117,
765    FilesDamagedOrMissing = 130,
766    LanguagePackMissing = 131,
767    RecordAccessDenied = 200,
768    FieldUnmodifiable = 201,
769    FieldAccessDenied = 202,
770    PrintAccessDenied = 203,
771    SortOrderFieldAccessDenied = 204,
772    ImportRecordCreationDenied = 205,
773    PasswordChangeDenied = 206,
774    DatabaseSchemaModificationDenied = 207,
775    ShortPassword = 208,
776    NewPasswordMatchesOld = 209,
777    AccountInactive = 210,
778    PasswordExpired = 211,
779    InvalidAccountOrPassword = 212,
780    AccountOrPasswordMissing = 213,
781    TooManyLogins = 214,
782    CannotDuplicateAdminPrivileges = 215,
783    CannotDuplicateGuestAccounts = 216,
784    InsufficientPrivilegesToModifyAdminAccount = 217,
785    FileLocked = 300,
786    RecordLocked = 301,
787    TableLocked = 302,
788    DatabaseSchemaLocked = 303,
789    LayoutLocked = 304,
790    RecordModificationIdMismatch = 306,
791    FindCriteriaEmpty = 400,
792    NoRecordsFound = 401,
793    FieldNotLookupMatch = 402,
794    TrialLimitExceeded = 403,
795    SortOrderInvalid = 404,
796    OmissionCountInvalid = 405,
797    ReplaceCriteriaInvalid = 406,
798    InvalidRelationships = 407,
799    InvalidFieldDataType = 408,
800    ImportOrderInvalid = 409,
801    ExportOrderInvalid = 410,
802    WrongVersionForRecovery = 412,
803    InvalidFieldType = 413,
804    LayoutCannotDisplayResult = 414,
805    RelatedRecordsUnavailable = 415,
806    DataSourcePrimaryKeyMissing = 416,
807    OdbcUnsupported = 417,
808    DataValidationFailed = 500,
809    TimeValidationFailed = 501,
810    NumberValidationFailed = 502,
811    ValueOutOfRange = 503,
812    ValueNotUnique = 504,
813    ValueNotExisting = 505,
814    ValueNotInValueList = 506,
815    ValueFailedValidationCalc = 507,
816    InvalidFindValue = 508,
817    FieldValueRequired = 509,
818    RelatedValueEmpty = 510,
819    ValueExceedsMaxChars = 511,
820    RecordAlreadyModified = 512,
821    ValueRequiredForCreation = 513,
822    PrintError = 600,
823    HeaderAndFooterExceedPage = 601,
824    BodyColumnSetupTooLarge = 602,
825    PrintConnectionLost = 603,
826    InvalidImportFileType = 700,
827    EpsfPreviewMissing = 706,
828    GraphicTranslatorMissing = 707,
829    ImportFailed = 708,
830    QuickTimeImportFailed = 709,
831    QuickTimeUpdateFailed = 710,
832    ImportTranslatorMissing = 711,
833    PasswordPrivilegesInsufficent = 714,
834    ExcelWorksheetOrRangeMissing = 715,
835    OdbcImportQueryInvalid = 716,
836    XmlImportExportInvalid = 717,
837    XmlParsingError = 718,
838    XmlTransformationError = 719,
839    RepeatingFieldsNotSupported = 720,
840    UnknownParserOrTransformerError = 721,
841    ImportTargetMissingFields = 722,
842    RecordCreationModificationDenied = 723,
843    RecordCreationDenied = 724,
844    RecordModificationDenied = 725,
845    AllRecordsNotImported = 726,
846    AllRecordsNotUpdated = 727,
847    ImportError = 729,
848    ExcelVersionUnsupported = 730,
849    ImportFileEmpty = 731,
850    FileContainsOtherFiles = 732,
851    SelfReferentialImport = 733,
852    FileInvalidForPictureDisplay = 734,
853    FileInvalidForPictureDisplayInsertedAsFile = 735,
854    DataTruncated = 736,
855    BentoTableMissing = 737,
856    FileCreationFailed = 800,
857    TemporaryFileCreationFailed = 801,
858    OpenFileFailed = 802,
859    FileSingleUserOrHostMissing = 803,
860    FileReadOnlyOpenFailed = 804,
861    FileDamagedRecoveryRequired = 805,
862    FileVersionInvalid = 806,
863    FileNotFileMaker = 807,
864    AccessPrivilegesDamaged = 808,
865    DiskFull = 809,
866    DiskLocked = 810,
867    TemporaryFileNotFileMaker = 811,
868    RecordSynchronizationError = 813,
869    OpenFileLimitExceeded = 814,
870    OpenLookupFileFailed = 815,
871    FileConversionFailed = 816,
872    FileBelongsToOtherSolution = 817,
873    LocalSaveRemoteFileDenied = 819,
874    FileClosing = 820,
875    ForcedDisconnect = 821,
876    FmiFilesMissing = 822,
877    GuestsConnectedSingleUserDenied = 823,
878    FileDamaged = 824,
879    UnauthorizedReferenceToProtectedFile = 825,
880    SpellingEngineError = 900,
881    SpellingDictionaryMissing = 901,
882    HelpSystemLaunchFailed = 902,
883    CommandInvalidInSharedFile = 903,
884    NoFieldSelected = 905,
885    FileNotShared = 906,
886    SpellingEngineInitializationFailed = 920,
887    UserDictionaryLoadFailed = 921,
888    UserDictionaryMissing = 922,
889    UserDictionaryReadOnly = 923,
890    UnexpectedError = 951,
891    UnsupportedXmlGrammar = 954,
892    DatabaseNameMissing = 955,
893    DatabaseSessionMaxExceeded = 956,
894    ConflictingCommands = 957,
895    ParameterMissing = 958,
896    CustomWebPublishingDisabled = 959,
897    ParameterInvalid = 960,
898    CalculationError = 1200,
899    TooFewParameters = 1201,
900    TooManyParameters = 1202,
901    UnexpectedEndOfCalculation = 1203,
902    UnexpectedValue = 1204,
903    UnterminatedComment = 1205,
904    MissingEndQuote = 1206,
905    UnbalancedParenthesis = 1207,
906    OperatorMissing = 1208,
907    FieldOrLayoutNameMissing = 1209,
908    PluginFunctionAlreadyRegistered = 1210,
909    ListUsageNotAllowed = 1211,
910    OperatorExpected = 1212,
911    VariableAlreadyDefined = 1213,
912    ExpressionFoundFieldNeeded = 1214,
913    InvalidGetFunction = 1215,
914    SummaryFieldsOnly = 1216,
915    BreakFieldInvalid = 1217,
916    NumberEvaluatationFailed = 1218,
917    SelfReferentialFieldDefinition = 1219,
918    WrongFieldType = 1220,
919    InvalidDataType = 1221,
920    CalculationCannotBeStored = 1222,
921    UnimplementedFunction = 1223,
922    UndefinedFunction = 1224,
923    UnsupportedFunction = 1225,
924    InvalidName = 1300,
925    OdbcDriverInitializationFailed = 1400,
926    OdbcEnvironmentAllocationFailed = 1401,
927    OdbcEnvironmentFreeFailed = 1402,
928    OdbcDisconnectFailed = 1403,
929    OdbcConnectionAllocationFailed = 1404,
930    OdbcConnectionFreeFailed = 1405,
931    OdbcSqlCheckFailed = 1406,
932    OdbcStatementAllocationFailed = 1407,
933    OdbcExtendedError = 1408,
934    OdbcError = 1409,
935    OdbcCommunicationLinkFailed = 1413,
936    PhpPrivilegeExtensionMissing = 1450,
937    FileNotRemote = 1451,
938    SmtpAuthenticationFailed = 1501,
939    SmtpConnectionRefused = 1502,
940    SmtpSslError = 1503,
941    EncryptedConnectionRequired = 1504,
942    SmtpAuthenticationUnsupported = 1505,
943    EmailSendFailed = 1506,
944    SmtpLoginFailed = 1507,
945    InvalidPlugin = 1550,
946    PluginInstallFailed = 1551,
947    GenericPluginError1 = 1552,
948    GenericPluginError2 = 1553,
949    GenericPluginError3 = 1554,
950    GenericPluginError4 = 1555,
951    GenericPluginError5 = 1556,
952    GenericPluginError6 = 1557,
953    GenericPluginError7 = 1558,
954    GenericPluginError8 = 1559,
955    UnsupportedProtocol = 1626,
956    AuthenticationFailed = 1627,
957    SslError = 1628,
958    ConnectionTimedOut = 1629,
959    IncorrectUrlFormat = 1630,
960    ConnectionFailed = 1631,
961    CertificateAuthenticationFailed = 1632,
962    CertificateError = 1633,
963    UnsupportedCommand = 2046,
964    BentoMissing = 2047,
965    WrongExcelFormat = 2048,
966    ActionCanceled = 3000,
967    OnTimerScriptFailed = 8404,
968}
969
970impl Display for FMError {
971    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
972        write!(f, "{:?}", self)
973    }
974}