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