Win32 API 日本語リファレンス
ホームGlobalization › ucol_getLocaleByType

ucol_getLocaleByType

関数
コレータのロケールを種別指定で取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

// icuin.dll
#include <windows.h>

LPSTR ucol_getLocaleByType(
    const UCollator* coll,
    ULocDataLocaleType type,
    UErrorCode* status
);

パラメーター

名前方向
collUCollator*in
typeULocDataLocaleTypein
statusUErrorCode*inout

戻り値の型: LPSTR

各言語での呼び出し定義

// icuin.dll
#include <windows.h>

LPSTR ucol_getLocaleByType(
    const UCollator* coll,
    ULocDataLocaleType type,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucol_getLocaleByType(
    ref IntPtr coll,   // UCollator*
    int type,   // ULocDataLocaleType
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_getLocaleByType(
    ByRef coll As IntPtr,   ' UCollator*
    type As Integer,   ' ULocDataLocaleType
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' coll : UCollator*
' type : ULocDataLocaleType
' status : UErrorCode* in/out
Declare PtrSafe Function ucol_getLocaleByType Lib "icuin" ( _
    ByRef coll 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

ucol_getLocaleByType = ctypes.cdll.icuin.ucol_getLocaleByType
ucol_getLocaleByType.restype = wintypes.LPSTR
ucol_getLocaleByType.argtypes = [
    ctypes.c_void_p,  # coll : UCollator*
    ctypes.c_int,  # type : ULocDataLocaleType
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
ucol_getLocaleByType = Fiddle::Function.new(
  lib['ucol_getLocaleByType'],
  [
    Fiddle::TYPE_VOIDP,  # coll : UCollator*
    Fiddle::TYPE_INT,  # type : ULocDataLocaleType
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn ucol_getLocaleByType(
        coll: *const isize,  // UCollator*
        type: i32,  // ULocDataLocaleType
        status: *mut i32  // UErrorCode* in/out
    ) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ucol_getLocaleByType(ref IntPtr coll, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_getLocaleByType' -Namespace Win32 -PassThru
# $api::ucol_getLocaleByType(coll, type, status)
#uselib "icuin.dll"
#func global ucol_getLocaleByType "ucol_getLocaleByType" sptr, sptr, sptr
; ucol_getLocaleByType coll, type, status   ; 戻り値は stat
; coll : UCollator* -> "sptr"
; type : ULocDataLocaleType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuin.dll"
#cfunc global ucol_getLocaleByType "ucol_getLocaleByType" int, int, int
; res = ucol_getLocaleByType(coll, type, status)
; coll : UCollator* -> "int"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"
; LPSTR ucol_getLocaleByType(UCollator* coll, ULocDataLocaleType type, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global ucol_getLocaleByType "ucol_getLocaleByType" int, int, int
; res = ucol_getLocaleByType(coll, type, status)
; coll : UCollator* -> "int"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucol_getLocaleByType = icuin.NewProc("ucol_getLocaleByType")
)

// coll (UCollator*), type (ULocDataLocaleType), status (UErrorCode* in/out)
r1, _, err := procucol_getLocaleByType.Call(
	uintptr(coll),
	uintptr(type),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // LPSTR
function ucol_getLocaleByType(
  coll: Pointer;   // UCollator*
  type: Integer;   // ULocDataLocaleType
  status: Pointer   // UErrorCode* in/out
): PAnsiChar; cdecl;
  external 'icuin.dll' name 'ucol_getLocaleByType';
result := DllCall("icuin\ucol_getLocaleByType"
    , "Ptr", coll   ; UCollator*
    , "Int", type   ; ULocDataLocaleType
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: LPSTR
●ucol_getLocaleByType(coll, type, status) = DLL("icuin.dll", "char* ucol_getLocaleByType(void*, int, void*)")
# 呼び出し: ucol_getLocaleByType(coll, type, status)
# coll : UCollator* -> "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`,…) を使用。