ホーム › Globalization › uloc_getParent
uloc_getParent
関数指定ロケールIDの親ロケールIDを取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT uloc_getParent(
LPCSTR localeID,
LPSTR parent,
INT parentCapacity,
UErrorCode* err
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| localeID | LPCSTR | in |
| parent | LPSTR | in |
| parentCapacity | INT | in |
| err | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT uloc_getParent(
LPCSTR localeID,
LPSTR parent,
INT parentCapacity,
UErrorCode* err
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uloc_getParent(
[MarshalAs(UnmanagedType.LPStr)] string localeID, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string parent, // LPSTR
int parentCapacity, // INT
ref int err // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uloc_getParent(
<MarshalAs(UnmanagedType.LPStr)> localeID As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> parent As String, ' LPSTR
parentCapacity As Integer, ' INT
ByRef err As Integer ' UErrorCode* in/out
) As Integer
End Function' localeID : LPCSTR
' parent : LPSTR
' parentCapacity : INT
' err : UErrorCode* in/out
Declare PtrSafe Function uloc_getParent Lib "icuuc" ( _
ByVal localeID As String, _
ByVal parent As String, _
ByVal parentCapacity As Long, _
ByRef err As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uloc_getParent = ctypes.cdll.icuuc.uloc_getParent
uloc_getParent.restype = ctypes.c_int
uloc_getParent.argtypes = [
wintypes.LPCSTR, # localeID : LPCSTR
wintypes.LPCSTR, # parent : LPSTR
ctypes.c_int, # parentCapacity : INT
ctypes.c_void_p, # err : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
uloc_getParent = Fiddle::Function.new(
lib['uloc_getParent'],
[
Fiddle::TYPE_VOIDP, # localeID : LPCSTR
Fiddle::TYPE_VOIDP, # parent : LPSTR
Fiddle::TYPE_INT, # parentCapacity : INT
Fiddle::TYPE_VOIDP, # err : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn uloc_getParent(
localeID: *const u8, // LPCSTR
parent: *mut u8, // LPSTR
parentCapacity: i32, // INT
err: *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 uloc_getParent([MarshalAs(UnmanagedType.LPStr)] string localeID, [MarshalAs(UnmanagedType.LPStr)] string parent, int parentCapacity, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uloc_getParent' -Namespace Win32 -PassThru
# $api::uloc_getParent(localeID, parent, parentCapacity, err)#uselib "icuuc.dll"
#func global uloc_getParent "uloc_getParent" sptr, sptr, sptr, sptr
; uloc_getParent localeID, parent, parentCapacity, err ; 戻り値は stat
; localeID : LPCSTR -> "sptr"
; parent : LPSTR -> "sptr"
; parentCapacity : INT -> "sptr"
; err : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global uloc_getParent "uloc_getParent" str, str, int, int
; res = uloc_getParent(localeID, parent, parentCapacity, err)
; localeID : LPCSTR -> "str"
; parent : LPSTR -> "str"
; parentCapacity : INT -> "int"
; err : UErrorCode* in/out -> "int"; INT uloc_getParent(LPCSTR localeID, LPSTR parent, INT parentCapacity, UErrorCode* err)
#uselib "icuuc.dll"
#cfunc global uloc_getParent "uloc_getParent" str, str, int, int
; res = uloc_getParent(localeID, parent, parentCapacity, err)
; localeID : LPCSTR -> "str"
; parent : LPSTR -> "str"
; parentCapacity : INT -> "int"
; err : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
proculoc_getParent = icuuc.NewProc("uloc_getParent")
)
// localeID (LPCSTR), parent (LPSTR), parentCapacity (INT), err (UErrorCode* in/out)
r1, _, err := proculoc_getParent.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(localeID))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(parent))),
uintptr(parentCapacity),
uintptr(err),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction uloc_getParent(
localeID: PAnsiChar; // LPCSTR
parent: PAnsiChar; // LPSTR
parentCapacity: Integer; // INT
err: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuuc.dll' name 'uloc_getParent';result := DllCall("icuuc\uloc_getParent"
, "AStr", localeID ; LPCSTR
, "AStr", parent ; LPSTR
, "Int", parentCapacity ; INT
, "Ptr", err ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●uloc_getParent(localeID, parent, parentCapacity, err) = DLL("icuuc.dll", "int uloc_getParent(char*, char*, int, void*)")
# 呼び出し: uloc_getParent(localeID, parent, parentCapacity, err)
# localeID : LPCSTR -> "char*"
# parent : LPSTR -> "char*"
# parentCapacity : INT -> "int"
# err : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。