Class: Schema::Value

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

Defined Under Namespace

Classes: List, Which

Constant Summary collapse

DEFAULT_BOOL =
false
DEFAULT_INT8 =
0
DEFAULT_INT16 =
0
DEFAULT_INT32 =
0
DEFAULT_INT64 =
0
DEFAULT_UINT8 =
0
DEFAULT_UINT16 =
0
DEFAULT_UINT32 =
0
DEFAULT_UINT64 =
0
DEFAULT_FLOAT32 =
0.0
DEFAULT_FLOAT64 =
0.0
DEFAULT_TEXT =
nil
DEFAULT_DATA =
nil
DEFAULT_ENUM =
0

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

#any_pointerObject



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

def any_pointer = read_pointer(0)

#boolObject



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

def bool = (read_u8(2, 0x00) & 0x1) != 0

#dataObject



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

def data = Capnp::Data.from_pointer(read_pointer(0))

#enumObject



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

def enum = read_u16(2, 0)

#float32Object



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

def float32 = read_f32(4, 0.0)

#float64Object



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

def float64 = read_f64(8, 0.0)

#int16Object



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

def int16 = read_s16(2, 0)

#int32Object



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

def int32 = read_s32(4, 0)

#int64Object



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

def int64 = read_s64(8, 0)

#int8Object



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

def int8 = read_s8(2, 0)

#interfaceObject



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

def interface = nil

#is_any_pointer?Boolean

Returns:

  • (Boolean)


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

def is_any_pointer? = which? == Which::AnyPointer

#is_bool?Boolean

Returns:

  • (Boolean)


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

def is_bool? = which? == Which::Bool

#is_data?Boolean

Returns:

  • (Boolean)


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

def is_data? = which? == Which::Data

#is_enum?Boolean

Returns:

  • (Boolean)


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

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

#is_float32?Boolean

Returns:

  • (Boolean)


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

def is_float32? = which? == Which::Float32

#is_float64?Boolean

Returns:

  • (Boolean)


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

def is_float64? = which? == Which::Float64

#is_int16?Boolean

Returns:

  • (Boolean)


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

def is_int16? = which? == Which::Int16

#is_int32?Boolean

Returns:

  • (Boolean)


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

def is_int32? = which? == Which::Int32

#is_int64?Boolean

Returns:

  • (Boolean)


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

def is_int64? = which? == Which::Int64

#is_int8?Boolean

Returns:

  • (Boolean)


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

def is_int8? = which? == Which::Int8

#is_interface?Boolean

Returns:

  • (Boolean)


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

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

#is_list?Boolean

Returns:

  • (Boolean)


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

def is_list? = which? == Which::List

#is_struct?Boolean

Returns:

  • (Boolean)


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

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

#is_text?Boolean

Returns:

  • (Boolean)


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

def is_text? = which? == Which::Text

#is_uint16?Boolean

Returns:

  • (Boolean)


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

def is_uint16? = which? == Which::Uint16

#is_uint32?Boolean

Returns:

  • (Boolean)


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

def is_uint32? = which? == Which::Uint32

#is_uint64?Boolean

Returns:

  • (Boolean)


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

def is_uint64? = which? == Which::Uint64

#is_uint8?Boolean

Returns:

  • (Boolean)


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

def is_uint8? = which? == Which::Uint8

#is_void?Boolean

Returns:

  • (Boolean)


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

def is_void? = which? == Which::Void

#listObject



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

def list = read_pointer(0)

#structObject



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

def struct = read_pointer(0)

#textObject



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

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

#to_objObject



1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
# File 'lib/capnp/generator/schema.capnp.rb', line 1150

def to_obj
  res = {}
  case which?
  when Which::Void then res["void"] = void
  when Which::Bool then res["bool"] = bool
  when Which::Int8 then res["int8"] = int8
  when Which::Int16 then res["int16"] = int16
  when Which::Int32 then res["int32"] = int32
  when Which::Int64 then res["int64"] = int64
  when Which::Uint8 then res["uint8"] = uint8
  when Which::Uint16 then res["uint16"] = uint16
  when Which::Uint32 then res["uint32"] = uint32
  when Which::Uint64 then res["uint64"] = uint64
  when Which::Float32 then res["float32"] = float32
  when Which::Float64 then res["float64"] = float64
  when Which::Text then res["text"] = text&.to_obj
  when Which::Data then res["data"] = data&.to_obj
  when Which::List then res["list"] = list
  when Which::Enum then res["enum"] = enum
  when Which::Struct then res["struct"] = struct
  when Which::Interface then res["interface"] = interface
  when Which::AnyPointer then res["any_pointer"] = any_pointer
  end
  res
end

#uint16Object



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

def uint16 = read_u16(2, 0)

#uint32Object



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

def uint32 = read_u32(4, 0)

#uint64Object



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

def uint64 = read_u64(8, 0)

#uint8Object



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

def uint8 = read_u8(2, 0)

#voidObject



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

def void = nil

#which?Boolean

Returns:

  • (Boolean)


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

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