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

u_stringHasBinaryProperty

関数
文字列が指定のバイナリプロパティを持つか判定する。
DLLicu.dll呼出規約cdecl

シグネチャ

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

CHAR u_stringHasBinaryProperty(
    const WORD* s,
    INT length,
    UProperty which
);

パラメーター

名前方向
sWORD*in
lengthINTin
whichUPropertyin

戻り値の型: CHAR

各言語での呼び出し定義

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

CHAR u_stringHasBinaryProperty(
    const WORD* s,
    INT length,
    UProperty which
);
[DllImport("icu.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern sbyte u_stringHasBinaryProperty(
    ref ushort s,   // WORD*
    int length,   // INT
    int which   // UProperty
);
<DllImport("icu.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_stringHasBinaryProperty(
    ByRef s As UShort,   ' WORD*
    length As Integer,   ' INT
    which As Integer   ' UProperty
) As SByte
End Function
' s : WORD*
' length : INT
' which : UProperty
Declare PtrSafe Function u_stringHasBinaryProperty Lib "icu" ( _
    ByRef s As Integer, _
    ByVal length As Long, _
    ByVal which As Long) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

u_stringHasBinaryProperty = ctypes.cdll.icu.u_stringHasBinaryProperty
u_stringHasBinaryProperty.restype = ctypes.c_byte
u_stringHasBinaryProperty.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # s : WORD*
    ctypes.c_int,  # length : INT
    ctypes.c_int,  # which : UProperty
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icu.dll')
u_stringHasBinaryProperty = Fiddle::Function.new(
  lib['u_stringHasBinaryProperty'],
  [
    Fiddle::TYPE_VOIDP,  # s : WORD*
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_INT,  # which : UProperty
  ],
  Fiddle::TYPE_CHAR, Fiddle::Function::CDECL)
#[link(name = "icu")]
extern "C" {
    fn u_stringHasBinaryProperty(
        s: *const u16,  // WORD*
        length: i32,  // INT
        which: i32  // UProperty
    ) -> i8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icu.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte u_stringHasBinaryProperty(ref ushort s, int length, int which);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icu_u_stringHasBinaryProperty' -Namespace Win32 -PassThru
# $api::u_stringHasBinaryProperty(s, length, which)
#uselib "icu.dll"
#func global u_stringHasBinaryProperty "u_stringHasBinaryProperty" sptr, sptr, sptr
; u_stringHasBinaryProperty varptr(s), length, which   ; 戻り値は stat
; s : WORD* -> "sptr"
; length : INT -> "sptr"
; which : UProperty -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icu.dll"
#cfunc global u_stringHasBinaryProperty "u_stringHasBinaryProperty" var, int, int
; res = u_stringHasBinaryProperty(s, length, which)
; s : WORD* -> "var"
; length : INT -> "int"
; which : UProperty -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; CHAR u_stringHasBinaryProperty(WORD* s, INT length, UProperty which)
#uselib "icu.dll"
#cfunc global u_stringHasBinaryProperty "u_stringHasBinaryProperty" var, int, int
; res = u_stringHasBinaryProperty(s, length, which)
; s : WORD* -> "var"
; length : INT -> "int"
; which : UProperty -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icu = windows.NewLazySystemDLL("icu.dll")
	procu_stringHasBinaryProperty = icu.NewProc("u_stringHasBinaryProperty")
)

// s (WORD*), length (INT), which (UProperty)
r1, _, err := procu_stringHasBinaryProperty.Call(
	uintptr(s),
	uintptr(length),
	uintptr(which),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CHAR
function u_stringHasBinaryProperty(
  s: Pointer;   // WORD*
  length: Integer;   // INT
  which: Integer   // UProperty
): Shortint; cdecl;
  external 'icu.dll' name 'u_stringHasBinaryProperty';
result := DllCall("icu\u_stringHasBinaryProperty"
    , "Ptr", s   ; WORD*
    , "Int", length   ; INT
    , "Int", which   ; UProperty
    , "Cdecl Char")   ; return: CHAR
●u_stringHasBinaryProperty(s, length, which) = DLL("icu.dll", "char u_stringHasBinaryProperty(void*, int, int)")
# 呼び出し: u_stringHasBinaryProperty(s, length, which)
# s : WORD* -> "void*"
# length : INT -> "int"
# which : UProperty -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。