#include <method_info.hpp>
Inheritance diagram for ClassEncoder::method_info:
The function name. | |||
Default constructor.
| |||
method_info (ConstantPool *constantPool, const std::string &name) | |||
virtual | ~method_info () | ||
Default destructor. | |||
void | write (std::ofstream &stream) | ||
Write the method to the class stream. | |||
void | setAccess (u2 flags) | ||
Sets the availability of this function. | |||
void | addParameter (const std::string &objectType, bool addLocal=false) | ||
Add class type parameter. | |||
void | setReturnType (const std::string &type) | ||
Set the return type of this function. | |||
unsigned int | addLocal () | ||
Add a local variable. | |||
ByteCode * | code () | ||
Get the pointer to the ByteCode object for this method. | |||
void | finish () | ||
This function finishes writing for this class. | |||
std::string | buildMethodDescriptor () | ||
Build method descriptor. | |||
Private Attributes | |||
ConstantPool * | ConstantPoolEntries | ||
code_attribute * | CodeAttribute | ||
u2 | access_flags | ||
u2 | name_index | ||
u2 | descriptor_index | ||
std::string | FunctionName | ||
std::vector< std::string > | Parameters | ||
std::string | ReturnType |
The details of the method_info structure is defined by SUN: http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#1513 For each method that you specify you must set the access parameters, the parametres themselves and the return type. After you are done with this the function finish() must be called.
Definition at line 30 of file method_info.hpp.
|
Default destructor. Destroys the object Definition at line 43 of file method_info.cpp. |
|
Add a local variable. This function is a convinience function forwarding the call to the code attribute.
Definition at line 119 of file method_info.cpp. References ClassEncoder::code_attribute::addLocal(). |
|
Add class type parameter.
Definition at line 95 of file method_info.cpp. References ClassEncoder::code_attribute::addLocal(). |
|
Build method descriptor. Builds the methoddescriptor for this class based on the parameters and return types. Rules: ( ParameterDescriptor* ) ReturnDescriptor ParameterDescriptor = CZFDBSIJ for basic types, Lobject; for objects [ in front for arrays ReturnDescriptor = same as above, V for void
Definition at line 133 of file method_info.cpp. Referenced by finish(). |
|
Get the pointer to the ByteCode object for this method.
Definition at line 150 of file method_info.cpp. References ClassEncoder::code_attribute::code(). |
|
This function finishes writing for this class. Any function calls after you have called finished will not have any impact. This function makes sure all it's properties are written into the constant_pool it is important that this is done before writing.
Definition at line 163 of file method_info.cpp. References ClassEncoder::ConstantPool::add(), and buildMethodDescriptor(). |
|
Sets the availability of this function. Available flags are:
Definition at line 84 of file method_info.cpp. |
|
Set the return type of this function. All functions return void until implemented
Definition at line 107 of file method_info.cpp. |
|
Write the method to the class stream.
Definition at line 53 of file method_info.cpp. References ClassEncoder::code_attribute::write(), and ClassEncoder::ClassWriterBase::writeu2(). |