ホーム › Globalization › ures_getLocaleByType
ures_getLocaleByType
関数リソースバンドルのロケールを種別指定で取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
LPSTR ures_getLocaleByType(
const UResourceBundle* resourceBundle,
ULocDataLocaleType type,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| resourceBundle | UResourceBundle* | in |
| type | ULocDataLocaleType | in |
| status | UErrorCode* | inout |
戻り値の型: LPSTR
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
LPSTR ures_getLocaleByType(
const UResourceBundle* resourceBundle,
ULocDataLocaleType type,
UErrorCode* status
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ures_getLocaleByType(
ref IntPtr resourceBundle, // UResourceBundle*
int type, // ULocDataLocaleType
ref int status // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ures_getLocaleByType(
ByRef resourceBundle As IntPtr, ' UResourceBundle*
type As Integer, ' ULocDataLocaleType
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' resourceBundle : UResourceBundle*
' type : ULocDataLocaleType
' status : UErrorCode* in/out
Declare PtrSafe Function ures_getLocaleByType Lib "icuuc" ( _
ByRef resourceBundle As LongPtr, _
ByVal type As Long, _
ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ures_getLocaleByType = ctypes.cdll.icuuc.ures_getLocaleByType
ures_getLocaleByType.restype = wintypes.LPSTR
ures_getLocaleByType.argtypes = [
ctypes.c_void_p, # resourceBundle : UResourceBundle*
ctypes.c_int, # type : ULocDataLocaleType
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ures_getLocaleByType = Fiddle::Function.new(
lib['ures_getLocaleByType'],
[
Fiddle::TYPE_VOIDP, # resourceBundle : UResourceBundle*
Fiddle::TYPE_INT, # type : ULocDataLocaleType
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ures_getLocaleByType(
resourceBundle: *const isize, // UResourceBundle*
type: i32, // ULocDataLocaleType
status: *mut i32 // UErrorCode* in/out
) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ures_getLocaleByType(ref IntPtr resourceBundle, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ures_getLocaleByType' -Namespace Win32 -PassThru
# $api::ures_getLocaleByType(resourceBundle, type, status)#uselib "icuuc.dll"
#func global ures_getLocaleByType "ures_getLocaleByType" sptr, sptr, sptr
; ures_getLocaleByType resourceBundle, type, status ; 戻り値は stat
; resourceBundle : UResourceBundle* -> "sptr"
; type : ULocDataLocaleType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global ures_getLocaleByType "ures_getLocaleByType" int, int, int
; res = ures_getLocaleByType(resourceBundle, type, status)
; resourceBundle : UResourceBundle* -> "int"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"; LPSTR ures_getLocaleByType(UResourceBundle* resourceBundle, ULocDataLocaleType type, UErrorCode* status)
#uselib "icuuc.dll"
#cfunc global ures_getLocaleByType "ures_getLocaleByType" int, int, int
; res = ures_getLocaleByType(resourceBundle, type, status)
; resourceBundle : UResourceBundle* -> "int"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procures_getLocaleByType = icuuc.NewProc("ures_getLocaleByType")
)
// resourceBundle (UResourceBundle*), type (ULocDataLocaleType), status (UErrorCode* in/out)
r1, _, err := procures_getLocaleByType.Call(
uintptr(resourceBundle),
uintptr(type),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPSTRfunction ures_getLocaleByType(
resourceBundle: Pointer; // UResourceBundle*
type: Integer; // ULocDataLocaleType
status: Pointer // UErrorCode* in/out
): PAnsiChar; cdecl;
external 'icuuc.dll' name 'ures_getLocaleByType';result := DllCall("icuuc\ures_getLocaleByType"
, "Ptr", resourceBundle ; UResourceBundle*
, "Int", type ; ULocDataLocaleType
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: LPSTR●ures_getLocaleByType(resourceBundle, type, status) = DLL("icuuc.dll", "char* ures_getLocaleByType(void*, int, void*)")
# 呼び出し: ures_getLocaleByType(resourceBundle, type, status)
# resourceBundle : UResourceBundle* -> "void*"
# type : ULocDataLocaleType -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。