|
Revision 13478, 1.0 kB
(checked in by fd0, 5 years ago)
|
|
initial release
|
| Line | |
|---|
| 1 | module Yabcel
|
|---|
| 2 | class Member
|
|---|
| 3 | attr_accessor :access_flags
|
|---|
| 4 | attr_accessor :name_index
|
|---|
| 5 | attr_accessor :signature_index
|
|---|
| 6 | attr_accessor :attributes
|
|---|
| 7 | attr_accessor :constant_pool
|
|---|
| 8 | def initialize(access_flags, name_index, signature_index, attributes,
|
|---|
| 9 | constant_pool)
|
|---|
| 10 | @access_flags = access_flags
|
|---|
| 11 | @name_index = name_index
|
|---|
| 12 | @signature_index = signature_index
|
|---|
| 13 | @attributes = attributes
|
|---|
| 14 | @constant_pool = constant_pool
|
|---|
| 15 | end
|
|---|
| 16 | def self.parse(file, constant_pool)
|
|---|
| 17 | access_flags = file.read_short()
|
|---|
| 18 | name_index = file.read_short()
|
|---|
| 19 | signature_index = file.read_short()
|
|---|
| 20 | attributes = []
|
|---|
| 21 | file.read_short().times {
|
|---|
| 22 | attributes.push(Attribute::parse(file, constant_pool))
|
|---|
| 23 | }
|
|---|
| 24 | new(access_flags, name_index, signature_index, attributes, constant_pool)
|
|---|
| 25 | end
|
|---|
| 26 | def get_signature()
|
|---|
| 27 | @constant_pool[@signature_index]
|
|---|
| 28 | end
|
|---|
| 29 | def get_name()
|
|---|
| 30 | @constant_pool[@name_index]
|
|---|
| 31 | end
|
|---|
| 32 | end
|
|---|
| 33 | end
|
|---|