Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
m417z
pykd
Commits
0450a3ab
Commit
0450a3ab
authored
Sep 17, 2019
by
ussrhero
Browse files
typedVar.members methods ( return defined members of class, not inherited)
parent
a0f0905c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
8 deletions
+48
-8
pykd/pytypedvar.cpp
pykd/pytypedvar.cpp
+45
-7
pykd/pytypedvar.h
pykd/pytypedvar.h
+3
-1
No files found.
pykd/pytypedvar.cpp
View file @
0450a3ab
...
...
@@ -103,7 +103,7 @@ python::list getTypedVarArrayByType( kdlib::MEMOFFSET_64 offset, kdlib::TypeInfo
///////////////////////////////////////////////////////////////////////////////
python
::
list
TypedVarAdapter
::
getFields
(
kdlib
::
TypedVar
&
typedVar
)
python
::
list
TypedVarAdapter
::
getFields
(
const
kdlib
::
TypedVar
Ptr
&
typedVar
)
{
typedef
boost
::
tuple
<
std
::
wstring
,
kdlib
::
MEMOFFSET_32
,
kdlib
::
TypedVarPtr
>
FieldTuple
;
...
...
@@ -113,18 +113,18 @@ python::list TypedVarAdapter::getFields( kdlib::TypedVar& typedVar )
AutoRestorePyState
pystate
;
for
(
size_t
i
=
0
;
i
<
typedVar
.
getElementCount
();
++
i
)
for
(
size_t
i
=
0
;
i
<
typedVar
->
getElementCount
();
++
i
)
{
std
::
wstring
name
=
typedVar
.
getElementName
(
i
);
std
::
wstring
name
=
typedVar
->
getElementName
(
i
);
kdlib
::
MEMOFFSET_32
offset
=
0
;
if
(
typedVar
.
getType
()
->
isConstMember
(
i
))
if
(
typedVar
->
getType
()
->
isConstMember
(
i
))
continue
;
if
(
!
typedVar
.
getType
()
->
isStaticMember
(
i
)
)
offset
=
typedVar
.
getElementOffset
(
i
);
if
(
!
typedVar
->
getType
()
->
isStaticMember
(
i
)
)
offset
=
typedVar
->
getElementOffset
(
i
);
kdlib
::
TypedVarPtr
val
=
typedVar
.
getElement
(
i
);
kdlib
::
TypedVarPtr
val
=
typedVar
->
getElement
(
i
);
lst
.
push_back
(
FieldTuple
(
name
,
offset
,
val
)
);
}
...
...
@@ -139,6 +139,44 @@ python::list TypedVarAdapter::getFields( kdlib::TypedVar& typedVar )
return
pylst
;
}
python
::
list
TypedVarAdapter
::
getMembers
(
const
kdlib
::
TypedVarPtr
&
typedVar
)
{
typedef
boost
::
tuple
<
std
::
wstring
,
kdlib
::
MEMOFFSET_32
,
kdlib
::
TypedVarPtr
>
FieldTuple
;
std
::
list
<
FieldTuple
>
lst
;
do
{
AutoRestorePyState
pystate
;
auto
varType
=
typedVar
->
getType
();
for
(
size_t
i
=
0
;
i
<
typedVar
->
getElementCount
();
++
i
)
{
if
(
varType
->
isConstMember
(
i
)
||
varType
->
isInheritedMember
(
i
))
continue
;
std
::
wstring
name
=
typedVar
->
getElementName
(
i
);
kdlib
::
MEMOFFSET_32
offset
=
0
;
if
(
!
varType
->
isStaticMember
(
i
))
offset
=
typedVar
->
getElementOffset
(
i
);
kdlib
::
TypedVarPtr
val
=
typedVar
->
getElement
(
i
);
lst
.
push_back
(
FieldTuple
(
name
,
offset
,
val
));
}
}
while
(
false
);
python
::
list
pylst
;
for
(
std
::
list
<
FieldTuple
>::
const_iterator
it
=
lst
.
begin
();
it
!=
lst
.
end
();
++
it
)
pylst
.
append
(
python
::
make_tuple
(
it
->
get
<
0
>
(),
it
->
get
<
1
>
(),
it
->
get
<
2
>
()));
return
pylst
;
}
///////////////////////////////////////////////////////////////////////////////
bool
TypedVarAdapter
::
hasField
(
kdlib
::
TypedVarPtr
&
typedVar
,
const
std
::
wstring
&
fieldName
)
...
...
pykd/pytypedvar.h
View file @
0450a3ab
...
...
@@ -187,7 +187,9 @@ struct TypedVarAdapter {
return
typedVar
.
str
();
}
static
python
::
list
getFields
(
kdlib
::
TypedVar
&
typedVar
);
static
python
::
list
getFields
(
const
kdlib
::
TypedVarPtr
&
typedVar
);
static
python
::
list
getMembers
(
const
kdlib
::
TypedVarPtr
&
typedVar
);
static
kdlib
::
TypeInfoPtr
getType
(
kdlib
::
TypedVar
&
typedVar
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment