ホーム › Globalization › ucurr_getName
ucurr_getName
関数指定通貨の表示名や記号を取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
WORD* ucurr_getName(
const WORD* currency,
LPCSTR locale,
UCurrNameStyle nameStyle,
CHAR* isChoiceFormat,
INT* len,
UErrorCode* ec
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| currency | WORD* | in |
| locale | LPCSTR | in |
| nameStyle | UCurrNameStyle | in |
| isChoiceFormat | CHAR* | inout |
| len | INT* | inout |
| ec | UErrorCode* | inout |
戻り値の型: WORD*
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
WORD* ucurr_getName(
const WORD* currency,
LPCSTR locale,
UCurrNameStyle nameStyle,
CHAR* isChoiceFormat,
INT* len,
UErrorCode* ec
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucurr_getName(
ref ushort currency, // WORD*
[MarshalAs(UnmanagedType.LPStr)] string locale, // LPCSTR
int nameStyle, // UCurrNameStyle
IntPtr isChoiceFormat, // CHAR* in/out
ref int len, // INT* in/out
ref int ec // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucurr_getName(
ByRef currency As UShort, ' WORD*
<MarshalAs(UnmanagedType.LPStr)> locale As String, ' LPCSTR
nameStyle As Integer, ' UCurrNameStyle
isChoiceFormat As IntPtr, ' CHAR* in/out
ByRef len As Integer, ' INT* in/out
ByRef ec As Integer ' UErrorCode* in/out
) As IntPtr
End Function' currency : WORD*
' locale : LPCSTR
' nameStyle : UCurrNameStyle
' isChoiceFormat : CHAR* in/out
' len : INT* in/out
' ec : UErrorCode* in/out
Declare PtrSafe Function ucurr_getName Lib "icuuc" ( _
ByRef currency As Integer, _
ByVal locale As String, _
ByVal nameStyle As Long, _
ByVal isChoiceFormat As LongPtr, _
ByRef len As Long, _
ByRef ec As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucurr_getName = ctypes.cdll.icuuc.ucurr_getName
ucurr_getName.restype = ctypes.c_void_p
ucurr_getName.argtypes = [
ctypes.POINTER(ctypes.c_ushort), # currency : WORD*
wintypes.LPCSTR, # locale : LPCSTR
ctypes.c_int, # nameStyle : UCurrNameStyle
ctypes.POINTER(ctypes.c_byte), # isChoiceFormat : CHAR* in/out
ctypes.POINTER(ctypes.c_int), # len : INT* in/out
ctypes.c_void_p, # ec : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucurr_getName = Fiddle::Function.new(
lib['ucurr_getName'],
[
Fiddle::TYPE_VOIDP, # currency : WORD*
Fiddle::TYPE_VOIDP, # locale : LPCSTR
Fiddle::TYPE_INT, # nameStyle : UCurrNameStyle
Fiddle::TYPE_VOIDP, # isChoiceFormat : CHAR* in/out
Fiddle::TYPE_VOIDP, # len : INT* in/out
Fiddle::TYPE_VOIDP, # ec : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucurr_getName(
currency: *const u16, // WORD*
locale: *const u8, // LPCSTR
nameStyle: i32, // UCurrNameStyle
isChoiceFormat: *mut i8, // CHAR* in/out
len: *mut i32, // INT* in/out
ec: *mut i32 // UErrorCode* in/out
) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ucurr_getName(ref ushort currency, [MarshalAs(UnmanagedType.LPStr)] string locale, int nameStyle, IntPtr isChoiceFormat, ref int len, ref int ec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucurr_getName' -Namespace Win32 -PassThru
# $api::ucurr_getName(currency, locale, nameStyle, isChoiceFormat, len, ec)#uselib "icuuc.dll"
#func global ucurr_getName "ucurr_getName" sptr, sptr, sptr, sptr, sptr, sptr
; ucurr_getName varptr(currency), locale, nameStyle, varptr(isChoiceFormat), varptr(len), ec ; 戻り値は stat
; currency : WORD* -> "sptr"
; locale : LPCSTR -> "sptr"
; nameStyle : UCurrNameStyle -> "sptr"
; isChoiceFormat : CHAR* in/out -> "sptr"
; len : INT* in/out -> "sptr"
; ec : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global ucurr_getName "ucurr_getName" var, str, int, var, var, int ; res = ucurr_getName(currency, locale, nameStyle, isChoiceFormat, len, ec) ; currency : WORD* -> "var" ; locale : LPCSTR -> "str" ; nameStyle : UCurrNameStyle -> "int" ; isChoiceFormat : CHAR* in/out -> "var" ; len : INT* in/out -> "var" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global ucurr_getName "ucurr_getName" sptr, str, int, sptr, sptr, int ; res = ucurr_getName(varptr(currency), locale, nameStyle, varptr(isChoiceFormat), varptr(len), ec) ; currency : WORD* -> "sptr" ; locale : LPCSTR -> "str" ; nameStyle : UCurrNameStyle -> "int" ; isChoiceFormat : CHAR* in/out -> "sptr" ; len : INT* in/out -> "sptr" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; WORD* ucurr_getName(WORD* currency, LPCSTR locale, UCurrNameStyle nameStyle, CHAR* isChoiceFormat, INT* len, UErrorCode* ec) #uselib "icuuc.dll" #cfunc global ucurr_getName "ucurr_getName" var, str, int, var, var, int ; res = ucurr_getName(currency, locale, nameStyle, isChoiceFormat, len, ec) ; currency : WORD* -> "var" ; locale : LPCSTR -> "str" ; nameStyle : UCurrNameStyle -> "int" ; isChoiceFormat : CHAR* in/out -> "var" ; len : INT* in/out -> "var" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; WORD* ucurr_getName(WORD* currency, LPCSTR locale, UCurrNameStyle nameStyle, CHAR* isChoiceFormat, INT* len, UErrorCode* ec) #uselib "icuuc.dll" #cfunc global ucurr_getName "ucurr_getName" intptr, str, int, intptr, intptr, int ; res = ucurr_getName(varptr(currency), locale, nameStyle, varptr(isChoiceFormat), varptr(len), ec) ; currency : WORD* -> "intptr" ; locale : LPCSTR -> "str" ; nameStyle : UCurrNameStyle -> "int" ; isChoiceFormat : CHAR* in/out -> "intptr" ; len : INT* in/out -> "intptr" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucurr_getName = icuuc.NewProc("ucurr_getName")
)
// currency (WORD*), locale (LPCSTR), nameStyle (UCurrNameStyle), isChoiceFormat (CHAR* in/out), len (INT* in/out), ec (UErrorCode* in/out)
r1, _, err := procucurr_getName.Call(
uintptr(currency),
uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
uintptr(nameStyle),
uintptr(isChoiceFormat),
uintptr(len),
uintptr(ec),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WORD*function ucurr_getName(
currency: Pointer; // WORD*
locale: PAnsiChar; // LPCSTR
nameStyle: Integer; // UCurrNameStyle
isChoiceFormat: Pointer; // CHAR* in/out
len: Pointer; // INT* in/out
ec: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuuc.dll' name 'ucurr_getName';result := DllCall("icuuc\ucurr_getName"
, "Ptr", currency ; WORD*
, "AStr", locale ; LPCSTR
, "Int", nameStyle ; UCurrNameStyle
, "Ptr", isChoiceFormat ; CHAR* in/out
, "Ptr", len ; INT* in/out
, "Ptr", ec ; UErrorCode* in/out
, "Cdecl Ptr") ; return: WORD*●ucurr_getName(currency, locale, nameStyle, isChoiceFormat, len, ec) = DLL("icuuc.dll", "void* ucurr_getName(void*, char*, int, void*, void*, void*)")
# 呼び出し: ucurr_getName(currency, locale, nameStyle, isChoiceFormat, len, ec)
# currency : WORD* -> "void*"
# locale : LPCSTR -> "char*"
# nameStyle : UCurrNameStyle -> "int"
# isChoiceFormat : CHAR* in/out -> "void*"
# len : INT* in/out -> "void*"
# ec : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。