add id enum
This commit is contained in:
parent
d69036d3b5
commit
e084dd1b8b
2 changed files with 11 additions and 8 deletions
|
|
@ -268,7 +268,10 @@ impl Apk {
|
||||||
*val as usize,
|
*val as usize,
|
||||||
dex,
|
dex,
|
||||||
)?)),
|
)?)),
|
||||||
EncodedValue::Enum(val) => Ok(DexValue::Enum(IdEnum(*val))),
|
EncodedValue::Enum(val) => Ok(DexValue::Enum(IdEnum(Self::get_id_field_from_idx(
|
||||||
|
*val as usize,
|
||||||
|
dex,
|
||||||
|
)?))),
|
||||||
EncodedValue::Array(arr) => Ok(DexValue::Array(DexArray(
|
EncodedValue::Array(arr) => Ok(DexValue::Array(DexArray(
|
||||||
arr.values
|
arr.values
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -383,25 +383,25 @@ impl IdMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyclass]
|
#[pyclass]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct IdEnum(pub u32);
|
pub struct IdEnum(pub IdField);
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl IdEnum {
|
impl IdEnum {
|
||||||
#[new]
|
#[new]
|
||||||
pub fn new(val: u32) -> Self {
|
pub fn new(val: IdField) -> Self {
|
||||||
Self(val)
|
Self(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_value(&self) -> u32 {
|
pub fn get_value(&self) -> IdField {
|
||||||
self.0
|
self.0.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn __str__(&self) -> String {
|
pub fn __str__(&self) -> String {
|
||||||
self.__repr__()
|
self.0.__str__()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn __repr__(&self) -> String {
|
pub fn __repr__(&self) -> String {
|
||||||
format!("DexEnum({})", self.0)
|
format!("DexEnum({})", self.__str__())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue