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

uset_getItem

関数
USetの指定項目の範囲または文字列を取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT uset_getItem(
    const USet* set,
    INT itemIndex,
    INT* start,
    INT* end,
    WORD* str,
    INT strCapacity,
    UErrorCode* ec
);

パラメーター

名前方向
setUSet*in
itemIndexINTin
startINT*inout
endINT*inout
strWORD*inout
strCapacityINTin
ecUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

uset_getItem = ctypes.cdll.icuuc.uset_getItem
uset_getItem.restype = ctypes.c_int
uset_getItem.argtypes = [
    ctypes.c_void_p,  # set : USet*
    ctypes.c_int,  # itemIndex : INT
    ctypes.POINTER(ctypes.c_int),  # start : INT* in/out
    ctypes.POINTER(ctypes.c_int),  # end : INT* in/out
    ctypes.POINTER(ctypes.c_ushort),  # str : WORD* in/out
    ctypes.c_int,  # strCapacity : INT
    ctypes.c_void_p,  # ec : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuset_getItem = icuuc.NewProc("uset_getItem")
)

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