Example #1
0
void Struct_Class::writeStruct(DataWriter &data) const
{
    data.putAddress(constantPoolTable, "constantPoolTable");
    data.putAddress(fieldPoolTable, "fieldPoolTable");
    data.putAddress(methodPoolTable, "methodPoolTable");

    data.put16(inheritedStaticDataSize + ownStaticDataSize, "staticDataSize");
    data.put16(inheritedInstanceDataSize + ownInstanceDataSize, "instanceDataSize");
    data.put16(staticDataHandle, "staticDataHandle");
    data.pad16();
}
void Struct_Method::writeStruct(DataWriter &data) const
{
    if (!exceptionHandlers.isEmpty())
    {
        data.putAddress(exceptionHandlerTable, "exceptionHandlerTable");
        data.put16(offsetHandlers, "offsetHandlers");
        data.put16(lengthHandlers, "lengthHandlers");
    }
    else
    {
        data.putAddress(0, "exceptionHandlerTable");
        data.put16(0, "offsetHandlers");
        data.put16(0, "lengthHandlers");
    }

    if (!exceptions.isEmpty())
    {
        data.putAddress(exceptionsTable, "exceptionsTable");
        data.put16(offsetExceptions, "offsetExceptions");
        data.put16(lengthExceptions, "lengthExceptions");
    }
    else
    {
        data.putAddress(0, "exceptionsTable");
        data.put16(0, "offsetExceptions");
        data.put16(0, "lengthExceptions");
    }

    data.put16(accessFlags, "accessFlags");
    data.put16(nameIndex, "nameIndex");
    data.put16(descriptorIndex, "descriptorIndex");
    data.put16(maxStacks, "maxStacks");
    data.put16(maxLocals, "maxLocals");

    if (nativeFunction != NULL)
    {
        data.put16(nativeFunction->id, "nativeFunctionId");
    }
    else
    {
        data.put16(code.length(), "codeLength");
        data.putBytes(code, "code");
    }

    data.put8(parameterTypes.length(), "parameterTypesLength");
    data.putBytes(parameterTypes, "parameterTypes");
}
void Struct_CP_Table::writeStruct(DataWriter &data) const
{
    data.put16(constants.size(), "size");
    data.pad16();

    foreach (QSharedPointer<Struct_CP> cp, constants)
        data.putAddress(cp, "constant");
}