ホーム › Globalization › ufmtval_getString
ufmtval_getString
関数整形済み値の文字列表現を取得する。
シグネチャ
// icu.dll
#include <windows.h>
WORD* ufmtval_getString(
const UFormattedValue* ufmtval,
INT* pLength,
UErrorCode* ec
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ufmtval | UFormattedValue* | in |
| pLength | INT* | inout |
| ec | UErrorCode* | inout |
戻り値の型: WORD*
各言語での呼び出し定義
// icu.dll
#include <windows.h>
WORD* ufmtval_getString(
const UFormattedValue* ufmtval,
INT* pLength,
UErrorCode* ec
);[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ufmtval_getString(
ref IntPtr ufmtval, // UFormattedValue*
ref int pLength, // INT* in/out
ref int ec // UErrorCode* in/out
);<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ufmtval_getString(
ByRef ufmtval As IntPtr, ' UFormattedValue*
ByRef pLength As Integer, ' INT* in/out
ByRef ec As Integer ' UErrorCode* in/out
) As IntPtr
End Function' ufmtval : UFormattedValue*
' pLength : INT* in/out
' ec : UErrorCode* in/out
Declare PtrSafe Function ufmtval_getString Lib "icu" ( _
ByRef ufmtval As LongPtr, _
ByRef pLength 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
ufmtval_getString = ctypes.cdll.icu.ufmtval_getString
ufmtval_getString.restype = ctypes.c_void_p
ufmtval_getString.argtypes = [
ctypes.c_void_p, # ufmtval : UFormattedValue*
ctypes.POINTER(ctypes.c_int), # pLength : INT* in/out
ctypes.c_void_p, # ec : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icu.dll')
ufmtval_getString = Fiddle::Function.new(
lib['ufmtval_getString'],
[
Fiddle::TYPE_VOIDP, # ufmtval : UFormattedValue*
Fiddle::TYPE_VOIDP, # pLength : INT* in/out
Fiddle::TYPE_VOIDP, # ec : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icu")]
extern "C" {
fn ufmtval_getString(
ufmtval: *const isize, // UFormattedValue*
pLength: *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("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ufmtval_getString(ref IntPtr ufmtval, ref int pLength, ref int ec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_ufmtval_getString' -Namespace Win32 -PassThru
# $api::ufmtval_getString(ufmtval, pLength, ec)#uselib "icu.dll"
#func global ufmtval_getString "ufmtval_getString" sptr, sptr, sptr
; ufmtval_getString ufmtval, varptr(pLength), ec ; 戻り値は stat
; ufmtval : UFormattedValue* -> "sptr"
; pLength : INT* in/out -> "sptr"
; ec : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icu.dll" #cfunc global ufmtval_getString "ufmtval_getString" int, var, int ; res = ufmtval_getString(ufmtval, pLength, ec) ; ufmtval : UFormattedValue* -> "int" ; pLength : INT* in/out -> "var" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icu.dll" #cfunc global ufmtval_getString "ufmtval_getString" int, sptr, int ; res = ufmtval_getString(ufmtval, varptr(pLength), ec) ; ufmtval : UFormattedValue* -> "int" ; pLength : INT* in/out -> "sptr" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; WORD* ufmtval_getString(UFormattedValue* ufmtval, INT* pLength, UErrorCode* ec) #uselib "icu.dll" #cfunc global ufmtval_getString "ufmtval_getString" int, var, int ; res = ufmtval_getString(ufmtval, pLength, ec) ; ufmtval : UFormattedValue* -> "int" ; pLength : INT* in/out -> "var" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; WORD* ufmtval_getString(UFormattedValue* ufmtval, INT* pLength, UErrorCode* ec) #uselib "icu.dll" #cfunc global ufmtval_getString "ufmtval_getString" int, intptr, int ; res = ufmtval_getString(ufmtval, varptr(pLength), ec) ; ufmtval : UFormattedValue* -> "int" ; pLength : INT* in/out -> "intptr" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icu = windows.NewLazySystemDLL("icu.dll")
procufmtval_getString = icu.NewProc("ufmtval_getString")
)
// ufmtval (UFormattedValue*), pLength (INT* in/out), ec (UErrorCode* in/out)
r1, _, err := procufmtval_getString.Call(
uintptr(ufmtval),
uintptr(pLength),
uintptr(ec),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WORD*function ufmtval_getString(
ufmtval: Pointer; // UFormattedValue*
pLength: Pointer; // INT* in/out
ec: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icu.dll' name 'ufmtval_getString';result := DllCall("icu\ufmtval_getString"
, "Ptr", ufmtval ; UFormattedValue*
, "Ptr", pLength ; INT* in/out
, "Ptr", ec ; UErrorCode* in/out
, "Cdecl Ptr") ; return: WORD*●ufmtval_getString(ufmtval, pLength, ec) = DLL("icu.dll", "void* ufmtval_getString(void*, void*, void*)")
# 呼び出し: ufmtval_getString(ufmtval, pLength, ec)
# ufmtval : UFormattedValue* -> "void*"
# pLength : 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`,…) を使用。