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

uset_containsString

関数
USetが指定文字列を含むかどうかを判定する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

CHAR uset_containsString(
    const USet* set,
    const WORD* str,
    INT strLen
);

パラメーター

名前方向説明
setUSet*in判定対象のUnicodeセット。
strWORD*inセットに含まれるか検査する文字列へのポインタ。
strLenINTinstrの長さ(UChar単位)。-1の場合はNUL終端文字列として扱う。

戻り値の型: CHAR

各言語での呼び出し定義

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

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

uset_containsString = ctypes.cdll.icuuc.uset_containsString
uset_containsString.restype = ctypes.c_byte
uset_containsString.argtypes = [
    ctypes.c_void_p,  # set : USet*
    ctypes.POINTER(ctypes.c_ushort),  # str : WORD*
    ctypes.c_int,  # strLen : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuset_containsString = icuuc.NewProc("uset_containsString")
)

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

extern "icuuc" fn uset_containsString(
    set: [*c]isize, // USet*
    str: [*c]u16, // WORD*
    strLen: i32 // INT
) callconv(.c) i8;
proc uset_containsString(
    set: ptr int,  # USet*
    str: ptr uint16,  # WORD*
    strLen: int32  # INT
): int8 {.importc: "uset_containsString", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
byte uset_containsString(
    ptrdiff_t* set,   // USet*
    ushort* str,   // WORD*
    int strLen   // INT
);
ccall((:uset_containsString, "icuuc.dll"), Int8,
      (Ptr{Int}, Ptr{UInt16}, Int32),
      set, str, strLen)
# set : USet* -> Ptr{Int}
# str : WORD* -> Ptr{UInt16}
# strLen : INT -> Int32
local ffi = require("ffi")
ffi.cdef[[
int8_t uset_containsString(
    intptr_t* set,
    uint16_t* str,
    int32_t strLen);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.uset_containsString(set, str, strLen)
-- set : USet*
-- str : WORD*
-- strLen : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const uset_containsString = lib.func('__cdecl', 'uset_containsString', 'int8_t', ['intptr_t *', 'uint16_t *', 'int32_t']);
// uset_containsString(set, str, strLen)
// set : USet* -> 'intptr_t *'
// str : WORD* -> 'uint16_t *'
// strLen : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  uset_containsString: { parameters: ["pointer", "pointer", "i32"], result: "i8" },
});
// lib.symbols.uset_containsString(set, str, strLen)
// set : USet* -> "pointer"
// str : WORD* -> "pointer"
// strLen : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int8_t uset_containsString(
    intptr_t* set,
    uint16_t* str,
    int32_t strLen);
C, "icuuc.dll");
// $ffi->uset_containsString(set, str, strLen);
// set : USet*
// str : WORD*
// strLen : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuuc extends Library {
    Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
    byte uset_containsString(
        LongByReference set,   // USet*
        ShortByReference str,   // WORD*
        int strLen   // INT
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun uset_containsString = uset_containsString(
    set : LibC::SSizeT*,   # USet*
    str : UInt16*,   # WORD*
    strLen : Int32   # INT
  ) : Int8
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef uset_containsStringNative = Int8 Function(Pointer<IntPtr>, Pointer<Uint16>, Int32);
typedef uset_containsStringDart = int Function(Pointer<IntPtr>, Pointer<Uint16>, int);
final uset_containsString = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<uset_containsStringNative, uset_containsStringDart>('uset_containsString');
// set : USet* -> Pointer<IntPtr>
// str : WORD* -> Pointer<Uint16>
// strLen : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function uset_containsString(
  set: Pointer;   // USet*
  str: Pointer;   // WORD*
  strLen: Integer   // INT
): Shortint; cdecl;
  external 'icuuc.dll' name 'uset_containsString';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "uset_containsString"
  c_uset_containsString :: Ptr CIntPtr -> Ptr Word16 -> Int32 -> IO Int8
-- set : USet* -> Ptr CIntPtr
-- str : WORD* -> Ptr Word16
-- strLen : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uset_containsstring =
  foreign "uset_containsString"
    ((ptr intptr_t) @-> (ptr uint16_t) @-> int32_t @-> returning int8_t)
(* set : USet* -> (ptr intptr_t) *)
(* str : WORD* -> (ptr uint16_t) *)
(* strLen : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("uset_containsString" uset-contains-string :convention :cdecl) :int8
  (set :pointer)   ; USet*
  (str :pointer)   ; WORD*
  (str-len :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $uset_containsString = Win32::API::More->new('icuuc',
    'char uset_containsString(LPVOID set, LPVOID str, int strLen)');
# my $ret = $uset_containsString->Call($set, $str, $strLen);
# set : USet* -> LPVOID
# str : WORD* -> LPVOID
# strLen : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。