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

ucurr_getKeywordValuesForLocale

関数
ロケールで有効な通貨キーワード値の列挙子を取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

UEnumeration* ucurr_getKeywordValuesForLocale(
    LPCSTR key,
    LPCSTR locale,
    CHAR commonlyUsed,
    UErrorCode* status
);

パラメーター

名前方向
keyLPCSTRin
localeLPCSTRin
commonlyUsedCHARin
statusUErrorCode*inout

戻り値の型: UEnumeration*

各言語での呼び出し定義

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

UEnumeration* ucurr_getKeywordValuesForLocale(
    LPCSTR key,
    LPCSTR locale,
    CHAR commonlyUsed,
    UErrorCode* status
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucurr_getKeywordValuesForLocale(
    [MarshalAs(UnmanagedType.LPStr)] string key,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string locale,   // LPCSTR
    sbyte commonlyUsed,   // CHAR
    ref int status   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucurr_getKeywordValuesForLocale(
    <MarshalAs(UnmanagedType.LPStr)> key As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> locale As String,   ' LPCSTR
    commonlyUsed As SByte,   ' CHAR
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' key : LPCSTR
' locale : LPCSTR
' commonlyUsed : CHAR
' status : UErrorCode* in/out
Declare PtrSafe Function ucurr_getKeywordValuesForLocale Lib "icuuc" ( _
    ByVal key As String, _
    ByVal locale As String, _
    ByVal commonlyUsed As Byte, _
    ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucurr_getKeywordValuesForLocale = ctypes.cdll.icuuc.ucurr_getKeywordValuesForLocale
ucurr_getKeywordValuesForLocale.restype = ctypes.c_void_p
ucurr_getKeywordValuesForLocale.argtypes = [
    wintypes.LPCSTR,  # key : LPCSTR
    wintypes.LPCSTR,  # locale : LPCSTR
    ctypes.c_byte,  # commonlyUsed : CHAR
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucurr_getKeywordValuesForLocale = icuuc.NewProc("ucurr_getKeywordValuesForLocale")
)

// key (LPCSTR), locale (LPCSTR), commonlyUsed (CHAR), status (UErrorCode* in/out)
r1, _, err := procucurr_getKeywordValuesForLocale.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(key))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
	uintptr(commonlyUsed),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UEnumeration*
function ucurr_getKeywordValuesForLocale(
  key: PAnsiChar;   // LPCSTR
  locale: PAnsiChar;   // LPCSTR
  commonlyUsed: Shortint;   // CHAR
  status: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuuc.dll' name 'ucurr_getKeywordValuesForLocale';
result := DllCall("icuuc\ucurr_getKeywordValuesForLocale"
    , "AStr", key   ; LPCSTR
    , "AStr", locale   ; LPCSTR
    , "Char", commonlyUsed   ; CHAR
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UEnumeration*
●ucurr_getKeywordValuesForLocale(key, locale, commonlyUsed, status) = DLL("icuuc.dll", "void* ucurr_getKeywordValuesForLocale(char*, char*, char, void*)")
# 呼び出し: ucurr_getKeywordValuesForLocale(key, locale, commonlyUsed, status)
# key : LPCSTR -> "char*"
# locale : LPCSTR -> "char*"
# commonlyUsed : CHAR -> "char"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。