Package com.sun.jna

Examples of com.sun.jna.Structure$ByValue


            if(ppc) {
                // on ppc32 structs never return in registers
                return objc_msgSend_stret_Pair;
            }
            // on i386 structs with sizeof exactly equal to 1, 2, 4, or 8 return in registers
            Structure prototype = (Structure) returnTypeForThisCall.newInstance();
            return prototype.size() < stretCutoff ? objc_msgSend_Pair : objc_msgSend_stret_Pair;
        }
        catch(InstantiationException e) {
            throw new RococoaException(e);
        }
        catch(IllegalAccessException e) {
View Full Code Here


    }
   
    private Structure readStructureByValue(NSInvocation invocation, int index,
            Class<? extends Structure> type)
    {
        Structure result = newInstance(type);
        Memory buffer = new Memory(result.size());
        invocation.getArgument_atIndex(buffer, index);
        return copyBufferToStructure(buffer, result);
    }
View Full Code Here

            Class<? extends Structure> type)
    {
        Memory buffer = new Memory(Native.POINTER_SIZE);
        invocation.getArgument_atIndex(buffer, index);
        Pointer pointerToResult = buffer.getPointer(0);
        Structure result = newInstance(type);       
        return copyBufferToStructure(pointerToResult, result);
    }
View Full Code Here

    public static void main(String[] args) {
        junit.textui.TestRunner.run(Shell32Test.class);
    }

    public void testStructurePacking() {
        Structure s = new ShellAPI.SHFILEOPSTRUCT();
        final int SIZE = Pointer.SIZE * 5 + 10; // 5 pointers, 2 ints, 1 short
        assertEquals("Wrong structure size", SIZE, s.size());
    }
View Full Code Here

            if(ppc) {
                // on ppc32 structs never return in registers
                return objc_msgSend_stret_Pair;
            }
            // on i386 structs with sizeof exactly equal to 1, 2, 4, or 8 return in registers
            Structure prototype = (Structure) returnTypeForThisCall.newInstance();
            return prototype.size() < stretCutoff ? objc_msgSend_Pair : objc_msgSend_stret_Pair;
        }
        catch(InstantiationException e) {
            throw new RococoaException(e);
        }
        catch(IllegalAccessException e) {
View Full Code Here

    }
   
    private Structure readStructureByValue(NSInvocation invocation, int index,
            Class<? extends Structure> type)
    {
        Structure result = newInstance(type);
        Memory buffer = new Memory(result.size());
        invocation.getArgument_atIndex(buffer, index);
        return copyBufferToStructure(buffer, result);
    }
View Full Code Here

            Class<? extends Structure> type)
    {
        Memory buffer = new Memory(Native.POINTER_SIZE);
        invocation.getArgument_atIndex(buffer, index);
        Pointer pointerToResult = buffer.getPointer(0);
        Structure result = newInstance(type);       
        return copyBufferToStructure(pointerToResult, result);
    }
View Full Code Here

import com.sun.jna.Structure;
import junit.framework.TestCase;

public class Shell32Test extends TestCase {
    public void testStructurePacking() {
        Structure s = new Shell32.SHFILEOPSTRUCT();
        assertEquals("Wrong structure size", 30, s.size());
    }
View Full Code Here

            case kEdsDataType_Point: //EdsPoint
            case kEdsDataType_Rect: //EdsRect
            case kEdsDataType_Time: //EdsTime
            case kEdsDataType_FocusInfo: //EdsFocusInfo
            case kEdsDataType_PictureStyleDesc: { //EdsPictureStyleDesc
                final Structure structure = (Structure) value;
                structure.write();
                pointer = structure.getPointer();
                size = structure.size();
                break;
            }
            case kEdsDataType_Int8_Array: //EdsInt8[]
            case kEdsDataType_UInt8_Array: { //EdsUInt8[]
                final byte[] array = (byte[]) value;
View Full Code Here

    public static void main(String[] args) {
        junit.textui.TestRunner.run(Shell32Test.class);
    }

    public void testStructurePacking() {
        Structure s = new Shell32.SHFILEOPSTRUCT();
        final int SIZE = Pointer.SIZE * 5 + 10; // 5 pointers, 2 ints, 1 short
        assertEquals("Wrong structure size", SIZE, s.size());
    }
View Full Code Here

TOP

Related Classes of com.sun.jna.Structure$ByValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.