Add to ConceptSingleton to PABCSystem

This commit is contained in:
Bogdan Voloshin 2018-04-13 16:53:20 +03:00
parent a6c6ce9f8f
commit cd9912deb7
3 changed files with 54 additions and 0 deletions

View file

@ -2048,6 +2048,24 @@ type
constructor(ptr: pointer);
end;
type
///--
__ConceptSingleton<T> = class where T: constructor;
class _instance: T;
class inited: boolean := false;
public
class function &Instance: T;
begin
if inited = false then
begin
inited := true;
_instance := new T;
end;
Result := _instance;
end;
end;
// -----------------------------------------------------
// Internal procedures for PABCRTL.dll
// -----------------------------------------------------

View file

@ -1966,6 +1966,24 @@ type
constructor(ptr: pointer);
end;
type
///--
__ConceptSingleton<T> = class where T: constructor;
class _instance: T;
class inited: boolean := false;
public
class function &Instance: T;
begin
if inited = false then
begin
inited := true;
_instance := new T;
end;
Result := _instance;
end;
end;
// -----------------------------------------------------
// Internal procedures for PABCRTL.dll
// -----------------------------------------------------

View file

@ -2048,6 +2048,24 @@ type
constructor(ptr: pointer);
end;
type
///--
__ConceptSingleton<T> = class where T: constructor;
class _instance: T;
class inited: boolean := false;
public
class function &Instance: T;
begin
if inited = false then
begin
inited := true;
_instance := new T;
end;
Result := _instance;
end;
end;
// -----------------------------------------------------
// Internal procedures for PABCRTL.dll
// -----------------------------------------------------