ホーム › Globalization › ucasemap_toTitle
ucasemap_toTitle
関数UTF-16文字列を分割境界に基づきタイトルケースへ変換する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT ucasemap_toTitle(
UCaseMap* csm,
WORD* dest,
INT destCapacity,
const WORD* src,
INT srcLength,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| csm | UCaseMap* | inout | タイトルケース化に用いる設定済みUCaseMapを指す。 |
| dest | WORD* | inout | タイトルケース化結果を格納するUTF-16出力バッファ。NULL可。 |
| destCapacity | INT | in | destの容量をUChar単位で指定する。0で事前長取得。 |
| src | WORD* | in | タイトルケース化対象の入力UTF-16文字列を指す。 |
| srcLength | INT | in | srcの長さをUChar単位で指定する。-1でNUL終端。 |
| pErrorCode | UErrorCode* | inout | ICUエラーコードを入出力するポインタ。呼出前に成功値で初期化する。 |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT ucasemap_toTitle(
UCaseMap* csm,
WORD* dest,
INT destCapacity,
const WORD* src,
INT srcLength,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucasemap_toTitle(
ref IntPtr csm, // UCaseMap* in/out
ref ushort dest, // WORD* in/out
int destCapacity, // INT
ref ushort src, // WORD*
int srcLength, // INT
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucasemap_toTitle(
ByRef csm As IntPtr, ' UCaseMap* in/out
ByRef dest As UShort, ' WORD* in/out
destCapacity As Integer, ' INT
ByRef src As UShort, ' WORD*
srcLength As Integer, ' INT
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As Integer
End Function' csm : UCaseMap* in/out
' dest : WORD* in/out
' destCapacity : INT
' src : WORD*
' srcLength : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function ucasemap_toTitle Lib "icuuc" ( _
ByRef csm As LongPtr, _
ByRef dest As Integer, _
ByVal destCapacity As Long, _
ByRef src As Integer, _
ByVal srcLength As Long, _
ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucasemap_toTitle = ctypes.cdll.icuuc.ucasemap_toTitle
ucasemap_toTitle.restype = ctypes.c_int
ucasemap_toTitle.argtypes = [
ctypes.c_void_p, # csm : UCaseMap* in/out
ctypes.POINTER(ctypes.c_ushort), # dest : WORD* in/out
ctypes.c_int, # destCapacity : INT
ctypes.POINTER(ctypes.c_ushort), # src : WORD*
ctypes.c_int, # srcLength : INT
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucasemap_toTitle = Fiddle::Function.new(
lib['ucasemap_toTitle'],
[
Fiddle::TYPE_VOIDP, # csm : UCaseMap* in/out
Fiddle::TYPE_VOIDP, # dest : WORD* in/out
Fiddle::TYPE_INT, # destCapacity : INT
Fiddle::TYPE_VOIDP, # src : WORD*
Fiddle::TYPE_INT, # srcLength : INT
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucasemap_toTitle(
csm: *mut isize, // UCaseMap* in/out
dest: *mut u16, // WORD* in/out
destCapacity: i32, // INT
src: *const u16, // WORD*
srcLength: i32, // INT
pErrorCode: *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 ucasemap_toTitle(ref IntPtr csm, ref ushort dest, int destCapacity, ref ushort src, int srcLength, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucasemap_toTitle' -Namespace Win32 -PassThru
# $api::ucasemap_toTitle(csm, dest, destCapacity, src, srcLength, pErrorCode)#uselib "icuuc.dll"
#func global ucasemap_toTitle "ucasemap_toTitle" sptr, sptr, sptr, sptr, sptr, sptr
; ucasemap_toTitle csm, varptr(dest), destCapacity, varptr(src), srcLength, pErrorCode ; 戻り値は stat
; csm : UCaseMap* in/out -> "sptr"
; dest : WORD* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; src : WORD* -> "sptr"
; srcLength : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global ucasemap_toTitle "ucasemap_toTitle" int, var, int, var, int, int ; res = ucasemap_toTitle(csm, dest, destCapacity, src, srcLength, pErrorCode) ; csm : UCaseMap* in/out -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; src : WORD* -> "var" ; srcLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global ucasemap_toTitle "ucasemap_toTitle" int, sptr, int, sptr, int, int ; res = ucasemap_toTitle(csm, varptr(dest), destCapacity, varptr(src), srcLength, pErrorCode) ; csm : UCaseMap* in/out -> "int" ; dest : WORD* in/out -> "sptr" ; destCapacity : INT -> "int" ; src : WORD* -> "sptr" ; srcLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ucasemap_toTitle(UCaseMap* csm, WORD* dest, INT destCapacity, WORD* src, INT srcLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global ucasemap_toTitle "ucasemap_toTitle" int, var, int, var, int, int ; res = ucasemap_toTitle(csm, dest, destCapacity, src, srcLength, pErrorCode) ; csm : UCaseMap* in/out -> "int" ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; src : WORD* -> "var" ; srcLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ucasemap_toTitle(UCaseMap* csm, WORD* dest, INT destCapacity, WORD* src, INT srcLength, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global ucasemap_toTitle "ucasemap_toTitle" int, intptr, int, intptr, int, int ; res = ucasemap_toTitle(csm, varptr(dest), destCapacity, varptr(src), srcLength, pErrorCode) ; csm : UCaseMap* in/out -> "int" ; dest : WORD* in/out -> "intptr" ; destCapacity : INT -> "int" ; src : WORD* -> "intptr" ; srcLength : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucasemap_toTitle = icuuc.NewProc("ucasemap_toTitle")
)
// csm (UCaseMap* in/out), dest (WORD* in/out), destCapacity (INT), src (WORD*), srcLength (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := procucasemap_toTitle.Call(
uintptr(csm),
uintptr(dest),
uintptr(destCapacity),
uintptr(src),
uintptr(srcLength),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucasemap_toTitle(
csm: Pointer; // UCaseMap* in/out
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
src: Pointer; // WORD*
srcLength: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuuc.dll' name 'ucasemap_toTitle';result := DllCall("icuuc\ucasemap_toTitle"
, "Ptr", csm ; UCaseMap* in/out
, "Ptr", dest ; WORD* in/out
, "Int", destCapacity ; INT
, "Ptr", src ; WORD*
, "Int", srcLength ; INT
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●ucasemap_toTitle(csm, dest, destCapacity, src, srcLength, pErrorCode) = DLL("icuuc.dll", "int ucasemap_toTitle(void*, void*, int, void*, int, void*)")
# 呼び出し: ucasemap_toTitle(csm, dest, destCapacity, src, srcLength, pErrorCode)
# csm : UCaseMap* in/out -> "void*"
# dest : WORD* in/out -> "void*"
# destCapacity : INT -> "int"
# src : WORD* -> "void*"
# srcLength : INT -> "int"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。