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

ubrk_getLocaleByType

関数
分割イテレータのロケールを種別指定で取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

LPSTR ubrk_getLocaleByType(
    const UBreakIterator* bi,
    ULocDataLocaleType type,
    UErrorCode* status
);

パラメーター

名前方向
biUBreakIterator*in
typeULocDataLocaleTypein
statusUErrorCode*inout

戻り値の型: LPSTR

各言語での呼び出し定義

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

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

ubrk_getLocaleByType = ctypes.cdll.icuuc.ubrk_getLocaleByType
ubrk_getLocaleByType.restype = wintypes.LPSTR
ubrk_getLocaleByType.argtypes = [
    ctypes.c_void_p,  # bi : UBreakIterator*
    ctypes.c_int,  # type : ULocDataLocaleType
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ubrk_getLocaleByType = Fiddle::Function.new(
  lib['ubrk_getLocaleByType'],
  [
    Fiddle::TYPE_VOIDP,  # bi : UBreakIterator*
    Fiddle::TYPE_INT,  # type : ULocDataLocaleType
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ubrk_getLocaleByType(
        bi: *const isize,  // UBreakIterator*
        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 ubrk_getLocaleByType(ref IntPtr bi, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ubrk_getLocaleByType' -Namespace Win32 -PassThru
# $api::ubrk_getLocaleByType(bi, type, status)
#uselib "icuuc.dll"
#func global ubrk_getLocaleByType "ubrk_getLocaleByType" sptr, sptr, sptr
; ubrk_getLocaleByType bi, type, status   ; 戻り値は stat
; bi : UBreakIterator* -> "sptr"
; type : ULocDataLocaleType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuuc.dll"
#cfunc global ubrk_getLocaleByType "ubrk_getLocaleByType" int, int, int
; res = ubrk_getLocaleByType(bi, type, status)
; bi : UBreakIterator* -> "int"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"
; LPSTR ubrk_getLocaleByType(UBreakIterator* bi, ULocDataLocaleType type, UErrorCode* status)
#uselib "icuuc.dll"
#cfunc global ubrk_getLocaleByType "ubrk_getLocaleByType" int, int, int
; res = ubrk_getLocaleByType(bi, type, status)
; bi : UBreakIterator* -> "int"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procubrk_getLocaleByType = icuuc.NewProc("ubrk_getLocaleByType")
)

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