ホーム › Globalization › udtitvfmt_getContext
udtitvfmt_getContext
関数日付間隔フォーマッタの表示コンテキストを取得する。
シグネチャ
// icu.dll
#include <windows.h>
UDisplayContext udtitvfmt_getContext(
const UDateIntervalFormat* formatter,
UDisplayContextType type,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| formatter | UDateIntervalFormat* | in |
| type | UDisplayContextType | in |
| status | UErrorCode* | inout |
戻り値の型: UDisplayContext
各言語での呼び出し定義
// icu.dll
#include <windows.h>
UDisplayContext udtitvfmt_getContext(
const UDateIntervalFormat* formatter,
UDisplayContextType type,
UErrorCode* status
);[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int udtitvfmt_getContext(
ref IntPtr formatter, // UDateIntervalFormat*
int type, // UDisplayContextType
ref int status // UErrorCode* in/out
);<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function udtitvfmt_getContext(
ByRef formatter As IntPtr, ' UDateIntervalFormat*
type As Integer, ' UDisplayContextType
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' formatter : UDateIntervalFormat*
' type : UDisplayContextType
' status : UErrorCode* in/out
Declare PtrSafe Function udtitvfmt_getContext Lib "icu" ( _
ByRef formatter As LongPtr, _
ByVal type As Long, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
udtitvfmt_getContext = ctypes.cdll.icu.udtitvfmt_getContext
udtitvfmt_getContext.restype = ctypes.c_int
udtitvfmt_getContext.argtypes = [
ctypes.c_void_p, # formatter : UDateIntervalFormat*
ctypes.c_int, # type : UDisplayContextType
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icu.dll')
udtitvfmt_getContext = Fiddle::Function.new(
lib['udtitvfmt_getContext'],
[
Fiddle::TYPE_VOIDP, # formatter : UDateIntervalFormat*
Fiddle::TYPE_INT, # type : UDisplayContextType
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icu")]
extern "C" {
fn udtitvfmt_getContext(
formatter: *const isize, // UDateIntervalFormat*
type: i32, // UDisplayContextType
status: *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 udtitvfmt_getContext(ref IntPtr formatter, int type, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_udtitvfmt_getContext' -Namespace Win32 -PassThru
# $api::udtitvfmt_getContext(formatter, type, status)#uselib "icu.dll"
#func global udtitvfmt_getContext "udtitvfmt_getContext" sptr, sptr, sptr
; udtitvfmt_getContext formatter, type, status ; 戻り値は stat
; formatter : UDateIntervalFormat* -> "sptr"
; type : UDisplayContextType -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icu.dll"
#cfunc global udtitvfmt_getContext "udtitvfmt_getContext" int, int, int
; res = udtitvfmt_getContext(formatter, type, status)
; formatter : UDateIntervalFormat* -> "int"
; type : UDisplayContextType -> "int"
; status : UErrorCode* in/out -> "int"; UDisplayContext udtitvfmt_getContext(UDateIntervalFormat* formatter, UDisplayContextType type, UErrorCode* status)
#uselib "icu.dll"
#cfunc global udtitvfmt_getContext "udtitvfmt_getContext" int, int, int
; res = udtitvfmt_getContext(formatter, type, status)
; formatter : UDateIntervalFormat* -> "int"
; type : UDisplayContextType -> "int"
; status : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icu = windows.NewLazySystemDLL("icu.dll")
procudtitvfmt_getContext = icu.NewProc("udtitvfmt_getContext")
)
// formatter (UDateIntervalFormat*), type (UDisplayContextType), status (UErrorCode* in/out)
r1, _, err := procudtitvfmt_getContext.Call(
uintptr(formatter),
uintptr(type),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UDisplayContextfunction udtitvfmt_getContext(
formatter: Pointer; // UDateIntervalFormat*
type: Integer; // UDisplayContextType
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icu.dll' name 'udtitvfmt_getContext';result := DllCall("icu\udtitvfmt_getContext"
, "Ptr", formatter ; UDateIntervalFormat*
, "Int", type ; UDisplayContextType
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: UDisplayContext●udtitvfmt_getContext(formatter, type, status) = DLL("icu.dll", "int udtitvfmt_getContext(void*, int, void*)")
# 呼び出し: udtitvfmt_getContext(formatter, type, status)
# formatter : UDateIntervalFormat* -> "void*"
# type : UDisplayContextType -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。