Exemple #1
0
class ArraySwitchStruct(Struct):
    array1 = array(
        one_of(
            integer(signed=False, endianness=Big, validate=lambda x: x < 0x10),
            integer(signed=False, endianness=Big,
                    validate=lambda x: x > 0x20)))
Exemple #2
0
class VariableSizeSwitchStruct(Struct):
    value = one_of(string(size=20), integer(endianness=Big))
Exemple #3
0
class ComplexSwitchStruct(Struct):
    value = one_of(embed(EmbeddedSwitchStruct1), embed(EmbeddedSwitchStruct2))
Exemple #4
0
class SwitchStruct(Struct):
    int_a = one_of(
        integer(signed=False, endianness=Big, validate=lambda x: x < 50),
        integer(signed=False, endianness=Little, validate=lambda x: x > 100))
Exemple #5
0
class EXSFile(Struct):
    objects = array_of(one_of(
        EXSHeader, EXSZone, EXSGroup, EXSSample, EXSParam))