A lightweight handle to a single DEX class definition.
More...
#include <analysis/class.hpp>
|
| std::string_view | descriptor () const |
| | The class descriptor, such as "Lcom/example/Foo;".
|
| |
| std::string | package () const |
| | The package in Java source form, with dots between its parts: "java.lang" for "Ljava/lang/Object;", the same form as apk::Manifest::package.
|
| |
| std::optional< ClassRef > | superclass () const |
| | A ClassRef for the direct superclass, or std::nullopt for java.lang.Object itself (superclass_idx == NO_INDEX in the class_def_item).
|
| |
| std::vector< ClassRef > | interfaces () const |
| | The interfaces implemented by this class, in declaration order.
|
| |
| std::vector< Method > | methods () const |
| | All direct and virtual methods defined in this class, in that order.
|
| |
| std::vector< Field > | fields () const |
| | All static and instance fields declared in this class, in that order.
|
| |
| std::vector< Annotation > | annotations () const |
| | Class-level annotations, resolved.
|
| |
| AccessFlags | access_flags () const |
| |
| std::optional< std::string_view > | source_file () const |
| | The source file name recorded in the class_def_item (e.g. "Foo.java"), or std::nullopt if the DEX file does not carry this information.
|
| |
| bool | is_public () const |
| |
| bool | is_abstract () const |
| |
| bool | is_interface () const |
| |
| bool | is_final () const |
| |
| bool | is_enum () const |
| |
| bool | operator== (const Class &) const =default |
| | Two handles are equal when they come from the same analysis (one AnalysisContext, or copies of it) and point at the same class definition.
|
| |
A lightweight handle to a single DEX class definition.
Get one from AnalysisContext::classes(), AnalysisContext::find_class() or ClassRef::resolve(). The handle keeps shared ownership of the analysis, so it remains valid even after every AnalysisContext wrapper has been destroyed. A Class always points at a class: there is no null Class, and a lookup that finds nothing returns std::nullopt instead.
◆ descriptor()
| std::string_view dex::Class::descriptor |
( |
| ) |
const |
The class descriptor, such as "Lcom/example/Foo;".
Method::name() and Field::name() are simple names; a class is named by its descriptor.
◆ package()
| std::string dex::Class::package |
( |
| ) |
const |
The package in Java source form, with dots between its parts: "java.lang" for "Ljava/lang/Object;", the same form as apk::Manifest::package.
An empty string for a class in the default package.
◆ superclass()
| std::optional< ClassRef > dex::Class::superclass |
( |
| ) |
const |
A ClassRef for the direct superclass, or std::nullopt for java.lang.Object itself (superclass_idx == NO_INDEX in the class_def_item).
◆ interfaces()
| std::vector< ClassRef > dex::Class::interfaces |
( |
| ) |
const |
The interfaces implemented by this class, in declaration order.
◆ methods()
| std::vector< Method > dex::Class::methods |
( |
| ) |
const |
All direct and virtual methods defined in this class, in that order.
◆ fields()
| std::vector< Field > dex::Class::fields |
( |
| ) |
const |
All static and instance fields declared in this class, in that order.
◆ annotations()
| std::vector< Annotation > dex::Class::annotations |
( |
| ) |
const |
Class-level annotations, resolved.
Parsed on demand.
◆ access_flags()
◆ source_file()
| std::optional< std::string_view > dex::Class::source_file |
( |
| ) |
const |
The source file name recorded in the class_def_item (e.g. "Foo.java"), or std::nullopt if the DEX file does not carry this information.
◆ is_public()
| bool dex::Class::is_public |
( |
| ) |
const |
|
inline |
◆ is_abstract()
| bool dex::Class::is_abstract |
( |
| ) |
const |
|
inline |
◆ is_interface()
| bool dex::Class::is_interface |
( |
| ) |
const |
|
inline |
◆ is_final()
| bool dex::Class::is_final |
( |
| ) |
const |
|
inline |
◆ is_enum()
| bool dex::Class::is_enum |
( |
| ) |
const |
|
inline |
◆ operator==()
| bool dex::Class::operator== |
( |
const Class & |
| ) |
const |
|
default |
Two handles are equal when they come from the same analysis (one AnalysisContext, or copies of it) and point at the same class definition.
Handles from two contexts that loaded the same file are not equal. std::hash<Class> is consistent with it.
◆ std::hash< Class >
| friend struct std::hash< Class > |
|
friend |
◆ AnalysisContext
◆ ClassRef
The documentation for this class was generated from the following file: