ホーム › Globalization › u_getPropertyName
u_getPropertyName
関数プロパティの名前を取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
LPSTR u_getPropertyName(
UProperty property,
UPropertyNameChoice nameChoice
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| property | UProperty | in | 名称を取得する対象のUnicodeプロパティを示す列挙値。 |
| nameChoice | UPropertyNameChoice | in | 取得する名称の種類(短縮名・長い名前など)を指定する列挙値。 |
戻り値の型: LPSTR
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
LPSTR u_getPropertyName(
UProperty property,
UPropertyNameChoice nameChoice
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr u_getPropertyName(
int property, // UProperty
int nameChoice // UPropertyNameChoice
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_getPropertyName(
[property] As Integer, ' UProperty
nameChoice As Integer ' UPropertyNameChoice
) As IntPtr
End Function' property : UProperty
' nameChoice : UPropertyNameChoice
Declare PtrSafe Function u_getPropertyName Lib "icuuc" ( _
ByVal property As Long, _
ByVal nameChoice As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
u_getPropertyName = ctypes.cdll.icuuc.u_getPropertyName
u_getPropertyName.restype = wintypes.LPSTR
u_getPropertyName.argtypes = [
ctypes.c_int, # property : UProperty
ctypes.c_int, # nameChoice : UPropertyNameChoice
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
u_getPropertyName = Fiddle::Function.new(
lib['u_getPropertyName'],
[
Fiddle::TYPE_INT, # property : UProperty
Fiddle::TYPE_INT, # nameChoice : UPropertyNameChoice
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn u_getPropertyName(
property: i32, // UProperty
nameChoice: i32 // UPropertyNameChoice
) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr u_getPropertyName(int property, int nameChoice);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_getPropertyName' -Namespace Win32 -PassThru
# $api::u_getPropertyName(property, nameChoice)#uselib "icuuc.dll"
#func global u_getPropertyName "u_getPropertyName" sptr, sptr
; u_getPropertyName property, nameChoice ; 戻り値は stat
; property : UProperty -> "sptr"
; nameChoice : UPropertyNameChoice -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global u_getPropertyName "u_getPropertyName" int, int
; res = u_getPropertyName(property, nameChoice)
; property : UProperty -> "int"
; nameChoice : UPropertyNameChoice -> "int"; LPSTR u_getPropertyName(UProperty property, UPropertyNameChoice nameChoice)
#uselib "icuuc.dll"
#cfunc global u_getPropertyName "u_getPropertyName" int, int
; res = u_getPropertyName(property, nameChoice)
; property : UProperty -> "int"
; nameChoice : UPropertyNameChoice -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procu_getPropertyName = icuuc.NewProc("u_getPropertyName")
)
// property (UProperty), nameChoice (UPropertyNameChoice)
r1, _, err := procu_getPropertyName.Call(
uintptr(property),
uintptr(nameChoice),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPSTRfunction u_getPropertyName(
property: Integer; // UProperty
nameChoice: Integer // UPropertyNameChoice
): PAnsiChar; cdecl;
external 'icuuc.dll' name 'u_getPropertyName';result := DllCall("icuuc\u_getPropertyName"
, "Int", property ; UProperty
, "Int", nameChoice ; UPropertyNameChoice
, "Cdecl Ptr") ; return: LPSTR●u_getPropertyName(property, nameChoice) = DLL("icuuc.dll", "char* u_getPropertyName(int, int)")
# 呼び出し: u_getPropertyName(property, nameChoice)
# property : UProperty -> "int"
# nameChoice : UPropertyNameChoice -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuuc" fn u_getPropertyName(
property: i32, // UProperty
nameChoice: i32 // UPropertyNameChoice
) callconv(.c) [*c]const u8;proc u_getPropertyName(
property: int32, # UProperty
nameChoice: int32 # UPropertyNameChoice
): cstring {.importc: "u_getPropertyName", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
const(char)* u_getPropertyName(
int property, // UProperty
int nameChoice // UPropertyNameChoice
);ccall((:u_getPropertyName, "icuuc.dll"), Cstring,
(Int32, Int32),
property, nameChoice)
# property : UProperty -> Int32
# nameChoice : UPropertyNameChoice -> Int32local ffi = require("ffi")
ffi.cdef[[
const char* u_getPropertyName(
int32_t property,
int32_t nameChoice);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.u_getPropertyName(property, nameChoice)
-- property : UProperty
-- nameChoice : UPropertyNameChoice
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const u_getPropertyName = lib.func('__cdecl', 'u_getPropertyName', 'void *', ['int32_t', 'int32_t']);
// u_getPropertyName(property, nameChoice)
// property : UProperty -> 'int32_t'
// nameChoice : UPropertyNameChoice -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
u_getPropertyName: { parameters: ["i32", "i32"], result: "pointer" },
});
// lib.symbols.u_getPropertyName(property, nameChoice)
// property : UProperty -> "i32"
// nameChoice : UPropertyNameChoice -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
const char* u_getPropertyName(
int32_t property,
int32_t nameChoice);
C, "icuuc.dll");
// $ffi->u_getPropertyName(property, nameChoice);
// property : UProperty
// nameChoice : UPropertyNameChoice
// 構造体/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);
Pointer u_getPropertyName(
int property, // UProperty
int nameChoice // UPropertyNameChoice
);
}@[Link("icuuc")]
lib Libicuuc
fun u_getPropertyName = u_getPropertyName(
property : Int32, # UProperty
nameChoice : Int32 # UPropertyNameChoice
) : UInt8*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef u_getPropertyNameNative = Pointer<Utf8> Function(Int32, Int32);
typedef u_getPropertyNameDart = Pointer<Utf8> Function(int, int);
final u_getPropertyName = DynamicLibrary.open('icuuc.dll')
.lookupFunction<u_getPropertyNameNative, u_getPropertyNameDart>('u_getPropertyName');
// property : UProperty -> Int32
// nameChoice : UPropertyNameChoice -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function u_getPropertyName(
property: Integer; // UProperty
nameChoice: Integer // UPropertyNameChoice
): PAnsiChar; cdecl;
external 'icuuc.dll' name 'u_getPropertyName';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "u_getPropertyName"
c_u_getPropertyName :: Int32 -> Int32 -> IO CString
-- property : UProperty -> Int32
-- nameChoice : UPropertyNameChoice -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let u_getpropertyname =
foreign "u_getPropertyName"
(int32_t @-> int32_t @-> returning string)
(* property : UProperty -> int32_t *)
(* nameChoice : UPropertyNameChoice -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("u_getPropertyName" u-get-property-name :convention :cdecl) :string
(property :int32) ; UProperty
(name-choice :int32)) ; UPropertyNameChoice
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $u_getPropertyName = Win32::API::More->new('icuuc',
'LPSTR u_getPropertyName(int property, int nameChoice)');
# my $ret = $u_getPropertyName->Call($property, $nameChoice);
# property : UProperty -> int
# nameChoice : UPropertyNameChoice -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。