1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
//! The column element definition.
// Copyright (c) 2021 ShiftLeft Software
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub struct ElemColumn {
/// Name of the column.
col_name: String,
/// Index of the column name.
col_name_index: usize,
/// Header text of the column.
col_header: String,
/// Description of the column.
col_description: String,
/// Group of the descriptor.
group: String,
/// Name of the descriptor.
name: String,
/// Type of the descriptor.
col_type: String,
/// Code of the descriptor.
code: String,
/// Format of the column.
format: crate::FormatType,
/// Number of significant decimal digits.
decimal_digits: usize,
/// Width of column.
column_width: usize,
/// Column exclude.
column_editable: bool,
}
/// The column element implementation.
impl ElemColumn {
/// Create a new column element.
///
/// # Arguments
///
/// * `col_name_param` - Column name.
/// * `col_name_index_param` - Column index.
/// * `col_header_param` - Column header.
/// * `col_description_param` - Column description.
/// * `group_param` - Group parameter.
/// * `name_param` - Name parameter.
/// * `col_type_param` - Column type.
/// * `code_param` - Code parameter.
/// * `format_param` - Column format.
/// * `decimal_digits_param` - Decimal digits.
/// * `column_width_param` - Column width.
/// * `column_editable` - Column editable.
///
/// # Return
///
/// * See description.
#[allow(clippy::too_many_arguments)]
pub fn new(
col_name_param: &str,
col_name_index_param: usize,
col_header_param: &str,
col_description_param: &str,
group_param: &str,
name_param: &str,
col_type_param: &str,
code_param: &str,
format_param: crate::FormatType,
decimal_digits_param: usize,
column_width_param: usize,
column_editable_param: bool,
) -> ElemColumn {
ElemColumn {
col_name: String::from(col_name_param),
col_name_index: col_name_index_param,
col_header: String::from(col_header_param),
col_description: String::from(col_description_param),
group: String::from(group_param),
name: String::from(name_param),
col_type: String::from(col_type_param),
code: String::from(code_param),
format: format_param,
decimal_digits: decimal_digits_param,
column_width: column_width_param,
column_editable: column_editable_param,
}
}
/// Get the column name.
///
/// # Return
///
/// * See description.
pub fn col_name(&self) -> &str {
self.col_name.as_str()
}
/// Get the column name index.
///
/// # Return
///
/// * See description.
pub fn col_name_index(&self) -> usize {
self.col_name_index
}
/// Get the column header.
///
/// # Return
///
/// * See description.
pub fn col_header(&self) -> &str {
self.col_header.as_str()
}
/// Get the column description.
///
/// # Return
///
/// * See description.
pub fn col_description(&self) -> &str {
self.col_description.as_str()
}
/// Get the descriptor group.
///
/// # Return
///
/// * See description.
pub fn group(&self) -> &str {
self.group.as_str()
}
/// Get the descriptor name.
///
/// # Return
///
/// * See description.
pub fn name(&self) -> &str {
self.name.as_str()
}
/// Get the descriptor type.
///
/// # Return
///
/// * See description.
pub fn col_type(&self) -> &str {
self.col_type.as_str()
}
/// Get the descriptor code.
///
/// # Return
///
/// * See description.
pub fn code(&self) -> &str {
self.code.as_str()
}
/// Get the column format.
///
/// # Return
///
/// * See description.
pub fn format(&self) -> crate::FormatType {
self.format
}
/// Get the decimal digits.
///
/// # Return
///
/// * See description.
pub fn decimal_digits(&self) -> usize {
self.decimal_digits
}
/// Get the column width.
///
/// # Return
///
/// * See description.
pub fn column_width(&self) -> usize {
self.column_width
}
/// Get the column editable.
///
/// # Return
///
/// * See description.
pub fn column_editable(&self) -> bool {
self.column_editable
}
/// Set the column name.
///
/// # Arguments
///
/// * `col_name_param` - See description.
pub fn set_col_name(&mut self, col_name_param: &str) {
self.col_name = String::from(col_name_param);
}
/// Set the column name index.
///
/// # Arguments
///
/// * `col_name_index_param` - See description.
pub fn set_col_name_index(&mut self, col_name_index_param: usize) {
self.col_name_index = col_name_index_param;
}
/// Set the column header.
///
/// # Arguments
///
/// * `col_header_param` - See description.
pub fn set_col_header(&mut self, col_header_param: &str) {
self.col_header = String::from(col_header_param);
}
/// Set the column description.
///
/// # Arguments
///
/// * `col_desc_param` - See description.
pub fn set_col_description(&mut self, col_desc_param: &str) {
self.col_description = String::from(col_desc_param);
}
/// Set the descriptor group.
///
/// # Arguments
///
/// * `group_param` - See description.
pub fn set_group(&mut self, group_param: &str) {
self.group = String::from(group_param);
}
/// Set the descriptor name.
///
/// # Arguments
///
/// * `name_param` - See description.
pub fn set_name(&mut self, name_param: &str) {
self.name = String::from(name_param);
}
/// Set the descriptor type.
///
/// # Arguments
///
/// * `col_type_param` - See description.
pub fn set_col_type(&mut self, col_type_param: &str) {
self.col_type = String::from(col_type_param);
}
/// Set the descriptor code.
///
/// # Arguments
///
/// * `code_param` - See description.
pub fn set_code(&mut self, code_param: &str) {
self.code = String::from(code_param);
}
/// Set the column format.
///
/// # Arguments
///
/// * `format_param` - See description.
pub fn set_format(&mut self, format_param: crate::FormatType) {
self.format = format_param;
}
/// Set the decimal digits.
///
/// # Arguments
///
/// * `dec_digits_param` - See description.
pub fn set_decimal_digits(&mut self, dec_digits_param: usize) {
self.decimal_digits = dec_digits_param;
}
/// Set the column width.
///
/// # Arguments
///
/// * `width_param` - See description.
pub fn set_column_width(&mut self, width_param: usize) {
self.column_width = width_param;
}
/// Set the column editable.
///
/// # Arguments
///
/// * `editable_param` - See description.
pub fn set_column_editable(&mut self, editable_param: bool) {
self.column_editable = editable_param;
}
}