convention.java

来自「jnative java 调用动态库需要的包和dll」· Java 代码 · 共 56 行

JAVA
56
字号
package org.xvolks.jnative;

/**
 * Represents the call convention of the function (STDCALL, CDECL)
 * $Id$
 * 
 * This software is released under the LGPL.
 * 
 * @author Created by Marc DENTY - (c) 2006 JNative project
 *
 */
public enum Convention {
	/**
	 * The callee cleans the stack
	 */
	STDCALL(0),
	/**
	 * The caller cleans the stack
	 */
	CDECL(1),
	
	;
	private final int value;
	
	static void setDefaultStyle(Convention convention) {
		DEFAULT = convention;
	}
	
	public static Convention DEFAULT = Convention.STDCALL;
	
	private Convention(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}
	
	/**
	 * 
	 * @param v
	 * @return a valid enum value (by default STDCALL)
	 */
	public static Convention fromInt(int v) {
		switch (v) {
		case 0:
			return STDCALL;
		case 1:
			return CDECL;

		default:
			return STDCALL;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?