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,
|
||||
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(
|
||||
arr.values
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -383,25 +383,25 @@ impl IdMethod {
|
|||
}
|
||||
|
||||
#[pyclass]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct IdEnum(pub u32);
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct IdEnum(pub IdField);
|
||||
#[pymethods]
|
||||
impl IdEnum {
|
||||
#[new]
|
||||
pub fn new(val: u32) -> Self {
|
||||
pub fn new(val: IdField) -> Self {
|
||||
Self(val)
|
||||
}
|
||||
|
||||
pub fn get_value(&self) -> u32 {
|
||||
self.0
|
||||
pub fn get_value(&self) -> IdField {
|
||||
self.0.clone()
|
||||
}
|
||||
|
||||
pub fn __str__(&self) -> String {
|
||||
self.__repr__()
|
||||
self.0.__str__()
|
||||
}
|
||||
|
||||
pub fn __repr__(&self) -> String {
|
||||
format!("DexEnum({})", self.0)
|
||||
format!("DexEnum({})", self.__str__())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue