Class: Schema::Value
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
decode_pointer, from_pointer, #initialize
Constructor Details
This class inherits a constructor from Capnp::Struct
Instance Method Details
#any_pointer ⇒ Object
1088
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1088
def any_pointer = read_pointer(0)
|
#bool ⇒ Object
1007
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1007
def bool = (read_u8(2, 0x00) & 0x1) != 0
|
#data ⇒ Object
1067
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1067
def data = Capnp::Data.from_pointer(read_pointer(0))
|
#enum ⇒ Object
1076
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1076
def enum = read_u16(2, 0)
|
#float32 ⇒ Object
1052
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1052
def float32 = read_f32(4, 0.0)
|
#float64 ⇒ Object
1057
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1057
def float64 = read_f64(8, 0.0)
|
#int16 ⇒ Object
1017
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1017
def int16 = read_s16(2, 0)
|
#int32 ⇒ Object
1022
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1022
def int32 = read_s32(4, 0)
|
#int64 ⇒ Object
1027
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1027
def int64 = read_s64(8, 0)
|
#int8 ⇒ Object
1012
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1012
def int8 = read_s8(2, 0)
|
#interface ⇒ Object
1084
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1084
def interface = nil
|
#is_any_pointer? ⇒ Boolean
1090
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1090
def is_any_pointer? = which? == Which::AnyPointer
|
#is_bool? ⇒ Boolean
1009
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1009
def is_bool? = which? == Which::Bool
|
#is_data? ⇒ Boolean
1069
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1069
def is_data? = which? == Which::Data
|
#is_enum? ⇒ Boolean
1078
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1078
def is_enum? = which? == Which::Enum
|
#is_float32? ⇒ Boolean
1054
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1054
def is_float32? = which? == Which::Float32
|
#is_float64? ⇒ Boolean
1059
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1059
def is_float64? = which? == Which::Float64
|
#is_int16? ⇒ Boolean
1019
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1019
def is_int16? = which? == Which::Int16
|
#is_int32? ⇒ Boolean
1024
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1024
def is_int32? = which? == Which::Int32
|
#is_int64? ⇒ Boolean
1029
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1029
def is_int64? = which? == Which::Int64
|
#is_int8? ⇒ Boolean
1014
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1014
def is_int8? = which? == Which::Int8
|
#is_interface? ⇒ Boolean
1086
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1086
def is_interface? = which? == Which::Interface
|
#is_list? ⇒ Boolean
1073
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1073
def is_list? = which? == Which::List
|
#is_struct? ⇒ Boolean
1082
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1082
def is_struct? = which? == Which::Struct
|
#is_text? ⇒ Boolean
1064
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1064
def is_text? = which? == Which::Text
|
#is_uint16? ⇒ Boolean
1039
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1039
def is_uint16? = which? == Which::Uint16
|
#is_uint32? ⇒ Boolean
1044
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1044
def is_uint32? = which? == Which::Uint32
|
#is_uint64? ⇒ Boolean
1049
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1049
def is_uint64? = which? == Which::Uint64
|
#is_uint8? ⇒ Boolean
1034
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1034
def is_uint8? = which? == Which::Uint8
|
#is_void? ⇒ Boolean
1004
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1004
def is_void? = which? == Which::Void
|
#list ⇒ Object
1071
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1071
def list = read_pointer(0)
|
#struct ⇒ Object
1080
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1080
def struct = read_pointer(0)
|
#to_obj ⇒ Object
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
|
#uint16 ⇒ Object
1037
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1037
def uint16 = read_u16(2, 0)
|
#uint32 ⇒ Object
1042
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1042
def uint32 = read_u32(4, 0)
|
#uint64 ⇒ Object
1047
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1047
def uint64 = read_u64(8, 0)
|
#uint8 ⇒ Object
1032
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1032
def uint8 = read_u8(2, 0)
|
#void ⇒ Object
1002
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1002
def void = nil
|
#which? ⇒ Boolean
1098
|
# File 'lib/capnp/generator/schema.capnp.rb', line 1098
def which? = Which.from_integer(read_u16(0, 0))
|