|
RPNXCortado
C++23 JVM class-file, bytecode, validation, and JAR toolkit
|
An owning symbolic class-file builder with a shared constant-pool interner. More...
#include <builders.hpp>
Public Member Functions | |
| class_file_builder (std::string_view class_name, std::string_view super_class_name="java/lang/Object", class_file_version version={0, 70}) | |
| Creates a new class with the supplied internal names. | |
| class_file_builder (class_file value) | |
| Initializes a builder from an exact parsed class model. | |
| auto | access_flags () noexcept -> class_access_flags & |
| Returns the mutable class access flags. | |
| auto | version () noexcept -> class_file_version & |
| Returns the mutable class-file version. | |
| auto | constant_pool () noexcept -> constant_pool_builder & |
| Returns the shared constant-pool interner. | |
| auto | add_interface (std::string_view internal_name) -> class_file_builder & |
| Adds an implemented or extended interface by internal class name. | |
| auto | fields () noexcept -> std::vector< field_info > & |
| Returns the mutable exact field sequence for transformations. | |
| auto | methods () noexcept -> std::vector< method_info > & |
| Returns the mutable exact method sequence for transformations. | |
| auto | attributes () noexcept -> std::vector< class_attribute > & |
| Returns the mutable typed class-attribute sequence for transformations. | |
| auto | add_method (std::string_view name, std::string_view descriptor, method_access_flags flags, code_builder const &code, code_build_options const &options={}, class_hierarchy_resolver_ref hierarchy={}) -> method_info & |
Adds a method with a symbolic Code body. | |
| auto | add_field (std::string_view name, std::string_view descriptor, field_access_flags flags) -> field_info & |
| Adds a field without attributes. | |
| class_file | build () const |
| Returns a complete exact class-file model. | |
An owning symbolic class-file builder with a shared constant-pool interner.
The builder owns its class model and interns names and references in one deterministic pool. References returned from mutable accessors follow normal std::vector invalidation rules.
Definition at line 672 of file builders.hpp.
|
explicit |
Creates a new class with the supplied internal names.
| class_name | Slash-separated internal name of the new class. |
| super_class_name | Direct superclass internal name. |
| version | Class-file version to emit. |
References version().
Referenced by add_interface().
|
explicit |
Initializes a builder from an exact parsed class model.
| value | Model whose existing constant-pool indexes and ordering are retained. |
| validation_error | if its constant pool cannot initialize the interner. |
|
nodiscardnoexcept |
Returns the mutable class access flags.
| auto rpnx::cortado::class_file_builder::add_field | ( | std::string_view | name, |
| std::string_view | descriptor, | ||
| field_access_flags | flags ) -> field_info & |
Adds a field without attributes.
| name | JVM field name. |
| descriptor | Complete JVM field descriptor bytes. |
| flags | Field access flags. |
| auto rpnx::cortado::class_file_builder::add_interface | ( | std::string_view | internal_name | ) | -> class_file_builder & |
Adds an implemented or extended interface by internal class name.
| internal_name | Slash-separated interface internal name. |
*this. References add_interface(), and class_file_builder().
Referenced by add_interface().
| auto rpnx::cortado::class_file_builder::add_method | ( | std::string_view | name, |
| std::string_view | descriptor, | ||
| method_access_flags | flags, | ||
| code_builder const & | code, | ||
| code_build_options const & | options = {}, | ||
| class_hierarchy_resolver_ref | hierarchy = {} ) -> method_info & |
Adds a method with a symbolic Code body.
| name | JVM method name. |
| descriptor | Complete JVM method descriptor. |
| flags | Method access flags. |
| code | Symbolic code to finalize against this class's shared pool. |
| options | Analysis and metadata policy. |
| hierarchy | Optional resolver for verifier reference merges. |
| parse_error | if descriptor is malformed. |
| assembly_error | if the code cannot be finalized. |
References add_method().
Referenced by add_method().
|
nodiscardnoexcept |
Returns the mutable typed class-attribute sequence for transformations.
References attributes().
Referenced by attributes().
|
nodiscard |
Returns a complete exact class-file model.
|
nodiscardnoexcept |
Returns the shared constant-pool interner.
References constant_pool().
Referenced by constant_pool().
|
nodiscardnoexcept |
|
nodiscardnoexcept |
|
nodiscardnoexcept |
Returns the mutable class-file version.
References version().
Referenced by class_file_builder(), and version().