ホーム › Globalization › ucol_setStrength
ucol_setStrength
関数コレータの比較強度レベルを設定する。
シグネチャ
// icuin.dll
#include <windows.h>
void ucol_setStrength(
UCollator* coll,
UColAttributeValue strength
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| coll | UCollator* | inout | 照合強度を設定する対象のコレーターハンドル。 |
| strength | UColAttributeValue | in | 設定する照合強度。PRIMARY(基底文字)〜IDENTICAL(完全一致)の段階を指定する。 |
戻り値の型: void
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
void ucol_setStrength(
UCollator* coll,
UColAttributeValue strength
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucol_setStrength(
ref IntPtr coll, // UCollator* in/out
int strength // UColAttributeValue
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucol_setStrength(
ByRef coll As IntPtr, ' UCollator* in/out
strength As Integer ' UColAttributeValue
)
End Sub' coll : UCollator* in/out
' strength : UColAttributeValue
Declare PtrSafe Sub ucol_setStrength Lib "icuin" ( _
ByRef coll As LongPtr, _
ByVal strength As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucol_setStrength = ctypes.cdll.icuin.ucol_setStrength
ucol_setStrength.restype = None
ucol_setStrength.argtypes = [
ctypes.c_void_p, # coll : UCollator* in/out
ctypes.c_int, # strength : UColAttributeValue
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucol_setStrength = Fiddle::Function.new(
lib['ucol_setStrength'],
[
Fiddle::TYPE_VOIDP, # coll : UCollator* in/out
Fiddle::TYPE_INT, # strength : UColAttributeValue
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucol_setStrength(
coll: *mut isize, // UCollator* in/out
strength: i32 // UColAttributeValue
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ucol_setStrength(ref IntPtr coll, int strength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_setStrength' -Namespace Win32 -PassThru
# $api::ucol_setStrength(coll, strength)#uselib "icuin.dll"
#func global ucol_setStrength "ucol_setStrength" sptr, sptr
; ucol_setStrength varptr(coll), strength
; coll : UCollator* in/out -> "sptr"
; strength : UColAttributeValue -> "sptr"出力引数:
#uselib "icuin.dll" #func global ucol_setStrength "ucol_setStrength" var, int ; ucol_setStrength coll, strength ; coll : UCollator* in/out -> "var" ; strength : UColAttributeValue -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #func global ucol_setStrength "ucol_setStrength" sptr, int ; ucol_setStrength varptr(coll), strength ; coll : UCollator* in/out -> "sptr" ; strength : UColAttributeValue -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void ucol_setStrength(UCollator* coll, UColAttributeValue strength) #uselib "icuin.dll" #func global ucol_setStrength "ucol_setStrength" var, int ; ucol_setStrength coll, strength ; coll : UCollator* in/out -> "var" ; strength : UColAttributeValue -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void ucol_setStrength(UCollator* coll, UColAttributeValue strength) #uselib "icuin.dll" #func global ucol_setStrength "ucol_setStrength" intptr, int ; ucol_setStrength varptr(coll), strength ; coll : UCollator* in/out -> "intptr" ; strength : UColAttributeValue -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucol_setStrength = icuin.NewProc("ucol_setStrength")
)
// coll (UCollator* in/out), strength (UColAttributeValue)
r1, _, err := procucol_setStrength.Call(
uintptr(coll),
uintptr(strength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ucol_setStrength(
coll: Pointer; // UCollator* in/out
strength: Integer // UColAttributeValue
); cdecl;
external 'icuin.dll' name 'ucol_setStrength';result := DllCall("icuin\ucol_setStrength"
, "Ptr", coll ; UCollator* in/out
, "Int", strength ; UColAttributeValue
, "Cdecl Int") ; return: void●ucol_setStrength(coll, strength) = DLL("icuin.dll", "int ucol_setStrength(void*, int)")
# 呼び出し: ucol_setStrength(coll, strength)
# coll : UCollator* in/out -> "void*"
# strength : UColAttributeValue -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn ucol_setStrength(
coll: [*c]isize, // UCollator* in/out
strength: i32 // UColAttributeValue
) callconv(.c) void;proc ucol_setStrength(
coll: ptr int, # UCollator* in/out
strength: int32 # UColAttributeValue
) {.importc: "ucol_setStrength", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
void ucol_setStrength(
ptrdiff_t* coll, // UCollator* in/out
int strength // UColAttributeValue
);ccall((:ucol_setStrength, "icuin.dll"), Cvoid,
(Ptr{Int}, Int32),
coll, strength)
# coll : UCollator* in/out -> Ptr{Int}
# strength : UColAttributeValue -> Int32local ffi = require("ffi")
ffi.cdef[[
void ucol_setStrength(
intptr_t* coll,
int32_t strength);
]]
local icuin = ffi.load("icuin")
-- icuin.ucol_setStrength(coll, strength)
-- coll : UCollator* in/out
-- strength : UColAttributeValue
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const ucol_setStrength = lib.func('__cdecl', 'ucol_setStrength', 'void', ['intptr_t *', 'int32_t']);
// ucol_setStrength(coll, strength)
// coll : UCollator* in/out -> 'intptr_t *'
// strength : UColAttributeValue -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
ucol_setStrength: { parameters: ["pointer", "i32"], result: "void" },
});
// lib.symbols.ucol_setStrength(coll, strength)
// coll : UCollator* in/out -> "pointer"
// strength : UColAttributeValue -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void ucol_setStrength(
intptr_t* coll,
int32_t strength);
C, "icuin.dll");
// $ffi->ucol_setStrength(coll, strength);
// coll : UCollator* in/out
// strength : UColAttributeValue
// 構造体/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 Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
void ucol_setStrength(
LongByReference coll, // UCollator* in/out
int strength // UColAttributeValue
);
}@[Link("icuin")]
lib Libicuin
fun ucol_setStrength = ucol_setStrength(
coll : LibC::SSizeT*, # UCollator* in/out
strength : Int32 # UColAttributeValue
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucol_setStrengthNative = Void Function(Pointer<IntPtr>, Int32);
typedef ucol_setStrengthDart = void Function(Pointer<IntPtr>, int);
final ucol_setStrength = DynamicLibrary.open('icuin.dll')
.lookupFunction<ucol_setStrengthNative, ucol_setStrengthDart>('ucol_setStrength');
// coll : UCollator* in/out -> Pointer<IntPtr>
// strength : UColAttributeValue -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure ucol_setStrength(
coll: Pointer; // UCollator* in/out
strength: Integer // UColAttributeValue
); cdecl;
external 'icuin.dll' name 'ucol_setStrength';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucol_setStrength"
c_ucol_setStrength :: Ptr CIntPtr -> Int32 -> IO ()
-- coll : UCollator* in/out -> Ptr CIntPtr
-- strength : UColAttributeValue -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucol_setstrength =
foreign "ucol_setStrength"
((ptr intptr_t) @-> int32_t @-> returning void)
(* coll : UCollator* in/out -> (ptr intptr_t) *)
(* strength : UColAttributeValue -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("ucol_setStrength" ucol-set-strength :convention :cdecl) :void
(coll :pointer) ; UCollator* in/out
(strength :int32)) ; UColAttributeValue
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucol_setStrength = Win32::API::More->new('icuin',
'void ucol_setStrength(LPVOID coll, int strength)');
# my $ret = $ucol_setStrength->Call($coll, $strength);
# coll : UCollator* in/out -> LPVOID
# strength : UColAttributeValue -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型