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

uregion_getContainingRegionOfType

関数
指定タイプの上位包含地域を取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

URegion* uregion_getContainingRegionOfType(
    const URegion* uregion,
    URegionType type
);

パラメーター

名前方向説明
uregionURegion*in指定種別の上位地域を取得する対象の地域オブジェクト。
typeURegionTypein取得したい上位地域の種別。URGN_CONTINENTやURGN_SUBCONTINENT等を指定する。

戻り値の型: URegion*

各言語での呼び出し定義

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

URegion* uregion_getContainingRegionOfType(
    const URegion* uregion,
    URegionType type
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr uregion_getContainingRegionOfType(
    ref IntPtr uregion,   // URegion*
    int type   // URegionType
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uregion_getContainingRegionOfType(
    ByRef uregion As IntPtr,   ' URegion*
    type As Integer   ' URegionType
) As IntPtr
End Function
' uregion : URegion*
' type : URegionType
Declare PtrSafe Function uregion_getContainingRegionOfType Lib "icuin" ( _
    ByRef uregion As LongPtr, _
    ByVal type As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uregion_getContainingRegionOfType = ctypes.cdll.icuin.uregion_getContainingRegionOfType
uregion_getContainingRegionOfType.restype = ctypes.c_void_p
uregion_getContainingRegionOfType.argtypes = [
    ctypes.c_void_p,  # uregion : URegion*
    ctypes.c_int,  # type : URegionType
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procuregion_getContainingRegionOfType = icuin.NewProc("uregion_getContainingRegionOfType")
)

// uregion (URegion*), type (URegionType)
r1, _, err := procuregion_getContainingRegionOfType.Call(
	uintptr(uregion),
	uintptr(type),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // URegion*
function uregion_getContainingRegionOfType(
  uregion: Pointer;   // URegion*
  type: Integer   // URegionType
): Pointer; cdecl;
  external 'icuin.dll' name 'uregion_getContainingRegionOfType';
result := DllCall("icuin\uregion_getContainingRegionOfType"
    , "Ptr", uregion   ; URegion*
    , "Int", type   ; URegionType
    , "Cdecl Ptr")   ; return: URegion*
●uregion_getContainingRegionOfType(uregion, type) = DLL("icuin.dll", "void* uregion_getContainingRegionOfType(void*, int)")
# 呼び出し: uregion_getContainingRegionOfType(uregion, type)
# uregion : URegion* -> "void*"
# type : URegionType -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "icuin" fn uregion_getContainingRegionOfType(
    uregion: [*c]isize, // URegion*
    type: i32 // URegionType
) callconv(.c) [*c]isize;
proc uregion_getContainingRegionOfType(
    uregion: ptr int,  # URegion*
    `type`: int32  # URegionType
): ptr int {.importc: "uregion_getContainingRegionOfType", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
ptrdiff_t* uregion_getContainingRegionOfType(
    ptrdiff_t* uregion,   // URegion*
    int type   // URegionType
);
ccall((:uregion_getContainingRegionOfType, "icuin.dll"), Ptr{Int},
      (Ptr{Int}, Int32),
      uregion, type)
# uregion : URegion* -> Ptr{Int}
# type : URegionType -> Int32
local ffi = require("ffi")
ffi.cdef[[
intptr_t* uregion_getContainingRegionOfType(
    intptr_t* uregion,
    int32_t type);
]]
local icuin = ffi.load("icuin")
-- icuin.uregion_getContainingRegionOfType(uregion, type)
-- uregion : URegion*
-- type : URegionType
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const uregion_getContainingRegionOfType = lib.func('__cdecl', 'uregion_getContainingRegionOfType', 'intptr_t *', ['intptr_t *', 'int32_t']);
// uregion_getContainingRegionOfType(uregion, type)
// uregion : URegion* -> 'intptr_t *'
// type : URegionType -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  uregion_getContainingRegionOfType: { parameters: ["pointer", "i32"], result: "pointer" },
});
// lib.symbols.uregion_getContainingRegionOfType(uregion, type)
// uregion : URegion* -> "pointer"
// type : URegionType -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
intptr_t* uregion_getContainingRegionOfType(
    intptr_t* uregion,
    int32_t type);
C, "icuin.dll");
// $ffi->uregion_getContainingRegionOfType(uregion, type);
// uregion : URegion*
// type : URegionType
// 構造体/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);
    Pointer uregion_getContainingRegionOfType(
        LongByReference uregion,   // URegion*
        int type   // URegionType
    );
}
@[Link("icuin")]
lib Libicuin
  fun uregion_getContainingRegionOfType = uregion_getContainingRegionOfType(
    uregion : LibC::SSizeT*,   # URegion*
    type_ : Int32   # URegionType
  ) : LibC::SSizeT*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef uregion_getContainingRegionOfTypeNative = Pointer<IntPtr> Function(Pointer<IntPtr>, Int32);
typedef uregion_getContainingRegionOfTypeDart = Pointer<IntPtr> Function(Pointer<IntPtr>, int);
final uregion_getContainingRegionOfType = DynamicLibrary.open('icuin.dll')
    .lookupFunction<uregion_getContainingRegionOfTypeNative, uregion_getContainingRegionOfTypeDart>('uregion_getContainingRegionOfType');
// uregion : URegion* -> Pointer<IntPtr>
// type : URegionType -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function uregion_getContainingRegionOfType(
  uregion: Pointer;   // URegion*
  type: Integer   // URegionType
): Pointer; cdecl;
  external 'icuin.dll' name 'uregion_getContainingRegionOfType';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "uregion_getContainingRegionOfType"
  c_uregion_getContainingRegionOfType :: Ptr CIntPtr -> Int32 -> IO (Ptr CIntPtr)
-- uregion : URegion* -> Ptr CIntPtr
-- type : URegionType -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uregion_getcontainingregionoftype =
  foreign "uregion_getContainingRegionOfType"
    ((ptr intptr_t) @-> int32_t @-> returning (ptr intptr_t))
(* uregion : URegion* -> (ptr intptr_t) *)
(* type : URegionType -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("uregion_getContainingRegionOfType" uregion-get-containing-region-of-type :convention :cdecl) :pointer
  (uregion :pointer)   ; URegion*
  (type :int32))   ; URegionType
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $uregion_getContainingRegionOfType = Win32::API::More->new('icuin',
    'LPVOID uregion_getContainingRegionOfType(LPVOID uregion, int type)');
# my $ret = $uregion_getContainingRegionOfType->Call($uregion, $type);
# uregion : URegion* -> LPVOID
# type : URegionType -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型