dex++ 0.3.1
C++ and C API reference
Loading...
Searching...
No Matches
dex::axml::XmlAttribute Struct Reference

One attribute of an element. More...

#include <apk/axml.hpp>

Public Member Functions

std::optional< std::string_view > as_string () const
 The value as text, when it is one (TYPE_STRING or a raw value).
 
std::optional< int64_t > as_int () const
 The value as an integer (TYPE_INT_DEC / TYPE_INT_HEX).
 
std::optional< bool > as_bool () const
 The value as a boolean (TYPE_INT_BOOLEAN).
 
std::optional< uint32_t > as_reference () const
 The value as a resource reference (TYPE_REFERENCE), e.g. 0x7f0b0014.
 

Public Attributes

std::string namespace_uri
 e.g. "http://schemas.android.com/apk/res/android"; may be empty.
 
std::string name
 e.g. "exported".
 
std::string raw_value
 Resolved string value when the value is a string; else empty.
 
TypedValue typed
 
uint32_t resource_id = 0
 The attribute's resource id, from the document's resource map: for example 0x01010010 for android:exported.
 

Detailed Description

One attribute of an element.

String-typed values are pre-resolved into raw_value; other types live in typed.

Member Function Documentation

◆ as_string()

std::optional< std::string_view > dex::axml::XmlAttribute::as_string ( ) const
inline

The value as text, when it is one (TYPE_STRING or a raw value).

◆ as_int()

std::optional< int64_t > dex::axml::XmlAttribute::as_int ( ) const
inline

The value as an integer (TYPE_INT_DEC / TYPE_INT_HEX).

◆ as_bool()

std::optional< bool > dex::axml::XmlAttribute::as_bool ( ) const
inline

The value as a boolean (TYPE_INT_BOOLEAN).

◆ as_reference()

std::optional< uint32_t > dex::axml::XmlAttribute::as_reference ( ) const
inline

The value as a resource reference (TYPE_REFERENCE), e.g. 0x7f0b0014.

Member Data Documentation

◆ namespace_uri

std::string dex::axml::XmlAttribute::namespace_uri

e.g. "http://schemas.android.com/apk/res/android"; may be empty.

◆ name

std::string dex::axml::XmlAttribute::name

e.g. "exported".

◆ raw_value

std::string dex::axml::XmlAttribute::raw_value

Resolved string value when the value is a string; else empty.

◆ typed

TypedValue dex::axml::XmlAttribute::typed

◆ resource_id

uint32_t dex::axml::XmlAttribute::resource_id = 0

The attribute's resource id, from the document's resource map: for example 0x01010010 for android:exported.

0 when the attribute has none (the attribute is not a framework attribute, or the document has no resource map). Android identifies framework attributes by this id, not by name.


The documentation for this struct was generated from the following file: