ホーム › Globalization › udat_getLocaleByType
udat_getLocaleByType
関数日付書式に関連するロケール名を種別指定で取得する。
シグネチャ
// icuin.dll
#include <windows.h>
LPSTR udat_getLocaleByType(
const void** fmt,
ULocDataLocaleType type,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| fmt | void** | in |
| type | ULocDataLocaleType | in |
| status | UErrorCode* | inout |
戻り値の型: LPSTR
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
LPSTR udat_getLocaleByType(
const void** fmt,
ULocDataLocaleType type,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr udat_getLocaleByType(
IntPtr fmt, // void**
int type, // ULocDataLocaleType
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function udat_getLocaleByType(
fmt As IntPtr, ' void**
type As Integer, ' ULocDataLocaleType
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' fmt : void**
' type : ULocDataLocaleType
' status : UErrorCode* in/out
Declare PtrSafe Function udat_getLocaleByType Lib "icuin" ( _
ByVal fmt 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
udat_getLocaleByType = ctypes.cdll.icuin.udat_getLocaleByType
udat_getLocaleByType.restype = wintypes.LPSTR
udat_getLocaleByType.argtypes = [
ctypes.c_void_p, # fmt : void**
ctypes.c_int, # type : ULocDataLocaleType
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
udat_getLocaleByType = Fiddle::Function.new(
lib['udat_getLocaleByType'],
[
Fiddle::TYPE_VOIDP, # fmt : void**
Fiddle::TYPE_INT, # type : ULocDataLocaleType
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn udat_getLocaleByType(
fmt: *const *const (), // void**
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 udat_getLocaleByType(IntPtr fmt, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udat_getLocaleByType' -Namespace Win32 -PassThru
# $api::udat_getLocaleByType(fmt, type, status)#uselib "icuin.dll"
#func global udat_getLocaleByType "udat_getLocaleByType" sptr, sptr, sptr
; udat_getLocaleByType fmt, type, status ; 戻り値は stat
; fmt : void** -> "sptr"
; type : ULocDataLocaleType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuin.dll"
#cfunc global udat_getLocaleByType "udat_getLocaleByType" sptr, int, int
; res = udat_getLocaleByType(fmt, type, status)
; fmt : void** -> "sptr"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"; LPSTR udat_getLocaleByType(void** fmt, ULocDataLocaleType type, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global udat_getLocaleByType "udat_getLocaleByType" intptr, int, int
; res = udat_getLocaleByType(fmt, type, status)
; fmt : void** -> "intptr"
; type : ULocDataLocaleType -> "int"
; status : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procudat_getLocaleByType = icuin.NewProc("udat_getLocaleByType")
)
// fmt (void**), type (ULocDataLocaleType), status (UErrorCode* in/out)
r1, _, err := procudat_getLocaleByType.Call(
uintptr(fmt),
uintptr(type),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPSTRfunction udat_getLocaleByType(
fmt: Pointer; // void**
type: Integer; // ULocDataLocaleType
status: Pointer // UErrorCode* in/out
): PAnsiChar; cdecl;
external 'icuin.dll' name 'udat_getLocaleByType';result := DllCall("icuin\udat_getLocaleByType"
, "Ptr", fmt ; void**
, "Int", type ; ULocDataLocaleType
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: LPSTR●udat_getLocaleByType(fmt, type, status) = DLL("icuin.dll", "char* udat_getLocaleByType(void*, int, void*)")
# 呼び出し: udat_getLocaleByType(fmt, type, status)
# fmt : void** -> "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`,…) を使用。