00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef CODEATTRIBUTE_HPP
00011 #define CODEATTRIBUTE_HPP
00012
00013 #include <fstream>
00014 #include "attribute_info.hpp"
00015 #include "bytecode.hpp"
00016
00017 namespace ClassEncoder
00018 {
00019
00020 class ConstantPool;
00021
00023
00027 class code_attribute : public attribute_info
00028 {
00029 public:
00030 code_attribute( ConstantPool *pool );
00031 virtual ~code_attribute();
00032
00033 virtual void write( std::ofstream &stream );
00034 virtual unsigned int size();
00036
00040 ByteCode *code() { return Code; }
00041
00043
00053 unsigned int addLocal() { return max_locals++; }
00054
00055 private:
00057
00060 code_attribute() {}
00061
00062 private:
00063 ConstantPool *ConstantPoolEntries;
00064 ByteCode *Code;
00065 u2 max_locals;
00066 };
00067
00068 }
00069 #endif // CODEATTRIBUTE_HPP