Class: Schema::Node

Inherits:
Capnp::Struct show all
Defined in:
lib/capnp/generator/schema.capnp.rb

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

Methods inherited from Capnp::Struct

decode_pointer, from_pointer, #initialize

Constructor Details

This class inherits a constructor from Capnp::Struct

Instance Method Details

#annotationObject



123
# File 'lib/capnp/generator/schema.capnp.rb', line 123

def annotation = GroupAnnotation.new(@data, @data_size, @pointers, @pointers_size)

#annotationsObject



27
# File 'lib/capnp/generator/schema.capnp.rb', line 27

def annotations = Schema::Annotation::List.from_pointer(read_pointer(2))

#constObject



105
# File 'lib/capnp/generator/schema.capnp.rb', line 105

def const = GroupConst.new(@data, @data_size, @pointers, @pointers_size)

#display_nameObject



12
# File 'lib/capnp/generator/schema.capnp.rb', line 12

def display_name = Capnp::BufferString.from_pointer(read_pointer(0))

#display_name_prefix_lengthObject



15
# File 'lib/capnp/generator/schema.capnp.rb', line 15

def display_name_prefix_length = read_u32(8, 0)

#enumObject



72
# File 'lib/capnp/generator/schema.capnp.rb', line 72

def enum = GroupEnum.new(@data, @data_size, @pointers, @pointers_size)

#fileObject



29
# File 'lib/capnp/generator/schema.capnp.rb', line 29

def file = nil

#idObject



9
# File 'lib/capnp/generator/schema.capnp.rb', line 9

def id = read_u64(0, 0)

#interfaceObject



87
# File 'lib/capnp/generator/schema.capnp.rb', line 87

def interface = GroupInterface.new(@data, @data_size, @pointers, @pointers_size)

#is_annotation?Boolean

Returns:

  • (Boolean)


184
# File 'lib/capnp/generator/schema.capnp.rb', line 184

def is_annotation? = which? == Which::Annotation

#is_const?Boolean

Returns:

  • (Boolean)


121
# File 'lib/capnp/generator/schema.capnp.rb', line 121

def is_const? = which? == Which::Const

#is_enum?Boolean

Returns:

  • (Boolean)


85
# File 'lib/capnp/generator/schema.capnp.rb', line 85

def is_enum? = which? == Which::Enum

#is_file?Boolean

Returns:

  • (Boolean)


31
# File 'lib/capnp/generator/schema.capnp.rb', line 31

def is_file? = which? == Which::File

#is_genericObject



23
# File 'lib/capnp/generator/schema.capnp.rb', line 23

def is_generic = (read_u8(36, 0x00) & 0x1) != 0

#is_interface?Boolean

Returns:

  • (Boolean)


103
# File 'lib/capnp/generator/schema.capnp.rb', line 103

def is_interface? = which? == Which::Interface

#is_struct?Boolean

Returns:

  • (Boolean)


70
# File 'lib/capnp/generator/schema.capnp.rb', line 70

def is_struct? = which? == Which::Struct

#nested_nodesObject



25
# File 'lib/capnp/generator/schema.capnp.rb', line 25

def nested_nodes = Schema::Node::NestedNode::List.from_pointer(read_pointer(1))

#parametersObject



20
# File 'lib/capnp/generator/schema.capnp.rb', line 20

def parameters = Schema::Node::Parameter::List.from_pointer(read_pointer(5))

#scope_idObject



18
# File 'lib/capnp/generator/schema.capnp.rb', line 18

def scope_id = read_u64(16, 0)

#structObject



33
# File 'lib/capnp/generator/schema.capnp.rb', line 33

def struct = GroupStruct.new(@data, @data_size, @pointers, @pointers_size)

#to_objObject



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

Returns:

  • (Boolean)


275
# File 'lib/capnp/generator/schema.capnp.rb', line 275

def which? = Which.from_integer(read_u16(12, 0))