Init
This commit is contained in:
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
declare module "ffi" {
|
||||
|
||||
|
||||
class Closure {
|
||||
}
|
||||
|
||||
class CFunctionPointer {
|
||||
}
|
||||
|
||||
type PrimitiveTypes = "void" | "uint8" | "int8" | "uint16" | "int16" | "uint32" | "int32" | "uint64" | "int64" | "float" | "double" | "pointer" | "size_t" | "cstring" ;
|
||||
|
||||
interface TypeInfo {
|
||||
new(...args: any[]): any
|
||||
|
||||
size: number;
|
||||
|
||||
alloc(...data: any[]): Uint8Array;
|
||||
|
||||
read(pointer:Uint8Array, offset?: number): any;
|
||||
|
||||
write(pointer:Uint8Array, val: any, offset?: number): number;
|
||||
|
||||
get(pointer:Uint8Array, index: number): any;
|
||||
|
||||
set(pointer:Uint8Array, val: any, index: number): any;
|
||||
}
|
||||
|
||||
interface PointerTypeInfo extends TypeInfo {
|
||||
ref(val: any): Uint8Array;
|
||||
unref(buff:Uint8Array): any;
|
||||
}
|
||||
|
||||
type AnyTypeInfo = PrimitiveTypes | TypeInfo;
|
||||
|
||||
function typeInfo(info: AnyTypeInfo): TypeInfo;
|
||||
|
||||
function makeStruct(description: Object): TypeInfo;
|
||||
|
||||
function makePointer(info: AnyTypeInfo): PointerTypeInfo;
|
||||
|
||||
function binding(funcIndex :number, abi: number, returnType: AnyTypeInfo, parameterTypes: AnyTypeInfo[], fixArgNum: number): Function;
|
||||
function binding(funcIndex :number, returnType: AnyTypeInfo, parameterTypes: AnyTypeInfo[], fixArgNum?: number): Function;
|
||||
|
||||
namespace closure {
|
||||
function alloc(func: Function, abi: number, returnType: AnyTypeInfo, parameterTypes: AnyTypeInfo[]): Closure;
|
||||
function alloc(func: Function, returnType: AnyTypeInfo, parameterTypes: AnyTypeInfo[]): Closure;
|
||||
function func(cl: Closure): CFunctionPointer;
|
||||
function free(cl: Closure):void;
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making Puerts available.
|
||||
* Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* Puerts is licensed under the BSD 3-Clause License, except for the third-party components listed in the file 'LICENSE' which may be subject to their corresponding license terms.
|
||||
* This file is subject to the terms and conditions defined in file 'LICENSE', which is part of this source code package.
|
||||
*/
|
||||
|
||||
declare module "puerts" {
|
||||
import {Object, Class, $Delegate} from "ue"
|
||||
|
||||
interface $Ref<T> {
|
||||
__doNoAccess: T
|
||||
}
|
||||
|
||||
interface $InRef<T> {
|
||||
__doNoAccess: T
|
||||
}
|
||||
|
||||
type $Nullable<T> = T | null;
|
||||
|
||||
type cstring = string | ArrayBuffer;
|
||||
|
||||
function toCString(str:string) : ArrayBuffer;
|
||||
|
||||
function toCPtrArray(...ab:ArrayBuffer[]) : ArrayBuffer;
|
||||
|
||||
function $ref<T>(x? : T) : $Ref<T>;
|
||||
|
||||
function $unref<T>(x: $Ref<T> | $InRef<T>) : T;
|
||||
|
||||
function $set<T>(x: $Ref<T> | $InRef<T>, val:T) : void;
|
||||
|
||||
const argv : {
|
||||
getByIndex(index: number): Object;
|
||||
getByName(name: string): Object;
|
||||
}
|
||||
|
||||
function merge(des: {}, src: {}): void;
|
||||
|
||||
//function requestJitModuleMethod(moduleName: string, methodName: string, callback: (err: Error, result: any)=> void, ... args: any[]): void;
|
||||
|
||||
/**
|
||||
* @deprecated please use mixin instead!
|
||||
*/
|
||||
function makeUClass(ctor: { new(): Object }): Class;
|
||||
|
||||
function blueprint<T extends {
|
||||
new (...args:any[]): Object;
|
||||
}>(path:string): T;
|
||||
|
||||
namespace blueprint {
|
||||
type MixinConfig = { objectTakeByNative?:boolean, inherit?:boolean, generatedClass?: Class, noMixinedWarning?:boolean};
|
||||
function tojs<T extends typeof Object>(cls:Class): T;
|
||||
function mixin<T extends typeof Object, R extends InstanceType<T>>(to:T, mixinMethods:new (...args: any) => R, config?: MixinConfig) : {
|
||||
new (Outer?: Object, Name?: string, ObjectFlags?: number) : R;
|
||||
StaticClass(): Class;
|
||||
};
|
||||
function unmixin<T extends typeof Object>(to:T): void
|
||||
function load(cls: any): void
|
||||
function unload(cls: any): void
|
||||
}
|
||||
|
||||
function on(eventType: string, listener: Function, prepend?: boolean) : void;
|
||||
|
||||
function off(eventType: string, listener: Function) : void;
|
||||
|
||||
function emit(eventType: string, ...args:any[]) : boolean;
|
||||
|
||||
function toManualReleaseDelegate<T extends (...args: any) => any>(func: T): $Delegate<T>;
|
||||
|
||||
function releaseManualReleaseDelegate<T extends (...args: any) => any>(func: T): void;
|
||||
|
||||
function toDelegate<T extends Object, K extends keyof T>(obj: T, key: T[K] extends (...args: any) => any ? K : never) : $Delegate<T[K] extends (...args: any) => any ? T[K] : never>;
|
||||
|
||||
function toDelegate<T extends (...args: any) => any>(owner: Object, callback: T): $Delegate<T>;
|
||||
|
||||
function load<T>(dllpath): T;
|
||||
|
||||
/*function getProperties(obj: Object, ...propNames:string[]): any;
|
||||
function getPropertiesAsync(obj: Object, ...propNames:string[]): Promise<any>;
|
||||
function setProperties(obj: Object, properties: any):void;
|
||||
function setPropertiesAsync(obj: Object, properties: any):Promise<void>;
|
||||
function flushAsyncCall(trace?:boolean):number;
|
||||
|
||||
type AsyncFunction<T extends (...args: any) => any> = (...a: ArgumentTypes<T>) => Promise<ReturnType<T> extends Object ? AsyncObject<ReturnType<T>> : ReturnType<T>>;
|
||||
|
||||
type AsyncObject<T> = {
|
||||
[P in keyof T] : T[P] extends (...args: any) => any ? AsyncFunction<T[P]> : T[P];
|
||||
} & T
|
||||
|
||||
function $async<T>(x: T) : AsyncObject<T>;*/
|
||||
|
||||
function setJsTakeRef(object : Object) : void;
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
/// <reference path="puerts.d.ts" />
|
||||
/// <reference path="ue.d.ts" />
|
||||
/// <reference path="puerts_decorators.d.ts" />
|
||||
/// <reference path="ue_bp.d.ts" />
|
||||
Vendored
+175
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making Puerts available.
|
||||
* Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* Puerts is licensed under the BSD 3-Clause License, except for the third-party components listed in the file 'LICENSE' which may be subject to their corresponding license terms.
|
||||
* This file is subject to the terms and conditions defined in file 'LICENSE', which is part of this source code package.
|
||||
*/
|
||||
|
||||
declare module "ue" {
|
||||
type ArgumentTypes<T> = T extends (... args: infer U ) => infer R ? U: never;
|
||||
|
||||
interface $CallbackID {}
|
||||
|
||||
interface $Delegate<T extends (...args: any) => any> {
|
||||
Bind(fn : T): void;
|
||||
Bind(target: Object, methodName: string): void;
|
||||
Unbind(): void;
|
||||
IsBound(): boolean;
|
||||
Execute(...a: ArgumentTypes<T>) : ReturnType<T>;
|
||||
}
|
||||
|
||||
interface $MulticastDelegate<T extends (...args: any) => any> {
|
||||
Add(fn : T): void;
|
||||
Add(target: Object, methodName: string): void;
|
||||
Remove(fn : T): void;
|
||||
Broadcast(...a: ArgumentTypes<T>) : ReturnType<T>;
|
||||
Clear(): void;
|
||||
}
|
||||
|
||||
interface FixSizeArray<T> {
|
||||
Num(): number;
|
||||
Get(Index: number): T;
|
||||
GetRef(Index: number): T;
|
||||
Set(Index: number, Value: T): void;
|
||||
}
|
||||
|
||||
interface TArray<T> {
|
||||
Num(): number;
|
||||
Add(...args: T[]): void;
|
||||
Get(Index: number): T;
|
||||
GetRef(Index: number): T;
|
||||
Set(Index: number, Value: T): void;
|
||||
Contains(Value: T): boolean;
|
||||
FindIndex(Value: T): number;
|
||||
RemoveAt(Index: number): void;
|
||||
IsValidIndex(Index: number): boolean;
|
||||
Empty(): void;
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface TSet<T> {
|
||||
Num(): number;
|
||||
Add(Value: T): void;
|
||||
Get(Index: number): T; // TODO - 这个接口要用Index吗?
|
||||
GetRef(Index: number): T;
|
||||
// Set(Index: number, Value: T): void;
|
||||
Contains(Value: T): boolean;
|
||||
FindIndex(Value: T): number;
|
||||
RemoveAt(Index: number): void;
|
||||
GetMaxIndex(): number; // TODO - GetMaxIndex的返回值是InvalidIndex,合理吗?(GetMaxIndex的解释应该是:最大合法index+1),当调用Empty,返回值为0
|
||||
IsValidIndex(Index: number): boolean;
|
||||
Empty(): void;
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
interface TMap<TKey, TValue> {
|
||||
Num(): number;
|
||||
Add(Key: TKey, Value: TValue): void;
|
||||
Get(Key: TKey): TValue | undefined;
|
||||
GetRef(Key: TKey): TValue | undefined;
|
||||
Set(Key: TKey, Value: TValue): void; // 即Add()。TODO - 有存在的必要吗?
|
||||
Remove(Key: TKey): void;
|
||||
GetMaxIndex(): number; // TODO - 接口注释要说明返回的是kv的索引。只有调用了Empty后才会返回0
|
||||
IsValidIndex(Index: number): boolean;
|
||||
GetKey(Index: number): TKey; // TODO - 对于非法index,是否应该返回undefined
|
||||
Empty(): void;
|
||||
[Symbol.iterator](): IterableIterator<[TKey, TValue]>;
|
||||
}
|
||||
|
||||
interface TSharedPtr<T> {
|
||||
__tid_SharedPtr: T
|
||||
Equals(other: TSharedPtr<T>):boolean
|
||||
}
|
||||
|
||||
type BuiltinBool = 0;
|
||||
type BuiltinByte = 1;
|
||||
type BuiltinInt = 2;
|
||||
type BuiltinFloat = 3;
|
||||
type BuiltinDouble = 4;
|
||||
type BuiltinInt64 = 5;
|
||||
type BuiltinString = 6;
|
||||
type BuiltinText = 7;
|
||||
type BuiltinName = 8;
|
||||
|
||||
const BuiltinBool = 0;
|
||||
const BuiltinByte = 1;
|
||||
const BuiltinInt = 2;
|
||||
const BuiltinFloat = 3;
|
||||
const BuiltinDouble = 4;
|
||||
const BuiltinInt64 = 5;
|
||||
const BuiltinString = 6;
|
||||
const BuiltinText = 7;
|
||||
const BuiltinName = 8;
|
||||
|
||||
type ContainerKVType<T> =
|
||||
T extends BuiltinBool ? boolean :
|
||||
T extends BuiltinByte | BuiltinInt | BuiltinFloat | BuiltinDouble ? number :
|
||||
T extends BuiltinInt64 ? bigint :
|
||||
T extends BuiltinString | BuiltinText | BuiltinName ? string :
|
||||
T extends {__typeKeyDoNoAccess: infer R} ? R :
|
||||
T extends {new (...args:any[]): infer R} ? R :
|
||||
never;
|
||||
|
||||
type SupportedContainerKVType = BuiltinBool | BuiltinByte | BuiltinInt | BuiltinFloat | BuiltinDouble | BuiltinInt64 | BuiltinString | BuiltinText | BuiltinName | {StaticClass(): Class} | {StaticStruct(): ScriptStruct} | {__typeKeyDoNoAccess: any}
|
||||
|
||||
function NewArray<T extends SupportedContainerKVType>(t: T): TArray<ContainerKVType<T>>;
|
||||
function NewSet<T extends SupportedContainerKVType>(t: T): TSet<ContainerKVType<T>>;
|
||||
function NewMap<TKey extends SupportedContainerKVType, TValue extends SupportedContainerKVType>(k: TKey, v: TValue): TMap<ContainerKVType<TKey>, ContainerKVType<TValue>>;
|
||||
|
||||
type DataPropertyNames<T> = {
|
||||
[K in keyof T]: T[K] extends (...args: any) => any ? never : K;
|
||||
}[keyof T];
|
||||
|
||||
type DataPropertiesOnly<T> = {
|
||||
[P in DataPropertyNames<T>]: T[P] extends object ? DataPropertiesOnly<T[P]> : T[P]
|
||||
};
|
||||
|
||||
function NewObject(Cls: Class, Outer?: Object, Name?:string, ObjectFlags?: number, JsTakeRef?: boolean): Object;
|
||||
|
||||
function NewStruct(St: ScriptStruct): object;
|
||||
|
||||
function FNameLiteral(str:string):string;
|
||||
|
||||
type TWeakObjectPtr<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
}
|
||||
|
||||
type TSoftObjectPtr<T> = {
|
||||
Get():T;
|
||||
LoadSynchronous(): T;
|
||||
}
|
||||
|
||||
type TLazyObjectPtr<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
}
|
||||
|
||||
type TSubclassOf<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
}
|
||||
|
||||
type TSoftClassPtr<T> = {
|
||||
Get():Class;
|
||||
LoadSynchronous(): Class;
|
||||
}
|
||||
|
||||
class UInt64Ptr { }
|
||||
|
||||
class FloatPtr { }
|
||||
|
||||
class DoublePtr { }
|
||||
|
||||
class Int64Ptr { }
|
||||
|
||||
class UInt32Ptr { }
|
||||
|
||||
class Int32Ptr { }
|
||||
|
||||
class CharPtr { }
|
||||
|
||||
class ShortPtr { }
|
||||
|
||||
class BoolPtr { }
|
||||
|
||||
class StringPtr { }
|
||||
|
||||
}
|
||||
+2047
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user