00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef METHODINFO_HPP
00011 #define METHODINFO_HPP
00012
00013 #include <string>
00014 #include <vector>
00015
00016 #include "classwriterbase.hpp"
00017
00018 namespace ClassEncoder
00019 {
00020
00021 class code_attribute;
00022 class ByteCode;
00023 class ConstantPool;
00024
00026
00030 class method_info : public ClassWriterBase
00031 {
00032 public:
00033 method_info( ConstantPool *constantPool, const std::string &name );
00034 virtual ~method_info();
00035
00036 void write( std::ofstream &stream );
00037 void setAccess( u2 flags );
00038
00039 void addParameter( const std::string &objectType, bool addLocal = false );
00040 void setReturnType( const std::string &type );
00041 unsigned int addLocal();
00042
00043 ByteCode *code();
00044
00045 void finish();
00046
00047 private:
00048 std::string buildMethodDescriptor();
00049
00050 private:
00051 ConstantPool *ConstantPoolEntries;
00052 code_attribute *CodeAttribute;
00053
00054 u2 access_flags;
00055 u2 name_index;
00056 u2 descriptor_index;
00057 std::string FunctionName;
00058
00059 std::vector<std::string> Parameters;
00060 std::string ReturnType;
00061 };
00062
00063 }
00064
00065 #endif // METHODINFO_HPP