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
//! The key 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 ElemKey {
/// Name of the key.
key: String,
/// Value of the key.
value: usize,
/// Extension value of the key.
value_ext: usize,
}
/// The key implementation.
impl ElemKey {
/// Create a new object.
///
/// # Return
///
/// * See description.
pub fn new() -> ElemKey {
ElemKey {
key: String::from(""),
value: 0,
value_ext: 0,
}
}
/// Get the key of symbol.
///
/// # Return
///
/// * See description.
pub fn key(&self) -> &str {
self.key.as_str()
}
/// Get the value.
///
/// # Return
///
/// * See description.
pub fn value(&self) -> usize {
self.value
}
/// Get the value extension.
///
/// # Return
///
/// * See description.
pub fn value_ext(&self) -> usize {
self.value_ext
}
/// Set the key value.
///
/// # Arguments
///
/// * `key_param` - See description.
pub fn set_key(&mut self, key_param: &str) {
self.key = String::from(key_param);
}
/// Set the value.
///
/// # Arguments
///
/// * `value_param` - See description.
pub fn set_value(&mut self, value_param: usize) {
self.value = value_param;
}
/// Set the value extension.
///
/// # Arguments
///
/// * `value_ext_param` - See description.
pub fn set_value_ext(&mut self, value_ext_param: usize) {
self.value_ext = value_ext_param;
}
}