Class: Schema::Node
Defined Under Namespace
Classes: GroupAnnotation, GroupConst, GroupEnum, GroupInterface, GroupStruct, List, NestedNode, Parameter, SourceInfo, Which
Constant Summary
collapse
- DEFAULT_ID =
0
- DEFAULT_DISPLAY_NAME =
nil
- DEFAULT_DISPLAY_NAME_PREFIX_LENGTH =
0
- DEFAULT_SCOPE_ID =
0
- DEFAULT_IS_GENERIC =
false
Instance Method Summary
collapse
decode_pointer, from_pointer, #initialize
Constructor Details
This class inherits a constructor from Capnp::Struct
Instance Method Details
#annotation ⇒ Object
123
|
# File 'lib/capnp/generator/schema.capnp.rb', line 123
def annotation = GroupAnnotation.new(@data, @data_size, @pointers, @pointers_size)
|
#annotations ⇒ Object
27
|
# File 'lib/capnp/generator/schema.capnp.rb', line 27
def annotations = Schema::Annotation::List.from_pointer(read_pointer(2))
|
#const ⇒ Object
105
|
# File 'lib/capnp/generator/schema.capnp.rb', line 105
def const = GroupConst.new(@data, @data_size, @pointers, @pointers_size)
|
#display_name ⇒ Object
12
|
# File 'lib/capnp/generator/schema.capnp.rb', line 12
def display_name = Capnp::BufferString.from_pointer(read_pointer(0))
|
#display_name_prefix_length ⇒ Object
15
|
# File 'lib/capnp/generator/schema.capnp.rb', line 15
def display_name_prefix_length = read_u32(8, 0)
|
#enum ⇒ Object
72
|
# File 'lib/capnp/generator/schema.capnp.rb', line 72
def enum = GroupEnum.new(@data, @data_size, @pointers, @pointers_size)
|
#file ⇒ Object
29
|
# File 'lib/capnp/generator/schema.capnp.rb', line 29
def file = nil
|
#id ⇒ Object
9
|
# File 'lib/capnp/generator/schema.capnp.rb', line 9
def id = read_u64(0, 0)
|
#interface ⇒ Object
87
|
# File 'lib/capnp/generator/schema.capnp.rb', line 87
def interface = GroupInterface.new(@data, @data_size, @pointers, @pointers_size)
|
#is_annotation? ⇒ Boolean
184
|
# File 'lib/capnp/generator/schema.capnp.rb', line 184
def is_annotation? = which? == Which::Annotation
|
#is_const? ⇒ Boolean
121
|
# File 'lib/capnp/generator/schema.capnp.rb', line 121
def is_const? = which? == Which::Const
|
#is_enum? ⇒ Boolean
85
|
# File 'lib/capnp/generator/schema.capnp.rb', line 85
def is_enum? = which? == Which::Enum
|
#is_file? ⇒ Boolean
31
|
# File 'lib/capnp/generator/schema.capnp.rb', line 31
def is_file? = which? == Which::File
|
#is_generic ⇒ Object
23
|
# File 'lib/capnp/generator/schema.capnp.rb', line 23
def is_generic = (read_u8(36, 0x00) & 0x1) != 0
|
#is_interface? ⇒ Boolean
103
|
# File 'lib/capnp/generator/schema.capnp.rb', line 103
def is_interface? = which? == Which::Interface
|
#is_struct? ⇒ Boolean
70
|
# File 'lib/capnp/generator/schema.capnp.rb', line 70
def is_struct? = which? == Which::Struct
|
#nested_nodes ⇒ Object
25
|
# File 'lib/capnp/generator/schema.capnp.rb', line 25
def nested_nodes = Schema::Node::NestedNode::List.from_pointer(read_pointer(1))
|
#parameters ⇒ Object
20
|
# File 'lib/capnp/generator/schema.capnp.rb', line 20
def parameters = Schema::Node::Parameter::List.from_pointer(read_pointer(5))
|
#scope_id ⇒ Object
18
|
# File 'lib/capnp/generator/schema.capnp.rb', line 18
def scope_id = read_u64(16, 0)
|
#struct ⇒ Object
33
|
# File 'lib/capnp/generator/schema.capnp.rb', line 33
def struct = GroupStruct.new(@data, @data_size, @pointers, @pointers_size)
|
#to_obj ⇒ Object
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# File 'lib/capnp/generator/schema.capnp.rb', line 301
def to_obj
res = {}
res["id"] = id
res["display_name"] = display_name&.to_obj
res["display_name_prefix_length"] = display_name_prefix_length
res["scope_id"] = scope_id
res["parameters"] = parameters&.to_obj
res["is_generic"] = is_generic
res["nested_nodes"] = nested_nodes&.to_obj
res["annotations"] = annotations&.to_obj
case which?
when Which::File then res["file"] = file
when Which::Struct then res["struct"] = struct.to_obj
when Which::Enum then res["enum"] = enum.to_obj
when Which::Interface then res["interface"] = interface.to_obj
when Which::Const then res["const"] = const.to_obj
when Which::Annotation then res["annotation"] = annotation.to_obj
end
res
end
|
#which? ⇒ Boolean
275
|
# File 'lib/capnp/generator/schema.capnp.rb', line 275
def which? = Which.from_integer(read_u16(12, 0))
|