/* eslint-disable prefer-const */'use strict'const prototest = require('../proto/test')console.log(new prototest.StructSimple() + '\n')console.log(new prototest.StructOptional() + '\n')console.log(new prototest.StructNested() + '\n')// Print bytes structlet structBytes = new prototest.StructBytes()// noinspection JSUnresolvedFunctionstructBytes.f1 = Uint8Array.from('ABC', x => x.charCodeAt(0))// noinspection JSUnresolvedFunctionstructBytes.f2 = Uint8Array.from('test', x => x.charCodeAt(0))console.log(structBytes + '\n')// Print array structlet structArray = new prototest.StructArray()structArray.f1[0] = 48structArray.f1[1] = 65structArray.f2[0] = 97structArray.f2[1] = undefinedstructArray.f3[0] = Array.from('000', x => x.charCodeAt(0))structArray.f3[1] = Array.from('AAA', x => x.charCodeAt(0))structArray.f4[0] = Array.from('aaa', x => x.charCodeAt(0))structArray.f4[1] = undefinedstructArray.f5[0] = prototest.EnumSimple.ENUM_VALUE_1structArray.f5[1] = prototest.EnumSimple.ENUM_VALUE_2structArray.f6[0] = prototest.EnumSimple.ENUM_VALUE_1structArray.f6[1] = undefinedstructArray.f7[0] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2)structArray.f7[1] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2 | prototest.FlagsSimple.FLAG_VALUE_3)structArray.f8[0] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2)structArray.f8[1] = undefinedstructArray.f9[0] = new prototest.StructSimple()structArray.f9[1] = new prototest.StructSimple()structArray.f10[0] = new prototest.StructSimple()structArray.f10[1] = undefinedconsole.log(structArray + '\n')// Print vector structlet structVector = new prototest.StructVector()structVector.f1[0] = 48structVector.f1[1] = 65structVector.f2[0] = 97structVector.f2[1] = undefinedstructVector.f3[0] = Array.from('000', x => x.charCodeAt(0))structVector.f3[1] = Array.from('AAA', x => x.charCodeAt(0))structVector.f4[0] = Array.from('aaa', x => x.charCodeAt(0))structVector.f4[1] = undefinedstructVector.f5[0] = prototest.EnumSimple.ENUM_VALUE_1structVector.f5[1] = prototest.EnumSimple.ENUM_VALUE_2structVector.f6[0] = prototest.EnumSimple.ENUM_VALUE_1structVector.f6[1] = undefinedstructVector.f7[0] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2)structVector.f7[1] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2 | prototest.FlagsSimple.FLAG_VALUE_3)structVector.f8[0] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2)structVector.f8[1] = undefinedstructVector.f9[0] = new prototest.StructSimple()structVector.f9[1] = new prototest.StructSimple()structVector.f10[0] = new prototest.StructSimple()structVector.f10[1] = undefinedconsole.log(structVector + '\n')// Print list structlet structList = new prototest.StructList()structList.f1[0] = 48structList.f1[1] = 65structList.f2[0] = 97structList.f2[1] = undefinedstructList.f3[0] = Array.from('000', x => x.charCodeAt(0))structList.f3[1] = Array.from('AAA', x => x.charCodeAt(0))structList.f4[0] = Array.from('aaa', x => x.charCodeAt(0))structList.f4[1] = undefinedstructList.f5[0] = prototest.EnumSimple.ENUM_VALUE_1structList.f5[1] = prototest.EnumSimple.ENUM_VALUE_2structList.f6[0] = prototest.EnumSimple.ENUM_VALUE_1structList.f6[1] = undefinedstructList.f7[0] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2)structList.f7[1] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2 | prototest.FlagsSimple.FLAG_VALUE_3)structList.f8[0] = prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2)structList.f8[1] = undefinedstructList.f9[0] = new prototest.StructSimple()structList.f9[1] = new prototest.StructSimple()structList.f10[0] = new prototest.StructSimple()structList.f10[1] = undefinedconsole.log(structList + '\n')// Print set structlet structSet = new prototest.StructSet()structSet.f1.add(48)structSet.f1.add(65)structSet.f1.add(97)structSet.f2.add(prototest.EnumSimple.ENUM_VALUE_1)structSet.f2.add(prototest.EnumSimple.ENUM_VALUE_2)structSet.f3.add(prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2))structSet.f3.add(prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2 | prototest.FlagsSimple.FLAG_VALUE_3))let s1 = new prototest.StructSimple()s1.id = 48structSet.f4.add(s1)let s2 = new prototest.StructSimple()s2.id = 65structSet.f4.add(s2)console.log(structSet + '\n')// Print map structlet structMap = new prototest.StructMap()structMap.f1.set(10, 48)structMap.f1.set(20, 65)structMap.f2.set(10, 97)structMap.f2.set(20, undefined)structMap.f3.set(10, Array.from('000', x => x.charCodeAt(0)))structMap.f3.set(20, Array.from('AAA', x => x.charCodeAt(0)))structMap.f4.set(10, Array.from('aaa', x => x.charCodeAt(0)))structMap.f4.set(20, undefined)structMap.f5.set(10, prototest.EnumSimple.ENUM_VALUE_1)structMap.f5.set(20, prototest.EnumSimple.ENUM_VALUE_2)structMap.f6.set(10, prototest.EnumSimple.ENUM_VALUE_1)structMap.f6.set(20, undefined)structMap.f7.set(10, prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2))structMap.f7.set(20, prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2 | prototest.FlagsSimple.FLAG_VALUE_3))structMap.f8.set(10, prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2))structMap.f8.set(20, undefined)s1.id = 48structMap.f9.set(10, s1)s2.id = 65structMap.f9.set(20, s2)structMap.f10.set(10, s1)structMap.f10.set(20, undefined)console.log(structMap + '\n')// Print hash structlet structHash = new prototest.StructHash()structHash.f1.set('10', 48)structHash.f1.set('20', 65)structHash.f2.set('10', 97)structHash.f2.set('20', undefined)structHash.f3.set('10', Array.from('000', x => x.charCodeAt(0)))structHash.f3.set('20', Array.from('AAA', x => x.charCodeAt(0)))structHash.f4.set('10', Array.from('aaa', x => x.charCodeAt(0)))structHash.f4.set('20', undefined)structHash.f5.set('10', prototest.EnumSimple.ENUM_VALUE_1)structHash.f5.set('20', prototest.EnumSimple.ENUM_VALUE_2)structHash.f6.set('10', prototest.EnumSimple.ENUM_VALUE_1)structHash.f6.set('20', undefined)structHash.f7.set('10', prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2))structHash.f7.set('20', prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2 | prototest.FlagsSimple.FLAG_VALUE_3))structHash.f8.set('10', prototest.FlagsSimple.fromFlags(prototest.FlagsSimple.FLAG_VALUE_1 | prototest.FlagsSimple.FLAG_VALUE_2))structHash.f8.set('20', undefined)s1.id = 48structHash.f9.set('10', s1)s2.id = 65structHash.f9.set('20', s2)structHash.f10.set('10', s1)structHash.f10.set('20', undefined)console.log(structHash + '\n')// Print extended hash structlet structHashEx = new prototest.StructHashEx()s1.id = 48structHashEx.f1.set(s1, new prototest.StructNested())s2.id = 65structHashEx.f1.set(s2, new prototest.StructNested())structHashEx.f2.set(s1, new prototest.StructNested())structHashEx.f2.set(s2, undefined)console.log(structHashEx + '\n')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。