text stringlengths 14 6.51M |
|---|
{------------------------------------
功能说明:平台主窗体
创建日期:2008/11/17
作者:wzw
版权:wzw
-------------------------------------}
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MainFormIntf, Menus, ExtCtrls, ComCtrls, ToolWin, Buttons, SvcInfoIntf,
ImgList, StdCtrls, System.ImageList;
type
PShortCutItem = ^RShortCutItem;
RShortCutItem = record
aCaption: String[255];
onClick: TShortCutClick;
end;
Tfrm_Main = class(TForm, IMainForm, IFormMgr, ISvcInfoEx)
MainMenu: TMainMenu;
StatusBar: TStatusBar;
ImageList1: TImageList;
ToolBar1: TToolBar;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FShortCutList: TList;
procedure ShowShortCutForm;
procedure HandleException(Sender: TObject; E: Exception);
protected
{IMainForm}
//注册普通菜单
function CreateMenu(const Path: string; MenuClick: TNotifyEvent): TObject;
//取消注册菜单
procedure DeleteMenu(const Path: string);
//创建工具栏
function CreateToolButton(const aCaption: String; onClick: TNotifyEvent; Hint: String = ''): TObject;
//注册快捷菜单
procedure RegShortCut(const aCaption: string; onClick: TShortCutClick);
//显示状态
procedure ShowStatus(PnlIndex: Integer; const Msg: string);
//退出程序
procedure ExitApplication;
//给ImageList添加图标
function AddImage(Img: TGraphic): Integer;
{IFormMgr}
function FindForm(const FormClassName: string): TForm;
function CreateForm(FormClass: TFormClass; SingleInstance: Boolean = True): TForm;
procedure CloseForm(aForm: TForm);
{ISvrInfoEx}
procedure GetSvcInfo(Intf: ISvcInfoGetter);
public
end;
ERegShortCutException = class(Exception);
var
frm_Main: Tfrm_Main;
implementation
uses ShortCutFormUnit, ExceptionHandle, SysFactoryEx, SysSvc;
{$R *.dfm}
{ Tfrm_Main }
procedure Tfrm_Main.GetSvcInfo(Intf: ISvcInfoGetter);
var SvcInfo: TSvcInfoRec;
begin
SvcInfo.ModuleName := ExtractFileName(ParamStr(0));
SvcInfo.GUID := GUIDToString(IMainForm);
SvcInfo.Title := '主窗体接口(IMainForm)';
SvcInfo.Version := '20100421.001';
SvcInfo.Comments := '封装一些主窗体的操作,比如创建菜单、在状态显示信息或退出系统等。';
Intf.SvcInfo(SvcInfo);
SvcInfo.GUID := GUIDToString(IFormMgr);
SvcInfo.Title := '窗体管理接口(IFormMgr)';
SvcInfo.Version := '20100421.001';
SvcInfo.Comments := '封装一些窗体的操作,比如新建一个窗体,查找已创建的窗体等。';
Intf.SvcInfo(SvcInfo);
end;
function Tfrm_Main.CreateForm(FormClass: TFormClass; SingleInstance: Boolean = True): TForm;
var newForm: TForm;
begin
newForm := nil;
Result := nil;
if assigned(FormClass) then
begin
if SingleInstance then
newForm := FindForm(FormClass.ClassName);
if newForm = Nil then
begin
newForm := FormClass.Create(application);
newForm.FormStyle := fsMDIChild;
newForm.Show;
end
else
begin
if newForm.WindowState = wsMinimized then
newForm.WindowState := wsNormal;
newForm.BringToFront;
end;
Result := newForm;
end;
end;
procedure Tfrm_Main.ExitApplication;
begin
self.Close;
end;
function Tfrm_Main.FindForm(const FormClassName: string): TForm;
var i: integer;
begin
Result := nil;
for i := 0 to self.MDIChildCount - 1 do
begin
if UpperCase(self.MDIChildren[i].ClassName) =
UpperCase(FormClassName) then
begin
Result := self.MDIChildren[i];
exit;
end;
end;
end;
procedure Tfrm_Main.FormCreate(Sender: TObject);
begin
Application.OnException := HandleException;
FShortCutList := TList.Create;
TObjFactoryEx.Create([IMainForm, IFormMgr, IShortCutClick], self);
end;
procedure Tfrm_Main.FormDestroy(Sender: TObject);
var i: integer;
begin
for i := 0 to FShortCutList.Count - 1 do
disPose(PShortCutItem(FShortCutList[i]));
FShortCutList.Free;
end;
procedure Tfrm_Main.FormShow(Sender: TObject);
begin
ShowShortCutForm;
end;
procedure Tfrm_Main.HandleException(Sender: TObject; E: Exception);
begin
frm_Exception := Tfrm_Exception.Create(nil);
try
frm_Exception.ExceptionClass := E.ClassName;
if Sender.InheritsFrom(TComponent) then
frm_Exception.SourceClass := TComponent(Sender).Name;
frm_Exception.ExceptionMsg := E.Message;
frm_Exception.ShowModal;
finally
frm_Exception.Free;
end;
end;
function Tfrm_Main.CreateMenu(const Path: string; MenuClick: TNotifyEvent): TObject;
var aList: TStrings;
newItem: TMenuItem;
function CreateMenuItem(aList: TStrings): TMenuItem;
var i: integer;
pItem, aItem: TMenuItem;
itemCaption: string;
begin
aItem := nil;
pItem := MainMenu.Items;
for i := 0 to aList.count - 1 do
begin
itemCaption := aList[i];
aItem := pItem.Find(itemCaption);
if aItem = Nil then
begin
aItem := TMenuItem.Create(self);
//aItem.Name:=...
aItem.Caption := itemCaption;
pItem.Add(aItem);
end;
pItem := aItem;
end;
Result := aItem;
end;
begin
Result := nil;
if trim(path) = '' then
Exit;
aList := TStringList.Create;
try
ExtractStrings(['\'], [], Pchar(Path), aList);
newItem := CreateMenuItem(aList);
newItem.OnClick := MenuClick;
Result := newItem;
finally
aList.Free;
end;
end;
procedure Tfrm_Main.RegShortCut(const aCaption: string; onClick: TShortCutClick);
var ShortCutItem: PShortCutItem;
begin
if trim(aCaption) = '' then
Exit;
new(ShortCutItem);
ShortCutItem^.aCaption := ShortString(aCaption);
ShortCutItem^.onClick := onClick;
FShortCutList.Add(ShortCutItem);
end;
procedure Tfrm_Main.ShowShortCutForm;
var aForm: Tform;
i: integer;
begin
aForm := self.FindForm(TFrm_Shortcut.ClassName);
if aForm = Nil then
begin
frm_ShortCut := TFrm_Shortcut.Create(self);
//显示快捷方式(常用功能)
for i := 0 to FShortCutList.Count - 1 do
frm_ShortCut.RegShotcutItem(PShortCutItem(FShortCutList[i]));
frm_ShortCut.show;
end
else
begin
if aForm.WindowState = wsMinimized then
aForm.WindowState := wsNormal
else aForm.BringToFront;
end;
end;
procedure Tfrm_Main.ShowStatus(PnlIndex: Integer; const Msg: string);
begin
if (PnlIndex >= 0) and (PnlIndex < StatusBar.Panels.Count - 1) then
StatusBar.Panels[PnlIndex].Text := msg;
end;
procedure Tfrm_Main.DeleteMenu(const Path: string);
begin
//
end;
function Tfrm_Main.AddImage(Img: TGraphic): Integer;
begin
Result := -1;
if Img = nil then
exit;
if Img is TBitmap then
Result := self.ImageList1.Add(TBitmap(Img), TBitmap(Img))
else
if Img is TIcon then
Result := self.ImageList1.AddIcon(TIcon(Img));
end;
function Tfrm_Main.CreateToolButton(const aCaption: String;
onClick: TNotifyEvent; Hint: String): TObject;
var ToolButton: TToolButton;
begin
ToolButton := TToolButton.Create(self);
ToolButton.Parent := self.ToolBar1;
ToolButton.Left := ToolBar1.Buttons[ToolBar1.ButtonCount - 1].Left + ToolBar1.Buttons[ToolBar1.ButtonCount - 1].Width;
if aCaption = '-' then//是分隔
begin
ToolButton.Style := tbsDivider;
ToolButton.Width := 8;
end
else
begin
ToolButton.Caption := aCaption;
ToolButton.OnClick := onClick;
if Hint <> '' then
begin
ToolButton.ShowHint := True;
ToolButton.Hint := Hint;
end;
end;
Result := ToolButton;
end;
procedure Tfrm_Main.CloseForm(aForm: TForm);
begin
if Assigned(aForm) then
aForm.Close;
end;
end.
|
unit Classe.Pessoa;
interface
uses
System.Classes, Interfaces;
type
TPessoa = class
private
ttt : String;
protected
hhh : String;
public
Nome: String;
Telefone: String;
Endereco: String;
Cidade: String;
UF: String;
Conexao : IConexao;
Tipo : String;
constructor Create(aConexao : IConexao); virtual;
procedure Cadastrar;
procedure CriarFinanceiro;
function GetHHH : String;
end;
implementation
uses
System.SysUtils;
{ TCliente }
procedure TPessoa.Cadastrar;
var
Lista : TStringList;
begin
Lista := TStringList.Create;
try
Lista.Add('Nome:' + Nome);
Lista.Add('Telefone:' + Telefone);
Lista.Add('Enderešo:' + Endereco);
Lista.Add('Cidade:' + Cidade);
Lista.Add('UF:' + UF);
Lista.SaveToFile(Nome + '_Cliente.txt');
Conexao.Gravar;
finally
Lista.Free;
end;
end;
constructor TPessoa.Create(aConexao : IConexao);
begin
Conexao := aConexao;
UF := 'RJ';
end;
procedure TPessoa.CriarFinanceiro;
var
Lista : TStringList;
begin
Lista := TStringList.Create;
try
Lista.Add('Nome:' + Nome);
Lista.SaveToFile(Nome + '_Financeiro.txt');
finally
Lista.Free;
end;
end;
function TPessoa.GetHHH: String;
begin
Result := hhh;// FormatCurr('#,##0.00', hhh);
end;
end.
|
unit SetPads;
interface
uses
Windows, SysUtils, Classes, Pad, SetInit, Forms, Graphics, SetBtn;
type
TPads = class(TList)
private
FLastPadID: Integer;
procedure SetPadID(frmPad: TfrmPad);
function Get(Index: Integer): TfrmPad;
public
CtrlTabActivate: Boolean;
Destroying: Boolean;
property Items[Index: Integer]: TfrmPad read Get; default;
constructor Create;
destructor Destroy; override;
procedure Clear; override;
function New(BasePad: TfrmPad): TfrmPad;
procedure Close(frmPad: TfrmPad);
procedure AllArrange;
procedure Load;
procedure SaveIni;
procedure BeginPads;
procedure EndPads;
function IndexOfPadID(PadID: Integer): Integer;
function PadOfID(PadID: Integer): TfrmPad;
end;
var
Pads: TPads;
implementation
constructor TPads.Create;
begin
Destroying := False;
end;
destructor TPads.Destroy;
begin
Destroying := True;
Clear;
inherited;
end;
procedure TPads.Clear;
var
i: Integer;
begin
for i := 0 to Count - 1 do
Items[i].Release;
inherited;
end;
// PadID をセットする
procedure TPads.SetPadID(frmPad: TfrmPad);
procedure IncID;
begin
Inc(FLastPadID);
if FLastPadID <= 0 then
FLastPadID := 1;
end;
var
i: Integer;
begin
IncID;
while True do
begin
i := 0;
while i < Count do
begin
if Items[i].ID = FLastPadID then
Break;
Inc(i);
end;
if i = Count then
Break;
IncID;
end;
frmPad.ID := FLastPadID;
end;
// 取得
function TPads.Get(Index: Integer): TfrmPad;
begin
Result := inherited Get(Index);
end;
// 新規パッド
function TPads.New(BasePad: TfrmPad): TfrmPad;
var
frmPad: TfrmPad;
ButtonGroup: TButtonGroup;
begin
frmPad := TfrmPad.Create(nil);
SetPadID(frmPad);
Insert(0, frmPad);
if BasePad = nil then
begin
ButtonGroup := TButtonGroup.Create;
ButtonGroup.Name := '新規';
frmPad.ButtonGroups.Add(ButtonGroup);
frmPad.GroupIndex := 0;
end
else
begin
frmPad.Assign(BasePad);
end;
frmPad.Show;
frmPad.EndUpdate;
frmPad.SaveBtn;
frmPad.SaveIni;
// Save;
Result := frmPad;
end;
// パッドを閉じる
procedure TPads.Close(frmPad: TfrmPad);
var
IniFileName: string;
begin
IniFileName := ChangeFileExt(frmPad.BtnFileName, '.ini');
Remove(frmPad);
if FileExists(IniFileName) then
DeleteFile(IniFileName);
if FileExists(frmPad.BtnFileName) then
DeleteFile(frmPad.BtnFileName);
frmPad.Release;
if Count > 0 then
begin
// フォアグラウンドを移動しておかないと OnDestroy のあとに WM_KILLFOCUS がくる
frmPad.Foreground := False;
Items[0].Show;
end;
end;
// すべてのパッドを再配置
procedure TPads.AllArrange;
var
i: Integer;
begin
for i := 0 to Count - 1 do
begin
Items[i].ButtonArrangement.Arrange;
// Items[i].ArrangeButtons ではプラグインボタンの追加削除が探知できない
Items[i].ArrangeScrolls;
Items[i].ArrangeGroupMenu;
Items[i].ArrangePluginMenu;
end;
end;
// パッドをすべて読み込む
procedure TPads.Load;
var
PadsFolder: string;
FindHandle: THandle;
Win32FindData: TWin32FindData;
BtnFileName: string;
IniFileName: string;
frmPad: TfrmPad;
ButtonGroup: TButtonGroup;
i, ID, Index: Integer;
begin
FLastPadID := UserIniFile.ReadInteger(IS_PADS, 'LastPadID', 0);
// パッドのフォルダ
PadsFolder := UserFolder + 'Pads\';
if not DirectoryExists(PadsFolder) then
ForceDirectories(PadsFolder);
FindHandle := FindFirstFile(PChar(PadsFolder + 'Pad*.btn'), Win32FindData);
if FindHandle <> INVALID_HANDLE_VALUE then
begin
while True do
begin
BtnFileName := PadsFolder + Win32FindData.cFileName;
IniFileName := ChangeFileExt(BtnFileName, '.ini');
frmPad := TfrmPad.Create(nil);
frmPad.LoadBtn(BtnFileName);
frmPad.LoadIni(IniFileName);
frmPad.ButtonArrangement.Clear;
if frmPad.ID = 0 then
SetPadID(frmPad);
Add(frmPad);
if not FindNextFile(FindHandle, Win32FindData) then
Break;
end;
Windows.FindClose(FindHandle)
end;
// パッドの順番
i := 0;
while True do
begin
ID := UserIniFile.ReadInteger(IS_PADSZORDER, IntToStr(i), 0);
if ID = 0 then
Break;
Index := IndexOf(PadOfID(ID));
if (Index >= 0) and (i < Count) then
Move(Index, i);
Inc(i);
end;
// 1つもなければ作る
if Count = 0 then
begin
frmPad := TfrmPad.Create(nil);
SetPadID(frmPad);
Add(frmPad);
ButtonGroup := TButtonGroup.Create;
ButtonGroup.Name := '新規';
frmPad.ButtonGroups.Add(ButtonGroup);
frmPad.GroupIndex := 0;
frmPad.SaveBtn;
frmPad.SaveIni;
end;
end;
// パッドをすべて書き込む
procedure TPads.SaveIni;
var
i: Integer;
begin
if not UserIniReadOnly then
begin
UserIniFile.WriteInteger(IS_PADS, 'LastPadID', FLastPadID);
UserIniFile.EraseSection(IS_PADSZORDER);
// 書き込み
for i := 0 to Count - 1 do
begin
UserIniFile.WriteInteger(IS_PADSZORDER, IntToStr(i), Items[i].ID);
try
Items[i].SaveIni;
except
on E: Exception do
Application.MessageBox(PChar(E.Message), 'エラー', MB_ICONERROR);
end;
end;
UserIniFile.UpdateFile;
end;
end;
// すべてのパッドを開始
procedure TPads.BeginPads;
var
i: Integer;
ShowList: TList;
begin
AllArrange;
ShowList := TList.Create;
try
for i := 0 to Pads.Count - 1 do
ShowList.Add(Items[i]);
for i := ShowList.Count - 1 downto 0 do
begin
TfrmPad(ShowList[i]).Show;
TfrmPad(ShowList[i]).EndUpdate;
end;
finally
ShowList.Free;
end;
if Items[0].Handle <> GetForegroundWindow then
Items[0].Foreground := False;
end;
// すべてのパッドを終了
procedure TPads.EndPads;
var
i: Integer;
begin
for i := 0 to Pads.Count - 1 do
Items[i].ButtonArrangement.Clear;
end;
// PadID のパッドのインデックスを取得
function TPads.IndexOfPadID(PadID: Integer): Integer;
var
i: Integer;
begin
i := 0;
Result := -1;
while i < Pads.Count do
begin
if Pads[i].ID = PadID then
begin
Result := i;
Break;
end;
Inc(i);
end;
end;
// PadID からパッドを取得
function TPads.PadOfID(PadID: Integer): TfrmPad;
var
Index: Integer;
begin
Index := IndexOfPadID(PadID);
if Index < 0 then
Result := nil
else
Result := Items[Index];
end;
end.
|
unit Unit_memoryStreamServer;
{ ******************************************************************************
Stream Exchange Server Demo Indy 10.5.5
It just shows how to send/receive Record/Buffer.
No error handling.
by BdLm
Version March 2012
remark : load *.bmp to TImage, other file formats need more code at TImage !!!
******************************************************************************* }
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdContext, StdCtrls, IdBaseComponent, IdComponent, IdCustomTCPServer,
IdTCPServer, IdSync, Unit_Indy_Classes, Unit_Indy_Functions, Vcl.Imaging.jpeg,
Vcl.ExtCtrls;
type
TStreamServerForm = class(TForm)
IdTCPServer1: TIdTCPServer;
CheckBox1: TCheckBox;
Memo1: TMemo;
Button1: TButton;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure ClientConnected;
procedure ClientDisconnected;
procedure IdTCPServer1Execute(AContext: TIdContext);
procedure IdTCPServer1Connect(AContext: TIdContext);
procedure IdTCPServer1Disconnect(AContext: TIdContext);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
procedure ShowCannotGetBufferErrorMessage;
procedure ShowCannotSendBufferErrorMessage;
procedure StreamReceived;
{ Private declarations }
public
{ Public declarations }
aFS_s: TmemoryStream;
aFS_r: TmemoryStream;
file_send : String;
file_receive : String;
end;
var
StreamServerForm: TStreamServerForm;
MyErrorMessage: string;
implementation
{$R *.dfm}
uses Unit_DelphiCompilerversionDLG;
procedure TStreamServerForm.Button1Click(Sender: TObject);
begin
OKRightDlgDelphi.Show;
end;
procedure TStreamServerForm.CheckBox1Click(Sender: TObject);
begin
try
IdTCPServer1.Active := CheckBox1.Checked;
finally
end;
end;
procedure TStreamServerForm.ClientConnected;
begin
Memo1.Lines.Add('A Client connected');
end;
procedure TStreamServerForm.ClientDisconnected;
begin
Memo1.Lines.Add('A Client disconnected');
end;
procedure TStreamServerForm.FormCreate(Sender: TObject);
begin
IdTCPServer1.Bindings.Add.IP := '127.0.0.1';
IdTCPServer1.Bindings.Add.Port := 6000;
end;
procedure TStreamServerForm.FormDestroy(Sender: TObject);
begin
IdTCPServer1.Active := False;
end;
procedure TStreamServerForm.IdTCPServer1Connect(AContext: TIdContext);
begin
TIdNotify.NotifyMethod(ClientConnected);
end;
procedure TStreamServerForm.IdTCPServer1Disconnect(AContext: TIdContext);
begin
TIdNotify.NotifyMethod(ClientDisconnected);
end;
procedure TStreamServerForm.IdTCPServer1Execute(AContext: TIdContext);
begin
///
afS_s:= TmemoryStream.Create;
afS_r:= TmemoryStream.Create;
Memo1.Lines.Add('Server starting .... ');
Image1.Picture.Bitmap.SaveToStream(aFS_s);
aFS_s.Seek(0,soFromBeginning);
AContext.Connection.IOHandler.ReadTimeout := 9000;
if (ReceiveStream(AContext, TStream(aFS_r)) = False) then
begin
TIdNotify.NotifyMethod(ShowCannotGetBufferErrorMessage);
Exit;
end;
Memo1.Lines.Add('size received stream ' + IntToStr(aFS_r.Size));
Image1.Picture.Bitmap.LoadFromStream(aFS_R);
aFS_r.Position := 0;
Image1.Picture.Bitmap.LoadFromStream(aFS_r);
TIdNotify.NotifyMethod(StreamReceived);
if (SendStream(AContext, TStream(aFS_s)) = False) then
begin
TIdNotify.NotifyMethod(ShowCannotSendBufferErrorMessage);
Exit;
end;
Memo1.Lines.Add('Stream sent');
Memo1.Lines.Add('Server done .... ');
///
///
///
aFS_s.Free;
aFS_r.Free;
end;
procedure TStreamServerForm.StreamReceived;
begin
Memo1.Lines.Add('Stream received');
end;
procedure TStreamServerForm.ShowCannotGetBufferErrorMessage;
begin
Memo1.Lines.Add('Cannot get stream/file from client, Unknown error occured');
end;
procedure TStreamServerForm.ShowCannotSendBufferErrorMessage;
begin
Memo1.Lines.Add('Cannot send stream/file to client, Unknown error occured');
end;
end.
|
unit NovusJSONUtils;
interface
Uses NovusUtilities, Data.DBXJSON, SysUtils, JSON, NovusDateUtils, NovusDateStringUtils,
NovusStringUtils, RegularExpressions;
Type
tNovusJSONUtils = class(tNovusUtilities)
private
protected
public
class function InJSONArray(const aElement: string;const aJSONArray: TJSONArray): TJSONPair;
class function IsNullorBlank(const aValue: String): Boolean;
class function InJSONArrayToDate(const aElement: string;const aJSONArray: TJSONArray): tDateTime;
class function InJSONArrayToInt64(const aElement: string;const aJSONArray: TJSONArray): Int64;
class function InJSONArrayToString(const aElement: string;const aJSONArray: TJSONArray): String;
class function InJSONArrayToCurrency(const aElement: string;const aJSONArray: TJSONArray): Currency;
end;
implementation
class function tNovusJSONUtils.InJSONArray(const aElement: string;const aJSONArray: TJSONArray): TJSONPair;
Var
I: Integer;
begin
Result := NIL;
if Not Assigned(aJSONArray) then Exit;
for I := 0 to aJSONArray.Size-1 do
begin
if Trim(Uppercase(TJSONPair(aJSONArray.Get(i)).JSONString.Value)) = Trim(Uppercase(aElement)) then
begin
Result := TJSONPair(aJSONArray.Get(i));
Break;
end;
end;
end;
class function tNovusJSONUtils.IsNullorBlank(const aValue: String): Boolean;
begin
Result := ((Lowercase(Trim(aValue)) = 'null') or (Trim(aValue) = ''));
end;
class function tNovusJSONUtils.InJSONArrayToDate(const aElement: string;const aJSONArray: TJSONArray): tDateTime;
begin
Result := TNovusDateUtils.UnixTimeToDateTime(TNovusDateStringUtils.JSONDateStr2UnixTime(InJSONArray(aElement, aJSONArray).JsonValue.ToString));
end;
class function tNovusJSONUtils.InJSONArrayToInt64(const aElement: string;const aJSONArray: TJSONArray): Int64;
begin
Result := TNovusStringUtils.Str2Int64(InJSONArray(aElement, aJSONArray).JsonValue.Value);
end;
class function tNovusJSONUtils.InJSONArrayToString(const aElement: string;const aJSONArray: TJSONArray): String;
begin
Result := InJSONArray(aElement, aJSONArray).JsonValue.Value;
end;
class function tNovusJSONUtils.InJSONArrayToCurrency(const aElement: string;const aJSONArray: TJSONArray): Currency;
begin
Result := TNovusStringUtils.Str2Curr(InJSONArray(aElement, aJSONArray).JsonValue.Value);
end;
end.
|
unit MimeMessage;
{
Copyright (c) 2011+, HL7 and Health Intersections Pty Ltd (http://www.healthintersections.com.au)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
interface
uses
SysUtils, Classes, Contnrs,
IdHeaderList, idGlobal, IdGlobalProtocols,
StringSupport,
AdvObjects, AdvGenerics, AdvStreams, AdvMemories, AdvBuffers;
type
TMimeBase = class (TAdvObject)
private
FHeaders: TIdHeaderList;
procedure ReadHeaders(AStream : TStream);
procedure WriteHeaders(AStream : TStream);
function ReadBytes(AStream: TStream; AByteCount: Integer): AnsiString;
function ReadToValue(AStream: TStream; AValue: AnsiString): AnsiString;
public
constructor Create; override;
destructor Destroy; override;
property Headers : TIdHeaderList read FHeaders;
end;
TMimePart = class (TMimeBase)
private
FContent: TAdvBuffer;
FId : string;
procedure SetContent(const AValue: TAdvBuffer);
procedure DecodeContent;
procedure ReadFromStream(AStream : TStream; ABoundary : AnsiString);
procedure WriteToStream(AStream : TStream);
function GetMediaType: String;
function GetTransferEncoding: String;
procedure SetMediaType(const AValue: String);
procedure SetTransferEncoding(const AValue: String);
procedure SetId(const AValue: String);
function GetContentDisposition: String;
procedure SetContentDisposition(const sValue: String);
public
constructor Create; override;
destructor Destroy; override;
property Content : TAdvBuffer read FContent write SetContent;
property Id : String read FId write SetId;
property MediaType : String read GetMediaType write SetMediaType;
property ContentDisposition : String read GetContentDisposition write SetContentDisposition;
property TransferEncoding : String read GetTransferEncoding write SetTransferEncoding;
function ParamName : String;
function FileName : String;
end;
TMimeMessage = class (TMimeBase)
private
FParts: TAdvList<TMimePart>;
FBoundary : Ansistring;
FStart : String;
FMainType : String;
procedure AnalyseContentType(AContent : String);
function GetMainPart: TMimePart;
procedure Validate;
public
constructor Create; override;
destructor Destroy; override;
function Link : TMimeMessage; overload;
property Parts : TAdvList<TMimePart> read FParts;
function AddPart(id: String) : TMimePart;
property MainPart : TMimePart read GetMainPart;
property Boundary : ansistring read FBoundary write FBoundary;
property Start : String read FStart write FStart;
property MainType : String read FMainType write FMainType;
// for multi-part forms
function getparam(name : String) : TMimePart;
function hasParam(name : String) : Boolean;
procedure ReadFromStream(AStream : TStream); overload;
procedure ReadFromStream(AStream : TStream; AContentType : String); overload; // headers are not part of the stream
function GetContentTypeHeader : String;
procedure WriteToStream(AStream : TStream; AHeaders : boolean);
end;
implementation
const
ASSERT_UNIT = 'MimeMessage';
MIME_TRANSFERENCODING = 'Content-Transfer-Encoding';
MIME_DEFAULT_START = 'uuid:{FF461456-FE30-4933-9AF6-F8EB226E1BF7}';
MIME_DEFAULT_BOUNDARY = 'MIME_boundary';
MIME_ID = 'Content-ID';
EOL_WINDOWS = CR + LF;
EOL_PLATFORM = EOL_WINDOWS;
CONTENT_TYPE = 'Content-Type';
CONTENT_DISPOSITION = 'Content-Disposition';
MULTIPART_RELATED : AnsiString = 'multipart/related';
MULTIPART_FORMDATA : AnsiString = 'multipart/form-data';
MIME_BOUNDARY : AnsiString = 'boundary';
MIME_START : AnsiString = 'start';
MIME_TYPE : AnsiString = 'type';
{ Stream Readers }
function TMimeBase.ReadToValue(AStream : TStream; AValue : AnsiString):AnsiString;
const ASSERT_LOCATION = ASSERT_UNIT+'.ReadToValue';
var
c : AnsiChar;
begin
result := '';
while copy(result, length(result)-length(AValue)+1, length(AValue)) <> AValue do
begin
CheckCondition(AStream.Size - AStream.Position <> 0, ASSERT_LOCATION, 'Premature termination of stream looking for value "'+string(AValue)+'"');
AStream.Read(c, 1);
result := result + c;
end;
delete(result, length(result)-length(AValue)+1, length(AValue));
end;
function TMimeBase.ReadBytes(AStream : TStream; AByteCount : Integer):AnsiString;
const ASSERT_LOCATION = ASSERT_UNIT+'.ReadBytes';
begin
CheckCondition(AStream.Size - AStream.Position >= AByteCount, ASSERT_LOCATION, 'Premature termination of stream reading "'+inttostr(AByteCount)+'" bytes');
SetLength(result, AByteCount);
if AByteCount > 0 then
begin
AStream.Read(result[1], AByteCount);
end;
end;
{ Stream Writers }
procedure WriteString(AStream : TStream; Const AStr : AnsiString);
begin
If AStr <> '' then
begin
AStream.Write(AStr[1], length(AStr));
end;
end;
{ TMimeBase }
constructor TMimeBase.create;
begin
inherited;
FHeaders := TIdHeaderList.create(QuotePlain);
end;
destructor TMimeBase.destroy;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeBase.destroy';
begin
FreeAndNil(FHeaders);
inherited;
end;
procedure TMimeBase.ReadHeaders(AStream: TStream);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeBase.ReadHeaders';
var
LHeader : AnsiString;
LFound : Boolean;
begin
LFound := false;
repeat
LHeader := ReadToValue(AStream, EOL);
if LHeader <> '' then
begin
LFound := true;
FHeaders.Add(string(LHeader));
end
until LFound and (LHeader = '');
end;
procedure TMimeBase.WriteHeaders(AStream: TStream);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeBase.WriteHeaders';
var
i : integer;
begin
For i := 0 to FHeaders.Count - 1 do
begin
WriteString(AStream, ansiString(FHeaders[i])+EOL);
end;
WriteString(AStream, EOL);
end;
{ TMimePart }
constructor TMimePart.create;
begin
inherited;
FContent := TAdvBuffer.create;
end;
destructor TMimePart.destroy;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.destroy';
begin
FContent.Free;
inherited;
end;
function TMimePart.FileName: String;
var
s : String;
begin
s := Headers.Values['Content-Disposition'];
StringSplit(s, ';', s, result);
if (s = 'form-data') and result.Contains('filename="') then
begin
result := result.Substring(result.IndexOf('filename="')+10);
result := copy(result, 1, pos('"', result)-1);
end
else
result := '';
end;
procedure TMimePart.DecodeContent;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.DecodeContent';
var
LCnt : String;
begin
LCnt := FHeaders.Values[MIME_TRANSFERENCODING];
// possible values (rfc 2045):
// "7bit" / "8bit" / "binary" / "quoted-printable" / "base64"
// and extendible with ietf-token / x-token
// we only process base64. everything else is considered to be binary
// (this is not an email processor). Where this is a problem, notify
// the indysoap team *with an example*, and this will be extended
if AnsiSameText(LCnt, 'base64') then
begin
raise Exception.Create('not done yet');
// Content := Base64Decode(Content);
end
else
begin
// well, we leave the content unchanged
end;
end;
procedure TMimePart.ReadFromStream(AStream: TStream; ABoundary: AnsiString);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.ReadFromStream';
var
LBuffer : pansichar;
LEnd : word;
LComp0 : Pointer;
LComp1 : Pointer;
LCompLen : Word;
offset : integer;
b : TBytes;
const
BUF_LEN = 1024;
begin
ReadHeaders(AStream);
FId := FHeaders.Values[MIME_ID];
if (FId <> '') and (FId[1] = '<') then
delete(FId, 1, 1);
if (FId <> '') and (FId[length(fId)] = '>') then
delete(FId, length(FId), 1);
// do this fast
GetMem(LBuffer, BUF_LEN);
try
FillChar(LBuffer^, BUF_LEN, 0);
LEnd := 0;
LCompLen := length(ABoundary);
LComp1 := pAnsichar(ABoundary);
while true do
begin
if LEnd = BUF_LEN-1 then
begin
offset := length(b);
SetLength(b, offset + LEnd - LCompLen);
move(LBuffer^, b[offset], LEnd - LCompLen);
move(LBuffer[LEnd - LCompLen], LBuffer[0], LCompLen);
LEnd := LCompLen;
FillChar(LBuffer[LEnd], BUF_LEN - LEnd, 0);
end
else
begin
AStream.Read(LBuffer[LEnd], 1);
inc(LEnd);
end;
LComp0 := pointer(NativeUInt(LBuffer)+LEnd-LCompLen);
if (LEnd >= LCompLen) and CompareMem(LComp0, LComp1, LCompLen) then
begin
offset := length(b);
SetLength(b, offset + LEnd - (LCompLen + 2 + 2));// -2 for the EOL, +2 for the other EOL
if (length(b) > offset) then
move(LBuffer^, b[offset], LEnd - (LCompLen + 2 + 2));
FContent.AsBytes := b;
break;
end;
end;
finally
FreeMem(LBuffer);
end;
DecodeContent;
end;
procedure TMimePart.SetContent(const AValue: TAdvBuffer);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.SetContent';
begin
FContent.Free;
FContent := AValue;
end;
procedure TMimePart.WriteToStream(AStream: TStream);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.WriteToStream';
var
LTemp : AnsiString;
begin
WriteHeaders(AStream);
if FHeaders.Values[MIME_TRANSFERENCODING] = 'base64' then
begin
raise Exception.Create('not done yet');
// WriteString(AStream, Base64EncodeAnsi(FContent, true)+EOL_WINDOWS);
end
else
begin
raise Exception.Create('not done yet');
//AStream.CopyFrom(FContent, (FContent.Size - FContent.Position)-2);
// if FContent.Size - FContent.Position >= 2 then
// LTemp := ReadBytes(FContent, 2)
// else
// LTemp := '';
WriteString(AStream, LTemp);
if LTemp <> EOL_WINDOWS then
begin
WriteString(AStream, EOL_WINDOWS);
end;
end;
end;
function TMimePart.GetMediaType: String;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.GetMediaType';
begin
result := FHeaders.Values[CONTENT_TYPE];
end;
function TMimePart.GetTransferEncoding: String;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.GetTransferEncoding';
begin
result := FHeaders.Values[MIME_TRANSFERENCODING];
end;
Function StringSplit(Const sValue, sDelimiter : String; Var sLeft, sRight: String) : Boolean;
Var
iIndex : Integer;
sA, sB : String;
Begin
// Find the delimiter within the source string
iIndex := Pos(sDelimiter, sValue);
Result := iIndex <> 0;
If Not Result Then
Begin
sA := sValue;
sB := '';
End
Else
Begin
sA := Copy(sValue, 1, iIndex - 1);
sB := Copy(sValue, iIndex + Length(sDelimiter), MaxInt);
End;
sLeft := sA;
sRight := sB;
End;
function StartsWith(s, test : String):Boolean;
begin
result := lowercase(copy(s, 1, length(test))) = lowercase(test);
end;
function TMimePart.ParamName: String;
var
s : String;
begin
s := Headers.Values['Content-Disposition'];
StringSplit(s, ';', s, result);
if (s = 'form-data') and StartsWith(trim(result), 'name="') then
begin
result := copy(result, 8, $FFFF);
result := copy(result, 1, pos('"', result)-1);
end
else
result := '';
end;
procedure TMimePart.SetMediaType(const AValue: String);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.SetMediaType';
begin
FHeaders.Values[CONTENT_TYPE] := AValue;
end;
procedure TMimePart.SetTransferEncoding(const AValue: String);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.SetTransferEncoding';
begin
FHeaders.Values[MIME_TRANSFERENCODING] := AValue;
end;
procedure TMimePart.SetId(const AValue: String);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.SetId';
begin
FId := AValue;
FHeaders.Values[MIME_ID] := '<'+AValue+'>';
end;
function TMimePart.GetContentDisposition: String;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePart.GetContentDisposition';
begin
result := FHeaders.Values[CONTENT_DISPOSITION];
end;
procedure TMimePart.SetContentDisposition(const sValue: String);
begin
FHeaders.Values[CONTENT_DISPOSITION] := sValue;
end;
(*{ TMimePartList }
function TMimePartList.GetPartByIndex(i: integer): TMimePart;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePartList.GetPart';
begin
result := Items[i] as TMimePart;
end;
function TMimePartList.GetPart(AName : String): TMimePart;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePartList.GetPart';
var
i : integer;
s : String;
begin
if (AName <> '') and (AName[1] = '<') then
System.delete(AName, 1, 1);
if (AName <> '') and (AName[length(AName)] = '>') then
System.delete(AName, length(AName), 1);
result := nil;
for i := 0 to Count - 1 do
begin
s := (Items[i] as TMimePart).Id;
if s = AName then
begin
result := Items[i] as TMimePart;
exit;
end
end;
Condition(False, ASSERT_LOCATION, 'Part "'+AName+'" not found in parts '+CommaList);
end;
function TMimePartList.CommaList: String;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePartList.CommaList';
var
i : integer;
begin
result := '';
for i := 0 to Count -1 do
begin
result := CommaAdd(result, (Items[i] as TMimePart).Id);
end;
end;
function TMimePartList.AddPart(AId: String): TMimePart;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimePartList.Add';
begin
result := TMimePart.create;
result.Id := AId;
add(result);
end;
*)
{ TMimeMessage }
function IdAnsiSameText(const S1, S2: ansistring): Boolean;
begin
Result := AnsiCompareText(String(S1), String(S2)) = 0;
end;
function TMimeMessage.AddPart(id: String): TMimePart;
begin
result := TMimePart.create;
FParts.Add(result);
result.Id := id;
end;
procedure TMimeMessage.AnalyseContentType(AContent: String);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.AnalyseContentType';
var
s, l, r, id : AnsiString;
begin
// this parser is weak - and needs review
StringSplitAnsi(AnsiString(Trim(AContent)), ';', l, s);
CheckCondition(IdAnsiSameText(l, MULTIPART_RELATED) or IdAnsiSameText(l, MULTIPART_FORMDATA), ASSERT_LOCATION, 'attempt to read content as Mime, but the content-Type is "'+String(l)+'", not "'+String(MULTIPART_RELATED)+'" or "'+String(MULTIPART_FORMDATA)+'" in header '+String(AContent));
while s <> '' do
begin
StringSplitAnsi(s, ';',l, s);
StringSplitAnsi(AnsiString(trim(String(l))), '=', l, r);
CheckCondition(l <> '', ASSERT_LOCATION, 'Unnamed part in Content_type header '+AContent);
CheckCondition(r <> '', ASSERT_LOCATION, 'Unvalued part in Content_type header '+AContent);
if r[1] = '"' then
begin
delete(r, 1, 1);
end;
if r[length(r)] = '"' then
begin
delete(r, length(r), 1);
end;
if AnsiSameText(string(l), string(MIME_BOUNDARY)) then
begin
FBoundary := r;
end
else if IdAnsiSameText(l, MIME_START) then
begin
id := r;
if (id <> '') and (id[1] = '<') then
delete(id, 1, 1);
if (id <> '') and (id[length(id)] = '>') then
delete(id, length(id), 1);
FStart := string(id);
end
else if IdAnsiSameText(l, MIME_TYPE) then
begin
FMainType := String(r);
end;
end;
end;
constructor TMimeMessage.create;
begin
inherited create;
FParts := TAdvList<TMimePart>.create;
end;
destructor TMimeMessage.destroy;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.destroy';
begin
FParts.Free;
inherited;
end;
procedure TMimeMessage.ReadFromStream(AStream: TStream);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.ReadFromStream';
var
LHeader : String;
begin
ReadHeaders(AStream);
LHeader := FHeaders.Values[CONTENT_TYPE];
CheckCondition(LHeader <> '', ASSERT_LOCATION, ''+CONTENT_TYPE+' header not found in '+FHeaders.CommaText);
ReadFromStream(AStream, LHeader);
end;
function TMimeMessage.GetMainPart: TMimePart;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.GetMainPart';
begin
CheckCondition(FStart <> '', ASSERT_LOCATION, 'Start header not valid');
result := getparam(FStart);
end;
function TMimeMessage.getparam(name: String): TMimePart;
var
i: Integer;
begin
result := nil;
for i := 0 to Parts.Count - 1 do
if Parts[i].ParamName = name then
begin
result := Parts[i];
exit;
end;
end;
function TMimeMessage.hasParam(name: String): Boolean;
var
i: Integer;
begin
result := false;
for i := 0 to Parts.Count - 1 do
result := result or (Parts[i].ParamName = name);
end;
function TMimeMessage.Link: TMimeMessage;
begin
result := TMimeMessage(inherited Link);
end;
procedure TMimeMessage.ReadFromStream(AStream: TStream; AContentType: String);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.ReadFromStream';
var
LTemp : AnsiString;
LPart : TMimePart;
begin
CheckCondition(AContentType <> '', ASSERT_LOCATION, 'Content-Type header not valid');
AnalyseContentType(AContentType);
LTemp := ReadToValue(AStream, FBoundary);
// that was getting going. usually LTemp would be empty, but we will throw it away
repeat
LTemp := ReadBytes(AStream, 2);
if LTemp = EOL then
begin
LPart := TMimePart.create;
try
LPart.ReadFromStream(AStream, FBoundary);
except
FreeAndNil(LPart);
raise;
end;
FParts.Add(LPart);
end
until LTemp = '--';
end;
function TMimeMessage.GetContentTypeHeader: String;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.GetContentTypeHeader';
begin
result := String(MULTIPART_RELATED)+'; type="application/xop+xml"; '+String(MIME_START)+'="'+FStart+'"; start-info="application/soap+xml"; '+String(MIME_BOUNDARY)+'="'+String(FBoundary)+'"; action="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b"';
if FMainType <> '' then
begin
result := result + '; '+String(MIME_TYPE)+'="'+FMainType+'"';
end;
// oracle Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@soapui.org>"; start-info="application/soap+xml"; action="ProvideAndRegisterDocumentSet-b"; boundary="----=_Part_2_2098391526.1311207545005"
end;
procedure TMimeMessage.Validate;
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.Validate';
var
i, j : integer;
LFound : boolean;
begin
CheckCondition(FBoundary <> '', ASSERT_LOCATION, 'Boundary is not valid');
CheckCondition(FStart <> '', ASSERT_LOCATION, 'Start is not valid');
LFound := false;
for i := 0 to FParts.Count - 1 do
begin
CheckCondition(FParts[i].Id <> '', ASSERT_LOCATION, 'Part['+inttostr(i)+'].Id is not valid');
LFound := LFound or (FParts[i].Id = FStart);
for j := 0 to i - 1 do
begin
CheckCondition(FParts[i].Id <> FParts[j].Id, ASSERT_LOCATION, 'Part['+inttostr(i)+'].Id is a duplicate of Part['+inttostr(j)+'].Id ("'+FParts[i].Id+'")');
end;
end;
CheckCondition(LFound, ASSERT_LOCATION, 'The Start Part "'+FStart+'" was not found in the part list');
end;
procedure TMimeMessage.WriteToStream(AStream: TStream; AHeaders: boolean);
const ASSERT_LOCATION = ASSERT_UNIT+'.TMimeMessage.WriteToStream';
var
i : integer;
begin
Validate;
if AHeaders then
begin
WriteHeaders(AStream);
end;
for i := 0 to FParts.Count - 1 do
begin
WriteString(AStream, '--'+FBoundary+EOL);
FParts[i].WriteToStream(AStream);
end;
WriteString(AStream, '--'+FBoundary+'--');
end;
end.
|
unit SQLFunction;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls, ShellApi,
Data.DB, Datasnap.DBClient, Datasnap.Win.MConnect, Datasnap.Win.SConnect,
System.Win.ScktComp, Data.Win.ADODB, DBXJSON, Vcl.Grids, Vcl.DBGrids,
Data.FMTBcd, Data.SqlExpr, Data.DBXMSSQL, Vcl.ExtCtrls, DataSetJSONConverter4D,
Vcl.Mask, Vcl.DBCtrls;
type
ESQLFunctionException = class(Exception);
TSQLFunction = class(TObject)
rows : string; // selected data from sql
function prepareRows(const vArray: TJSONArray) : string;
end;
implementation
{
* This function will select all rows from table
* @param const sqlStr (string) - full SQL correct string to execute
}
function TSQLFunction.prepareRows(const vArray: TJSONArray) : string;
begin
if( vArray = nil) then
raise ESQLFunctionException.Create('Empty str string to execute');
Result := vArray.ToString;
end;
end.
|
unit SetupRec;
// -------------------------------------------------------------
// Sampling rate and input channel calibration setup dialog box
// -------------------------------------------------------------
// 7.10.03 ... Scaling factor now set correctly when calibration changed
// 21.07.05 ... A/D Input mode (differential/single ended) can now be set
// 23.09.12 ... SESLABIO. properties now updated instead of Main.
// 18.12.15 ... Input channel can now be remapped
// Sampling interval now updated correctly and digital filter selection now works correctly
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Grids, ComCtrls, ValEdit, ValidatedEdit, math ;
type
TSetupRecFrm = class(TForm)
GroupBox1: TGroupBox;
lbNumChannels: TLabel;
lbSamplingInterval: TLabel;
Label4: TLabel;
edNumChannels: TValidatedEdit;
edSamplingInterval: TValidatedEdit;
edDigitalFilter: TEdit;
udFilterFactor: TUpDown;
Channels: TGroupBox;
lbADCVoltageRange: TLabel;
ChannelTable: TStringGrid;
bOK: TButton;
Button1: TButton;
GroupBox2: TGroupBox;
ckBackupEnabled: TCheckBox;
edBackupInterval: TValidatedEdit;
Label1: TLabel;
Label2: TLabel;
Panel0: TPanel;
cbADCVoltageRange0: TComboBox;
cbAIInput0: TComboBox;
Panel1: TPanel;
cbADCVoltageRange1: TComboBox;
cbAIInput1: TComboBox;
Panel2: TPanel;
cbADCVoltageRange2: TComboBox;
cbAIInput2: TComboBox;
Panel3: TPanel;
cbADCVoltageRange3: TComboBox;
cbAIInput3: TComboBox;
Panel4: TPanel;
cbADCVoltageRange4: TComboBox;
cbAIInput4: TComboBox;
Panel5: TPanel;
cbADCVoltageRange5: TComboBox;
cbAIInput5: TComboBox;
Panel6: TPanel;
cbADCVoltageRange6: TComboBox;
cbAIInput6: TComboBox;
Panel7: TPanel;
cbADCVoltageRange7: TComboBox;
cbAIInput7: TComboBox;
procedure FormShow(Sender: TObject);
procedure bOKClick(Sender: TObject);
procedure edNumChannelsKeyPress(Sender: TObject; var Key: Char);
procedure SetADCVoltageRangeAndChannel(
Chan : Integer ;
cbADCVoltageRange : TComboBox ;
cbAIChannel : TComboBox ) ;
procedure udFilterFactorChanging(Sender: TObject; var AllowChange: Boolean);
procedure udFilterFactorChangingEx(Sender: TObject;
var AllowChange: Boolean; NewValue: SmallInt;
Direction: TUpDownDirection);
private
{ Private declarations }
VRange : Array[0..15] of Single ;
NumVRange : Integer ;
DigitalFilterFactor : Single ;
procedure UpdateParameters ;
procedure FillCalibrationTable ;
procedure UpdateVoltageRange(
Chan : Integer;
cbADCVoltageRange : TComboBox ;
cbADCChannel : TComboBox ) ;
public
{ Public declarations }
end;
var
SetupRecFrm: TSetupRecFrm;
function LPFilterCutoff( Factor : single ) : string ;
implementation
uses Main, shared ;
{$R *.DFM}
const
ChNum = 0 ;
ChName = 1 ;
ChCal = 2 ;
ChAmp = 3 ;
ChUnits = 4 ;
procedure TSetupRecFrm.FormShow(Sender: TObject);
{ ---------------------------------------------------------------------------
Initialise setup's combo lists and tables with current recording parameters
---------------------------------------------------------------------------}
var
EndChannel,LeftAt,TopAt : Integer ;
begin
DigitalFilterFactor := MainFrm.DigitalFilter.Factor ;
EdNumChannels.Value := MainFrm.SESLabIO.ADCNumChannels ;
edSamplingInterval.Value := MainFrm.SESLabIO.ADCSamplingInterval ;
UpdateParameters ;
{ Set channel calibration table }
FillCalibrationTable ;
{ Set trace colour box }
EndChannel := MainFrm.SESLabIO.ADCNumChannels - 1 ;
LeftAt := ChannelTable.Left + ChannelTable.Width + 2 ;
TopAt := ChannelTable.Top + 2 ;
// Place input voltage range and channel number
Panel0.Left := LeftAt ;
Panel0.Top := TopAt + (ChannelTable.DefaultRowHeight+1) ;
Panel1.Left := LeftAt ;
Panel1.Top := TopAt + (ChannelTable.DefaultRowHeight+1)*2 ;
Panel2.Left := LeftAt ;
Panel2.Top := TopAt + (ChannelTable.DefaultRowHeight+1)*3 ;
Panel3.Left := LeftAt ;
Panel3.Top := TopAt + (ChannelTable.DefaultRowHeight+1)*4 ;
Panel4.Left := LeftAt ;
Panel4.Top := TopAt + (ChannelTable.DefaultRowHeight+1)*5 ;
Panel5.Left := LeftAt ;
Panel5.Top := TopAt + (ChannelTable.DefaultRowHeight+1)*6 ;
Panel6.Left := LeftAt ;
Panel6.Top := TopAt + (ChannelTable.DefaultRowHeight+1)*7 ;
Panel7.Left := LeftAt ;
Panel7.Top := TopAt + (ChannelTable.DefaultRowHeight+1)*8 ;
// Trace colour boxes
LeftAt := cbADCVoltageRange0.Left + cbADCVoltageRange0.Width + 5 ;
// Select the current A/D converter range in use
SetADCVoltageRangeAndChannel( 0, cbADCVoltageRange0, cbAIInput0 ) ;
SetADCVoltageRangeAndChannel( 1, cbADCVoltageRange1, cbAIInput1 ) ;
SetADCVoltageRangeAndChannel( 2, cbADCVoltageRange2, cbAIInput2 ) ;
SetADCVoltageRangeAndChannel( 3, cbADCVoltageRange3, cbAIInput3 ) ;
SetADCVoltageRangeAndChannel( 4, cbADCVoltageRange4, cbAIInput4 ) ;
SetADCVoltageRangeAndChannel( 5, cbADCVoltageRange5, cbAIInput5 ) ;
SetADCVoltageRangeAndChannel( 6, cbADCVoltageRange6, cbAIInput6 ) ;
SetADCVoltageRangeAndChannel( 7, cbADCVoltageRange7, cbAIInput7 ) ;
ChannelTable.cells[ChNum,0] := 'Ch.' ;
ChannelTable.ColWidths[ChNum] := ChannelTable.DefaultColWidth div 2 ;
ChannelTable.cells[ChName,0] := 'Name' ;
ChannelTable.cells[ChCal,0] := 'V/Units' ;
ChannelTable.ColWidths[ChCal] := (4 * ChannelTable.DefaultColWidth) div 2 ;
ChannelTable.cells[ChAmp,0] := 'Amp. Gain' ;
ChannelTable.ColWidths[ChAmp] := (3 * ChannelTable.DefaultColWidth) div 2 ;
ChannelTable.cells[ChUnits,0] := 'Units' ;
ChannelTable.RowCount := MainFrm.SESLabIO.ADCNumChannels + 1 ;
ChannelTable.options := [goEditing,goHorzLine,goVertLine] ;
// Automatic data file backup
ckBackupEnabled.Checked := MainFrm.BackupEnabled ;
edBackupInterval.Value := MainFrm.BackupInterval ;
end ;
procedure TSetupRecFrm.FillCalibrationTable ;
// ------------------------------
// Fill channel calibration table
// ------------------------------
var
ch,ADCScaleTo16Bit : Integer ;
begin
ADCScaleTo16Bit := (MainFrm.ADCMaxValue+1) div MainFrm.SESLabIO.ADCMaxValue ;
{ Set channel calibration table }
ChannelTable.RowCount := MainFrm.SESLabIO.ADCNumChannels+1 ;
for ch := 0 to MainFrm.SESLabIO.ADCNumChannels-1 do begin
ChannelTable.cells[ChNum,ch+1] := format('%d',[ch]);
ChannelTable.cells[ChName,ch+1] := MainFrm.SESLabIO.ADCChannelName[ch] ;
ChannelTable.cells[ChCal,ch+1] := Format( '%10.4g',
[MainFrm.SESLabIO.ADCChannelVoltsPerUnit[ch]/
ADCScaleTo16Bit] ) ;
ChannelTable.cells[ChAmp,ch+1] := Format( '%10.4g',
[MainFrm.SESLabIO.ADCChannelGain[ch]] ) ;
ChannelTable.cells[ChUnits,ch+1] := MainFrm.SESLabIO.ADCChannelUnits[ch] ;
end ;
end ;
procedure TSetupRecFrm.SetADCVoltageRangeAndChannel(
Chan : Integer ;
cbADCVoltageRange : TComboBox ;
cbAIChannel : TComboBox ) ;
var
i : Integer ;
Diff,MinDiff : single ;
RangeInList : Boolean ;
begin
// Set up A/D Converter voltage range selection box
cbADCVoltageRange.clear ;
MainFrm.SESLabIO.GetADCVoltageRanges( VRange, NumVRange) ;
for i := 0 to NumVRange-1 do begin
cbADCVoltageRange.items.addObject( format(
' +/- %.3g V ',
[VRange[i]]),
TObject(VRange[i]));
end ;
MinDiff := 1E30 ;
RangeInList := False ;
for i := 0 to NumVRange-1 do begin
Diff := Abs(MainFrm.SESLabIO.ADCChannelVoltageRange[Chan]-VRange[i]) ;
if MinDiff >= Diff then begin
MinDiff := Diff ;
cbADCVoltageRange.ItemIndex := i ;
RangeInList := True ;
end ;
end ;
if not RangeInList then begin
cbADCVoltageRange.items.addObject( format(
' +/- %.3g V ',
[MainFrm.SESLabIO.ADCChannelVoltageRange[Chan]]),
TObject(MainFrm.SESLabIO.ADCChannelVoltageRange[Chan]));
end ;
// Input channels
cbAIChannel.Clear ;
for i := 0 to MainFrm.SESLabIO.ADCMaxChannels-1 do begin
cbAIChannel.Items.Add(format('AI%d',[i]));
end;
cbAIChannel.ItemIndex := Min(Max(MainFrm.SESLabIO.ADCChannelInputNumber[Chan],
0),cbAIChannel.Items.Count-1) ;
end ;
procedure TSetupRecFrm.UpdateParameters ;
// -----------------
// Update parameters
// -----------------
begin
MainFrm.SESLabIO.ADCNumChannels := Round(edNumChannels.Value) ;
edNumChannels.Value := MainFrm.SESLabIO.ADCNumChannels ;
// Make voltage range / input channel panels visible
Panel0.Visible := True ;
Panel1.Visible := False ;
Panel2.Visible := False ;
Panel3.Visible := False ;
Panel4.Visible := False ;
Panel5.Visible := False ;
Panel6.Visible := False ;
Panel7.Visible := False ;
if MainFrm.SESLabIO.ADCNumChannels >= 2 then Panel1.Visible := True ;
if MainFrm.SESLabIO.ADCNumChannels >= 3 then Panel2.Visible := True ;
if MainFrm.SESLabIO.ADCNumChannels >= 4 then Panel3.Visible := True ;
if MainFrm.SESLabIO.ADCNumChannels >= 5 then Panel4.Visible := True ;
if MainFrm.SESLabIO.ADCNumChannels >= 6 then Panel5.Visible := True ;
if MainFrm.SESLabIO.ADCNumChannels >= 7 then Panel6.Visible := True ;
if MainFrm.SESLabIO.ADCNumChannels >= 7 then Panel7.Visible := True ;
{ Set recording parameters }
MainFrm.SESLabIO.ADCSamplingInterval := EdSamplingInterval.Value ;
EdSamplingInterval.Value := MainFrm.SESLabIO.ADCSamplingInterval ;
{ Digital low-pass filter constant }
edDigitalFilter.text := LPFilterCutOff( MainFrm.DigitalFilter.Factor ) ;
end ;
procedure TSetupRecFrm.bOKClick(Sender: TObject);
var
ch,ADCScaleTo16Bit : Integer ;
begin
{ Recording parameters }
MainFrm.SESLabIO.ADCNumChannels := Round(edNumChannels.Value) ;
MainFrm.SESLabIO.ADCSamplingInterval := edSamplingInterval.Value ;
ADCScaleTo16Bit := (MainFrm.ADCMaxValue+1) div MainFrm.SESLabIO.ADCMaxValue ;
// Digital low pass filter factor
MainFrm.DigitalFilter.Factor := DigitalFilterFactor ;
// A/D converter voltage range
UpdateVoltageRange( 0, cbADCVoltageRange0, cbAIInput0 ) ;
UpdateVoltageRange( 1, cbADCVoltageRange1, cbAIInput1 ) ;
UpdateVoltageRange( 2, cbADCVoltageRange2, cbAIInput2 ) ;
UpdateVoltageRange( 3, cbADCVoltageRange3, cbAIInput3 ) ;
UpdateVoltageRange( 4, cbADCVoltageRange4, cbAIInput4 ) ;
UpdateVoltageRange( 5, cbADCVoltageRange5, cbAIInput5 ) ;
UpdateVoltageRange( 6, cbADCVoltageRange6, cbAIInput6 ) ;
UpdateVoltageRange( 7, cbADCVoltageRange7, cbAIInput7 ) ;
{ Channel calibration }
for ch := 0 to MainFrm.SESLabIO.ADCNumChannels-1 do begin
MainFrm.SESLabIO.ADCChannelName[ch] := ChannelTable.cells[ChName,ch+1] ;
MainFrm.SESLabIO.ADCChannelVoltsPerUnit[ch] := ADCScaleTo16Bit*ExtractFloat(
ChannelTable.cells[ChCal,ch+1],1. );
MainFrm.SESLabIO.ADCChannelGain[ch] := ExtractFloat(
ChannelTable.cells[ChAmp,ch+1],1. );
MainFrm.SESLabIO.ADCChannelUnits[ch] := ChannelTable.cells[ChUnits,ch+1] ;
end ;
// Automatic data file backup
MainFrm.BackupEnabled := ckBackupEnabled.Checked ;
MainFrm.BackupInterval := edBackupInterval.Value ;
// Save to data file
MainFrm.SaveToDataFile( MainFrm.SaveFileName ) ;
end;
procedure TSetupRecFrm.UpdateVoltageRange(
Chan : Integer;
cbADCVoltageRange : TComboBox ;
cbADCChannel : TComboBox ) ;
// --------------------------------------
// Update voltage range and input channel
// --------------------------------------
var
NewRange : Single ;
begin
NewRange := Single(cbADCVoltageRange.Items.Objects[cbADCVoltageRange.ItemIndex]) ;
MainFrm.SESLabIO.ADCChannelVoltageRange[Chan] := NewRange ;
MainFrm.SESLabIO.ADCChannelInputNumber[Chan] := Max(cbADCChannel.ItemIndex,0);
end ;
procedure TSetupRecFrm.edNumChannelsKeyPress(Sender: TObject;
var Key: Char);
begin
MainFrm.SESLabIO.ADCNumChannels := Round(edNumChannels.Value) ;
if key = #13 then begin
FillCalibrationTable ;
UpdateParameters ;
end ;
end;
procedure TSetupRecFrm.udFilterFactorChanging(Sender: TObject;
var AllowChange: Boolean);
var
Factor : single ;
begin
Factor := udFilterFactor.Position*0.1 ;
EdDigitalFilter.text := LPFilterCutoff( Factor ) ;
outputdebugstring(pchar(format('%d %4g',[udFilterFactor.Position,Factor])));
end;
procedure TSetupRecFrm.udFilterFactorChangingEx(Sender: TObject;
var AllowChange: Boolean; NewValue: SmallInt; Direction: TUpDownDirection);
begin
if Direction = updUp then DigitalFilterFactor := Max(DigitalFilterFactor - 0.1,0.1)
else if Direction = updDown then DigitalFilterFactor := Min(DigitalFilterFactor + 0.1,1.0) ;
EdDigitalFilter.text := LPFilterCutoff( DigitalFilterFactor ) ;
end;
function LPFilterCutoff( Factor : single ) : string ;
Const
fTolerance = 0.01 ;
var
A,H1,H3,wt,f1,f2,f3 : Single ;
begin
if Factor < 1. then begin
A := 1. - Factor ;
f1 := 0.001 ;
f2 := 0.5 ;
while Abs(f1-f2) > fTolerance do begin
f3 := (f1+f2) / 2. ;
wT := 2.*pi*f1 ;
H1 := ((1.-A)*(1.-A) / (1. + A*A - 2*A*cos(wT)) ) - 0.5;
wT := 2.*pi*f3 ;
H3 := ((1.-A)*(1.-A) / (1. + A*A - 2*A*cos(wT)) ) - 0.5;
if (H3*H1) < 0. then f2 := f3
else f1 := f3 ;
end ;
LPFilterCutoff := format('%.3g Hz',[f1/MainFrm.SESLabIO.ADCSamplingInterval]);
end
else LPFilterCutoff := 'No Filter' ;
end ;
end.
|
{$include kode.inc}
unit kode_envelope;
//----------------------------------------------------------------------
interface
//----------------------------------------------------------------------
uses
kode_const;
const
env_off = 0;
env_attack = 1;
env_decay = 2;
env_sustain = 3;
env_release = 4;
env_finished = 5;
env_threshold = KODE_EPSILON;
env_maxstages = 5;
type
KEnvelope_Stage = record
FTarget : Single;
FRate : Single;
end;
//----------
KEnvelope_ADSR = class
private
FScale : Single;
FValue : Single;
FStage : LongInt;
FStages : array[0..4] of KEnvelope_Stage; // -,a,d,s,r
public
constructor create;
procedure setStage(AStage:LongInt; ATarget,ARate:Single);
procedure setADSR(a,d,s,r:Single);
procedure noteOn;
procedure noteOff;
function process : Single;
end;
//----------------------------------------------------------------------
implementation
//----------------------------------------------------------------------
uses
kode_math;
//----------
constructor KEnvelope_ADSR.create;
begin
inherited;
FScale := 50.0;//6.0f;
FStage := env_Off;
FValue := 0;
end;
//----------
procedure KEnvelope_ADSR.setStage(AStage:LongInt; ATarget,ARate:Single);
var
r1,r2 : Single;
begin
r1 := ARate*FScale;
r2 := r1*r1*r1 + 1;
//float r2 = r1*r1 + 1;
FStages[AStage].FTarget := ATarget;
FStages[AStage].FRate := 1 / r2;
end;
//----------
procedure KEnvelope_ADSR.setADSR(a,d,s,r:Single);
begin
setStage(env_Attack, 1,a);
setStage(env_Decay, s,d);
//setStage(env_Sustain,s,1);
FStages[env_Sustain].FTarget := s;
FStages[env_Sustain].FRate := 1;
setStage(env_Release,0,r);
end;
//----------
procedure KEnvelope_ADSR.noteOn;
begin
FStage := env_Attack;
FValue := 0;
end;
//----------
procedure KEnvelope_ADSR.noteOff;
begin
FStage := env_Release;
end;
//----------
function KEnvelope_ADSR.process : Single;
var
target,rate : single;
begin
if FStage = env_Off then exit(0);
if FStage = env_Finished then exit(0);
if FStage = env_Sustain then exit(FValue);
target := FStages[FStage].FTarget;
rate := FStages[FStage].FRate;
FValue += (target-FValue) * rate;
if KAbs(target-FValue) <= env_Threshold then FStage+=1;
result := FValue;
end;
//----------------------------------------------------------------------
end.
|
unit VSEBindMan;
interface
uses
Windows, AvL, avlUtils, VSECore
{$IFDEF VSE_CONSOLE}, VSEConsole{$ENDIF}{$IFDEF VSE_LOG}, VSELog{$ENDIF};
type
TBindEvents=(beDown, beUp);
TBindEvent=class(TCoreEvent)
protected
FName: string;
FEvType: TBindEvents;
{$IFDEF VSE_LOG}function GetDump: string; override;{$ENDIF}
public
constructor Create(Sender: TObject; const Name: string; EvType: TBindEvents);
property Name: string read FName;
property EvType: TBindEvents read FEvType;
end;
TBindingRec=record
Name, Description: string; //Name and description of binding
Key: Byte; //Default key
end;
TBinding=record
Name, Description: string;
Key, DefKey: Byte;
end;
TBindings = array of TBinding;
TBindMan=class(TModule)
private
FBindings: TBindings;
FScrollStateClicks: Integer;
FScrollStateUp: Boolean;
{$IFDEF VSE_CONSOLE}FCmdBindings: array of record Key: Byte; Cmd: string; end; {$ENDIF}
function KeyEvent(Key: Integer; Event: TKeyEvents): Boolean;
function GetActive(Name: string): Boolean;
function FindBinding(Name: string; NoLogLost: Boolean = false): Integer;
{$IFDEF VSE_CONSOLE}
function BindHandler(Sender: TObject; Args: array of const): Boolean;
function BindCmdHandler(Sender: TObject; Args: array of const): Boolean;
{$ENDIF}
public
constructor Create; override;
destructor Destroy; override;
class function Name: string; override;
procedure Update; override;
procedure OnEvent(var Event: TCoreEvent); override;
procedure AddBinding(const Name, Description: string; Key: Byte); //Add binding Name with default key Key
procedure AddBindings(const Bindings: array of TBindingRec); //Add several bindings
function GetBindKeyName(const BindName: string): string; //Get name of binded to BindName key
procedure ResetKeys; //Reset all keys to default
procedure SaveBindings; //Save bindings to ini
property Active[Name: string]: Boolean read GetActive; default; //True if binded key pressed
property Bindings: TBindings read FBindings; //Raw bindings info array
end;
function KeyToStr(Key: Integer): string; //Get name for key code
function ProcessKeyTags(const S: string): string; //Replaces tags $BindName$ by binded key name, $$ by $
var
BindMan: TBindMan; //Global variable for accessing to Bindings Manager
const
SSectionBindings = 'Bindings';
VK_XBUTTON4=5; //Mouse button 4
VK_XBUTTON5=6; //Mouse button 5
VK_MWHEELUP=VK_F23; //Mouse wheel up
VK_MWHEELDOWN=VK_F24; //Mouse wheel down
MBtnMap: array[mbLeft..mbX2] of Integer = (VK_LBUTTON, VK_RBUTTON, VK_MBUTTON, VK_XBUTTON4, VK_XBUTTON5);
BindEventNames: array[TBindEvents] of string = ('beDown', 'beUp');
implementation
const
TagDelim='$';
var
KeyNames: array[0..255] of string;
procedure InitKeyNames;
var
i: Integer;
begin
for i:=0 to 255 do
begin
SetLength(KeyNames[i], 101);
SetLength(KeyNames[i], GetKeyNameText(MapVirtualKey(i, 0) shl 16, @KeyNames[i][1], 100));
end;
KeyNames[0]:='---';
KeyNames[VK_LBUTTON]:='Left MB';
KeyNames[VK_RBUTTON]:='Right MB';
KeyNames[VK_MBUTTON]:='Middle MB';
KeyNames[VK_XBUTTON4]:='MB 4';
KeyNames[VK_XBUTTON5]:='MB 5';
KeyNames[VK_MWHEELUP]:='Wheel Up';
KeyNames[VK_MWHEELDOWN]:='Wheel Down';
KeyNames[$03]:='Cancel';
KeyNames[$0C]:='Clear';
KeyNames[$13]:='Pause';
KeyNames[$20]:='Space';
KeyNames[$21]:='Page Up';
KeyNames[$22]:='Page Down';
KeyNames[$23]:='End';
KeyNames[$24]:='Home';
KeyNames[$25]:='Left';
KeyNames[$26]:='Up';
KeyNames[$27]:='Right';
KeyNames[$28]:='Down';
KeyNames[$29]:='Select';
KeyNames[$2D]:='Insert';
KeyNames[$2E]:='Delete';
KeyNames[$5B]:='Left Win';
KeyNames[$5C]:='Right Win';
KeyNames[$5D]:='Apps';
KeyNames[$6F]:='Num /';
KeyNames[$90]:='Num Lock';
end;
function KeyToStr(Key: Integer): string;
begin
Result:=KeyNames[Key];
if Result='' then Result:='VK #'+IntToStr(Key);
end;
function StrToKey(KeyName: string): Integer;
var
i: Integer;
begin
Result:=0;
if KeyName='' then Exit;
if Copy(KeyName, 1, 4)='VK #' then Delete(KeyName, 1, 3);
if KeyName[1]<>'#' then
begin
for i:=0 to 255 do
if SameText(KeyName, KeyNames[i]) then
begin
Result:=i;
Exit;
end;
end
else Result:=StrToInt(Copy(KeyName, 2, 3));
end;
function ProcessKeyTags(const S: string): string;
var
CurPos, Idx: Integer;
begin
Result:='';
CurPos:=0;
Idx:=Pos(TagDelim, S);
while Idx>0 do
begin
Result:=Result+Copy(S, CurPos+1, Idx-CurPos-1);
if Idx=Length(S) then Break;
if S[Idx+1]=TagDelim then
begin
Result:=Result+TagDelim;
CurPos:=Idx+1;
end
else begin
CurPos:=PosEx(TagDelim, S, Idx+1);
if CurPos=0 then Exit;
Result:=Result+BindMan.GetBindKeyName(Copy(S, Idx+1, CurPos-Idx-1));
end;
Idx:=PosEx(TagDelim, S, CurPos+1);
end;
Result:=Result+Copy(S, CurPos+1, MaxInt);
end;
{ TBindEvent }
constructor TBindEvent.Create(Sender: TObject; const Name: string; EvType: TBindEvents);
begin
inherited Create(Sender);
FName := Name;
FEvType := EvType;
end;
{$IFDEF VSE_LOG}function TBindEvent.GetDump: string;
begin
Result := Format('%s(Name=%s Ev=%s)', [string(ClassName), FName, BindEventNames[FEvType]]);
end;{$ENDIF}
{ TBindMan }
constructor TBindMan.Create;
begin
inherited Create;
BindMan:=Self;
{$IFDEF VSE_CONSOLE}
Console['bind name=s ?key=s']:=BindHandler;
Console['bindcmd key=s ?cmd=s*']:=BindCmdHandler;
{$ENDIF}
end;
destructor TBindMan.Destroy;
begin
BindMan:=nil;
SaveBindings;
Finalize(FBindings);
inherited Destroy;
end;
class function TBindMan.Name: string;
begin
Result:='BindMan';
end;
function TBindMan.FindBinding(Name: string; NoLogLost: Boolean = false): Integer;
var
i: Integer;
begin
for i:=0 to High(FBindings) do
if SameText(FBindings[i].Name, Name) then
begin
Result:=i;
Exit;
end;
Result:=-1;
{$IFDEF VSE_LOG}if not NoLogLost then Log(llWarning, 'BindMan: Bind "'+Name+'" not found');{$ENDIF}
end;
function TBindMan.GetActive(Name: string): Boolean;
var
i: Integer;
begin
Result:=false;
i:=FindBinding(Name);
if i>-1 then
with FBindings[i] do
begin
if Key in [VK_MWHEELUP, VK_MWHEELDOWN] then
begin
if (FScrollStateClicks>0) and (((Key=VK_MWHEELUP) and FScrollStateUp) or
((Key=VK_MWHEELDOWN) and not FScrollStateUp))
then Result:=true;
end
else
Result:=Core.KeyPressed[Key];
end;
end;
procedure TBindMan.ResetKeys;
var
i: Integer;
begin
for i:=0 to High(FBindings) do
with FBindings[i] do
Key:=DefKey;
end;
procedure TBindMan.AddBinding(const Name, Description: string; Key: Byte);
var
Idx: Integer;
begin
Idx:=FindBinding(Name, true);
if Idx<0 then
begin
SetLength(FBindings, Length(FBindings)+1);
Idx:=High(FBindings);
end;
FBindings[Idx].Name:=Name;
FBindings[Idx].Description:=Description;
FBindings[Idx].DefKey:=Key;
with FBindings[Idx] do
if Settings.Str[SSectionBindings, Name]<>'' then
Key:=Settings.Int[SSectionBindings, Name]
else
Key:=DefKey;
end;
procedure TBindMan.AddBindings(const Bindings: array of TBindingRec);
var
i: Integer;
begin
for i:=0 to High(Bindings) do
with Bindings[i] do
AddBinding(Name, Description, Key);
end;
function TBindMan.GetBindKeyName(const BindName: string): string;
var
i: Integer;
begin
i:=FindBinding(BindName);
if i>-1
then Result:=KeyToStr(FBindings[i].Key)
else Result:='';
end;
procedure TBindMan.Update;
begin
if FScrollStateClicks>0 then Dec(FScrollStateClicks);
end;
procedure TBindMan.OnEvent(var Event: TCoreEvent);
const
EvMap: array[meDown..meUp] of TKeyEvents = (keDown, keUp);
var
Key, Btn: Integer;
begin
if Event is TMouseEvent then
with Event as TMouseEvent do
begin
if EvType in [meDown, meUp] then
KeyEvent(MBtnMap[Button], EvMap[EvType]);
if EvType=meWheel then
begin
Btn := Abs(Button);
if Button >= 0
then Key := VK_MWHEELUP
else
Key := VK_MWHEELDOWN;
FScrollStateClicks := Btn + 1;
FScrollStateUp := Key = VK_MWHEELUP;
while Btn > 0 do
begin
KeyEvent(Key, keDown);
KeyEvent(Key, keUp);
Dec(Btn);
end;
end;
end
else if Event is TKeyEvent then
with Event as TKeyEvent do
begin
if KeyEvent(Key, EvType) then
FreeAndNil(Event);
end
else if (Event is TSysNotify) and ((Event as TSysNotify).Notify = snStateChanged) then
FScrollStateClicks := 0
else inherited;
end;
function TBindMan.KeyEvent(Key: Integer; Event: TKeyEvents): Boolean;
const
EvMap: array[keDown..keUp] of TBindEvents = (beDown, beUp);
var
i: Integer;
begin
Result:=false;
for i:=0 to High(FBindings) do
if FBindings[i].Key=Key then
begin
Core.SendEvent(TBindEvent.Create(Self, FBindings[i].Name, EvMap[Event]), [erState]);
Result:=true;
Break;
end;
{$IFDEF VSE_CONSOLE}
if Event=keUp then
for i:=0 to High(FCmdBindings) do
if FCmdBindings[i].Key=Key then
begin
Console.Execute(FCmdBindings[i].Cmd);
Result:=true;
Break;
end;
{$ENDIF}
end;
procedure TBindMan.SaveBindings;
var
i: Integer;
begin
for i:=0 to High(FBindings) do
Settings.Int[SSectionBindings, FBindings[i].Name]:=FBindings[i].Key;
end;
{$IFDEF VSE_CONSOLE}
function TBindMan.BindHandler(Sender: TObject; Args: array of const): Boolean;
var
Binding, Key: Integer;
begin
Result:=false;
Binding:=FindBinding(string(Args[1].VAnsiString));
if Binding=-1 then Exit;
Result:=true;
if Length(Args)>2 then
begin
Key:=StrToKey(string(Args[2].VAnsiString));
if Key=0 then
begin
Console.WriteLn('Unknown key name: '+string(Args[2].VAnsiString)+PostfixError);
Result:=false;
Exit;
end;
FBindings[Binding].Key:=Key;
end
else Console.WriteLn(FBindings[Binding].Name+' binded to key '+KeyToStr(FBindings[Binding].Key));
end;
function TBindMan.BindCmdHandler(Sender: TObject; Args: array of const): Boolean;
function FindBinding(Key: Byte): Integer;
begin
for Result:=0 to High(FCmdBindings) do
if FCmdBindings[Result].Key=Key then Exit;
Result:=-1;
end;
var
Key: Byte;
Binding: Integer;
begin
Result:=false;
Key:=StrToKey(string(Args[1].VAnsiString));
if Key<>0 then
begin
Binding:=FindBinding(Key);
if Length(Args)>2 then
begin
if Binding=-1 then Binding:=FindBinding(0);
if Binding=-1 then
begin
SetLength(FCmdBindings, Length(FCmdBindings)+1);
Binding:=High(FCmdBindings);
end;
FCmdBindings[Binding].Key:=Key;
FCmdBindings[Binding].Cmd:=string(Args[2].VAnsiString);
end
else if Binding<>-1 then
FCmdBindings[Binding].Key:=0;
end
else Console.WriteLn('Unknown key name: '+string(Args[1].VAnsiString)+PostfixError);
end;
{$ENDIF}
initialization
InitKeyNames;
RegisterModule(TBindMan);
end. |
{------------------------------------------------------------------------------
Component Installer app
Developed by Rodrigo Depine Dalpiaz (digao dalpiaz)
Delphi utility app to auto-install component packages into IDE
https://github.com/digao-dalpiaz/CompInstall
Please, read the documentation at GitHub link.
------------------------------------------------------------------------------}
unit UFrm;
interface
uses Vcl.Forms, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.Buttons,
Vcl.Controls, System.Classes,
//
Vcl.Graphics, UDefinitions;
type
TFrm = class(TForm)
LbComponentName: TLabel;
EdCompName: TEdit;
LbDelphiVersion: TLabel;
EdDV: TComboBox;
Ck64bit: TCheckBox;
LbInstallLog: TLabel;
BtnInstall: TBitBtn;
BtnExit: TBitBtn;
M: TRichEdit;
LbVersion: TLabel;
LinkLabel1: TLinkLabel;
LbComponentVersion: TLabel;
EdCompVersion: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure BtnExitClick(Sender: TObject);
procedure BtnInstallClick(Sender: TObject);
procedure LinkLabel1LinkClick(Sender: TObject; const Link: string;
LinkType: TSysLinkType);
procedure FormShow(Sender: TObject);
private
D: TDefinitions;
procedure LoadDelphiVersions;
public
procedure SetButtons(bEnabled: Boolean);
procedure Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack);
end;
var
Frm: TFrm;
implementation
{$R *.dfm}
uses UCommon, UProcess, UGitHub,
System.SysUtils, System.Win.Registry,
Winapi.Windows, Winapi.Messages, Winapi.ShellApi, System.UITypes,
Vcl.Dialogs;
//-- Object to use in Delphi Version ComboBox
type TDelphiVersion = class
InternalNumber: string;
end;
//--
procedure TFrm.Log(const A: string; bBold: Boolean = True; Color: TColor = clBlack);
begin
//log text at RichEdit control, with some formatted rules
M.SelStart := Length(M.Text);
if bBold then
M.SelAttributes.Style := [fsBold]
else
M.SelAttributes.Style := [];
M.SelAttributes.Color := Color;
M.SelText := A+#13#10;
SendMessage(M.Handle, WM_VSCROLL, SB_BOTTOM, 0); //scroll to bottom
end;
procedure TFrm.FormCreate(Sender: TObject);
begin
AppDir := ExtractFilePath(Application.ExeName);
D := TDefinitions.Create;
try
D.LoadIniFile(AppDir+'CompInstall.ini');
EdCompName.Text := D.CompName;
EdCompVersion.Text := D.CompVersion;
LoadDelphiVersions; //load list of delphi versions
Ck64bit.Visible := D.HasAny64bit;
except
BtnInstall.Enabled := False;
raise;
end;
end;
procedure TFrm.FormDestroy(Sender: TObject);
var I: Integer;
begin
D.Free;
//--Free objects of delphi versions list
for I := 0 to EdDV.Items.Count-1 do
EdDV.Items.Objects[I].Free;
//--
end;
procedure TFrm.FormShow(Sender: TObject);
begin
CheckGitHubUpdate(D.GitHubRepository, D.CompVersion);
end;
procedure TFrm.LinkLabel1LinkClick(Sender: TObject; const Link: string;
LinkType: TSysLinkType);
begin
ShellExecute(0, '', PChar(Link), '', '', SW_SHOWNORMAL);
end;
procedure TFrm.BtnExitClick(Sender: TObject);
begin
Close;
end;
procedure TFrm.LoadDelphiVersions;
var R: TRegistry;
procedure Add(const Key, IniVer, Text: string);
var DV: TDelphiVersion;
begin
if R.KeyExists(Key) and HasInList(IniVer, D.DelphiVersions) then
begin
DV := TDelphiVersion.Create;
DV.InternalNumber := Key;
EdDV.Items.AddObject(Text, DV);
end;
end;
begin
R := TRegistry.Create;
try
R.RootKey := HKEY_CURRENT_USER;
if R.OpenKeyReadOnly(BDS_KEY) then
begin
Add('3.0', '2005', 'Delphi 2005');
Add('4.0', '2006', 'Delphi 2006');
Add('5.0', '2007', 'Delphi 2007');
Add('6.0', '2009', 'Delphi 2009');
Add('7.0', '2010', 'Delphi 2010');
Add('8.0', 'XE', 'Delphi XE');
Add('9.0', 'XE2', 'Delphi XE2');
Add('10.0', 'XE3', 'Delphi XE3');
Add('11.0', 'XE4', 'Delphi XE4');
Add('12.0', 'XE5', 'Delphi XE5'); //public folder 'RAD Studio'
Add('14.0', 'XE6', 'Delphi XE6'); //public folder 'Embarcadero\Studio'
Add('15.0', 'XE7', 'Delphi XE7');
Add('16.0', 'XE8', 'Delphi XE8');
Add('17.0', '10', 'Delphi 10 Seattle');
Add('18.0', '10.1', 'Delphi 10.1 Berlin');
Add('19.0', '10.2', 'Delphi 10.2 Tokyo');
Add('20.0', '10.3', 'Delphi 10.3 Rio');
Add('21.0', '10.4', 'Delphi 10.4 Sydney');
end;
finally
R.Free;
end;
if EdDV.Items.Count=0 then
raise Exception.Create('No version of Delphi installed or supported');
EdDV.ItemIndex := EdDV.Items.Count-1; //select last version
end;
procedure TFrm.BtnInstallClick(Sender: TObject);
var P: TProcess;
begin
M.Clear; //clear log
if EdDV.ItemIndex=-1 then
begin
MessageDlg('Select one Delphi version', mtError, [mbOK], 0);
EdDV.SetFocus;
Exit;
end;
//check if Delphi IDE is running
if FindWindow('TAppBuilder', nil)<>0 then
begin
MessageDlg('Please, close Delphi IDE first!', mtError, [mbOK], 0);
Exit;
end;
SetButtons(False);
Refresh;
P := TProcess.Create(D,
TDelphiVersion(EdDV.Items.Objects[EdDV.ItemIndex]).InternalNumber,
Ck64bit.Checked and Ck64bit.Visible);
P.Start;
end;
procedure TFrm.SetButtons(bEnabled: Boolean);
begin
BtnInstall.Enabled := bEnabled;
BtnExit.Enabled := bEnabled;
end;
end.
|
// Global defines
{$I IPDEFINE.INC}
unit ipHtmlTableLayout;
interface
uses
types, Classes, LCLType, LCLIntf, IpHtml, iphtmlprop;
type
{ TIpNodeTableLayouter }
TIpNodeTableLayouter = class(TIpHtmlBaseTableLayouter)
private
FTableOwner : TIpHtmlNodeTABLE;
CellOverhead : Integer; // sum of col widths + CellOverhead = TableWidth
RUH, RUV : Integer; // ruler width hor/vert
BL, BR, BT, BB : Integer; // border width, left, right, top, bottom
FColCount : Integer;
ColTextWidthMin, ColTextWidthMax : TIntArr; // min and max column widths
ColTextWidth : TIntArr; //actual column widths
ColStart : TIntArr; // start of each column relative to table's left
public
constructor Create(AOwner: TIpHtmlNodeCore); override;
destructor Destroy; override;
procedure CalcMinMaxColTableWidth(RenderProps: TIpHtmlProps;
var aMin, aMax: Integer); override;
procedure CalcSize(ParentWidth: Integer; RenderProps: TIpHtmlProps); override;
function GetColCount: Integer; override;
public
property ColCount : Integer read GetColCount; // Same as FTableOwner.ColCount.
end;
implementation
{ TIpNodeTableLayouter }
constructor TIpNodeTableLayouter.Create(AOwner: TIpHtmlNodeCore);
begin
inherited Create(AOwner);
FTableOwner := TIpHtmlNodeTABLE(FOwner);
FColCount := -1;
ColTextWidthMin := TIntArr.Create;
ColTextWidthMax := TIntArr.Create;
ColTextWidth := TIntArr.Create;
ColStart := TIntArr.Create;
end;
destructor TIpNodeTableLayouter.Destroy;
begin
ColTextWidth.Free;
ColStart.Free;
ColTextWidthMin.Free;
ColTextWidthMax.Free;
inherited Destroy;
end;
procedure TIpNodeTableLayouter.CalcMinMaxColTableWidth(RenderProps: TIpHtmlProps;
var aMin, aMax: Integer);
var
z, Min0, Max0: Integer;
i, j, CurCol, k : Integer;
TWMin, TWMax : Integer;
PendSpanWidthMin,
PendSpanWidthMax,
PendSpanStart,
PendSpanSpan : TIntArr;
PendCol : Integer;
CoreNode: TIpHtmlNodeCore;
TrNode: TIpHtmlNodeTR;
CellNode: TIpHtmlNodeTableHeaderOrCell;
procedure DistributeColSpace(ColSpan: Integer);
var
i, Rest, MinNow : Integer;
begin
if ColSpan > 1 then begin
PendSpanWidthMin[PendCol] := Min0;
PendSpanWidthMax[PendCol] := Max0;
PendSpanStart[PendCol] := CurCol;
PendSpanSpan[PendCol] := ColSpan;
Inc(PendCol);
Exit;
end;
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMin[i]);
if MinNow = 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidthMin[i] := Min0 div ColSpan;
end else begin
Rest := Min0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidthMin[i] := ColTextWidthMin[i] +
round(Rest * ColTextWidthMin[i] / MinNow);
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMin[i]);
Rest := Min0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do begin
ColTextWidthMin[i] := ColTextWidthMin[i] + 1;
Dec(Rest);
if rest = 0 then
break;
end;
end;
end;
end;
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMax[i]);
if MinNow = 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidthMax[i] := Max0 div ColSpan;
end else begin
Rest := Max0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidthMax[i] := ColTextWidthMax[i] +
round(Rest * ColTextWidthMax[i] / MinNow);
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMax[i]);
Rest := Max0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do begin
ColTextWidthMax[i] := ColTextWidthMax[i] + 1;
Dec(Rest);
if rest = 0 then
break;
end;
end;
end;
end;
for i := 0 to Pred(ColCount) do begin
ColTextWidthMin[i] := MinI2(ColTextWidthMin[i], ColTextWidthMax[i]);
ColTextWidthMax[i] := MaxI2(ColTextWidthMin[i], ColTextWidthMax[i]);
end;
end;
procedure DistributeSpannedColSpace;
var
z, i, Rest, MinNow, Min0, Max0, CurCol, ColSpan : Integer;
begin
for z := 0 to Pred(PendCol) do begin
Min0 := PendSpanWidthMin[z];
Max0 := PendSpanWidthMax[z];
CurCol := PendSpanStart[z];
ColSpan := PendSpanSpan[z];
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMin[i]);
if MinNow = 0 then begin
Rest := 0;
for i := CurCol to CurCol + ColSpan - 1 do begin
ColTextWidthMin[i] := Min0 div ColSpan;
Inc(Rest, ColTextWidthMin[i]);
end;
ColTextWidthMin[0] := ColTextWidthMin[0] + (Min0 - Rest);
end else begin
Rest := Min0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidthMin[i] := ColTextWidthMin[i] +
round(Rest * ColTextWidthMin[i] / MinNow);
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMin[i]);
Rest := Min0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do begin
ColTextWidthMin[i] := ColTextWidthMin[i] + 1;
Dec(Rest);
if rest = 0 then
break;
end;
end;
end;
end;
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMax[i]);
if MinNow = 0 then begin
Rest := 0;
for i := CurCol to CurCol + ColSpan - 1 do begin
ColTextWidthMax[i] := Max0 div ColSpan;
Inc(Rest, ColTextWidthMax[i]);
end;
ColTextWidthMax[0] := ColTextWidthMax[0] + (Max0 - Rest);
end else begin
Rest := Max0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidthMax[i] := ColTextWidthMax[i] +
round(Rest * ColTextWidthMax[i] / MinNow);
MinNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(MinNow, ColTextWidthMax[i]);
Rest := Max0 - MinNow;
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do begin
ColTextWidthMax[i] := ColTextWidthMax[i] + 1;
Dec(Rest);
if rest = 0 then
break;
end;
end;
end;
end;
for i := 0 to Pred(ColCount) do begin
ColTextWidthMax[i] := MaxI2(ColTextWidthMin[i], ColTextWidthMax[i]);
end;
end;
end;
begin
if FMin <> -1 then begin
aMin := FMin;
aMax := FMax;
Exit;
end;
FMin := 0;
FMax := 0;
if ColCount = 0 then
Exit;
PendSpanWidthMin := nil;
PendSpanWidthMax := nil;
PendSpanStart := nil;
PendSpanSpan := nil;
try
PendSpanWidthMin := TIntArr.Create;
PendSpanWidthMax := TIntArr.Create;
PendSpanStart := TIntArr.Create;
PendSpanSpan := TIntArr.Create;
{calc col and table widths}
for i := 0 to Pred(ColCount) do begin
FRowSp[i] := 0;
ColTextWidthMin[i] := 0;
ColTextWidthMax[i] := 0;
end;
PendCol := 0;
for z := 0 to Pred(FTableOwner.ChildCount) do
if FTableOwner.ChildNode[z] is TIpHtmlNodeTHeadFootBody then
begin
CoreNode := TIpHtmlNodeCore(FTableOwner.ChildNode[z]);
for i := 0 to Pred(CoreNode.ChildCount) do begin
if CoreNode.ChildNode[i] is TIpHtmlNodeTR then
begin
TrNode := TIpHtmlNodeTR(CoreNode.ChildNode[i]);
CurCol := 0;
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
for j := 0 to Pred(TrNode.ChildCount) do
if TrNode.ChildNode[j] is TIpHtmlNodeTableHeaderOrCell then
begin
CellNode := TIpHtmlNodeTableHeaderOrCell(TrNode.ChildNode[j]);
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
CellNode.CalcMinMaxPropWidth(RenderProps, Min0, Max0);
case CellNode.Width.LengthType of
hlAbsolute :
begin
if CellNode.Width.LengthValue <= CellNode.ExpParentWidth then
Min0 := MaxI2(Min0, CellNode.Width.LengthValue - 2*FCellPadding
- FCellSpacing - RUH);
Max0 := Min0;
end;
end;
CellNode.CalcWidthMin := Min0;
CellNode.CalcWidthMax := Max0;
DistributeColSpace(CellNode.ColSpan);
for k := 0 to Pred(CellNode.ColSpan) do begin
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
FRowSp[CurCol] := CellNode.RowSpan - 1;
Inc(CurCol);
end;
end;
for j := CurCol to Pred(ColCount) do
if FRowSp[j] > 0 then
FRowSp[j] := FRowSp[j] - 1;
end;
end;
end;
DistributeSpannedColSpace;
finally
PendSpanWidthMin.Free;
PendSpanWidthMax.Free;
PendSpanStart.Free;
PendSpanSpan.Free;
end;
TWMin := 0;
TWMax := 0;
CellOverhead := BL + FCellSpacing + BR;
for i := 0 to Pred(ColCount) do begin
Inc(TWMin, ColTextWidthMin[i]);
Inc(TWMax, ColTextWidthMax[i]);
Inc(CellOverhead, RUH + 2*FCellPadding + FCellSpacing + RUH);
FRowSp[i] := 0;
end;
FMin := MaxI2(FMin, TWMin + CellOverhead);
FMax := MaxI2(FMax, TWMax + CellOverhead);
aMin := FMin;
aMax := FMax;
end;
procedure TIpNodeTableLayouter.CalcSize(ParentWidth: Integer; RenderProps: TIpHtmlProps);
var
z, GrossCellSpace, NetCellSpace, CellExtra,
NetCellSpaceExtraExtra,
RelCellExtra,
i, j, CurCol, k,
CellSpace,
MinW, MaxW : Integer;
R : TRect;
TargetRect : TRect;
RowFixup : TRectRectArr;
RowFixupCount : Integer;
function GetSpanBottom(Row, Col: Integer): Integer;
var
R: PRect;
begin
R := RowFixup.Value[Row].Value[Col];
if R <> nil then
Result := R.Bottom
else
Result := 0;
end;
procedure SetSpanBottom(Row, Col, Value: Integer);
var
R: PRect;
begin
R := RowFixup.Value[Row].Value[Col];
if R <> nil then
R^.Bottom := Value;
end;
procedure SetSpanRect(Row,Col : Integer; const Rect: PRect);
begin
RowFixup[Row].Value[Col] := Rect;
end;
procedure DeleteFirstSpanRow;
begin
RowFixup.Delete(0);
end;
procedure AdjustCol(ColSpan, DesiredWidth: Integer);
var
i, Rest, WNow, Avail : Integer;
begin
WNow := 0;
for i := CurCol to CurCol + ColSpan - 1 do
Inc(WNow, ColTextWidth[i]);
Avail := MinI2(DesiredWidth, CellSpace);
if WNow = 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidth[i] := Avail div ColSpan;
end else begin
Rest := MinI2(CellSpace, DesiredWidth - WNow);
if Rest > 0 then begin
for i := CurCol to CurCol + ColSpan - 1 do
ColTextWidth[i] := ColTextWidth[i] + round(Rest * ColTextWidth[i] / WNow);
end;
end;
end;
procedure DoBlock(BlockType : TIpHtmlNodeTABLEHEADFOOTBODYClass);
var
z, i, j, k, zz : Integer;
RowSp2 : TIntArr;
AL0, AL : TIpHtmlAlign;
CellRect1 : TRect;
HA, HB, Y0: Integer;
maxY, maxYY: Integer;
VA0, VA : TIpHtmlVAlign3;
CoreNode: TIpHtmlNodeCore;
TrNode: TIpHtmlNodeTR;
CellNode: TIpHtmlNodeTableHeaderOrCell;
begin
RowSp2 := TIntArr.Create;
try
for z := 0 to Pred(FTableOwner.ChildCount) do
if (TIpHtmlNode(FTableOwner.ChildNode[z]) is BlockType) then
begin
CoreNode := TIpHtmlNodeCore(FTableOwner.ChildNode[z]);
for i := 0 to Pred(CoreNode.ChildCount) do begin
if CoreNode.ChildNode[i] is TIpHtmlNodeTR then
begin
TrNode := TIpHtmlNodeTR(CoreNode.ChildNode[i]);
for j := 0 to Pred(ColCount) do
RowSp2[j] := FRowSp[j];
CurCol := 0;
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
VA0 := TrNode.Props.VAlignment;
case TrNode.VAlign of
hvaTop :
VA0 := hva3Top;
hvaMiddle :
VA0 := hva3Middle;
hvaBottom :
VA0 := hva3Bottom;
end;
case TrNode.Align of
haDefault :
AL0 := haLeft;
else
AL0 := TrNode.Align;
end;
{determine height of cells and lay out with top alignment}
for j := 0 to Pred(TrNode.ChildCount) do
if TIpHtmlNode(TrNode.ChildNode[j]) is TIpHtmlNodeTableHeaderOrCell then
begin
CellNode := TIpHtmlNodeTableHeaderOrCell(TrNode.ChildNode[j]);
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
AL := AL0;
CellNode.Props.Assign(FOwner.Props); // assign table props
CellRect1 := TargetRect;
Inc(CellRect1.Left, ColStart[CurCol]);
Inc(CellRect1.Top, FCellSpacing + RUV);
CellRect1.Right := CellRect1.Left + 2*FCellPadding + ColTextWidth[CurCol];
for k := 1 to CellNode.ColSpan - 1 do
Inc(CellRect1.Right, ColTextWidth[CurCol + k] + 2*FCellPadding +
2*RUH + FCellSpacing);
// PadRect area of cell excluding rules
// CellRect area of text contained in cell
CellNode.PadRect := CellRect1;
Inc(CellRect1.Top, FCellPadding);
inflateRect(CellRect1, -FCellPadding, 0);
VA := CellNode.VAlign;
if VA = hva3Default then
VA := VA0;
case CellNode.Align of
haDefault : ;
else
AL := CellNode.Align;
end;
CellNode.Props.VAlignment := VA;
CellNode.Props.Alignment := AL;
CellNode.Layout(CellNode.Props, CellRect1);
if (CellNode.Height.PixelsType <> hpUndefined) {Height <> -1} then
if CellNode.PageRect.Bottom - CellNode.PageRect.Top < CellNode.Height.Value then
CellNode.Layouter.FPageRect.Bottom := CellRect1.Top + CellNode.Height.Value;
if (CellNode.Height.PixelsType = hpUndefined) {Height = -1}
and IsRectEmpty(CellNode.PageRect) then
CellNode.FPadRect.Bottom := CellRect1.Top + FCellPadding
else begin
CellNode.FPadRect.Bottom := CellNode.PageRect.Bottom + FCellPadding;
end;
SetSpanRect(CellNode.RowSpan - 1, CurCol, @CellNode.PadRect);
for k := 0 to Pred(CellNode.ColSpan) do begin
FRowSp[CurCol] := CellNode.RowSpan - 1;
Inc(CurCol);
end;
end;
{Adjust any trailing spanning columns}
for j := CurCol to Pred(ColCount) do
if FRowSp[j] > 0 then
FRowSp[j] := FRowSp[j] - 1;
maxYY := 0;
maxY := 0;
for zz := 0 to Pred(ColCount) do
maxY := MaxI2(GetSpanBottom(0, zz), maxY);
for zz := 0 to Pred(ColCount) do
SetSpanBottom(0, zz, maxY);
if maxY > maxYY then
maxYY := maxY;
for j := 0 to Pred(ColCount) do
FRowSp[j] := RowSp2[j];
CurCol := 0;
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
{relocate cells which are not top aligned}
for j := 0 to Pred(TrNode.ChildCount) do
if TrNode.ChildNode[j] is TIpHtmlNodeTableHeaderOrCell then
begin
CellNode := TIpHtmlNodeTableHeaderOrCell(TrNode.ChildNode[j]);
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
AL := AL0;
HA := maxYY - (TargetRect.Top + FCellSpacing + RUV);
HB := CellNode.PageRect.Bottom - CellNode.PageRect.Top;
VA := CellNode.VAlign;
if VA = hva3Default then
VA := VA0;
case VA of
hva3Middle :
Y0 := (HA - HB) div 2;
hva3Bottom :
Y0 := (HA - HB);
else
Y0 := 0;
end;
if Y0 > 0 then begin
CellRect1 := TargetRect;
Inc(CellRect1.Left, ColStart[CurCol]);
Inc(CellRect1.Top, FCellSpacing + RUV + Y0);
CellRect1.Right := CellRect1.Left + 2*FCellPadding + ColTextWidth[CurCol];
for k := 1 to CellNode.ColSpan - 1 do
Inc(CellRect1.Right, ColTextWidth[CurCol + k] + 2*FCellPadding +
2*RUH + FCellSpacing);
Inc(CellRect1.Top, FCellPadding);
inflateRect(CellRect1, -FCellPadding, 0);
case CellNode.Align of
haDefault : ;
else
AL := CellNode.Align;
end;
CellNode.Props.VAlignment := VA;
CellNode.Props.Alignment := AL;
CellNode.Layout(CellNode.Props, CellRect1);
if CellNode.Height.PixelsType <> hpUndefined then
if CellNode.PageRect.Bottom - CellNode.PageRect.Top < CellNode.Height.Value then
CellNode.Layouter.FPageRect.Bottom := CellRect1.Top + CellNode.Height.Value;
if (CellNode.Height.PixelsType = hpUndefined)
and IsRectEmpty(CellNode.PageRect) then
CellNode.FPadRect.Bottom := CellRect1.Top + FCellPadding
else begin
CellNode.FPadRect.Bottom := CellNode.PageRect.Bottom + FCellPadding;
end;
SetSpanRect(CellNode.RowSpan - 1, CurCol, @CellNode.PadRect);
end;
for k := 0 to Pred(CellNode.ColSpan) do begin
FRowSp[CurCol] := CellNode.RowSpan - 1;
Inc(CurCol);
end;
end;
maxYY := 0;
maxY := 0;
for zz := 0 to Pred(ColCount) do
maxY := MaxI2(GetSpanBottom(0, zz), maxY);
for zz := 0 to Pred(ColCount) do
SetSpanBottom(0, zz, maxY);
if maxY > maxYY then
maxYY := maxY;
{Adjust any trailing spanning columns}
for j := CurCol to Pred(ColCount) do
if FRowSp[j] > 0 then
FRowSp[j] := FRowSp[j] - 1;
TargetRect.Top := MaxI2(maxYY, TargetRect.Top) + RUV;
DeleteFirstSpanRow;
end;
end;
end;
while RowFixupCount > 0 do begin
maxYY := 0;
maxY := 0;
for zz := 0 to Pred(ColCount) do
maxY := MaxI2(GetSpanBottom(0, zz), maxY);
for zz := 0 to Pred(ColCount) do
SetSpanBottom(0, zz, maxY);
if maxY > maxYY then
maxYY := maxY;
TargetRect.Top := MaxI2(maxYY, TargetRect.Top);
DeleteFirstSpanRow;
end;
finally
RowSp2.Free;
end;
end;
var
P : Integer;
CoreNode: TIpHtmlNodeCore;
TrNode: TIpHtmlNodeTR;
CellNode: TIpHtmlNodeTableHeaderOrCell;
begin
FTableWidth := 0;
if ColCount = 0 then
Exit;
Props.Assign(RenderProps);
CalcMinMaxColTableWidth(Props, MinW, MaxW);
case FTableOwner.Width.LengthType of
hlUndefined :
begin
P := 0;
for z := 0 to Pred(FTableOwner.ChildCount) do
if FTableOwner.ChildNode[z] is TIpHtmlNodeTHeadFootBody then
begin
CoreNode := TIpHtmlNodeCore(FTableOwner.ChildNode[z]);
for i := 0 to Pred(CoreNode.ChildCount) do begin
if CoreNode.ChildNode[i] is TIpHtmlNodeTR then
begin
TrNode := TIpHtmlNodeTR(CoreNode.ChildNode[i]);
for j := 0 to Pred(TrNode.ChildCount) do
if TrNode.ChildNode[j] is TIpHtmlNodeTableHeaderOrCell then
begin
CellNode := TIpHtmlNodeTableHeaderOrCell(TrNode.ChildNode[j]);
case CellNode.Width.LengthType of
hlPercent :
Inc(P, CellNode.Width.LengthValue);
end;
end;
end;
end;
end;
if P <> 0 then
FTableWidth := MaxI2(MinW, round((P * ParentWidth) / 100))
else
FTableWidth := MaxI2(MinW, MinI2(MaxW, ParentWidth));
end;
hlAbsolute :
FTableWidth := MaxI2(FTableOwner.Width.LengthValue, MinW);
hlPercent :
FTableWidth := MaxI2(MinW, round((FTableOwner.Width.LengthValue * ParentWidth) / 100));
end;
for i := 0 to Pred(ColCount) do
ColTextWidth[i] := ColTextWidthMin[i];
for z := 0 to Pred(ColCount) do
FRowSp[z] := 0;
for z := 0 to Pred(FTableOwner.ChildCount) do
if FTableOwner.ChildNode[z] is TIpHtmlNodeTHeadFootBody then
begin
CoreNode := TIpHtmlNodeCore(FTableOwner.ChildNode[z]);
for i := 0 to Pred(CoreNode.ChildCount) do begin
if CoreNode.ChildNode[i] is TIpHtmlNodeTR then
begin
TrNode := TIpHtmlNodeTR(CoreNode.ChildNode[i]);
CellSpace := FTableWidth - CellOverhead;
for j := 0 to Pred(ColCount) do
Dec(CellSpace, ColTextWidth[j]);
if CellSpace > 0 then begin
{distribute extra space}
CurCol := 0;
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
for j := 0 to Pred(TrNode.ChildCount) do
if TrNode.ChildNode[j] is TIpHtmlNodeTableHeaderOrCell then
begin
CellNode := TIpHtmlNodeTableHeaderOrCell(TrNode.ChildNode[j]);
case CellNode.Width.LengthType of
hlAbsolute :
AdjustCol(CellNode.ColSpan, CellNode.Width.LengthValue - 2*FCellPadding
- FCellSpacing - RUH);
hlPercent :
AdjustCol(CellNode.Colspan,
round((FTableWidth - CellOverhead) *
CellNode.Width.LengthValue / 100));
end;
CellSpace := FTableWidth - CellOverhead;
for k := 0 to Pred(ColCount) do
Dec(CellSpace, ColTextWidth[k]);
for k := 0 to Pred(CellNode.ColSpan) do begin
while FRowSp[CurCol] <> 0 do begin
FRowSp[CurCol] := FRowSp[CurCol] - 1;
Inc(CurCol);
end;
FRowSp[CurCol] := CellNode.RowSpan - 1;
Inc(CurCol);
end;
end;
for j := CurCol to Pred(ColCount) do
if FRowSp[j] > 0 then
FRowSp[j] := FRowSp[j] - 1;
end;
end;
end;
end;
GrossCellSpace := MaxI2(FTableWidth - CellOverhead, 0);
NetCellSpace := 0;
for i := 0 to Pred(ColCount) do
Inc(NetCellSpace, ColTextWidth[i]);
if NetCellSpace > 0 then begin
CellExtra := GrossCellSpace - NetCellSpace;
if CellExtra > 0 then
for i := 0 to Pred(ColCount) do begin
RelCellExtra := round(CellExtra / NetCellSpace * ColTextWidth[i] );
if ColTextWidth[i] + RelCellExtra > ColTextWidthMax[i] then
ColTextWidth[i] := MaxI2(ColTextWidth[i], ColTextWidthMax[i])
else
ColTextWidth[i] := ColTextWidth[i] + RelCellExtra;
end;
end;
NetCellSpace := 0;
for i := 0 to Pred(ColCount) do
Inc(NetCellSpace, ColTextWidth[i]);
CellExtra := GrossCellSpace - NetCellSpace;
if CellExtra > 0 then begin
RelCellExtra := CellExtra div ColCount;
NetCellSpaceExtraExtra := CellExtra mod ColCount;
for i := 0 to Pred(ColCount) do begin
if (ColTextWidth[i] < ColTextWidthMax[i]) then begin
ColTextWidth[i] := ColTextWidth[i] + RelCellExtra;
if NetCellSpaceExtraExtra > 0 then begin
ColTextWidth[i] := ColTextWidth[i] + 1;
Dec(NetCellSpaceExtraExtra);
end;
end;
end;
end;
NetCellSpace := 0;
for i := 0 to Pred(ColCount) do
Inc(NetCellSpace, ColTextWidth[i]);
CellExtra := GrossCellSpace - NetCellSpace;
if CellExtra > 0 then begin
for i := 0 to Pred(ColCount) do begin
RelCellExtra := MinI2(ColTextWidthMax[i] - ColTextWidth[i], CellExtra);
if RelCellExtra > 0 then begin
ColTextWidth[i] := ColTextWidth[i] + RelCellExtra;
Dec(CellExtra, RelCellExtra);
end;
end;
end;
NetCellSpace := 0;
for i := 0 to Pred(ColCount) do
Inc(NetCellSpace, ColTextWidth[i]);
CellExtra := GrossCellSpace - NetCellSpace;
if CellExtra > 0 then begin
RelCellExtra := CellExtra div ColCount;
NetCellSpaceExtraExtra := CellExtra mod ColCount;
for i := 0 to Pred(ColCount) do begin
ColTextWidth[i] := ColTextWidth[i] + RelCellExtra;
if NetCellSpaceExtraExtra > 0 then begin
ColTextWidth[i] := ColTextWidth[i] + 1;
Dec(NetCellSpaceExtraExtra);
end;
end;
end;
for i := 0 to Pred(ColCount) do
FRowSp[i] := 0;
TargetRect := Rect(0, 0, ParentWidth, MaxInt);
with FTableOwner do
begin
BorderRect2 := TargetRect;
BorderRect := TargetRect;
for z := 0 to Pred(ChildCount) do
if ChildNode[z] is TIpHtmlNodeCAPTION then begin
FCaption := TIpHtmlNodeCAPTION(ChildNode[z]);
if FCaption.Align <> hva2Bottom then begin
FCaption.Layout(Props, BorderRect2);
Inc(BorderRect.Top, FCaption.PageRect.Bottom - FCaption.PageRect.Top);
end;
end;
TargetRect := BorderRect;
R := BorderRect;
end;
ColStart[0] := BL + FCellSpacing + RUH;
FRowSp[0] := 0;
for i := 1 to Pred(ColCount) do begin
ColStart[i] := ColStart[i-1] + 2*FCellPadding + ColTextWidth[i-1]
+ FCellSpacing + 2*RUH;
FRowSp[i] := 0;
end;
{calc size of table body}
Inc(TargetRect.Top, BT);
{calc rows}
RowFixup := TRectRectArr.Create;
try
RowFixupCount := 0;
DoBlock(TIpHtmlNodeTHEAD);
DoBlock(TIpHtmlNodeTBODY);
DoBlock(TIpHtmlNodeTFOOT);
finally
RowFixup.Free;
end;
Inc(TargetRect.Top, FCellSpacing + RUV + BB);
R.Right := R.Left + FTableWidth;
R.Bottom := TargetRect.Top;
if (R.Bottom > R.Top) and (R.Right = R.Left) then
R.Right := R.Left + 1;
with FTableOwner do
begin
BorderRect.BottomRight := R.BottomRight;
BorderRect2.BottomRight := R.BottomRight;
if assigned(FCaption) and (FCaption.Align = hva2Bottom) then begin
R.Top := BorderRect.Bottom;
R.Bottom := MaxInt;
FCaption.Layout(Props, R);
BorderRect2.Bottom := FCaption.PageRect.Bottom;
end;
end;
end;
function TIpNodeTableLayouter.GetColCount: Integer;
var
z, i, j, c : Integer;
Brd : Integer; // Border
CoreNode: TIpHtmlNodeCore;
TrNode: TIpHtmlNodeTR;
CellNode: TIpHtmlNodeTableHeaderOrCell;
begin
if FColCount = -1 then
begin
FColCount := 0;
for z := 0 to Pred(FTableOwner.ChildCount) do
if FTableOwner.ChildNode[z] is TIpHtmlNodeTHeadFootBody then
begin
CoreNode := TIpHtmlNodeCore(FTableOwner.ChildNode[z]);
for i := 0 to Pred(CoreNode.ChildCount) do begin
c := 0;
if CoreNode.ChildNode[i] is TIpHtmlNodeTR then
begin
TrNode := TIpHtmlNodeTR(CoreNode.ChildNode[i]);
for j := 0 to Pred(TrNode.ChildCount) do
if TrNode.ChildNode[j] is TIpHtmlNodeTableHeaderOrCell then
begin
CellNode := TIpHtmlNodeTableHeaderOrCell(TrNode.ChildNode[j]);
Inc(c, CellNode.Colspan);
end;
end;
if c > FColCount then
FColCount := c;
end;
end;
RUH := 0;
RUV := 0;
case FTableOwner.Rules of
hrNone :;
hrGroups : begin
RUH := 1;
RUV := 1;
end;
hrRows :
RUV := 1;
hrCols :
RUH := 1;
hrAll : begin
RUH := 1;
RUV := 1;
end;
end;
BL := 0; BR := 0;
BT := 0; BB := 0;
Brd := FTableOwner.Border;
case FTableOwner.Frame of
hfVoid,
hfAbove :
BT := Brd;
hfBelow :
BB := Brd;
hfHSides : begin
BT := Brd;
BB := Brd;
end;
hfLhs :
BL := Brd;
hfRhs :
BR := Brd;
hfvSides : begin
BL := Brd;
BR := Brd;
end;
hfBox,
hfBorder : begin
BT := Brd;
BB := Brd;
BL := Brd;
BR := Brd;
end;
end;
end;
Result := FColCount;
end;
initialization
TableLayouterClass := TIpNodeTableLayouter;
end.
|
unit qdac_fmx_pophint;
interface
uses classes, sysutils, types, uitypes, System.Messaging, fmx.types,
fmx.Objects, fmx.textlayout,
fmx.graphics, fmx.controls, fmx.stdctrls, fmx.forms;
type
TQPopupHintHelper = class(TFMXObject)
private
FPopup: TPopup;
FBackground: TRectangle;
FText: TLabel;
FTimer: TTimer;
FVKMsgId: Integer;
procedure DoHideHint(ASender: TObject);
procedure DoVKVisibleChanged(const Sender: TObject;
const Msg: System.Messaging.TMessage);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
TQPopupHint = class
private
FHintFrameColor: TAlphaColor;
FHintTextColor: TAlphaColor;
FHintBackgroundColor: TAlphaColor;
FHintPause: Cardinal;
FTextLayout: TTextLayout;
function HintNeeded: TQPopupHintHelper; inline;
function Prepare: TQPopupHintHelper;
function GetTextLayout: TTextLayout;
property textlayout: TTextLayout read GetTextLayout;
public
constructor Create; overload;
destructor Destroy; override;
procedure ShowHint(ACtrl: TControl; const AMsg: String;
APlacement: TPlacement = TPlacement.Bottom); overload;
procedure ShowHint(APos: TPointF; const AMsg: String); overload;
procedure ShowHint(ARect: TRectF; const AMsg: String); overload;
procedure ShowHint(const S: String;
AHorzAlign, AVertAlign: TTextAlign); overload;
function TextRect(const S: String; ASettings: TTextSettings;
AMaxWidth: Single): TRectF;
property HintFrameColor: TAlphaColor read FHintFrameColor
write FHintFrameColor;
property HintBackgroundColor: TAlphaColor read FHintBackgroundColor
write FHintBackgroundColor;
property HintTextColor: TAlphaColor read FHintTextColor
write FHintTextColor;
property HintPause: Cardinal read FHintPause write FHintPause;
end;
var
PopupHint: TQPopupHint;
implementation
uses qdac_fmx_vkhelper;
{ TQPopupHint }
constructor TQPopupHint.Create;
begin
inherited Create;
FHintFrameColor := TAlphaColors.Black;
FHintBackgroundColor := TAlphaColor($80FFFFFF);
FHintTextColor := TAlphaColors.Black;
FHintPause := 5000;
end;
destructor TQPopupHint.Destroy;
begin
if Assigned(FTextLayout) then
FTextLayout.DisposeOf;
inherited;
end;
function TQPopupHint.GetTextLayout: TTextLayout;
begin
if not Assigned(FTextLayout) then
begin
FTextLayout := TTextLayoutManager.TextLayoutByCanvas
(TCanvasManager.MeasureCanvas.ClassType)
.Create(TCanvasManager.MeasureCanvas);
FTextLayout.HorizontalAlign := TTextAlign.Leading;
end;
Result := FTextLayout;
end;
function TQPopupHint.HintNeeded: TQPopupHintHelper;
begin
Result := Prepare;
end;
function TQPopupHint.Prepare: TQPopupHintHelper;
var
AForm: TCommonCustomForm;
I: Integer;
begin
AForm := Screen.ActiveForm;
if not Assigned(AForm) then
AForm := Application.MainForm;
Result := nil;
if Assigned(AForm) then
begin
for I := 0 to AForm.ComponentCount - 1 do
begin
if AForm.Components[I] is TQPopupHintHelper then
begin
Result := AForm.Components[I] as TQPopupHintHelper;
Result.FBackground.Fill.Color := HintBackgroundColor;
Result.FBackground.Stroke.Color := HintFrameColor;
Result.FText.FontColor := HintTextColor;
Result.FTimer.Interval := HintPause;
Break;
end;
end;
if not Assigned(Result) then
begin
Result := TQPopupHintHelper.Create(AForm);
Result.FPopup.Parent := AForm;
end;
end;
end;
procedure TQPopupHint.ShowHint(ACtrl: TControl; const AMsg: String;
APlacement: TPlacement);
var
R: TRectF;
AHelper: TQPopupHintHelper;
begin
AHelper := Prepare;
if Assigned(AHelper) then
begin
R := TextRect(AMsg, AHelper.FText.ResultingTextSettings,
Screen.DesktopWidth);
AHelper.FPopup.Size.Size := TSizeF.Create(R.Width + 20, R.Height + 20);
AHelper.FText.Text := AMsg;
AHelper.FPopup.PlacementTarget := ACtrl;
AHelper.FPopup.Placement := APlacement;
AHelper.FPopup.IsOpen := true;
AHelper.FTimer.Enabled := false;
AHelper.FTimer.Enabled := true;
end;
end;
procedure TQPopupHint.ShowHint(const S: String;
AHorzAlign, AVertAlign: TTextAlign);
var
R, VKBounds: TRectF;
LT: TPointF;
AHelper: TQPopupHintHelper;
begin
AHelper := Prepare;
if Assigned(AHelper) then
begin
R := TextRect(S, AHelper.FText.ResultingTextSettings, Screen.DesktopWidth);
AHelper.FPopup.Size.Size := TSizeF.Create(R.Width + 20, R.Height + 20);
AHelper.FText.Text := S;
AHelper.FPopup.PlacementTarget := nil;
case AHorzAlign of
TTextAlign.Center:
LT.X := (Screen.Width - AHelper.FPopup.Width) / 2;
TTextAlign.Leading:
LT.X := 5;
TTextAlign.Trailing:
LT.X := (Screen.Width - 5 - AHelper.FPopup.Width);
end;
VKBounds := GetVKBounds;
if VKBounds.IsEmpty then
begin
case AVertAlign of
TTextAlign.Center:
LT.Y := (Screen.Height - AHelper.FPopup.Height) / 2;
TTextAlign.Leading:
LT.Y := 5;
TTextAlign.Trailing:
LT.Y := Screen.Height - AHelper.FPopup.Height - 5;
end;
end
else
begin
case AVertAlign of
TTextAlign.Center:
LT.Y := (VKBounds.Top - AHelper.FPopup.Height) / 2;
TTextAlign.Leading:
LT.Y := 5;
TTextAlign.Trailing:
LT.Y := VKBounds.Top - AHelper.FPopup.Height - 5;
end;
end;
if LT.X < 1 then
assert(LT.X > 0);
AHelper.FPopup.PlacementRectangle.Rect :=
RectF(LT.X, LT.Y, LT.X + AHelper.FPopup.Width,
LT.Y + AHelper.FPopup.Height);
AHelper.FPopup.PlacementTarget := nil;
AHelper.FPopup.Placement := TPlacement.Absolute;
AHelper.FPopup.IsOpen := true;
AHelper.FTimer.Enabled := false;
AHelper.FTimer.Enabled := true;
end;
end;
procedure TQPopupHint.ShowHint(ARect: TRectF; const AMsg: String);
var
R: TRectF;
AHelper: TQPopupHintHelper;
begin
AHelper := Prepare;
if Assigned(AHelper) then
begin
R := TextRect(AMsg, AHelper.FText.ResultingTextSettings,
Screen.DesktopWidth);
AHelper.FPopup.Size.Size := TSizeF.Create(R.Width + 20, R.Height + 20);
AHelper.FText.Text := AMsg;
AHelper.FPopup.PlacementTarget := nil;
if AHelper.FPopup.Height < ARect.Height then
AHelper.FPopup.Height := ARect.Height;
if AHelper.FPopup.Width < ARect.Width then
AHelper.FPopup.Width := ARect.Width;
if ARect.Left + AHelper.FPopup.Width > Screen.DesktopWidth then
ARect.Left := Screen.DesktopWidth - AHelper.FPopup.Width;
if ARect.Top + AHelper.FPopup.Height > Screen.DesktopHeight then
ARect.Top := Screen.DesktopHeight - AHelper.FPopup.Height;
AHelper.FPopup.HorizontalOffset := ARect.Left;
AHelper.FPopup.VerticalOffset := ARect.Top;
AHelper.FPopup.IsOpen := true;
AHelper.FTimer.Enabled := false;
AHelper.FTimer.Enabled := true;
end;
end;
function TQPopupHint.TextRect(const S: String; ASettings: TTextSettings;
AMaxWidth: Single): TRectF;
var
ALayout: TTextLayout;
begin
ALayout := textlayout;
Result := TRectF.Create(0, 0, AMaxWidth, MaxInt);
ALayout.BeginUpdate;
ALayout.Font.Assign(ASettings.Font);
ALayout.HorizontalAlign := ASettings.HorzAlign;
ALayout.WordWrap := ASettings.WordWrap;
ALayout.Text := S;
ALayout.TopLeft := Result.TopLeft;
ALayout.MaxSize := Result.BottomRight;
ALayout.EndUpdate;
Result := ALayout.TextRect;
end;
procedure TQPopupHint.ShowHint(APos: TPointF; const AMsg: String);
var
R: TRectF;
AHelper: TQPopupHintHelper;
begin
AHelper := Prepare;
if Assigned(AHelper) then
begin
R := TextRect(AMsg, AHelper.FText.ResultingTextSettings,
Screen.DesktopWidth);
AHelper.FPopup.Size.Size := TSizeF.Create(R.Width + 20, R.Height + 20);
AHelper.FText.Text := AMsg;
AHelper.FPopup.PlacementTarget := nil;
AHelper.FPopup.HorizontalOffset := APos.X;
AHelper.FPopup.VerticalOffset := APos.Y;
AHelper.FPopup.IsOpen := true;
AHelper.FTimer.Enabled := false;
AHelper.FTimer.Enabled := true;
end;
end;
{ TQPopupHintHelper }
constructor TQPopupHintHelper.Create(AOwner: TComponent);
begin
inherited;
FPopup := TPopup.Create(Self);
FPopup.Margins.Rect := RectF(5, 5, 5, 5);
FBackground := TRectangle.Create(FPopup);
FBackground.Parent := FPopup;
FBackground.Align := TAlignLayout.Client;
FBackground.Fill.Color := PopupHint.HintBackgroundColor;
FBackground.Stroke.Color := PopupHint.HintFrameColor;
FText := TLabel.Create(FPopup);
FText.Parent := FBackground;
FText.Align := TAlignLayout.Client;
FText.Margins.Rect := RectF(5, 5, 5, 5);
FText.StyledSettings := [];
FText.Font.Size := 14;
FText.FontColor := PopupHint.HintTextColor;
FText.TextSettings.HorzAlign := TTextAlign.Center;
FTimer := TTimer.Create(FPopup);
FTimer.OnTimer := DoHideHint;
FTimer.Interval := PopupHint.HintPause;
FTimer.Enabled := false;
FVKMsgId := TMessageManager.DefaultManager.SubscribeToMessage
(TVKStateChangeMessage, DoVKVisibleChanged);
end;
destructor TQPopupHintHelper.Destroy;
begin
TMessageManager.DefaultManager.Unsubscribe(TVKStateChangeMessage, FVKMsgId);
inherited;
end;
procedure TQPopupHintHelper.DoHideHint(ASender: TObject);
begin
FPopup.IsOpen := false;
FTimer.Enabled := false;
end;
procedure TQPopupHintHelper.DoVKVisibleChanged(const Sender: TObject;
const Msg: System.Messaging.TMessage);
var
AVKMsg: TVKStateChangeMessage absolute Msg;
R, KR: TRectF;
begin
if AVKMsg.KeyboardVisible then // ¼üÅ̿ɼû
begin
R := FPopup.PlacementRectangle.Rect;
KR := TRectF.Create(AVKMsg.KeyboardBounds);
if R.Bottom > KR.Top then
begin
OffsetRect(R, 0, KR.Top - R.Bottom-R.Height);
FPopup.PlacementRectangle.Rect := R;
end;
end;
end;
initialization
PopupHint := TQPopupHint.Create;
finalization
{$IFDEF AUTOREFCOUNT}
PopupHint := nil;
{$ELSE}
PopupHint.DisposeOf;
{$ENDIF}
end.
|
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvInterpreter_Types.PAS, released on 2002-07-04.
The Initial Developers of the Original Code are: Andrei Prygounkov <a dott prygounkov att gmx dott de>
Copyright (c) 1999, 2002 Andrei Prygounkov
All Rights Reserved.
Contributor(s):
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.delphi-jedi.org
Description : adapter unit - converts JvInterpreter calls to delphi calls
Known Issues:
-----------------------------------------------------------------------------}
// $Id: JvInterpreter_Types.pas 12461 2009-08-14 17:21:33Z obones $
unit JvInterpreter_Types;
{$I jvcl.inc}
interface
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
Types, Variants,
JvInterpreter;
function Point2Var(const Point: TPoint): Variant;
function Var2Point(const Point: Variant): TPoint;
function Rect2Var(const Rect: TRect): Variant;
function Var2Rect(const Rect: Variant): TRect;
procedure RegisterJvInterpreterAdapter(JvInterpreterAdapter: TJvInterpreterAdapter);
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$URL: https://jvcl.svn.sourceforge.net/svnroot/jvcl/branches/JVCL3_47_PREPARATION/run/JvInterpreter_Types.pas $';
Revision: '$Revision: 12461 $';
Date: '$Date: 2009-08-14 19:21:33 +0200 (ven. 14 août 2009) $';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
implementation
const
cTRect = 'TRect';
cTPoint = 'TPoint';
{ TPoint }
function Point2Var(const Point: TPoint): Variant;
var
Rec: ^TPoint;
begin
New(Rec);
Rec^ := Point;
Result := R2V(cTPoint, Rec);
end;
function Var2Point(const Point: Variant): TPoint;
begin
Result := TPoint(V2R(Point)^);
end;
procedure JvInterpreter_Point(var Value: Variant; Args: TJvInterpreterArgs);
begin
Value := Point2Var(Point(Args.Values[0], Args.Values[1]));
end;
{ TRect }
function Rect2Var(const Rect: TRect): Variant;
var
Rec: ^TRect;
begin
New(Rec);
Rec^ := Rect;
Result := R2V(cTRect, Rec);
end;
function Var2Rect(const Rect: Variant): TRect;
begin
Result := TRect(V2R(Rect)^);
end;
procedure JvInterpreter_Rect(var Value: Variant; Args: TJvInterpreterArgs);
begin
Value := Rect2Var(Rect(Args.Values[0], Args.Values[1], Args.Values[2], Args.Values[3]));
end;
procedure JvInterpreter_Bounds(var Value: Variant; Args: TJvInterpreterArgs);
begin
Value := Rect2Var(Bounds(Args.Values[0], Args.Values[1], Args.Values[2], Args.Values[3]));
end;
{ Read Field TopLeft: Integer; }
procedure TRect_Read_TopLeft(var Value: Variant; Args: TJvInterpreterArgs);
begin
Value := Point2Var(TRect(P2R(Args.Obj)^).TopLeft);
end;
{ Write Field TopLeft: Integer; }
procedure TRect_Write_TopLeft(const Value: Variant; Args: TJvInterpreterArgs);
begin
TRect(P2R(Args.Obj)^).TopLeft := Var2Point(Value);
end;
{ Read Field BottomRight: Integer; }
procedure TRect_Read_BottomRight(var Value: Variant; Args: TJvInterpreterArgs);
begin
Value := Point2Var(TRect(P2R(Args.Obj)^).BottomRight);
end;
{ Write Field Right: Integer; }
procedure TRect_Write_BottomRight(const Value: Variant; Args: TJvInterpreterArgs);
begin
TRect(P2R(Args.Obj)^).BottomRight := Var2Point(Value);
end;
procedure RegisterJvInterpreterAdapter(JvInterpreterAdapter: TJvInterpreterAdapter);
const
cTypes = 'Types';
begin
with JvInterpreterAdapter do
begin
AddExtUnit(cTypes);
{ TPoint }
AddRec(cTypes, cTPoint, SizeOf(TPoint), [RFD('X', 0, varInteger), RFD('Y', 4, varInteger)], nil, nil, nil);
AddFunction(cTypes, 'Point', JvInterpreter_Point, 2, [varInteger, varInteger], varRecord);
{ TRect }
AddRec(cTypes, cTRect, SizeOf(TRect), [RFD('Left', 0, varInteger), RFD('Top', 4, varInteger),
RFD('Right', 8, varInteger), RFD('Bottom', 12, varInteger)], nil, nil, nil);
AddFunction(cTypes, 'Rect', JvInterpreter_Rect, 4, [varInteger, varInteger, varInteger, varInteger], varRecord);
AddFunction(cTypes, 'Bounds', JvInterpreter_Bounds, 4, [varInteger, varInteger, varInteger, varInteger], varRecord);
AddRecGet(cTypes, cTRect, 'TopLeft', TRect_Read_TopLeft, 0, [varEmpty], varRecord);
AddRecSet(cTypes, cTRect, 'TopLeft', TRect_Write_TopLeft, 0, [varEmpty]);
AddRecGet(cTypes, cTRect, 'BottomRight', TRect_Read_BottomRight, 0, [varEmpty], varRecord);
AddRecSet(cTypes, cTRect, 'BottomRight', TRect_Write_BottomRight, 0, [varEmpty]);
end;
end;
{$IFDEF UNITVERSIONING}
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
end.
|
unit Aurelius.Sql.BaseTypes;
{$I Aurelius.inc}
interface
uses
Generics.Collections, DB;
type
TSQLTable = class
private
FName: string;
FSchema: string;
FAlias: string;
public
property Name: string read FName write FName;
property Schema: string read FSchema write FSchema;
property Alias: string read FAlias write FAlias;
function Clone: TSQLTable;
constructor Create(Name, Alias: string); overload;
constructor Create(Name, Schema, Alias: string); overload;
end;
TSQLField = class
private
FTable: TSQLTable;
FField: string;
public
property Table: TSQLTable read FTable write FTable;
property Field: string read FField write FField;
constructor Create(Table: TSQLTable; Field: string); virtual;
destructor Destroy; override;
end;
TJoinType = (Inner, Left);
TSQLJoinSegment = class
private
FPKField: TSQLField;
FFKField: TSQLField;
public
property PKField: TSQLField read FPKField write FPKField;
property FKField: TSQLField read FFKField write FFKField;
constructor Create(PKField, FKField: TSQLField);
destructor Destroy; override;
end;
TSQLJoin = class
private
FJoinType: TJoinType;
FSegments: TObjectList<TSQLJoinSegment>;
public
property Segments: TObjectList<TSQLJoinSegment> read FSegments write FSegments;
property JoinType: TJoinType read FJoinType write FJoinType;
constructor Create(JoinType: TJoinType = TJoinType.Inner); virtual;
destructor Destroy; override;
end;
TAggregateFunction = (Count, Sum, Average, Max, Min, List);
TAggregateFunctionSet = set of TAggregateFunction;
TSQLSelectField = class(TSQLField)
private
FIsAggregated: Boolean;
FAggregateFuntion: TAggregateFunction;
public
property IsAggregated: Boolean read FIsAggregated write FIsAggregated;
property AggregateFuntion: TAggregateFunction read FAggregateFuntion write FAggregateFuntion;
constructor Create(Table: TSQLTable; Field: string); overload; override;
constructor Create(Table: TSQLTable; Field: string; AggregateFunction: TAggregateFunction); reintroduce; overload; virtual;
end;
TWhereOperator = (woEqual, woDifferent, woGreater, woLess, woGreaterOrEqual,
woLessOrEqual, woLike, woIsNull, woIsNotNull, woIn);
TWhereOperationSet = set of TWhereOperator;
TSQLWhereField = class(TSQLField)
private
FWhereOperator: TWhereOperator;
FParamName: string;
public
property WhereOperator: TWhereOperator read FWhereOperator write FWhereOperator;
property ParamName: string read FParamName write FParamName;
constructor Create(Table: TSQLTable; Field: string); overload; override;
constructor Create(Table: TSQLTable; Field: string; WhereOperator: TWhereOperator); reintroduce; overload; virtual;
end;
TOrderDirection = (Ascendant, Descendant);
TSQLOrderField = class(TSQLField)
private
FDirection: TOrderDirection;
public
property Direction: TOrderDirection read FDirection write FDirection;
constructor Create(Table: TSQLTable; Field: string); overload; override;
constructor Create(Table: TSQLTable; Field: string; Direction: TOrderDirection); reintroduce; overload; virtual;
end;
implementation
{ TSQLField }
constructor TSQLField.Create(Table: TSQLTable; Field: string);
begin
FTable := Table;
FField := Field;
end;
destructor TSQLField.Destroy;
begin
FTable.Free;
inherited;
end;
{ TSQLJoin }
constructor TSQLJoin.Create(JoinType: TJoinType);
begin
FJoinType := JoinType;
FSegments := TObjectList<TSQLJoinSegment>.Create;
end;
destructor TSQLJoin.Destroy;
begin
FSegments.Free;
inherited;
end;
{ TSQLTable }
constructor TSQLTable.Create(Name, Alias: string);
begin
FName := Name;
FAlias := Alias;
end;
function TSQLTable.Clone: TSQLTable;
begin
Result := TSQLTable.Create(FName, FSchema, FAlias);
end;
constructor TSQLTable.Create(Name, Schema, Alias: string);
begin
Create(Name, Alias);
FSchema := Schema;
end;
{ TSQLWhereField }
constructor TSQLWhereField.Create(Table: TSQLTable; Field: string;
WhereOperator: TWhereOperator);
begin
inherited Create(Table, Field);
FWhereOperator := WhereOperator;
end;
constructor TSQLWhereField.Create(Table: TSQLTable; Field: string);
begin
inherited;
end;
{ TSQLOrderField }
constructor TSQLOrderField.Create(Table: TSQLTable; Field: string;
Direction: TOrderDirection);
begin
inherited Create(Table, Field);
FDirection := Direction;
end;
constructor TSQLOrderField.Create(Table: TSQLTable; Field: string);
begin
inherited;
end;
{ TSQLSelectField }
constructor TSQLSelectField.Create(Table: TSQLTable; Field: string;
AggregateFunction: TAggregateFunction);
begin
inherited Create(Table, Field);
FAggregateFuntion := AggregateFunction;
FIsAggregated := True;
end;
constructor TSQLSelectField.Create(Table: TSQLTable; Field: string);
begin
inherited;
end;
{ TSQLJoinSegment }
constructor TSQLJoinSegment.Create(PKField, FKField: TSQLField);
begin
FPKField := PKField;
FFKField := FKField;
end;
destructor TSQLJoinSegment.Destroy;
begin
FPKField.Free;
FFKField.Free;
inherited;
end;
end.
|
program Exercicio5;
type mat4x4 = array[1..4, 1..4] of integer;
var
matriz : mat4x4;
i, j, soma : integer;
begin
soma := 0;
for i := 1 to 4 do
begin
for j := 1 to 4 do
begin
write('Matriz[',i,'][',j,'] = ');
read(matriz[i][j]);
if (i + j) = 5 then
begin
soma := soma + matriz[i][j];
end;
end;
end;
writeln('A soma da diagonal secundaria: ', soma);
end. |
unit CommonfrmGridReport;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids,
OTFEFreeOTFEBase_U, Menus, ActnList, ExtCtrls, SDUStringGrid, Buttons, ComCtrls,
SDUForms, SDUDialogs;
type
TTextFormat = (clfText, clfTSV, clfCSV);
TfrmGridReport = class(TSDUForm)
pbSave: TButton;
pbClose: TButton;
ActionList1: TActionList;
mnuPopup: TPopupMenu;
actSelectAll: TAction;
actCopy: TAction;
Selectall1: TMenuItem;
Copy1: TMenuItem;
lblTitle: TLabel;
SaveDialog: TSDUSaveDialog;
pnlBetweenButtons: TPanel;
pnlBetweenButtonsCenter: TPanel;
lblTotalDrivers: TLabel;
lblTotalAlgorithms: TLabel;
ckShowAdvanced: TCheckBox;
lvReport: TListView;
pbDrivers: TButton;
procedure pbCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure actSelectAllExecute(Sender: TObject);
procedure ckShowAdvancedClick(Sender: TObject);
procedure actCopyExecute(Sender: TObject);
procedure pbSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure lvReportColumnClick(Sender: TObject; Column: TListColumn);
procedure lvReportCompare(Sender: TObject; Item1, Item2: TListItem;
Data: Integer; var Compare: Integer);
procedure ActionList1Update(Action: TBasicAction; var Handled: Boolean);
procedure pbDriversClick(Sender: TObject);
private
FColumnToSort: integer;
function FormatRow(format: TTextFormat; rowIdx: integer): string;
function FormatRow_TSV(rowIdx: integer): string;
function FormatRow_CSV(rowIdx: integer): string;
function FormatRow_xSV(rowIdx: integer; seperatorChar: char): string;
function FormatRow_xSV_Header(seperatorChar: char): string;
function FormatRow_xSV_Item(rowIdx: integer; seperatorChar: char): string;
function FormatRow_Text(rowIdx: integer): string;
function CellText(x, y: integer): string;
protected
function CountDrivers(): integer; virtual; abstract;
function CountImplementations(): integer; virtual; abstract;
procedure SetupGrid(); virtual;
procedure AddCol(colCaption: string);
procedure ResizeColumns();
procedure PopulateGrid(); virtual;
function IsColumnAdvanced(colIdx: integer): boolean; virtual;
public
OTFEFreeOTFE: TOTFEFreeOTFEBase;
end;
resourcestring
COL_TITLE_DRIVER_TITLE = 'Driver title';
COL_TITLE_DRIVER_VERSION = 'Driver version';
COL_TITLE_DRIVER_GUID = 'Driver GUID';
COL_TITLE_DRIVER_DEVICE_NAME = 'Driver device name';
COL_TITLE_DRIVER_USER_MODE_NAME = 'Driver user mode name';
COL_TITLE_DRIVER_KERNEL_MODE_NAME = 'Driver kernel mode name';
const
HEADER_ROW = -1;
implementation
{$R *.dfm}
uses
Clipbrd, // Required for clipboard functions
Math,
SDUi18n,
SDUGeneral,
{$IFDEF FREEOTFE_MAIN}
// When run under main FreeOTFE GUI, user can access driver control dialog
// via main FreeOTFE app
FreeOTFEfrmMain,
{$ENDIF}
CommonSettings,
SDUGraphics;
resourcestring
// Save dialog related
FILE_FILTER_FLT_REPORTS = 'Text report (*.txt)|*.txt|Comma separated values (*.csv)|*.csv|Tab separated values (*.tsv)|*.tsv';
FILE_FILTER_DFLT_REPORTS = 'txt';
const
// Important! This ordering maps the TTextFormat to the filter index
// specified in FILE_FILTER_FLT_REPORTS
FILE_FILTER_TO_FORMAT: array [TTextFormat] of integer = (1, 3, 2);
procedure TfrmGridReport.SetupGrid();
begin
lvReport.items.clear();
lvReport.RowSelect := TRUE;
FColumnToSort := 0;
lvReport.Columns.Clear();
end;
procedure TfrmGridReport.actCopyExecute(Sender: TObject);
var
outString: string;
i: integer;
begin
outString := '';
outString := outString + FormatRow(clfTSV, HEADER_ROW);
for i:=0 to (lvReport.items.count - 1) do
begin
if lvReport.items[i].selected then
begin
outString := outString + FormatRow(clfTSV, i);
end;
end;
Clipboard.AsText := outString;
end;
procedure TfrmGridReport.ActionList1Update(Action: TBasicAction;
var Handled: Boolean);
var
i: integer;
begin
// Can't select all unless there's something to select...
actSelectAll.Enabled := (lvReport.items.count > 0);
// Can't copy unless there's something selected...
actCopy.Enabled := FALSE;
for i:=0 to (lvReport.items.count - 1) do
begin
if lvReport.items[i].selected then
begin
actCopy.Enabled := TRUE;
break;
end;
end;
end;
procedure TfrmGridReport.actSelectAllExecute(Sender: TObject);
var
i: integer;
begin
for i:=0 to (lvReport.items.count-1) do
begin
lvReport.items[i].Selected := TRUE;
end;
end;
procedure TfrmGridReport.ckShowAdvancedClick(Sender: TObject);
begin
PopulateGrid();
end;
procedure TfrmGridReport.FormResize(Sender: TObject);
begin
SDUCenterControl(pnlBetweenButtonsCenter, ccHorizontal);
end;
procedure TfrmGridReport.FormShow(Sender: TObject);
var
totalAlgs: integer;
begin
totalAlgs := CountImplementations();
lblTotalDrivers.caption := SDUParamSubstitute(_('Total drivers: %1'), [CountDrivers]);
lblTotalAlgorithms.caption := SDUParamSubstitute(_('Total algorithms: %1'), [totalAlgs]);
ckShowAdvanced.checked := FALSE;
PopulateGrid();
end;
procedure TfrmGridReport.pbCloseClick(Sender: TObject);
begin
Close();
end;
procedure TfrmGridReport.pbDriversClick(Sender: TObject);
begin
{$IFDEF FREEOTFE_MAIN}
// When run under main FreeOTFE GUI, user can access driver control dialog
// via main FreeOTFE app
if (Owner is TfrmFreeOTFEMain) then
begin
TfrmFreeOTFEMain(Owner).DisplayDriverControlDlg();
end;
{$ENDIF}
end;
procedure TfrmGridReport.pbSaveClick(Sender: TObject);
var
testFormatCypher: TTextFormat;
useFormat: TTextFormat;
sContent: string;
stlContent: TStringList;
i: integer;
begin
SaveDialog.Filter := FILE_FILTER_FLT_REPORTS;
SaveDialog.DefaultExt := FILE_FILTER_DFLT_REPORTS;
FreeOTFEGUISetupOpenSaveDialog(SaveDialog);
if SaveDialog.Execute() then
begin
// Identify file format to save as...
useFormat := clfText;
for testFormatCypher:=low(FILE_FILTER_TO_FORMAT) to high(FILE_FILTER_TO_FORMAT) do
begin
if (SaveDialog.FilterIndex = FILE_FILTER_TO_FORMAT[testFormatCypher]) then
begin
useFormat := testFormatCypher;
break;
end;
end;
// Generate file contents...
if (CountImplementations() <= 0) then
begin
sContent := _('No implementations found');
end
else
begin
if (useFormat <> clfText) then
begin
sContent := FormatRow(useFormat, HEADER_ROW);
end;
for i:=0 to (lvReport.items.count - 1) do
begin
sContent := sContent + FormatRow(useFormat, i);
end;
end;
stlContent:= TStringList.Create();
try
// Add header if text report
if (useFormat = clfText) then
begin
OTFEFreeOTFE.AddStdDumpHeader(stlContent, self.caption);
stlContent.Add(_('Summary'));
stlContent.Add(StringOfChar('-', length(_('Summary'))));
stlContent.Add(SDUParamSubstitute(_('Total drivers : %1'), [CountDrivers()]));
stlContent.Add(SDUParamSubstitute(_('Total algorithms: %1'), [CountImplementations()]));
stlContent.Add('');
stlContent.Add('');
stlContent.Add(_('Details'));
stlContent.Add(StringOfChar('-', length(_('Details'))));
stlContent.Add('');
end;
// ...and dump to file
stlContent.Text := stlContent.Text + sContent;
stlContent.SaveToFile(SaveDialog.FileName);
finally
stlContent.Free();
end;
end;
end;
function TfrmGridReport.FormatRow_TSV(rowIdx: integer): string;
begin
Result := FormatRow_xSV(rowIdx, #9);
end;
function TfrmGridReport.FormatRow_CSV(rowIdx: integer): string;
begin
Result := FormatRow_xSV(rowIdx, ',');
end;
function TfrmGridReport.FormatRow_xSV(rowIdx: integer; seperatorChar: char): string;
var
row: string;
begin
if (rowIdx = HEADER_ROW) then
begin
row := FormatRow_xSV_Header(seperatorChar);
end
else
begin
row := FormatRow_xSV_Item(rowIdx, seperatorChar);
end;
Result := row + SDUCRLF;
end;
function TfrmGridReport.FormatRow_xSV_Header(seperatorChar: char): string;
var
retval: string;
i: integer;
begin
retval := '';
for i:=0 to (lvReport.columns.count - 1) do
begin
if (retval <> '') then
begin
retval := retval + seperatorChar;
end;
retval := retval + lvReport.columns[i].caption;
end;
Result := retval;
end;
function TfrmGridReport.FormatRow_xSV_Item(rowIdx: integer; seperatorChar: char): string;
var
retval: string;
i: integer;
item: TListItem;
itemText: string;
begin
retval := '';
for i:=0 to (lvReport.columns.count - 1) do
begin
if (retval <> '') then
begin
retval := retval + seperatorChar;
end;
item := lvReport.Items[rowIdx];
if (i = 0) then
begin
itemText := item.caption;
end
else
begin
itemText := item.SubItems.Strings[i-1];
end;
retval := retval + itemText
end;
Result := retval;
end;
procedure TfrmGridReport.FormCreate(Sender: TObject);
begin
lvReport.ViewStyle := vsReport;
lvReport.Multiselect := TRUE;
lvReport.ReadOnly := TRUE;
pnlBetweenButtons.BevelInner := bvNone;
pnlBetweenButtons.BevelOuter := bvNone;
pnlBetweenButtons.Caption := '';
pnlBetweenButtonsCenter.BevelInner := bvNone;
pnlBetweenButtonsCenter.BevelOuter := bvNone;
pnlBetweenButtonsCenter.Caption := '';
SDUSetUACShieldIcon(pbDrivers);
{$IFNDEF FREEOTFE_MAIN}
// When run under main FreeOTFE GUI, user can access driver control dialog
// via main FreeOTFE app
pbDrivers.Visible := FALSE;
{$ENDIF}
end;
function TfrmGridReport.FormatRow_Text(rowIdx: integer): string;
var
retval: string;
i: integer;
maxTitleX: integer;
begin
retval := '';
// Identify longest column title
maxTitleX := 0;
for i:=0 to (lvReport.columns.count - 1) do
begin
maxTitleX := max(maxTitleX, length(CellText(i, HEADER_ROW)));
end;
for i:=0 to (lvReport.columns.count - 1) do
begin
retval := retval +
CellText(i, HEADER_ROW) +
StringOfChar(' ', (maxTitleX - length(CellText(i, HEADER_ROW)))) +
': ' +
CellText(i, rowIdx) +
SDUCRLF;
end;
retval := retval + SDUCRLF;
Result := retval;
end;
function TfrmGridReport.FormatRow(format: TTextFormat; rowIdx: integer): string;
var
retval: string;
begin
retval := '';
case format of
clfTSV:
begin
retval := FormatRow_TSV(rowIdx);
end;
clfCSV:
begin
retval := FormatRow_CSV(rowIdx);
end;
clfText:
begin
retval := FormatRow_Text(rowIdx);
end;
else
begin
SDUMessageDlg(
_('Unknown output format?!')+SDUCRLF+
SDUCRLF+
_('Please report seeing this error!'),
mtError
);
end;
end;
Result := retval;
end;
function TfrmGridReport.IsColumnAdvanced(colIdx: integer): boolean;
begin
Result := FALSE;
end;
procedure TfrmGridReport.lvReportColumnClick(Sender: TObject;
Column: TListColumn);
begin
FColumnToSort := Column.Index;
lvReport.AlphaSort(); // trigger compare
if (FColumnToSort = 0) then
begin
if (lvReport.Tag = 1) then
begin
lvReport.Tag := 0;
end
else
begin
lvReport.Tag := 1;
end;
end
else
begin
if (lvReport.Columns.Items[FColumnToSort-1].Tag = 1) then
begin
lvReport.Columns.Items[FColumnToSort-1].Tag := 0;
end
else
begin
lvReport.Columns.Items[FColumnToSort-1].Tag := 1;
end;
end;
end;
procedure TfrmGridReport.lvReportCompare(Sender: TObject; Item1,
Item2: TListItem; Data: Integer; var Compare: Integer);
function CompareNumbers(ext1, ext2: extended): integer;
var
retval: integer;
begin
retval := 0;
if (ext1 > ext2) then
begin
retval := 1;
end
else if (ext1 < ext2) then
begin
retval := -1;
end;
Result := retval;
end;
var
str1, str2: string;
colTag: integer;
ext1, ext2: Extended;
areNumbers: boolean;
begin
if (FColumnToSort = 0) then
begin
ColTag := lvReport.Tag;
Str1 := Item1.Caption;
Str2 := Item2.Caption;
end
else
begin
ColTag := lvReport.Columns.Items[FColumnToSort-1].Tag;
Str1 := Item1.SubItems.Strings[FColumnToSort-1];
Str2 := Item2.SubItems.Strings[FColumnToSort-1];
end;
try
ext1 := StrToFloat(Str1);
ext2 := StrToFloat(Str2);
areNumbers := TRUE;
if (ColTag = 1) then
begin
Compare := CompareNumbers(ext1, ext2);
end
else
begin
Compare := CompareNumbers(ext2, ext1);
end;
except
areNumbers := FALSE;
end;
if not(areNumbers) then
begin
if (ColTag = 1) then
begin
Compare := CompareText(Str1, Str2);
end
else
begin
Compare := CompareText(Str2, Str1);
end;
end;
end;
procedure TfrmGridReport.PopulateGrid();
begin
SetupGrid();
end;
procedure TfrmGridReport.AddCol(colCaption: string);
var
newCol: TListColumn;
begin
newCol := lvReport.columns.Add();
newCol.Caption := colCaption;
// Note: DON'T set AutoSize to TRUE; otherwise if the user resizes the
// dialog, any user set column widths will be reverted
// newCol.AutoSize := TRUE;
end;
procedure TfrmGridReport.ResizeColumns();
const
// Resize the columns such that they're as wide as the widest item/subitem
// text
RESIZE_EXCL_HEADER = -1;
// Resize the columns such that they're as wide as the column header text/the
// widest item/subitem
RESIZE_INCL_HEADER = -2;
var
i: integer;
prevAutoSize: boolean;
begin
for i:=0 to (lvReport.columns.count -1) do
begin
prevAutoSize := lvReport.column[i].AutoSize;
lvReport.column[i].AutoSize := TRUE;
lvReport.column[i].width := RESIZE_INCL_HEADER;
// Revert AutoSize...
lvReport.column[i].AutoSize := prevAutoSize;
end;
end;
function TfrmGridReport.CellText(x, y: integer): string;
var
itemText: string;
item: TListItem;
begin
if (y = HEADER_ROW) then
begin
itemText := lvReport.columns[x].caption
end
else
begin
item := lvReport.items[y];
if (x = 0) then
begin
itemText := item.caption;
end
else
begin
itemText := item.SubItems.Strings[x-1];
end;
end;
Result := itemText;
end;
END.
|
procedure orange(n:integer);
begin
if n=0 then exit;
writeln('orange');
orange(n-1);
end;
begin
orange(3);
end. |
unit UCadastroProdutoExemplo;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls,
Data.DB, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
FireDAC.Comp.DataSet, FireDAC.Comp.Client, UProduto, System.Generics.Collections,
System.Rtti;
type
TCadastroProdutoExemplo = class(TForm)
DBGrid1: TDBGrid;
DsProduto: TDataSource;
Button2: TButton;
EdtNome: TEdit;
QueryProduto: TFDMemTable;
QueryProdutoCodigo: TIntegerField;
QueryProdutoNome: TStringField;
QueryProdutoAtivo: TIntegerField;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure DsProdutoDataChange(Sender: TObject; Field: TField);
procedure FormDestroy(Sender: TObject);
private
FListaProdutos: TObjectList<TProduto>;
procedure PreencherLista;
//procedure PreencherDataSet;
procedure PreencherCampos(Produto: TProduto);
procedure AdicionarNaLista(Produto : TProduto);
function IncluirProduto(Dados: Array of Variant): TProduto;
public
{ Public declarations }
end;
var
CadastroProdutoExemplo: TCadastroProdutoExemplo;
implementation
{$R *.dfm}
uses UBDados, UProdutoController;
procedure TCadastroProdutoExemplo.AdicionarNaLista(Produto: TProduto);
begin
FListaProdutos.Add(Produto);
QueryProduto.Append;
QueryProduto.FieldByName('Codigo').AsInteger := Produto.Codigo;
QueryProduto.FieldByName('Nome').AsString := Produto.Nome;
QueryProduto.FieldByName('Ativo').AsBoolean := Produto.Ativo;
QueryProduto.Post;
end;
procedure TCadastroProdutoExemplo.Button2Click(Sender: TObject);
Var
ProdutoController : TProdutoController;
Prod : TProduto;
begin
ProdutoController := TProdutoController.Create;
Prod := TProduto.Create;
Prod.Nome := EdtNome.Text;
try
If ProdutoController.Salvar(Prod) Then
Begin
AdicionarNaLista(Prod);
End;
finally
Begin
FreeAndNil(ProdutoController);
End;
end;
end;
procedure TCadastroProdutoExemplo.DsProdutoDataChange(Sender: TObject; Field: TField);
begin
if (DsProduto.DataSet.RecordCount > 0) and not(DsProduto.State in [dsInsert,dsEdit]) then
Begin
PreencherCampos(FListaProdutos[QueryProduto.RecNo - 1]);
End;
end;
procedure TCadastroProdutoExemplo.FormCreate(Sender: TObject);
begin
FListaProdutos := TObjectList<TProduto>.Create;
QueryProduto.Open;
PreencherLista;
QueryProduto.First;
end;
procedure TCadastroProdutoExemplo.FormDestroy(Sender: TObject);
begin
FListaProdutos.Free;
end;
function TCadastroProdutoExemplo.IncluirProduto(Dados: array of Variant): TProduto;
begin
Result := TProduto.Create;
Result.Codigo := Dados[0];
Result.Nome := Dados[1];
Result.Ativo := Dados[2];
end;
procedure TCadastroProdutoExemplo.PreencherCampos(Produto: TProduto);
var
Contexto: TRttiContext;
Tipo: TRttiType;
Propriedade: TRttiProperty;
Valor: variant;
Componente: TComponent;
begin
Contexto := TRttiContext.Create;
Tipo := Contexto.GetType(TProduto.ClassInfo);
try
for Propriedade in Tipo.GetProperties do
begin
Valor := Propriedade.GetValue(Produto).AsVariant;
Componente := FindComponent('Edt' + Propriedade.Name);
if Componente is TEdit then
(Componente as TEdit).Text := Valor;
if Componente is TCheckBox then
(Componente as TCheckBox).Checked := Valor;
end;
finally
Contexto.Free;
end;
end;
(*procedure TCadastroProduto.PreencherDataSet;
var
Contexto : TRttiContext;
Tipo : TRttiType;
PCodigo, PNome, PAtivo : TRttiProperty;
Prod : TProduto;
//Values : Array of TVarRec;
begin
Contexto := TRttiContext.Create;
try
Tipo := Contexto.GetType(TProduto.ClassInfo);
PCodigo := Tipo.GetProperty('Codigo');
PNome := Tipo.GetProperty('Nome');
PAtivo := Tipo.GetProperty('Ativo');
for Prod in FListaProdutos do
QueryProduto.AppendRecord([PCodigo.GetValue(Prod).AsInteger,
PNome.GetValue(Prod).AsString,
PAtivo.GetValue(Prod).AsInteger]);
{for Prod in FListaProdutos do
Begin
for Propriedade in Tipo.GetProperties do
Begin
SetLength(Values,Length(Values) + 1);
Values[Length(Values) - 1] := Propriedade.GetValue(Prod).AsVarRec;
End;
QueryProduto.AppendRecord(Values);
SetLength(Values,0);
End;}
QueryProduto.First;
finally
Contexto.Free;
end;
end;*)
procedure TCadastroProdutoExemplo.PreencherLista;
Var
Query : TFDQuery;
begin
Query := TFDQuery.Create(Application);
Query.Connection := BDados.BDados;
try
With Query Do
Begin
Open('SELECT * FROM Produto ORDER BY CODIGO');
while not Eof do
Begin
AdicionarNaLista(IncluirProduto([FieldByName('Codigo').AsInteger,
FieldByName('Nome').AsString,
FieldByName('Ativo').AsInteger]));
Next;
End;
Close;
End;
finally
FreeAndNil(Query);
end;
end;
end.
|
{
this file is part of Ares
Aresgalaxy ( http://aresgalaxy.sourceforge.net )
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
{
Description:
used to extract widestring comand line parameters
}
unit helper_params;
interface
uses
windows{,tntsysutils};
function WideParamStr(Index: Integer): WideString;
function WideParamCount: Integer;
function WideGetParamStr(P: PWideChar; var Param: WideString): PWideChar;
function should_hide_in_params:boolean;
implementation
function should_hide_in_params:boolean;
var
i:integer;
begin
result:=false;
for I := 1 to wideParamCount do begin
if wideparamstr(i)='-h' then begin
result:=true;
break;
end;
end;
end;
function WideParamCount:Integer;
var
P: PWideChar;
S: WideString;
begin
P := WideGetParamStr(GetCommandLineW,S);
Result := 0;
while True do begin
P := WideGetParamStr(P, S);
if S = '' then Break;
Inc(Result);
end;
end;
function WideGetParamStr(P: PWideChar; var Param: WideString): PWideChar;
var
Len: Integer;
Buffer: array[0..4095] of WideChar;
begin
while True do
begin
while (P[0] <> #0) and (P[0] <= ' ') do Inc(P);
if (P[0] = '"') and (P[1] = '"') then Inc(P, 2) else Break;
end;
Len := 0;
while (P[0] > ' ') and (Len < SizeOf(Buffer)) do
if P[0] = '"' then
begin
Inc(P);
while (P[0] <> #0) and (P[0] <> '"') do
begin
Buffer[Len] := P[0];
Inc(Len);
Inc(P);
end;
if P[0] <> #0 then Inc(P);
end else
begin
Buffer[Len] := P[0];
Inc(Len);
Inc(P);
end;
SetString(Param, Buffer, Len);
Result := P;
end;
function WideParamStr(Index: Integer): WideString;
var
P: PWideChar;
begin
if Index = 0 then
// Result := WideGetModuleFileName(0)
else begin
P := GetCommandLineW;
while True do begin
P := WideGetParamStr(P, Result);
if (Index = 0) or (Result = '') then Break;
Dec(Index);
end;
end;
end;
end.
|
{*******************************************************************************
作者: dmzn@163.com 2008-08-07
描述: 系统数据库常量定义
备注:
*.自动创建SQL语句,支持变量:$Inc,自增;$Float,浮点;$Integer=sFlag_Integer;
$Decimal=sFlag_Decimal;$Image,二进制流
*******************************************************************************}
unit USysDB;
{$I Link.inc}
interface
uses
SysUtils, Classes;
const
cSysDatabaseName: array[0..4] of String = (
'Access', 'SQL', 'MySQL', 'Oracle', 'DB2');
//db names
type
TSysDatabaseType = (dtAccess, dtSQLServer, dtMySQL, dtOracle, dtDB2);
//db types
PSysTableItem = ^TSysTableItem;
TSysTableItem = record
FTable: string;
FNewSQL: string;
end;
//系统表项
var
gSysTableList: TList = nil; //系统表数组
gSysDBType: TSysDatabaseType = dtSQLServer; //系统数据类型
//------------------------------------------------------------------------------
const
//自增字段
sField_Access_AutoInc = 'Counter';
sField_SQLServer_AutoInc = 'Integer IDENTITY (1,1) PRIMARY KEY';
//小数字段
sField_Access_Decimal = 'Float';
sField_SQLServer_Decimal = 'Decimal(15, 5)';
//图片字段
sField_Access_Image = 'OLEObject';
sField_SQLServer_Image = 'Image';
//日期相关
sField_SQLServer_Now = 'getDate()';
ResourceString
{*权限项*}
sPopedom_Read = 'A'; //浏览
sPopedom_Add = 'B'; //添加
sPopedom_Edit = 'C'; //修改
sPopedom_Delete = 'D'; //删除
sPopedom_Preview = 'E'; //预览
sPopedom_Print = 'F'; //打印
sPopedom_Export = 'G'; //导出
{*相关标记*}
sFlag_Yes = 'Y'; //是
sFlag_No = 'N'; //否
sFlag_Enabled = 'Y'; //启用
sFlag_Disabled = 'N'; //禁用
sFlag_Integer = 'I'; //整数
sFlag_Decimal = 'D'; //小数
sFlag_IOType_In = 'C'; //充值
sFlag_IOType_Out = 'X'; //消费
sFlag_GroupUnit = 'Unit'; //单位
sFlag_GroupColor = 'Color'; //颜色
sFlag_GroupType = 'Type'; //类型
sFlag_BusGroup = 'BusFunction'; //业务编码组
sFlag_MemberID = 'ID_Member'; //会员编号
sFlag_WashTypeID = 'ID_WashType'; //衣物类型
sFlag_WashData = 'ID_WashData'; //洗衣记录
{*数据表*}
sTable_Group = 'Sys_Group'; //用户组
sTable_User = 'Sys_User'; //用户表
sTable_Menu = 'Sys_Menu'; //菜单表
sTable_Popedom = 'Sys_Popedom'; //权限表
sTable_PopItem = 'Sys_PopItem'; //权限项
sTable_Entity = 'Sys_Entity'; //字典实体
sTable_DictItem = 'Sys_DataDict'; //字典明细
sTable_SysDict = 'Sys_Dict'; //系统字典
sTable_ExtInfo = 'Sys_ExtInfo'; //附加信息
sTable_SysLog = 'Sys_EventLog'; //系统日志
sTable_BaseInfo = 'Sys_BaseInfo'; //基础信息
sTable_SerialBase = 'Sys_SerialBase'; //编码种子
sTable_Member = 'W_Member'; //会员表
sTable_InOutMoney = 'W_InOutMoney'; //资金明细
sTable_WashType = 'W_WashType'; //衣物类型
sTable_WashData = 'W_WashData'; //洗衣数据
sTable_WashDetail = 'W_WashDetail'; //收衣明细
sTable_WashOut = 'W_WashOut'; //取衣数据
{*新建表*}
sSQL_NewSysDict = 'Create Table $Table(D_ID $Inc, D_Name varChar(15),' +
'D_Desc varChar(30), D_Value varChar(50), D_Memo varChar(20),' +
'D_ParamA $Float, D_ParamB varChar(50), D_Index Integer Default 0)';
{-----------------------------------------------------------------------------
系统字典: SysDict
*.D_ID: 编号
*.D_Name: 名称
*.D_Desc: 描述
*.D_Value: 取值
*.D_Memo: 相关信息
*.D_ParamA: 浮点参数
*.D_ParamB: 字符参数
*.D_Index: 显示索引
-----------------------------------------------------------------------------}
sSQL_NewExtInfo = 'Create Table $Table(I_ID $Inc, I_Group varChar(20),' +
'I_ItemID varChar(20), I_Item varChar(30), I_Info varChar(500),' +
'I_ParamA $Float, I_ParamB varChar(50), I_Index Integer Default 0)';
{-----------------------------------------------------------------------------
扩展信息表: ExtInfo
*.I_ID: 编号
*.I_Group: 信息分组
*.I_ItemID: 信息标识
*.I_Item: 信息项
*.I_Info: 信息内容
*.I_ParamA: 浮点参数
*.I_ParamB: 字符参数
*.I_Memo: 备注信息
*.I_Index: 显示索引
-----------------------------------------------------------------------------}
sSQL_NewSysLog = 'Create Table $Table(L_ID $Inc, L_Date DateTime,' +
'L_Man varChar(32),L_Group varChar(20), L_ItemID varChar(20),' +
'L_KeyID varChar(20), L_Event varChar(220))';
{-----------------------------------------------------------------------------
系统日志: SysLog
*.L_ID: 编号
*.L_Date: 操作日期
*.L_Man: 操作人
*.L_Group: 信息分组
*.L_ItemID: 信息标识
*.L_KeyID: 辅助标识
*.L_Event: 事件
-----------------------------------------------------------------------------}
sSQL_NewBaseInfo = 'Create Table $Table(B_ID $Inc, B_Group varChar(15),' +
'B_Text varChar(100), B_Py varChar(25), B_Memo varChar(50),' +
'B_PID Integer, B_Index Float)';
{-----------------------------------------------------------------------------
基本信息表: BaseInfo
*.B_ID: 编号
*.B_Group: 分组
*.B_Text: 内容
*.B_Py: 拼音简写
*.B_Memo: 备注信息
*.B_PID: 上级节点
*.B_Index: 创建顺序
-----------------------------------------------------------------------------}
sSQL_NewSerialBase = 'Create Table $Table(R_ID $Inc, B_Group varChar(15),' +
'B_Object varChar(32), B_Prefix varChar(25), B_IDLen Integer,' +
'B_Base Integer, B_Date DateTime)';
{-----------------------------------------------------------------------------
串行编号基数表: SerialBase
*.R_ID: 编号
*.B_Group: 分组
*.B_Object: 对象
*.B_Prefix: 前缀
*.B_IDLen: 编号长
*.B_Base: 基数
*.B_Date: 参考日期
-----------------------------------------------------------------------------}
sSQL_NewMember = 'Create Table $Table(R_ID $Inc, M_ID varChar(16),' +
'M_Name varChar(32), M_Py varChar(32),' +
'M_Phone varChar(32), M_Times Integer,' +
'M_MoneyIn $Float, M_MoneyOut $Float, M_MoneyFreeze $Float,' +
'M_JiFen $Float, M_ZheKou $Float)';
{-----------------------------------------------------------------------------
会员表: Member
*.R_ID: 编号
*.M_ID: 内码
*.M_Name: 姓名
*.M_Py: 拼音
*.M_Phone: 手机号
*.M_MoneyIn: 充值金额
*.M_MoneyOut: 消费金额
*.M_MoneyFreeze: 冻结金额
*.M_Times: 消费次数
*.M_JiFen: 积分
*.M_ZheKou: 折扣
-----------------------------------------------------------------------------}
sSQL_NewInOutMoney = 'Create Table $Table(R_ID $Inc, M_ID varChar(16),' +
'M_Type Char(1), M_Money $Float, M_Man varChar(16), M_Date DateTime,' +
'M_Memo varChar(100))';
{-----------------------------------------------------------------------------
资金明细: InOutMoney
*.R_ID: 编号
*.M_ID: 标识
*.M_Type: 类型
*.M_Money: 金额
*.M_Man: 收款人
*.M_Date: 日期
*.M_Memo: 描述
-----------------------------------------------------------------------------}
sSQL_NewWashType = 'Create Table $Table(R_ID $Inc, T_ID varChar(16),' +
'T_Name varChar(32), T_Py varChar(32), T_Unit varChar(16),' +
'T_WashType varChar(16), T_Price $Float, T_Memo varChar(100))';
{-----------------------------------------------------------------------------
衣物表: WashType
*.R_ID: 编号
*.T_ID: 标识
*.T_Name,T_Py: 名称
*.T_Unit: 单位
*.T_WashType: 洗衣类型(干/水)
*.T_Price: 单件价格
*.T_Memo: 备注
-----------------------------------------------------------------------------}
sSQL_NewWashData = 'Create Table $Table(R_ID $Inc, D_ID varChar(16),' +
'D_MID varChar(16), D_Number Integer, D_HasNumber Integer,' +
'D_YSMoney $Float, D_Money $Float, D_HasMoney $Float,' +
'D_Man varChar(16), D_Date DateTime, D_Memo varChar(100))';
{-----------------------------------------------------------------------------
洗衣记录: WashData
*.R_ID: 编号
*.D_ID: 标识
*.D_MID: 会员号
*.D_Number: 件数
*.D_HasNumber: 剩余
*.D_YSMoney: 应收
*.D_Money: 实收
*.D_HasMoney: 剩余
*.D_Man: 收件人
*.D_Date: 时间
*.D_Memo: 备注
-----------------------------------------------------------------------------}
sSQL_NewWashDetail = 'Create Table $Table(R_ID $Inc, D_ID varChar(16),' +
'D_TID varChar(16), D_Name varChar(32), D_Py varChar(32), ' +
'D_Unit varChar(16),D_WashType varChar(16), D_Color varChar(16), ' +
'D_Number Integer, D_HasNumber Integer,D_Memo varChar(100))';
{-----------------------------------------------------------------------------
收衣明细: WashDetail
*.R_ID: 编号
*.D_ID: 上架号
*.D_TID: 类型号
*.D_Name: 名称
*.D_Py: 拼音
*.D_Unit: 单位
*.D_WashType: 干/水
*.D_Number: 数量
*.D_HasNumber: 剩余
*.D_Color: 颜色
*.D_Memo: 备注
-----------------------------------------------------------------------------}
sSQL_NewWashOut = 'Create Table $Table(R_ID $Inc, D_ID varChar(16),' +
'D_TID varChar(16), D_Name varChar(32), D_Py varChar(32), ' +
'D_Unit varChar(16),D_WashType varChar(16), D_Color varChar(16), ' +
'D_Number Integer, D_Man varChar(16), D_Date DateTime, D_Memo varChar(100))';
{-----------------------------------------------------------------------------
取衣明细: WashOut
*.R_ID: 编号
*.D_ID: 上架号
*.D_TID: 类型号
*.D_Name: 名称
*.D_Py: 拼音
*.D_Unit: 单位
*.D_WashType: 干/水
*.D_Number: 数量
*.D_Color: 颜色
*.D_Man: 取衣人
*.D_Date: 取衣时间
*.D_Memo: 备注
-----------------------------------------------------------------------------}
implementation
//------------------------------------------------------------------------------
//Desc: 添加系统表项
procedure AddSysTableItem(const nTable,nNewSQL: string);
var nP: PSysTableItem;
begin
New(nP);
gSysTableList.Add(nP);
nP.FTable := nTable;
nP.FNewSQL := nNewSQL;
end;
//Desc: 系统表
procedure InitSysTableList;
begin
gSysTableList := TList.Create;
AddSysTableItem(sTable_SysDict, sSQL_NewSysDict);
AddSysTableItem(sTable_ExtInfo, sSQL_NewExtInfo);
AddSysTableItem(sTable_SysLog, sSQL_NewSysLog);
AddSysTableItem(sTable_BaseInfo, sSQL_NewBaseInfo);
AddSysTableItem(sTable_SerialBase, sSQL_NewSerialBase);
AddSysTableItem(sTable_Member, sSQL_NewMember);
AddSysTableItem(sTable_InOutMoney, sSQL_NewInOutMoney);
AddSysTableItem(sTable_WashType, sSQL_NewWashType);
AddSysTableItem(sTable_WashData, sSQL_NewWashData);
AddSysTableItem(sTable_WashDetail, sSQL_NewWashDetail);
AddSysTableItem(sTable_WashOut, sSQL_NewWashOut);
end;
//Desc: 清理系统表
procedure ClearSysTableList;
var nIdx: integer;
begin
for nIdx:= gSysTableList.Count - 1 downto 0 do
begin
Dispose(PSysTableItem(gSysTableList[nIdx]));
gSysTableList.Delete(nIdx);
end;
FreeAndNil(gSysTableList);
end;
initialization
InitSysTableList;
finalization
ClearSysTableList;
end.
|
unit TextEditor.Export.HTML;
interface
uses
System.Classes, System.SysUtils, Vcl.Graphics, TextEditor.Highlighter, TextEditor.Lines;
type
TTextEditorExportHTML = class(TObject)
private
FCharSet: string;
FFont: TFont;
FHighlighter: TTextEditorHighlighter;
FLines: TTextEditorLines;
FStringList: TStrings;
procedure CreateHTMLDocument;
procedure CreateHeader;
procedure CreateInternalCSS;
procedure CreateLines;
procedure CreateFooter;
public
constructor Create(const ALines: TTextEditorLines; const AHighlighter: TTextEditorHighlighter; const AFont: TFont;
const ACharSet: string); overload;
destructor Destroy; override;
procedure SaveToStream(AStream: TStream; AEncoding: System.SysUtils.TEncoding);
end;
implementation
uses
Winapi.Windows, System.UITypes, TextEditor.Consts, TextEditor.Highlighter.Attributes, TextEditor.Highlighter.Colors,
TextEditor.Utils;
constructor TTextEditorExportHTML.Create(const ALines: TTextEditorLines; const AHighlighter: TTextEditorHighlighter;
const AFont: TFont; const ACharSet: string);
begin
inherited Create;
FStringList := TStringList.Create;
FCharSet := ACharSet;
if FCharSet = '' then
FCharSet := 'utf-8';
FLines := ALines;
FHighlighter := AHighlighter;
FFont := AFont;
end;
destructor TTextEditorExportHTML.Destroy;
begin
FStringList.Free;
inherited Destroy;
end;
procedure TTextEditorExportHTML.CreateHTMLDocument;
begin
if not Assigned(FHighlighter) then
Exit;
if FLines.Count = 0 then
Exit;
CreateHeader;
CreateLines;
CreateFooter;
end;
procedure TTextEditorExportHTML.CreateHeader;
begin
FStringList.Add('<!DOCTYPE HTML>');
FStringList.Add('');
FStringList.Add('<html>');
FStringList.Add('<head>');
FStringList.Add(' <meta charset="' + FCharSet + '">');
CreateInternalCSS;
FStringList.Add('</head>');
FStringList.Add('');
FStringList.Add('<body class="Editor">');
end;
procedure TTextEditorExportHTML.CreateInternalCSS;
var
LIndex: Integer;
LStyles: TList;
LElement: PTextEditorHighlighterElement;
begin
FStringList.Add(' <style>');
FStringList.Add(' body {');
FStringList.Add(' font-family: ' + FFont.Name + ';');
FStringList.Add(' font-size: ' + IntToStr(FFont.Size) + 'px;');
FStringList.Add(' }');
LStyles := FHighlighter.Colors.Styles;
for LIndex := 0 to LStyles.Count - 1 do
begin
LElement := LStyles.Items[LIndex];
FStringList.Add(' .' + LElement^.Name + ' { ');
FStringList.Add(' color: ' + ColorToHex(LElement^.Foreground) + ';');
FStringList.Add(' background-color: ' + ColorToHex(LElement^.Background) + ';');
if TFontStyle.fsBold in LElement^.FontStyles then
FStringList.Add(' font-weight: bold;');
if TFontStyle.fsItalic in LElement^.FontStyles then
FStringList.Add(' font-style: italic;');
if TFontStyle.fsUnderline in LElement^.FontStyles then
FStringList.Add(' text-decoration: underline;');
if TFontStyle.fsStrikeOut in LElement^.FontStyles then
FStringList.Add(' text-decoration: line-through;');
FStringList.Add(' }');
FStringList.Add('');
end;
FStringList.Add(' </style>');
end;
procedure TTextEditorExportHTML.CreateLines;
var
LIndex: Integer;
LTextLine, LToken: string;
LHighlighterAttribute: TTextEditorHighlighterAttribute;
LPreviousElement: string;
begin
LPreviousElement := '';
for LIndex := 0 to FLines.Count - 1 do
begin
if LIndex = 0 then
FHighlighter.ResetRange
else
FHighlighter.SetRange(FLines.Items^[LIndex - 1].Range);
FHighlighter.SetLine(FLines.ExpandedStrings[LIndex]);
LTextLine := '';
while not FHighlighter.EndOfLine do
begin
LHighlighterAttribute := FHighlighter.TokenAttribute;
FHighlighter.GetToken(LToken);
if LToken = TEXT_EDITOR_SPACE_CHAR then
LTextLine := LTextLine + ' '
else
if LToken = '&' then
LTextLine := LTextLine + '&'
else
if LToken = '<' then
LTextLine := LTextLine + '<'
else
if LToken = '>' then
LTextLine := LTextLine + '>'
else
if LToken = '"' then
LTextLine := LTextLine + '"'
else
if Assigned(LHighlighterAttribute) then
begin
if (LPreviousElement <> '') and (LPreviousElement <> LHighlighterAttribute.Element) then
LTextLine := LTextLine + '</span>';
if LPreviousElement <> LHighlighterAttribute.Element then
LTextLine := LTextLine + '<span class="' + LHighlighterAttribute.Element + '">';
LTextLine := LTextLine + LToken;
LPreviousElement := LHighlighterAttribute.Element;
end
else
LTextLine := LTextLine + LToken;
FHighlighter.Next;
end;
FStringList.Add(LTextLine + '<br>');
end;
if LPreviousElement <> '' then
FStringList.Add('</span>');
end;
procedure TTextEditorExportHTML.CreateFooter;
begin
FStringList.Add('</body>');
FStringList.Add('</html>');
end;
procedure TTextEditorExportHTML.SaveToStream(AStream: TStream; AEncoding: System.SysUtils.TEncoding);
begin
CreateHTMLDocument;
if not Assigned(AEncoding) then
AEncoding := TEncoding.UTF8;
FStringList.SaveToStream(AStream, AEncoding);
end;
end.
|
unit FMX.VPR.Blend;
interface
uses
System.UITypes, System.Math;
function BlendRegEx(F, B, M: TAlphaColor): TAlphaColor;
procedure BlendMemEx(F: TAlphaColor; var B:TAlphaColor; M: TAlphaColor);
function CombineReg(X, Y, W: TAlphaColor): TAlphaColor;
procedure CombineMem(F: TAlphaColor; var B: TAlphaColor; W: TAlphaColor);
procedure BlendRGB(F, W: TAlphaColor; var B: TAlphaColor);
procedure BlendLine(Src, Dst: PAlphaColor; Count: Integer);
const
// gamma correction exponent
DEFAULT_GAMMA = 1.7;
var
GAMMA_TABLE: array [0..$1000] of Word;
implementation
var
AlphaTable: Pointer;
bias_ptr: Pointer;
alpha_ptr: Pointer;
procedure GenAlphaTable;
var
I: Integer;
L: Longword;
P: ^Longword;
begin
GetMem(AlphaTable, 257 * 8 * SizeOf(Cardinal));
alpha_ptr := Pointer(Cardinal(AlphaTable) and $FFFFFFF8);
if Cardinal(alpha_ptr) < Cardinal(AlphaTable) then
alpha_ptr := Pointer(Integer(alpha_ptr) + 8);
P := alpha_ptr;
for I := 0 to 255 do
begin
L := I + I shl 16;
P^ := L;
Inc(P);
P^ := L;
Inc(P);
P^ := L;
Inc(P);
P^ := L;
Inc(P);
end;
bias_ptr := Pointer(Integer(alpha_ptr) + $80 * 4 * SizeOf(Cardinal));
end;
procedure FreeAlphaTable;
begin
FreeMem(AlphaTable);
end;
{ Gamma / Pixel Shape Correction table }
procedure SetGamma(Gamma: Single);
var
i: Integer;
begin
// for i := 0 to 255 do
// GAMMA_TABLE[i] := Round(255 * Power(i / 255, Gamma));
for i := 0 to $1000 do
GAMMA_TABLE[i] := Round($1000 * Power(i / $1000, Gamma));
end;
type
TAlphaColorRec = packed record B, G, R, A: Byte; end;
//----------------------------------------------------------------------------//
// pure pascal blending routines
//----------------------------------------------------------------------------//
{$IFDEF PUREPASCAL}
function BlendRegEx(F, B, M: TAlphaColor): TAlphaColor;
begin
// TBA
end;
procedure BlendMemEx(F: TAlphaColor; var B:TAlphaColor; M: TAlphaColor);
begin
M := TAlphaColorRec(F).A * M;
TAlphaColorRec(B).R := M * (TAlphaColorRec(F).R - TAlphaColorRec(B).R) div (255*255) + TAlphaColorRec(B).R;
TAlphaColorRec(B).G := M * (TAlphaColorRec(F).G - TAlphaColorRec(B).G) div (255*255) + TAlphaColorRec(B).G;
TAlphaColorRec(B).B := M * (TAlphaColorRec(F).B - TAlphaColorRec(B).B) div (255*255) + TAlphaColorRec(B).B;
end;
function CombineReg(X, Y, W: TAlphaColor): TAlphaColor;
begin
TAlphaColorRec(Result).A := W * (TAlphaColorRec(X).A - TAlphaColorRec(Y).A) div 255 + TAlphaColorRec(Y).A;
TAlphaColorRec(Result).R := W * (TAlphaColorRec(X).R - TAlphaColorRec(Y).R) div 255 + TAlphaColorRec(Y).R;
TAlphaColorRec(Result).G := W * (TAlphaColorRec(X).G - TAlphaColorRec(Y).G) div 255 + TAlphaColorRec(Y).G;
TAlphaColorRec(Result).B := W * (TAlphaColorRec(X).B - TAlphaColorRec(Y).B) div 255 + TAlphaColorRec(Y).B;
end;
procedure BlendLine(Src, Dst: PAlphaColor; Count: Integer);
var
I: Integer;
begin
for I := 0 to Count - 1 do
begin
BlendMemEx(Src^, Dst^, 255);
Inc(Src); Inc(Dst);
end;
end;
{$ELSE}
//----------------------------------------------------------------------------//
// X86 blending routines
//----------------------------------------------------------------------------//
{$IFDEF CPUX86}
function BlendRegEx(F, B, M: TAlphaColor): TAlphaColor;
asm
// blend foregrownd color (F) to a background color (B),
// using alpha channel value of F
// EAX <- F
// EDX <- B
// ECX <- M
// Result := M * Fa * (Frgb - Brgb) + Brgb
PUSH EBX
MOV EBX,EAX
SHR EBX,24
INC ECX // 255:256 range bias
IMUL ECX,EBX
SHR ECX,8
JZ @1
PXOR XMM0,XMM0
MOVD XMM1,EAX
SHL ECX,4
MOVD XMM2,EDX
PUNPCKLBW XMM1,XMM0
PUNPCKLBW XMM2,XMM0
ADD ECX,alpha_ptr
PSUBW XMM1,XMM2
PMULLW XMM1,[ECX]
PSLLW XMM2,8
MOV ECX,bias_ptr
PADDW XMM2,[ECX]
PADDW XMM1,XMM2
PSRLW XMM1,8
PACKUSWB XMM1,XMM0
MOVD EAX,XMM1
// OR EAX,$ff000000
POP EBX
RET
@1: MOV EAX,EDX
POP EBX
end;
procedure BlendMemEx(F: TAlphaColor; var B: TAlphaColor; M: TAlphaColor);
asm
// blend foregrownd color (F) to a background color (B),
// using alpha channel value of F
// EAX <- F
// [EDX] <- B
// ECX <- M
// Result := M * Fa * (Frgb - Brgb) + Brgb
TEST EAX,$FF000000
JZ @2
PUSH EBX
MOV EBX,EAX
SHR EBX,24
INC ECX // 255:256 range bias
IMUL ECX,EBX
SHR ECX,8
JZ @1
PXOR XMM0,XMM0
MOVD XMM1,EAX
SHL ECX,4
// MOV EAX,[EDX]
MOVD XMM2,[EDX]
PUNPCKLBW XMM1,XMM0
PUNPCKLBW XMM2,XMM0
ADD ECX,alpha_ptr
PSUBW XMM1,XMM2
PMULLW XMM1,[ECX]
PSLLW XMM2,8
MOV ECX,bias_ptr
PADDW XMM2,[ECX]
PADDW XMM1,XMM2
PSRLW XMM1,8
PACKUSWB XMM1,XMM0
MOVD [EDX],XMM1
// AND EAX,$ff000000
// OR [EDX],EAX
// OR [EDX],$ff000000
@1: POP EBX
@2:
end;
function CombineReg(X, Y, W: TAlphaColor): TAlphaColor;
asm
// EAX - Color X
// EDX - Color Y
// ECX - Weight of X [0..255]
// Result := W * (X - Y) + Y
MOVD XMM1,EAX
PXOR XMM0,XMM0
SHL ECX,4
MOVD XMM2,EDX
PUNPCKLBW XMM1,XMM0
PUNPCKLBW XMM2,XMM0
ADD ECX,alpha_ptr
PSUBW XMM1,XMM2
PMULLW XMM1,[ECX]
PSLLW XMM2,8
MOV ECX,bias_ptr
PADDW XMM2,[ECX]
PADDW XMM1,XMM2
PSRLW XMM1,8
PACKUSWB XMM1,XMM0
MOVD EAX,XMM1
end;
procedure CombineMem(F: TAlphaColor; var B: TAlphaColor; W: TAlphaColor);
asm
// EAX - Color X
// [EDX] - Color Y
// ECX - Weight of X [0..255]
// Result := W * (X - Y) + Y
JCXZ @1
CMP ECX,$FF
JZ @2
MOVD XMM1,EAX
PXOR XMM0,XMM0
SHL ECX,4
MOVD XMM2,[EDX]
PUNPCKLBW XMM1,XMM0
PUNPCKLBW XMM2,XMM0
ADD ECX,alpha_ptr
PSUBW XMM1,XMM2
PMULLW XMM1,[ECX]
PSLLW XMM2,8
MOV ECX,bias_ptr
PADDW XMM2,[ECX]
PADDW XMM1,XMM2
PSRLW XMM1,8
PACKUSWB XMM1,XMM0
MOVD [EDX],XMM1
@1: RET
@2: MOV [EDX],EAX
end;
procedure BlendRGB(F, W: TAlphaColor; var B: TAlphaColor);
asm
PXOR XMM2,XMM2
MOVD XMM0,EAX
PUNPCKLBW XMM0,XMM2
MOVD XMM1,[ECX]
PUNPCKLBW XMM1,XMM2
BSWAP EDX
PSUBW XMM0,XMM1
MOVD XMM3,EDX
PUNPCKLBW XMM3,XMM2
PMULLW XMM0,XMM3
MOV EAX,bias_ptr
PSLLW XMM1,8
PADDW XMM1,[EAX]
PADDW XMM1,XMM0
PSRLW XMM1,8
PACKUSWB XMM1,XMM2
MOVD [ECX],XMM1
end;
procedure BlendLine(Src, Dst: PAlphaColor; Count: Integer);
asm
// EAX <- Src
// EDX <- Dst
// ECX <- Count
TEST ECX,ECX
JZ @4
PUSH ESI
PUSH EDI
MOV ESI,EAX
MOV EDI,EDX
@1: MOV EAX,[ESI]
TEST EAX,$FF000000
JZ @3
CMP EAX,$FF000000
JNC @2
MOVD XMM0,EAX
PXOR XMM3,XMM3
MOVD XMM2,[EDI]
PUNPCKLBW XMM0,XMM3
MOV EAX,bias_ptr
PUNPCKLBW XMM2,XMM3
MOVQ XMM1,XMM0
PUNPCKLBW XMM1,XMM3
PUNPCKHWD XMM1,XMM1
PSUBW XMM0,XMM2
PUNPCKHDQ XMM1,XMM1
PSLLW XMM2,8
PMULLW XMM0,XMM1
PADDW XMM2,[EAX]
PADDW XMM2,XMM0
PSRLW XMM2,8
PACKUSWB XMM2,XMM3
MOVD EAX,XMM2
// N: make output opaque in order to avoid problem in UpdateLayeredWindow (FMX.Platform.Win)
OR EAX,$ff000000
@2: MOV [EDI],EAX
@3: ADD ESI,4
ADD EDI,4
DEC ECX
JNZ @1
POP EDI
POP ESI
@4: RET
end;
{$ENDIF}
//----------------------------------------------------------------------------//
// X64 blending routines
//----------------------------------------------------------------------------//
{$IFDEF CPUX64}
function BlendRegEx(F, B, M: TAlphaColor): TAlphaColor;
begin
// TBA
end;
procedure BlendMemEx(F: TAlphaColor; var B:TAlphaColor; M: TAlphaColor);
asm
// blend foregrownd color (F) to a background color (B),
// using alpha channel value of F
// EAX <- F
// [EDX] <- B
// ECX <- M
// Result := M * Fa * (Frgb - Brgb) + Brgb
TEST RCX,$FF000000
JZ @1
MOV R9,RCX
SHR R9,24
INC R8 // 255:256 range bias
IMUL R8,R9
SHR R8,8
JZ @1
PXOR XMM0,XMM0
MOVD XMM1,ECX
SHL R8,4
MOVD XMM2,[RDX]
PUNPCKLBW XMM1,XMM0
PUNPCKLBW XMM2,XMM0
ADD R8,alpha_ptr
PSUBW XMM1,XMM2
PMULLW XMM1,[R8]
PSLLW XMM2,8
MOV R8,bias_ptr
PADDW XMM2,[R8]
PADDW XMM1,XMM2
PSRLW XMM1,8
PACKUSWB XMM1,XMM0
MOVD dword ptr [RDX],XMM1
// OR dword ptr [RDX],$ff000000 // set opaque
@1:
end;
function CombineReg(X, Y, W: TAlphaColor): TAlphaColor;
asm
// ECX - Color X
// EDX - Color Y
// E8 - Weight of X [0..255]
// Result := W * (X - Y) + Y
MOVD XMM1,ECX
PXOR XMM0,XMM0
SHL R8,4
MOVD XMM2,EDX
PUNPCKLBW XMM1,XMM0
PUNPCKLBW XMM2,XMM0
ADD R8,alpha_ptr
PSUBW XMM1,XMM2
PMULLW XMM1,[R8]
PSLLW XMM2,8
MOV R8,bias_ptr
PADDW XMM2,[R8]
PADDW XMM1,XMM2
PSRLW XMM1,8
PACKUSWB XMM1,XMM0
MOVD EAX,XMM1
end;
procedure CombineMem(F: TAlphaColor; var B: TAlphaColor; W: TAlphaColor);
begin
// TBA
end;
procedure BlendRGB(F, W: TAlphaColor; var B: TAlphaColor);
asm
PXOR XMM2,XMM2
MOVD XMM0,ECX
PUNPCKLBW XMM0,XMM2
MOVD XMM1,dword ptr [R8]
PUNPCKLBW XMM1,XMM2
BSWAP EDX
PSUBW XMM0,XMM1
MOVD XMM3,EDX
PUNPCKLBW XMM3,XMM2
PMULLW XMM0,XMM3
MOV RCX,bias_ptr
PSLLW XMM1,8
PADDW XMM1,[RCX]
PADDW XMM1,XMM0
PSRLW XMM1,8
PACKUSWB XMM1,XMM2
MOVD dword ptr [R8],XMM1
end;
// TODO: add X64 basm version
procedure BlendLine(Src, Dst: PAlphaColor; Count: Integer);
var
I: Integer;
begin
for I := 0 to Count - 1 do
begin
BlendMemEx(Src^, Dst^, 255);
Inc(Src); Inc(Dst);
end;
end;
{$ENDIF}
{$ENDIF}
initialization
SetGamma(DEFAULT_GAMMA);
GenAlphaTable;
finalization
FreeAlphaTable;
end.
|
{
ORM Brasil é um ORM simples e descomplicado para quem utiliza Delphi
Copyright (c) 2016, Isaque Pinheiro
All rights reserved.
GNU Lesser General Public License
Versão 3, 29 de junho de 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
A todos é permitido copiar e distribuir cópias deste documento de
licença, mas mudá-lo não é permitido.
Esta versão da GNU Lesser General Public License incorpora
os termos e condições da versão 3 da GNU General Public License
Licença, complementado pelas permissões adicionais listadas no
arquivo LICENSE na pasta principal.
}
{ @abstract(ORMBr Framework.)
@created(20 Jul 2016)
@author(Isaque Pinheiro <isaquepsp@gmail.com>)
@author(Skype : ispinheiro)
ORM Brasil é um ORM simples e descomplicado para quem utiliza Delphi.
}
unit dbcbr.mapping.register;
interface
uses
SysUtils,
Rtti,
Generics.Collections;
type
TRegisterClass = class
strict private
class var
FEntitys: TList<TClass>;
FViews: TList<TClass>;
FTriggers: TList<TClass>;
public
class constructor Create;
class destructor Destroy;
///
class function GetAllEntityClass: TArray<TClass>;
class function GetAllViewClass: TArray<TClass>;
class function GetAllTriggerClass: TArray<TClass>;
///
class procedure RegisterEntity(AClass: TClass);
class procedure RegisterView(AClass: TClass);
class procedure RegisterTrigger(AClass: TClass);
///
class property EntityList: TList<TClass> read FEntitys;
class property ViewList: TList<TClass> read FViews;
class property TriggerList: TList<TClass> read FTriggers;
end;
implementation
{ TMappedClasses }
class constructor TRegisterClass.Create;
begin
FEntitys := TList<TClass>.Create;
FViews := TList<TClass>.Create;
FTriggers := TList<TClass>.Create;
end;
class destructor TRegisterClass.Destroy;
begin
FEntitys.Free;
FViews.Free;
FTriggers.Free;
end;
class function TRegisterClass.GetAllEntityClass: TArray<TClass>;
var
LFor: Integer;
begin
try
SetLength(Result, FEntitys.Count);
for LFor := 0 to FEntitys.Count -1 do
Result[LFor] := FEntitys[LFor];
finally
FEntitys.Clear;
end;
end;
class function TRegisterClass.GetAllTriggerClass: TArray<TClass>;
var
LFor: Integer;
begin
try
SetLength(Result, FTriggers.Count);
for LFor := 0 to FTriggers.Count -1 do
Result[LFor] := FTriggers[LFor];
finally
FTriggers.Clear;
end;
end;
class function TRegisterClass.GetAllViewClass: TArray<TClass>;
var
LFor: Integer;
begin
try
SetLength(Result, FViews.Count);
for LFor := 0 to FViews.Count -1 do
Result[LFor] := FViews[LFor];
finally
FViews.Clear;
end;
end;
class procedure TRegisterClass.RegisterEntity(AClass: TClass);
begin
if not FEntitys.Contains(AClass) then
FEntitys.Add(AClass);
end;
class procedure TRegisterClass.RegisterTrigger(AClass: TClass);
begin
if not FTriggers.Contains(AClass) then
FTriggers.Add(AClass);
end;
class procedure TRegisterClass.RegisterView(AClass: TClass);
begin
if not FViews.Contains(AClass) then
FViews.Add(AClass);
end;
end.
|
{@Class TFhirResourceFactory : TFHIRBaseFactory
FHIR factory: class constructors and general useful builders
}
{!Wrapper uses FHIRBase, FHIRBase_Wrapper, FHIRTypes, FHIRTypes_Wrapper, FHIRComponents, FHIRComponents_Wrapper, DateAndTime_Wrapper}
unit FHIRResources;
{
Copyright (c) 2011+, HL7 and Health Intersections Pty Ltd (http://www.healthintersections.com.au)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
{$IFNDEF FHIR_DSTU1}
This is the dstu1 version of the FHIR code
{$ENDIF}
interface
// FHIR v0.0.82 generated Tue, Sep 30, 2014 18:08+1000
uses
SysUtils, Classes, StringSupport, DecimalSupport, AdvBuffers, FHIRBase, FHIRTypes, FHIRComponents;
Type
{@Enum TFhirResourceType
Enumeration of known resource types
}
TFhirResourceType = (
frtNull, {@enum.value Resource type not known / not Specified }
frtAdverseReaction, {@enum.value Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance. }
frtAlert, {@enum.value Prospective warnings of potential issues when providing care to the patient. }
frtAllergyIntolerance, {@enum.value Indicates the patient has a susceptibility to an adverse reaction upon exposure to a specified substance. }
frtCarePlan, {@enum.value Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions. }
frtComposition, {@enum.value A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. }
frtConceptMap, {@enum.value A statement of relationships from one set of concepts to one or more other concept systems. }
frtCondition, {@enum.value Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary. }
frtConformance, {@enum.value A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation. }
frtDevice, {@enum.value This resource identifies an instance of a manufactured thing that is used in the provision of healthcare without being substantially changed through that activity. The device may be a machine, an insert, a computer, an application, etc. This includes durable (reusable) medical equipment as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health. }
frtDeviceObservationReport, {@enum.value Describes the data produced by a device at a point in time. }
frtDiagnosticOrder, {@enum.value A request for a diagnostic investigation service to be performed. }
frtDiagnosticReport, {@enum.value The findings and interpretation of diagnostic tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretation, and formatted representation of diagnostic reports. }
frtDocumentManifest, {@enum.value A manifest that defines a set of documents. }
frtDocumentReference, {@enum.value A reference to a document. }
frtEncounter, {@enum.value An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient. }
frtFamilyHistory, {@enum.value Significant health events and conditions for people related to the subject relevant in the context of care for the subject. }
frtGroup, {@enum.value Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized. I.e. A collection of entities that isn't an Organization. }
frtImagingStudy, {@enum.value Manifest of a set of images produced in study. The set of images may include every image in the study, or it may be an incomplete sample, such as a list of key images. }
frtImmunization, {@enum.value Immunization event information. }
frtImmunizationRecommendation, {@enum.value A patient's point-of-time immunization status and recommendation with optional supporting justification. }
frtList, {@enum.value A set of information summarized from a list of other resources. }
frtLocation, {@enum.value Details and position information for a physical place where services are provided and resources and participants may be stored, found, contained or accommodated. }
frtMedia, {@enum.value A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference. }
frtMedication, {@enum.value Primarily used for identification and definition of Medication, but also covers ingredients and packaging. }
frtMedicationAdministration, {@enum.value Describes the event of a patient being given a dose of a medication. This may be as simple as swallowing a tablet or it may be a long running infusion.
Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner. }
frtMedicationDispense, {@enum.value Dispensing a medication to a named patient. This includes a description of the supply provided and the instructions for administering the medication. }
frtMedicationPrescription, {@enum.value An order for both supply of the medication and the instructions for administration of the medicine to a patient. }
frtMedicationStatement, {@enum.value A record of medication being taken by a patient, or that the medication has been given to a patient where the record is the result of a report from the patient or another clinician. }
frtMessageHeader, {@enum.value The header for a message exchange that is either requesting or responding to an action. The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle. }
frtObservation, {@enum.value Measurements and simple assertions made about a patient, device or other subject. }
frtOperationOutcome, {@enum.value A collection of error, warning or information messages that result from a system action. }
frtOrder, {@enum.value A request to perform an action. }
frtOrderResponse, {@enum.value A response to an order. }
frtOrganization, {@enum.value A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action. Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc. }
frtOther, {@enum.value Other is a conformant for handling resource concepts not yet defined for FHIR or outside HL7's scope of interest. }
frtPatient, {@enum.value Demographics and other administrative information about a person or animal receiving care or other health-related services. }
frtPractitioner, {@enum.value A person who is directly or indirectly involved in the provisioning of healthcare. }
frtProcedure, {@enum.value An action that is performed on a patient. This can be a physical 'thing' like an operation, or less invasive like counseling or hypnotherapy. }
frtProfile, {@enum.value A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. }
frtProvenance, {@enum.value Provenance information that describes the activity that led to the creation of a set of resources. This information can be used to help determine their reliability or trace where the information in them came from. The focus of the provenance resource is record keeping, audit and traceability, and not explicit statements of clinical significance. }
frtQuery, {@enum.value A description of a query with a set of parameters. }
frtQuestionnaire, {@enum.value A structured set of questions and their answers. The Questionnaire may contain questions, answers or both. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions. }
frtRelatedPerson, {@enum.value Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process. }
frtSecurityEvent, {@enum.value A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage. }
frtSpecimen, {@enum.value Sample for analysis. }
frtSubstance, {@enum.value A homogeneous material with a definite composition. }
frtSupply, {@enum.value A supply - a request for something, and provision of what is supplied. }
frtValueSet, {@enum.value A value set specifies a set of codes drawn from one or more code systems. }
frtBinary); {@enum.value Binary Resource }
TFhirResourceTypeSet = set of TFhirResourceType;
{@Enum TSearchParamsAdverseReaction
Search Parameters for AdverseReaction
}
TSearchParamsAdverseReaction = (
spAdverseReaction__id, {@enum.value spAdverseReaction__id The logical resource id associated with the resource (must be supported by all servers) }
spAdverseReaction__language, {@enum.value spAdverseReaction__language The language of the resource }
spAdverseReaction_Date, {@enum.value spAdverseReaction_Date The date of the reaction }
spAdverseReaction_Subject, {@enum.value spAdverseReaction_Subject The subject that the sensitivity is about }
spAdverseReaction_Substance, {@enum.value spAdverseReaction_Substance The name or code of the substance that produces the sensitivity }
spAdverseReaction_Symptom); {@enum.value spAdverseReaction_Symptom One of the symptoms of the reaction }
{@Enum TSearchParamsAlert
Search Parameters for Alert
}
TSearchParamsAlert = (
spAlert__id, {@enum.value spAlert__id The logical resource id associated with the resource (must be supported by all servers) }
spAlert__language, {@enum.value spAlert__language The language of the resource }
spAlert_Subject); {@enum.value spAlert_Subject The identity of a subject to list alerts for }
{@Enum TSearchParamsAllergyIntolerance
Search Parameters for AllergyIntolerance
}
TSearchParamsAllergyIntolerance = (
spAllergyIntolerance__id, {@enum.value spAllergyIntolerance__id The logical resource id associated with the resource (must be supported by all servers) }
spAllergyIntolerance__language, {@enum.value spAllergyIntolerance__language The language of the resource }
spAllergyIntolerance_Date, {@enum.value spAllergyIntolerance_Date Recorded date/time. }
spAllergyIntolerance_Recorder, {@enum.value spAllergyIntolerance_Recorder Who recorded the sensitivity }
spAllergyIntolerance_Status, {@enum.value spAllergyIntolerance_Status The status of the sensitivity }
spAllergyIntolerance_Subject, {@enum.value spAllergyIntolerance_Subject The subject that the sensitivity is about }
spAllergyIntolerance_Substance, {@enum.value spAllergyIntolerance_Substance The name or code of the substance that produces the sensitivity }
spAllergyIntolerance_Type); {@enum.value spAllergyIntolerance_Type The type of sensitivity }
{@Enum TSearchParamsCarePlan
Search Parameters for CarePlan
}
TSearchParamsCarePlan = (
spCarePlan__id, {@enum.value spCarePlan__id The logical resource id associated with the resource (must be supported by all servers) }
spCarePlan__language, {@enum.value spCarePlan__language The language of the resource }
spCarePlan_Activitycode, {@enum.value spCarePlan_Activitycode Detail type of activity }
spCarePlan_Activitydate, {@enum.value spCarePlan_Activitydate Specified date occurs within period specified by CarePlan.activity.timingSchedule }
spCarePlan_Activitydetail, {@enum.value spCarePlan_Activitydetail Activity details defined in specific resource }
spCarePlan_Condition, {@enum.value spCarePlan_Condition Health issues this plan addresses }
spCarePlan_Date, {@enum.value spCarePlan_Date Time period plan covers }
spCarePlan_Participant, {@enum.value spCarePlan_Participant Who is involved }
spCarePlan_Patient); {@enum.value spCarePlan_Patient Who care plan is for }
{@Enum TSearchParamsComposition
Search Parameters for Composition
}
TSearchParamsComposition = (
spComposition__id, {@enum.value spComposition__id The logical resource id associated with the resource (must be supported by all servers) }
spComposition__language, {@enum.value spComposition__language The language of the resource }
spComposition_Attester, {@enum.value spComposition_Attester Who attested the composition }
spComposition_Author, {@enum.value spComposition_Author Who and/or what authored the composition }
spComposition_Class, {@enum.value spComposition_Class Categorization of Composition }
spComposition_Context, {@enum.value spComposition_Context Code(s) that apply to the event being documented }
spComposition_Date, {@enum.value spComposition_Date Composition editing time }
spComposition_Identifier, {@enum.value spComposition_Identifier Logical identifier of composition (version-independent) }
spComposition_Section_content, {@enum.value spComposition_Section_content The actual data for the section }
spComposition_Section_type, {@enum.value spComposition_Section_type Classification of section (recommended) }
spComposition_Subject, {@enum.value spComposition_Subject Who and/or what the composition is about }
spComposition_Type); {@enum.value spComposition_Type Kind of composition (LOINC if possible) }
{@Enum TSearchParamsConceptMap
Search Parameters for ConceptMap
}
TSearchParamsConceptMap = (
spConceptMap__id, {@enum.value spConceptMap__id The logical resource id associated with the resource (must be supported by all servers) }
spConceptMap__language, {@enum.value spConceptMap__language The language of the resource }
spConceptMap_Date, {@enum.value spConceptMap_Date The concept map publication date }
spConceptMap_Dependson, {@enum.value spConceptMap_Dependson Reference to element/field/valueset provides the context }
spConceptMap_Description, {@enum.value spConceptMap_Description Text search in the description of the concept map }
spConceptMap_Identifier, {@enum.value spConceptMap_Identifier The identifier of the concept map }
spConceptMap_Name, {@enum.value spConceptMap_Name Name of the concept map }
spConceptMap_Product, {@enum.value spConceptMap_Product Reference to element/field/valueset provides the context }
spConceptMap_Publisher, {@enum.value spConceptMap_Publisher Name of the publisher of the concept map }
spConceptMap_Source, {@enum.value spConceptMap_Source The system for any concepts mapped by this concept map }
spConceptMap_Status, {@enum.value spConceptMap_Status Status of the concept map }
spConceptMap_System, {@enum.value spConceptMap_System The system for any destination concepts mapped by this map }
spConceptMap_Target, {@enum.value spConceptMap_Target Provides context to the mappings }
spConceptMap_Version); {@enum.value spConceptMap_Version The version identifier of the concept map }
{@Enum TSearchParamsCondition
Search Parameters for Condition
}
TSearchParamsCondition = (
spCondition__id, {@enum.value spCondition__id The logical resource id associated with the resource (must be supported by all servers) }
spCondition__language, {@enum.value spCondition__language The language of the resource }
spCondition_Asserter, {@enum.value spCondition_Asserter Person who asserts this condition }
spCondition_Category, {@enum.value spCondition_Category The category of the condition }
spCondition_Code, {@enum.value spCondition_Code Code for the condition }
spCondition_Date_asserted, {@enum.value spCondition_Date_asserted When first detected/suspected/entered }
spCondition_Encounter, {@enum.value spCondition_Encounter Encounter when condition first asserted }
spCondition_Evidence, {@enum.value spCondition_Evidence Manifestation/symptom }
spCondition_Location, {@enum.value spCondition_Location Location - may include laterality }
spCondition_Onset, {@enum.value spCondition_Onset When the Condition started (if started on a date) }
spCondition_Related_code, {@enum.value spCondition_Related_code Relationship target by means of a predefined code }
spCondition_Related_item, {@enum.value spCondition_Related_item Relationship target resource }
spCondition_Severity, {@enum.value spCondition_Severity The severity of the condition }
spCondition_Stage, {@enum.value spCondition_Stage Simple summary (disease specific) }
spCondition_Status, {@enum.value spCondition_Status The status of the condition }
spCondition_Subject); {@enum.value spCondition_Subject Who has the condition? }
{@Enum TSearchParamsConformance
Search Parameters for Conformance
}
TSearchParamsConformance = (
spConformance__id, {@enum.value spConformance__id The logical resource id associated with the resource (must be supported by all servers) }
spConformance__language, {@enum.value spConformance__language The language of the resource }
spConformance_Date, {@enum.value spConformance_Date The conformance statement publication date }
spConformance_Description, {@enum.value spConformance_Description Text search in the description of the conformance statement }
spConformance_Event, {@enum.value spConformance_Event Event code in a conformance statement }
spConformance_Fhirversion, {@enum.value spConformance_Fhirversion The version of FHIR }
spConformance_Format, {@enum.value spConformance_Format formats supported (xml | json | mime type) }
spConformance_Identifier, {@enum.value spConformance_Identifier The identifier of the conformance statement }
spConformance_Mode, {@enum.value spConformance_Mode Mode - restful (server/client) or messaging (sender/receiver) }
spConformance_Name, {@enum.value spConformance_Name Name of the conformance statement }
spConformance_Profile, {@enum.value spConformance_Profile A profile id invoked in a conformance statement }
spConformance_Publisher, {@enum.value spConformance_Publisher Name of the publisher of the conformance statement }
spConformance_Resource, {@enum.value spConformance_Resource Name of a resource mentioned in a conformance statement }
spConformance_Security, {@enum.value spConformance_Security Information about security of implementation }
spConformance_Software, {@enum.value spConformance_Software Part of a the name of a software application }
spConformance_Status, {@enum.value spConformance_Status The current status of the conformance statement }
spConformance_Supported_profile, {@enum.value spConformance_Supported_profile Profiles supported by the system }
spConformance_Version); {@enum.value spConformance_Version The version identifier of the conformance statement }
{@Enum TSearchParamsDevice
Search Parameters for Device
}
TSearchParamsDevice = (
spDevice__id, {@enum.value spDevice__id The logical resource id associated with the resource (must be supported by all servers) }
spDevice__language, {@enum.value spDevice__language The language of the resource }
spDevice_Identifier, {@enum.value spDevice_Identifier Instance id from manufacturer, owner and others }
spDevice_Location, {@enum.value spDevice_Location A location, where the resource is found }
spDevice_Manufacturer, {@enum.value spDevice_Manufacturer The manufacturer of the device }
spDevice_Model, {@enum.value spDevice_Model The model of the device }
spDevice_Organization, {@enum.value spDevice_Organization The organization responsible for the device }
spDevice_Patient, {@enum.value spDevice_Patient Patient information, if the resource is affixed to a person }
spDevice_Type, {@enum.value spDevice_Type The type of the device }
spDevice_Udi); {@enum.value spDevice_Udi FDA Mandated Unique Device Identifier }
{@Enum TSearchParamsDeviceObservationReport
Search Parameters for DeviceObservationReport
}
TSearchParamsDeviceObservationReport = (
spDeviceObservationReport__id, {@enum.value spDeviceObservationReport__id The logical resource id associated with the resource (must be supported by all servers) }
spDeviceObservationReport__language, {@enum.value spDeviceObservationReport__language The language of the resource }
spDeviceObservationReport_Channel, {@enum.value spDeviceObservationReport_Channel The channel code }
spDeviceObservationReport_Code, {@enum.value spDeviceObservationReport_Code The compatment code }
spDeviceObservationReport_Observation, {@enum.value spDeviceObservationReport_Observation The data for the metric }
spDeviceObservationReport_Source, {@enum.value spDeviceObservationReport_Source Identifies/describes where the data came from }
spDeviceObservationReport_Subject); {@enum.value spDeviceObservationReport_Subject Subject of the measurement }
{@Enum TSearchParamsDiagnosticOrder
Search Parameters for DiagnosticOrder
}
TSearchParamsDiagnosticOrder = (
spDiagnosticOrder__id, {@enum.value spDiagnosticOrder__id The logical resource id associated with the resource (must be supported by all servers) }
spDiagnosticOrder__language, {@enum.value spDiagnosticOrder__language The language of the resource }
spDiagnosticOrder_Actor, {@enum.value spDiagnosticOrder_Actor Who recorded or did this }
spDiagnosticOrder_Bodysite, {@enum.value spDiagnosticOrder_Bodysite Location of requested test (if applicable) }
spDiagnosticOrder_Code, {@enum.value spDiagnosticOrder_Code Code to indicate the item (test or panel) being ordered }
spDiagnosticOrder_Encounter, {@enum.value spDiagnosticOrder_Encounter The encounter that this diagnostic order is associated with }
spDiagnosticOrder_Event_date, {@enum.value spDiagnosticOrder_Event_date The date at which the event happened }
spDiagnosticOrder_Event_status, {@enum.value spDiagnosticOrder_Event_status requested | received | accepted | in progress | review | completed | suspended | rejected | failed }
spDiagnosticOrder_Event_status_date, {@enum.value spDiagnosticOrder_Event_status_date A combination of past-status and date }
spDiagnosticOrder_Identifier, {@enum.value spDiagnosticOrder_Identifier Identifiers assigned to this order }
spDiagnosticOrder_Item_date, {@enum.value spDiagnosticOrder_Item_date The date at which the event happened }
spDiagnosticOrder_Item_past_status, {@enum.value spDiagnosticOrder_Item_past_status requested | received | accepted | in progress | review | completed | suspended | rejected | failed }
spDiagnosticOrder_Item_status, {@enum.value spDiagnosticOrder_Item_status requested | received | accepted | in progress | review | completed | suspended | rejected | failed }
spDiagnosticOrder_Item_status_date, {@enum.value spDiagnosticOrder_Item_status_date A combination of item-past-status and item-date }
spDiagnosticOrder_Orderer, {@enum.value spDiagnosticOrder_Orderer Who ordered the test }
spDiagnosticOrder_Specimen, {@enum.value spDiagnosticOrder_Specimen If the whole order relates to specific specimens }
spDiagnosticOrder_Status, {@enum.value spDiagnosticOrder_Status requested | received | accepted | in progress | review | completed | suspended | rejected | failed }
spDiagnosticOrder_Subject); {@enum.value spDiagnosticOrder_Subject Who and/or what test is about }
{@Enum TSearchParamsDiagnosticReport
Search Parameters for DiagnosticReport
}
TSearchParamsDiagnosticReport = (
spDiagnosticReport__id, {@enum.value spDiagnosticReport__id The logical resource id associated with the resource (must be supported by all servers) }
spDiagnosticReport__language, {@enum.value spDiagnosticReport__language The language of the resource }
spDiagnosticReport_Date, {@enum.value spDiagnosticReport_Date The clinically relevant time of the report }
spDiagnosticReport_Diagnosis, {@enum.value spDiagnosticReport_Diagnosis A coded diagnosis on the report }
spDiagnosticReport_Identifier, {@enum.value spDiagnosticReport_Identifier An identifier for the report }
spDiagnosticReport_Image, {@enum.value spDiagnosticReport_Image Reference to the image source }
spDiagnosticReport_Issued, {@enum.value spDiagnosticReport_Issued When the report was issued }
spDiagnosticReport_Name, {@enum.value spDiagnosticReport_Name The name of the report (e.g. the code for the report as a whole, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result) }
spDiagnosticReport_Performer, {@enum.value spDiagnosticReport_Performer Who was the source of the report (organization) }
spDiagnosticReport_Request, {@enum.value spDiagnosticReport_Request What was requested }
spDiagnosticReport_Result, {@enum.value spDiagnosticReport_Result Link to an atomic result (observation resource) }
spDiagnosticReport_Service, {@enum.value spDiagnosticReport_Service Which diagnostic discipline/department created the report }
spDiagnosticReport_Specimen, {@enum.value spDiagnosticReport_Specimen The specimen details }
spDiagnosticReport_Status, {@enum.value spDiagnosticReport_Status The status of the report }
spDiagnosticReport_Subject); {@enum.value spDiagnosticReport_Subject The subject of the report }
{@Enum TSearchParamsDocumentManifest
Search Parameters for DocumentManifest
}
TSearchParamsDocumentManifest = (
spDocumentManifest__id, {@enum.value spDocumentManifest__id The logical resource id associated with the resource (must be supported by all servers) }
spDocumentManifest__language, {@enum.value spDocumentManifest__language The language of the resource }
spDocumentManifest_Author, {@enum.value spDocumentManifest_Author Who and/or what authored the document }
spDocumentManifest_Confidentiality, {@enum.value spDocumentManifest_Confidentiality Sensitivity of set of documents }
spDocumentManifest_Content, {@enum.value spDocumentManifest_Content Contents of this set of documents }
spDocumentManifest_Created, {@enum.value spDocumentManifest_Created When this document manifest created }
spDocumentManifest_Description, {@enum.value spDocumentManifest_Description Human-readable description (title) }
spDocumentManifest_Identifier, {@enum.value spDocumentManifest_Identifier Unique Identifier for the set of documents }
spDocumentManifest_Recipient, {@enum.value spDocumentManifest_Recipient Intended to get notified about this set of documents }
spDocumentManifest_Status, {@enum.value spDocumentManifest_Status current | superceded | entered in error }
spDocumentManifest_Subject, {@enum.value spDocumentManifest_Subject The subject of the set of documents }
spDocumentManifest_Supersedes, {@enum.value spDocumentManifest_Supersedes If this document manifest replaces another }
spDocumentManifest_Type); {@enum.value spDocumentManifest_Type What kind of document set this is }
{@Enum TSearchParamsDocumentReference
Search Parameters for DocumentReference
}
TSearchParamsDocumentReference = (
spDocumentReference__id, {@enum.value spDocumentReference__id The logical resource id associated with the resource (must be supported by all servers) }
spDocumentReference__language, {@enum.value spDocumentReference__language The language of the resource }
spDocumentReference_Authenticator, {@enum.value spDocumentReference_Authenticator Who/What authenticated the document }
spDocumentReference_Author, {@enum.value spDocumentReference_Author Who and/or what authored the document }
spDocumentReference_Class, {@enum.value spDocumentReference_Class Categorization of Document }
spDocumentReference_Confidentiality, {@enum.value spDocumentReference_Confidentiality Sensitivity of source document }
spDocumentReference_Created, {@enum.value spDocumentReference_Created Document creation time }
spDocumentReference_Custodian, {@enum.value spDocumentReference_Custodian Org which maintains the document }
spDocumentReference_Description, {@enum.value spDocumentReference_Description Human-readable description (title) }
spDocumentReference_Event, {@enum.value spDocumentReference_Event Main Clinical Acts Documented }
spDocumentReference_Facility, {@enum.value spDocumentReference_Facility Kind of facility where patient was seen }
spDocumentReference_Format, {@enum.value spDocumentReference_Format Format/content rules for the document }
spDocumentReference_Identifier, {@enum.value spDocumentReference_Identifier Master Version Specific Identifier }
spDocumentReference_Indexed, {@enum.value spDocumentReference_Indexed When this document reference created }
spDocumentReference_Language, {@enum.value spDocumentReference_Language The marked primary language for the document }
spDocumentReference_Location, {@enum.value spDocumentReference_Location Where to access the document }
spDocumentReference_Period, {@enum.value spDocumentReference_Period Time of service that is being documented }
spDocumentReference_Relatesto, {@enum.value spDocumentReference_Relatesto Target of the relationship }
spDocumentReference_Relation, {@enum.value spDocumentReference_Relation replaces | transforms | signs | appends }
spDocumentReference_Relationship, {@enum.value spDocumentReference_Relationship Combination of relation and relatesTo }
spDocumentReference_Size, {@enum.value spDocumentReference_Size Size of the document in bytes }
spDocumentReference_Status, {@enum.value spDocumentReference_Status current | superceded | entered in error }
spDocumentReference_Subject, {@enum.value spDocumentReference_Subject Who|what is the subject of the document }
spDocumentReference_Type); {@enum.value spDocumentReference_Type What kind of document this is (LOINC if possible) }
{@Enum TSearchParamsEncounter
Search Parameters for Encounter
}
TSearchParamsEncounter = (
spEncounter__id, {@enum.value spEncounter__id The logical resource id associated with the resource (must be supported by all servers) }
spEncounter__language, {@enum.value spEncounter__language The language of the resource }
spEncounter_Date, {@enum.value spEncounter_Date A date within the period the Encounter lasted }
spEncounter_Identifier, {@enum.value spEncounter_Identifier Identifier(s) by which this encounter is known }
spEncounter_Indication, {@enum.value spEncounter_Indication Reason the encounter takes place (resource) }
spEncounter_Length, {@enum.value spEncounter_Length Length of encounter in days }
spEncounter_Location, {@enum.value spEncounter_Location Location the encounter takes place }
spEncounter_Location_period, {@enum.value spEncounter_Location_period Time period during which the patient was present at the location }
spEncounter_Status, {@enum.value spEncounter_Status planned | in progress | onleave | finished | cancelled }
spEncounter_Subject); {@enum.value spEncounter_Subject The patient present at the encounter }
{@Enum TSearchParamsFamilyHistory
Search Parameters for FamilyHistory
}
TSearchParamsFamilyHistory = (
spFamilyHistory__id, {@enum.value spFamilyHistory__id The logical resource id associated with the resource (must be supported by all servers) }
spFamilyHistory__language, {@enum.value spFamilyHistory__language The language of the resource }
spFamilyHistory_Subject); {@enum.value spFamilyHistory_Subject The identity of a subject to list family history items for }
{@Enum TSearchParamsGroup
Search Parameters for Group
}
TSearchParamsGroup = (
spGroup__id, {@enum.value spGroup__id The logical resource id associated with the resource (must be supported by all servers) }
spGroup__language, {@enum.value spGroup__language The language of the resource }
spGroup_Actual, {@enum.value spGroup_Actual Descriptive or actual }
spGroup_Characteristic, {@enum.value spGroup_Characteristic Kind of characteristic }
spGroup_Characteristic_value, {@enum.value spGroup_Characteristic_value A composite of both characteristic and value }
spGroup_Code, {@enum.value spGroup_Code The kind of resources contained }
spGroup_Exclude, {@enum.value spGroup_Exclude Group includes or excludes }
spGroup_Identifier, {@enum.value spGroup_Identifier Unique id }
spGroup_Member, {@enum.value spGroup_Member Who is in group }
spGroup_Type, {@enum.value spGroup_Type The type of resources the group contains }
spGroup_Value); {@enum.value spGroup_Value Value held by characteristic }
{@Enum TSearchParamsImagingStudy
Search Parameters for ImagingStudy
}
TSearchParamsImagingStudy = (
spImagingStudy__id, {@enum.value spImagingStudy__id The logical resource id associated with the resource (must be supported by all servers) }
spImagingStudy__language, {@enum.value spImagingStudy__language The language of the resource }
spImagingStudy_Accession, {@enum.value spImagingStudy_Accession The accession id for the image }
spImagingStudy_Bodysite, {@enum.value spImagingStudy_Bodysite Body part examined (Map from 0018,0015) }
spImagingStudy_Date, {@enum.value spImagingStudy_Date The date the study was done was taken }
spImagingStudy_Dicom_class, {@enum.value spImagingStudy_Dicom_class DICOM class type (0008,0016) }
spImagingStudy_Modality, {@enum.value spImagingStudy_Modality The modality of the image }
spImagingStudy_Series, {@enum.value spImagingStudy_Series The series id for the image }
spImagingStudy_Size, {@enum.value spImagingStudy_Size The size of the image in MB - may include > or < in the value }
spImagingStudy_Study, {@enum.value spImagingStudy_Study The study id for the image }
spImagingStudy_Subject, {@enum.value spImagingStudy_Subject Who the study is about }
spImagingStudy_Uid); {@enum.value spImagingStudy_Uid Formal identifier for this instance (0008,0018) }
{@Enum TSearchParamsImmunization
Search Parameters for Immunization
}
TSearchParamsImmunization = (
spImmunization__id, {@enum.value spImmunization__id The logical resource id associated with the resource (must be supported by all servers) }
spImmunization__language, {@enum.value spImmunization__language The language of the resource }
spImmunization_Date, {@enum.value spImmunization_Date Vaccination Administration / Refusal Date }
spImmunization_Dose_sequence, {@enum.value spImmunization_Dose_sequence What dose number within series? }
spImmunization_Identifier, {@enum.value spImmunization_Identifier Business identifier }
spImmunization_Location, {@enum.value spImmunization_Location The service delivery location or facility in which the vaccine was / was to be administered }
spImmunization_Lot_number, {@enum.value spImmunization_Lot_number Vaccine Lot Number }
spImmunization_Manufacturer, {@enum.value spImmunization_Manufacturer Vaccine Manufacturer }
spImmunization_Performer, {@enum.value spImmunization_Performer The practitioner who administered the vaccination }
spImmunization_Reaction, {@enum.value spImmunization_Reaction Additional information on reaction }
spImmunization_Reaction_date, {@enum.value spImmunization_Reaction_date When did reaction start? }
spImmunization_Reason, {@enum.value spImmunization_Reason Why immunization occurred }
spImmunization_Refusal_reason, {@enum.value spImmunization_Refusal_reason Explanation of refusal / exemption }
spImmunization_Refused, {@enum.value spImmunization_Refused Was immunization refused? }
spImmunization_Requester, {@enum.value spImmunization_Requester The practitioner who ordered the vaccination }
spImmunization_Subject, {@enum.value spImmunization_Subject The subject of the vaccination event / refusal }
spImmunization_Vaccine_type); {@enum.value spImmunization_Vaccine_type Vaccine Product Type Administered }
{@Enum TSearchParamsImmunizationRecommendation
Search Parameters for ImmunizationRecommendation
}
TSearchParamsImmunizationRecommendation = (
spImmunizationRecommendation__id, {@enum.value spImmunizationRecommendation__id The logical resource id associated with the resource (must be supported by all servers) }
spImmunizationRecommendation__language, {@enum.value spImmunizationRecommendation__language The language of the resource }
spImmunizationRecommendation_Date, {@enum.value spImmunizationRecommendation_Date Date recommendation created }
spImmunizationRecommendation_Dose_number, {@enum.value spImmunizationRecommendation_Dose_number Recommended dose number }
spImmunizationRecommendation_Dose_sequence, {@enum.value spImmunizationRecommendation_Dose_sequence Number of dose within sequence }
spImmunizationRecommendation_Identifier, {@enum.value spImmunizationRecommendation_Identifier Business identifier }
spImmunizationRecommendation_Information, {@enum.value spImmunizationRecommendation_Information Patient observations supporting recommendation }
spImmunizationRecommendation_Status, {@enum.value spImmunizationRecommendation_Status Vaccine administration status }
spImmunizationRecommendation_Subject, {@enum.value spImmunizationRecommendation_Subject Who this profile is for }
spImmunizationRecommendation_Support, {@enum.value spImmunizationRecommendation_Support Past immunizations supporting recommendation }
spImmunizationRecommendation_Vaccine_type); {@enum.value spImmunizationRecommendation_Vaccine_type Vaccine recommendation applies to }
{@Enum TSearchParamsList
Search Parameters for List
}
TSearchParamsList = (
spList__id, {@enum.value spList__id The logical resource id associated with the resource (must be supported by all servers) }
spList__language, {@enum.value spList__language The language of the resource }
spList_Code, {@enum.value spList_Code What the purpose of this list is }
spList_Date, {@enum.value spList_Date When the list was prepared }
spList_Empty_reason, {@enum.value spList_Empty_reason Why list is empty }
spList_Item, {@enum.value spList_Item Actual entry }
spList_Source, {@enum.value spList_Source Who and/or what defined the list contents }
spList_Subject); {@enum.value spList_Subject If all resources have the same subject }
{@Enum TSearchParamsLocation
Search Parameters for Location
}
TSearchParamsLocation = (
spLocation__id, {@enum.value spLocation__id The logical resource id associated with the resource (must be supported by all servers) }
spLocation__language, {@enum.value spLocation__language The language of the resource }
spLocation_Address, {@enum.value spLocation_Address A (part of the) address of the location }
spLocation_Identifier, {@enum.value spLocation_Identifier Unique code or number identifying the location to its users }
spLocation_Name, {@enum.value spLocation_Name A (portion of the) name of the location }
spLocation_Near, {@enum.value spLocation_Near The coordinates expressed as [lat],[long] (using KML, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency) }
spLocation_Near_distance, {@enum.value spLocation_Near_distance A distance quantity to limit the near search to locations within a specific distance }
spLocation_Partof, {@enum.value spLocation_Partof The location of which this location is a part }
spLocation_Status, {@enum.value spLocation_Status Searches for locations with a specific kind of status }
spLocation_Type); {@enum.value spLocation_Type A code for the type of location }
{@Enum TSearchParamsMedia
Search Parameters for Media
}
TSearchParamsMedia = (
spMedia__id, {@enum.value spMedia__id The logical resource id associated with the resource (must be supported by all servers) }
spMedia__language, {@enum.value spMedia__language The language of the resource }
spMedia_Date, {@enum.value spMedia_Date When the media was taken/recorded (end) }
spMedia_Identifier, {@enum.value spMedia_Identifier Identifier(s) for the image }
spMedia_Operator, {@enum.value spMedia_Operator The person who generated the image }
spMedia_Subject, {@enum.value spMedia_Subject Who/What this Media is a record of }
spMedia_Subtype, {@enum.value spMedia_Subtype The type of acquisition equipment/process }
spMedia_Type, {@enum.value spMedia_Type photo | video | audio }
spMedia_View); {@enum.value spMedia_View Imaging view e.g Lateral or Antero-posterior }
{@Enum TSearchParamsMedication
Search Parameters for Medication
}
TSearchParamsMedication = (
spMedication__id, {@enum.value spMedication__id The logical resource id associated with the resource (must be supported by all servers) }
spMedication__language, {@enum.value spMedication__language The language of the resource }
spMedication_Code, {@enum.value spMedication_Code Codes that identify this medication }
spMedication_Container, {@enum.value spMedication_Container E.g. box, vial, blister-pack }
spMedication_Content, {@enum.value spMedication_Content A product in the package }
spMedication_Form, {@enum.value spMedication_Form powder | tablets | carton + }
spMedication_Ingredient, {@enum.value spMedication_Ingredient The product contained }
spMedication_Manufacturer, {@enum.value spMedication_Manufacturer Manufacturer of the item }
spMedication_Name); {@enum.value spMedication_Name Common / Commercial name }
{@Enum TSearchParamsMedicationAdministration
Search Parameters for MedicationAdministration
}
TSearchParamsMedicationAdministration = (
spMedicationAdministration__id, {@enum.value spMedicationAdministration__id The logical resource id associated with the resource (must be supported by all servers) }
spMedicationAdministration__language, {@enum.value spMedicationAdministration__language The language of the resource }
spMedicationAdministration_Device, {@enum.value spMedicationAdministration_Device Return administrations with this administration device identity }
spMedicationAdministration_Encounter, {@enum.value spMedicationAdministration_Encounter Return administrations that share this encounter }
spMedicationAdministration_Identifier, {@enum.value spMedicationAdministration_Identifier Return administrations with this external identity }
spMedicationAdministration_Medication, {@enum.value spMedicationAdministration_Medication Return administrations of this medication }
spMedicationAdministration_Notgiven, {@enum.value spMedicationAdministration_Notgiven Administrations that were not made }
spMedicationAdministration_Patient, {@enum.value spMedicationAdministration_Patient The identity of a patient to list administrations for }
spMedicationAdministration_Prescription, {@enum.value spMedicationAdministration_Prescription The identity of a prescription to list administrations from }
spMedicationAdministration_Status, {@enum.value spMedicationAdministration_Status MedicationAdministration event status (for example one of active/paused/completed/nullified) }
spMedicationAdministration_Whengiven); {@enum.value spMedicationAdministration_Whengiven Date of administration }
{@Enum TSearchParamsMedicationDispense
Search Parameters for MedicationDispense
}
TSearchParamsMedicationDispense = (
spMedicationDispense__id, {@enum.value spMedicationDispense__id The logical resource id associated with the resource (must be supported by all servers) }
spMedicationDispense__language, {@enum.value spMedicationDispense__language The language of the resource }
spMedicationDispense_Destination, {@enum.value spMedicationDispense_Destination Return dispenses that should be sent to a secific destination }
spMedicationDispense_Dispenser, {@enum.value spMedicationDispense_Dispenser Return all dispenses performed by a specific indiividual }
spMedicationDispense_Identifier, {@enum.value spMedicationDispense_Identifier Return dispenses with this external identity }
spMedicationDispense_Medication, {@enum.value spMedicationDispense_Medication Returns dispenses of this medicine }
spMedicationDispense_Patient, {@enum.value spMedicationDispense_Patient The identity of a patient to list dispenses for }
spMedicationDispense_Prescription, {@enum.value spMedicationDispense_Prescription The identity of a prescription to list dispenses from }
spMedicationDispense_Responsibleparty, {@enum.value spMedicationDispense_Responsibleparty Return all dispenses with the specified responsible party }
spMedicationDispense_Status, {@enum.value spMedicationDispense_Status Status of the dispense }
spMedicationDispense_Type, {@enum.value spMedicationDispense_Type Return all dispenses of a specific type }
spMedicationDispense_Whenhandedover, {@enum.value spMedicationDispense_Whenhandedover Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting) }
spMedicationDispense_Whenprepared); {@enum.value spMedicationDispense_Whenprepared Date when medication prepared }
{@Enum TSearchParamsMedicationPrescription
Search Parameters for MedicationPrescription
}
TSearchParamsMedicationPrescription = (
spMedicationPrescription__id, {@enum.value spMedicationPrescription__id The logical resource id associated with the resource (must be supported by all servers) }
spMedicationPrescription__language, {@enum.value spMedicationPrescription__language The language of the resource }
spMedicationPrescription_Datewritten, {@enum.value spMedicationPrescription_Datewritten Return prescriptions written on this date }
spMedicationPrescription_Encounter, {@enum.value spMedicationPrescription_Encounter Return prescriptions with this encounter identity }
spMedicationPrescription_Identifier, {@enum.value spMedicationPrescription_Identifier Return prescriptions with this external identity }
spMedicationPrescription_Medication, {@enum.value spMedicationPrescription_Medication Code for medicine or text in medicine name }
spMedicationPrescription_Patient, {@enum.value spMedicationPrescription_Patient The identity of a patient to list dispenses for }
spMedicationPrescription_Status); {@enum.value spMedicationPrescription_Status Status of the prescription }
{@Enum TSearchParamsMedicationStatement
Search Parameters for MedicationStatement
}
TSearchParamsMedicationStatement = (
spMedicationStatement__id, {@enum.value spMedicationStatement__id The logical resource id associated with the resource (must be supported by all servers) }
spMedicationStatement__language, {@enum.value spMedicationStatement__language The language of the resource }
spMedicationStatement_Device, {@enum.value spMedicationStatement_Device Return administrations with this administration device identity }
spMedicationStatement_Identifier, {@enum.value spMedicationStatement_Identifier Return administrations with this external identity }
spMedicationStatement_Medication, {@enum.value spMedicationStatement_Medication Code for medicine or text in medicine name }
spMedicationStatement_Patient, {@enum.value spMedicationStatement_Patient The identity of a patient to list administrations for }
spMedicationStatement_When_given); {@enum.value spMedicationStatement_When_given Date of administration }
{@Enum TSearchParamsMessageHeader
Search Parameters for MessageHeader
}
TSearchParamsMessageHeader = (
spMessageHeader__id, {@enum.value spMessageHeader__id The logical resource id associated with the resource (must be supported by all servers) }
spMessageHeader__language); {@enum.value spMessageHeader__language The language of the resource }
{@Enum TSearchParamsObservation
Search Parameters for Observation
}
TSearchParamsObservation = (
spObservation__id, {@enum.value spObservation__id The logical resource id associated with the resource (must be supported by all servers) }
spObservation__language, {@enum.value spObservation__language The language of the resource }
spObservation_Date, {@enum.value spObservation_Date Obtained date/time. If the obtained element is a period, a date that falls in the period }
spObservation_Name, {@enum.value spObservation_Name The name of the observation type }
spObservation_Name_value_x, {@enum.value spObservation_Name_value_x Both name and one of the value parameters }
spObservation_Performer, {@enum.value spObservation_Performer Who and/or what performed the observation }
spObservation_Related, {@enum.value spObservation_Related Related Observations - search on related-type and related-target together }
spObservation_Related_target, {@enum.value spObservation_Related_target Observation that is related to this one }
spObservation_Related_type, {@enum.value spObservation_Related_type has-component | has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by }
spObservation_Reliability, {@enum.value spObservation_Reliability The reliability of the observation }
spObservation_Specimen, {@enum.value spObservation_Specimen Specimen used for this observation }
spObservation_Status, {@enum.value spObservation_Status The status of the observation }
spObservation_Subject, {@enum.value spObservation_Subject The subject that the observation is about }
spObservation_Value_concept, {@enum.value spObservation_Value_concept The value of the observation, if the value is a CodeableConcept }
spObservation_Value_date, {@enum.value spObservation_Value_date The value of the observation, if the value is a Period }
spObservation_Value_quantity, {@enum.value spObservation_Value_quantity The value of the observation, if the value is a Quantity, or a SampledData (just search on the bounds of the values in sampled data) }
spObservation_Value_string); {@enum.value spObservation_Value_string The value of the observation, if the value is a string, and also searches in CodeableConcept.text }
{@Enum TSearchParamsOperationOutcome
Search Parameters for OperationOutcome
}
TSearchParamsOperationOutcome = (
spOperationOutcome__id, {@enum.value spOperationOutcome__id The logical resource id associated with the resource (must be supported by all servers) }
spOperationOutcome__language); {@enum.value spOperationOutcome__language The language of the resource }
{@Enum TSearchParamsOrder
Search Parameters for Order
}
TSearchParamsOrder = (
spOrder__id, {@enum.value spOrder__id The logical resource id associated with the resource (must be supported by all servers) }
spOrder__language, {@enum.value spOrder__language The language of the resource }
spOrder_Authority, {@enum.value spOrder_Authority If required by policy }
spOrder_Date, {@enum.value spOrder_Date When the order was made }
spOrder_Detail, {@enum.value spOrder_Detail What action is being ordered }
spOrder_Source, {@enum.value spOrder_Source Who initiated the order }
spOrder_Subject, {@enum.value spOrder_Subject Patient this order is about }
spOrder_Target, {@enum.value spOrder_Target Who is intended to fulfill the order }
spOrder_When, {@enum.value spOrder_When A formal schedule }
spOrder_When_code); {@enum.value spOrder_When_code Code specifies when request should be done. The code may simply be a priority code }
{@Enum TSearchParamsOrderResponse
Search Parameters for OrderResponse
}
TSearchParamsOrderResponse = (
spOrderResponse__id, {@enum.value spOrderResponse__id The logical resource id associated with the resource (must be supported by all servers) }
spOrderResponse__language, {@enum.value spOrderResponse__language The language of the resource }
spOrderResponse_Code, {@enum.value spOrderResponse_Code pending | review | rejected | error | accepted | cancelled | replaced | aborted | complete }
spOrderResponse_Date, {@enum.value spOrderResponse_Date When the response was made }
spOrderResponse_Fulfillment, {@enum.value spOrderResponse_Fulfillment Details of the outcome of performing the order }
spOrderResponse_Request, {@enum.value spOrderResponse_Request The order that this is a response to }
spOrderResponse_Who); {@enum.value spOrderResponse_Who Who made the response }
{@Enum TSearchParamsOrganization
Search Parameters for Organization
}
TSearchParamsOrganization = (
spOrganization__id, {@enum.value spOrganization__id The logical resource id associated with the resource (must be supported by all servers) }
spOrganization__language, {@enum.value spOrganization__language The language of the resource }
spOrganization_Active, {@enum.value spOrganization_Active Whether the organization's record is active }
spOrganization_Identifier, {@enum.value spOrganization_Identifier Any identifier for the organization (not the accreditation issuer's identifier) }
spOrganization_Name, {@enum.value spOrganization_Name A portion of the organization's name }
spOrganization_Partof, {@enum.value spOrganization_Partof Search all organizations that are part of the given organization }
spOrganization_Phonetic, {@enum.value spOrganization_Phonetic A portion of the organization's name using some kind of phonetic matching algorithm }
spOrganization_Type); {@enum.value spOrganization_Type A code for the type of organization }
{@Enum TSearchParamsOther
Search Parameters for Other
}
TSearchParamsOther = (
spOther__id, {@enum.value spOther__id The logical resource id associated with the resource (must be supported by all servers) }
spOther__language, {@enum.value spOther__language The language of the resource }
spOther_Code, {@enum.value spOther_Code Kind of Resource }
spOther_Created, {@enum.value spOther_Created When created }
spOther_Subject); {@enum.value spOther_Subject Identifies the }
{@Enum TSearchParamsPatient
Search Parameters for Patient
}
TSearchParamsPatient = (
spPatient__id, {@enum.value spPatient__id The logical resource id associated with the resource (must be supported by all servers) }
spPatient__language, {@enum.value spPatient__language The language of the resource }
spPatient_Active, {@enum.value spPatient_Active Whether the patient record is active }
spPatient_Address, {@enum.value spPatient_Address An address in any kind of address/part of the patient }
spPatient_Animal_breed, {@enum.value spPatient_Animal_breed The breed for animal patients }
spPatient_Animal_species, {@enum.value spPatient_Animal_species The species for animal patients }
spPatient_Birthdate, {@enum.value spPatient_Birthdate The patient's date of birth }
spPatient_Family, {@enum.value spPatient_Family A portion of the family name of the patient }
spPatient_Gender, {@enum.value spPatient_Gender Gender of the patient }
spPatient_Given, {@enum.value spPatient_Given A portion of the given name of the patient }
spPatient_Identifier, {@enum.value spPatient_Identifier A patient identifier }
spPatient_Language, {@enum.value spPatient_Language Language code (irrespective of use value) }
spPatient_Link, {@enum.value spPatient_Link All patients linked to the given patient }
spPatient_Name, {@enum.value spPatient_Name A portion of either family or given name of the patient }
spPatient_Phonetic, {@enum.value spPatient_Phonetic A portion of either family or given name using some kind of phonetic matching algorithm }
spPatient_Provider, {@enum.value spPatient_Provider The organization at which this person is a patient }
spPatient_Telecom); {@enum.value spPatient_Telecom The value in any kind of telecom details of the patient }
{@Enum TSearchParamsPractitioner
Search Parameters for Practitioner
}
TSearchParamsPractitioner = (
spPractitioner__id, {@enum.value spPractitioner__id The logical resource id associated with the resource (must be supported by all servers) }
spPractitioner__language, {@enum.value spPractitioner__language The language of the resource }
spPractitioner_Address, {@enum.value spPractitioner_Address An address in any kind of address/part }
spPractitioner_Family, {@enum.value spPractitioner_Family A portion of the family name }
spPractitioner_Gender, {@enum.value spPractitioner_Gender Gender of the practitioner }
spPractitioner_Given, {@enum.value spPractitioner_Given A portion of the given name }
spPractitioner_Identifier, {@enum.value spPractitioner_Identifier A practitioner's Identifier }
spPractitioner_Name, {@enum.value spPractitioner_Name A portion of either family or given name }
spPractitioner_Organization, {@enum.value spPractitioner_Organization The identity of the organization the practitioner represents / acts on behalf of }
spPractitioner_Phonetic, {@enum.value spPractitioner_Phonetic A portion of either family or given name using some kind of phonetic matching algorithm }
spPractitioner_Telecom); {@enum.value spPractitioner_Telecom The value in any kind of contact }
{@Enum TSearchParamsProcedure
Search Parameters for Procedure
}
TSearchParamsProcedure = (
spProcedure__id, {@enum.value spProcedure__id The logical resource id associated with the resource (must be supported by all servers) }
spProcedure__language, {@enum.value spProcedure__language The language of the resource }
spProcedure_Date, {@enum.value spProcedure_Date The date the procedure was performed on }
spProcedure_Subject, {@enum.value spProcedure_Subject The identity of a patient to list procedures for }
spProcedure_Type); {@enum.value spProcedure_Type Type of procedure }
{@Enum TSearchParamsProfile
Search Parameters for Profile
}
TSearchParamsProfile = (
spProfile__id, {@enum.value spProfile__id The logical resource id associated with the resource (must be supported by all servers) }
spProfile__language, {@enum.value spProfile__language The language of the resource }
spProfile_Code, {@enum.value spProfile_Code A code for the profile in the format uri::code (server may choose to do subsumption) }
spProfile_Date, {@enum.value spProfile_Date The profile publication date }
spProfile_Description, {@enum.value spProfile_Description Text search in the description of the profile }
spProfile_Extension, {@enum.value spProfile_Extension An extension code (use or definition) }
spProfile_Identifier, {@enum.value spProfile_Identifier The identifier of the profile }
spProfile_Name, {@enum.value spProfile_Name Name of the profile }
spProfile_Publisher, {@enum.value spProfile_Publisher Name of the publisher of the profile }
spProfile_Status, {@enum.value spProfile_Status The current status of the profile }
spProfile_Type, {@enum.value spProfile_Type Type of resource that is constrained in the profile }
spProfile_Valueset, {@enum.value spProfile_Valueset A vocabulary binding code }
spProfile_Version); {@enum.value spProfile_Version The version identifier of the profile }
{@Enum TSearchParamsProvenance
Search Parameters for Provenance
}
TSearchParamsProvenance = (
spProvenance__id, {@enum.value spProvenance__id The logical resource id associated with the resource (must be supported by all servers) }
spProvenance__language, {@enum.value spProvenance__language The language of the resource }
spProvenance_End, {@enum.value spProvenance_End End time with inclusive boundary, if not ongoing }
spProvenance_Location, {@enum.value spProvenance_Location Where the activity occurred, if relevant }
spProvenance_Party, {@enum.value spProvenance_Party Identity of agent (urn or url) }
spProvenance_Partytype, {@enum.value spProvenance_Partytype e.g. Resource | Person | Application | Record | Document + }
spProvenance_Start, {@enum.value spProvenance_Start Starting time with inclusive boundary }
spProvenance_Target); {@enum.value spProvenance_Target Target resource(s) (usually version specific) }
{@Enum TSearchParamsQuery
Search Parameters for Query
}
TSearchParamsQuery = (
spQuery__id, {@enum.value spQuery__id The logical resource id associated with the resource (must be supported by all servers) }
spQuery__language, {@enum.value spQuery__language The language of the resource }
spQuery_Identifier, {@enum.value spQuery_Identifier Links query and its response(s) }
spQuery_Response); {@enum.value spQuery_Response Links response to source query }
{@Enum TSearchParamsQuestionnaire
Search Parameters for Questionnaire
}
TSearchParamsQuestionnaire = (
spQuestionnaire__id, {@enum.value spQuestionnaire__id The logical resource id associated with the resource (must be supported by all servers) }
spQuestionnaire__language, {@enum.value spQuestionnaire__language The language of the resource }
spQuestionnaire_Author, {@enum.value spQuestionnaire_Author The author of the questionnaire }
spQuestionnaire_Authored, {@enum.value spQuestionnaire_Authored When the questionnaire was authored }
spQuestionnaire_Encounter, {@enum.value spQuestionnaire_Encounter Encounter during which questionnaire was authored }
spQuestionnaire_Identifier, {@enum.value spQuestionnaire_Identifier An identifier for the questionnaire }
spQuestionnaire_Name, {@enum.value spQuestionnaire_Name Name of the questionnaire }
spQuestionnaire_Status, {@enum.value spQuestionnaire_Status The status of the questionnaire }
spQuestionnaire_Subject); {@enum.value spQuestionnaire_Subject The subject of the questionnaire }
{@Enum TSearchParamsRelatedPerson
Search Parameters for RelatedPerson
}
TSearchParamsRelatedPerson = (
spRelatedPerson__id, {@enum.value spRelatedPerson__id The logical resource id associated with the resource (must be supported by all servers) }
spRelatedPerson__language, {@enum.value spRelatedPerson__language The language of the resource }
spRelatedPerson_Address, {@enum.value spRelatedPerson_Address An address in any kind of address/part }
spRelatedPerson_Gender, {@enum.value spRelatedPerson_Gender Gender of the person }
spRelatedPerson_Identifier, {@enum.value spRelatedPerson_Identifier A patient Identifier }
spRelatedPerson_Name, {@enum.value spRelatedPerson_Name A portion of name in any name part }
spRelatedPerson_Patient, {@enum.value spRelatedPerson_Patient The patient this person is related to }
spRelatedPerson_Phonetic, {@enum.value spRelatedPerson_Phonetic A portion of name using some kind of phonetic matching algorithm }
spRelatedPerson_Telecom); {@enum.value spRelatedPerson_Telecom The value in any kind of contact }
{@Enum TSearchParamsSecurityEvent
Search Parameters for SecurityEvent
}
TSearchParamsSecurityEvent = (
spSecurityEvent__id, {@enum.value spSecurityEvent__id The logical resource id associated with the resource (must be supported by all servers) }
spSecurityEvent__language, {@enum.value spSecurityEvent__language The language of the resource }
spSecurityEvent_Action, {@enum.value spSecurityEvent_Action Type of action performed during the event }
spSecurityEvent_Address, {@enum.value spSecurityEvent_Address Identifier for the network access point of the user device }
spSecurityEvent_Altid, {@enum.value spSecurityEvent_Altid Alternative User id e.g. authentication }
spSecurityEvent_Date, {@enum.value spSecurityEvent_Date Time when the event occurred on source }
spSecurityEvent_Desc, {@enum.value spSecurityEvent_Desc Instance-specific descriptor for Object }
spSecurityEvent_Identity, {@enum.value spSecurityEvent_Identity Specific instance of object (e.g. versioned) }
spSecurityEvent_Name, {@enum.value spSecurityEvent_Name Human-meaningful name for the user }
spSecurityEvent_Object_type, {@enum.value spSecurityEvent_Object_type Object type being audited }
spSecurityEvent_Patientid, {@enum.value spSecurityEvent_Patientid The id of the patient (one of multiple kinds of participations) }
spSecurityEvent_Reference, {@enum.value spSecurityEvent_Reference Specific instance of resource (e.g. versioned) }
spSecurityEvent_Site, {@enum.value spSecurityEvent_Site Logical source location within the enterprise }
spSecurityEvent_Source, {@enum.value spSecurityEvent_Source The id of source where event originated }
spSecurityEvent_Subtype, {@enum.value spSecurityEvent_Subtype More specific type/id for the event }
spSecurityEvent_Type, {@enum.value spSecurityEvent_Type Type/identifier of event }
spSecurityEvent_User); {@enum.value spSecurityEvent_User Unique identifier for the user }
{@Enum TSearchParamsSpecimen
Search Parameters for Specimen
}
TSearchParamsSpecimen = (
spSpecimen__id, {@enum.value spSpecimen__id The logical resource id associated with the resource (must be supported by all servers) }
spSpecimen__language, {@enum.value spSpecimen__language The language of the resource }
spSpecimen_Subject); {@enum.value spSpecimen_Subject The subject of the specimen }
{@Enum TSearchParamsSubstance
Search Parameters for Substance
}
TSearchParamsSubstance = (
spSubstance__id, {@enum.value spSubstance__id The logical resource id associated with the resource (must be supported by all servers) }
spSubstance__language, {@enum.value spSubstance__language The language of the resource }
spSubstance_Expiry, {@enum.value spSubstance_Expiry When no longer valid to use }
spSubstance_Identifier, {@enum.value spSubstance_Identifier Identifier of the package/container }
spSubstance_Quantity, {@enum.value spSubstance_Quantity Amount of substance in the package }
spSubstance_Substance, {@enum.value spSubstance_Substance A component of the substance }
spSubstance_Type); {@enum.value spSubstance_Type The type of the substance }
{@Enum TSearchParamsSupply
Search Parameters for Supply
}
TSearchParamsSupply = (
spSupply__id, {@enum.value spSupply__id The logical resource id associated with the resource (must be supported by all servers) }
spSupply__language, {@enum.value spSupply__language The language of the resource }
spSupply_Dispenseid, {@enum.value spSupply_Dispenseid External identifier }
spSupply_Dispensestatus, {@enum.value spSupply_Dispensestatus in progress | dispensed | abandoned }
spSupply_Identifier, {@enum.value spSupply_Identifier Unique identifier }
spSupply_Kind, {@enum.value spSupply_Kind The kind of supply (central, non-stock, etc) }
spSupply_Patient, {@enum.value spSupply_Patient Patient for whom the item is supplied }
spSupply_Status, {@enum.value spSupply_Status requested | dispensed | received | failed | cancelled }
spSupply_Supplier); {@enum.value spSupply_Supplier Dispenser }
{@Enum TSearchParamsValueSet
Search Parameters for ValueSet
}
TSearchParamsValueSet = (
spValueSet__id, {@enum.value spValueSet__id The logical resource id associated with the resource (must be supported by all servers) }
spValueSet__language, {@enum.value spValueSet__language The language of the resource }
spValueSet_Code, {@enum.value spValueSet_Code A code defined in the value set }
spValueSet_Date, {@enum.value spValueSet_Date The value set publication date }
spValueSet_Description, {@enum.value spValueSet_Description Text search in the description of the value set }
spValueSet_Identifier, {@enum.value spValueSet_Identifier The identifier of the value set }
spValueSet_Name, {@enum.value spValueSet_Name The name of the value set }
spValueSet_Publisher, {@enum.value spValueSet_Publisher Name of the publisher of the value set }
spValueSet_Reference, {@enum.value spValueSet_Reference A code system included or excluded in the value set or an imported value set }
spValueSet_Status, {@enum.value spValueSet_Status The status of the value set }
spValueSet_System, {@enum.value spValueSet_System The system for any codes defined by this value set }
spValueSet_Version); {@enum.value spValueSet_Version The version identifier of the value set }
Type
TFhirResource = class;
TFhirResourceList = class;
TFhirAdverseReaction = class;
TFhirAlert = class;
TFhirAllergyIntolerance = class;
TFhirCarePlan = class;
TFhirComposition = class;
TFhirConceptMap = class;
TFhirCondition = class;
TFhirConformance = class;
TFhirDevice = class;
TFhirDeviceObservationReport = class;
TFhirDiagnosticOrder = class;
TFhirDiagnosticReport = class;
TFhirDocumentManifest = class;
TFhirDocumentReference = class;
TFhirEncounter = class;
TFhirFamilyHistory = class;
TFhirGroup = class;
TFhirImagingStudy = class;
TFhirImmunization = class;
TFhirImmunizationRecommendation = class;
TFhirList = class;
TFhirLocation = class;
TFhirMedia = class;
TFhirMedication = class;
TFhirMedicationAdministration = class;
TFhirMedicationDispense = class;
TFhirMedicationPrescription = class;
TFhirMedicationStatement = class;
TFhirMessageHeader = class;
TFhirObservation = class;
TFhirOperationOutcome = class;
TFhirOrder = class;
TFhirOrderResponse = class;
TFhirOrganization = class;
TFhirOther = class;
TFhirPatient = class;
TFhirPractitioner = class;
TFhirProcedure = class;
TFhirProfile = class;
TFhirProvenance = class;
TFhirQuery = class;
TFhirQuestionnaire = class;
TFhirRelatedPerson = class;
TFhirSecurityEvent = class;
TFhirSpecimen = class;
TFhirSubstance = class;
TFhirSupply = class;
TFhirValueSet = class;
{@Class TFhirResource : TFhirElement
Base Resource Definition - extensions, narrative, contained resources
}
{!.Net HL7Connect.Fhir.Resource}
TFhirResource = {abstract} class (TFhirBackboneElement)
private
FText : TFhirNarrative;
FLanguage : TFhirCode;
FFormat : TFHIRFormat;
FContainedList : TFhirResourceList;
procedure SetText(value : TFhirNarrative);
procedure SetLanguage(value : TFhirCode);
protected
function GetResourceType : TFhirResourceType; virtual; abstract;
function GetHasASummary : Boolean; virtual; abstract;
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
public
constructor Create; override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirResource; overload;
function Clone : TFhirResource; overload;
{!script show}
published
Property ResourceType : TFhirResourceType read GetResourceType;
Property HasASummary : Boolean read GetHasASummary;
{@member language
The base language of the resource
}
property language : TFhirCode read FLanguage write SetLanguage;
{@member text
Text summary of resource content, for human interpretation
}
property text : TFhirNarrative read FText write SetText;
{@member containedList
Text summary of resource content, for human interpretation
}
property containedList : TFhirResourceList read FContainedList;
{@member _source_format
Whether the resource was first represented in XML or JSON
}
property _source_format : TFHIRFormat read FFormat write FFormat;
end;
TFhirResourceClass = class of TFhirResource;
{@Class TFhirBinary : TFhirResource
Special Binary Resource
}
{!.Net HL7Connect.Fhir.Binary}
TFhirBinary = class (TFhirResource)
private
FContent : TAdvBuffer;
FContentType : string;
protected
function GetResourceType : TFhirResourceType; override;
function GetHasASummary : Boolean; override;
public
Constructor Create; Overload; Override;
Destructor Destroy; Override;
published
Property Content : TAdvBuffer read FContent;
Property ContentType : string read FContentType write FContentType;
end;
TFhirResourceListEnumerator = class (TAdvObject)
private
FIndex : integer;
FList : TFhirResourceList;
function GetCurrent : TFhirResource;
public
Constructor Create(list : TFhirResourceList);
Destructor Destroy; override;
function MoveNext : boolean;
property Current : TFhirResource read GetCurrent;
end;
{@Class TFhirResourceList
A list of FhirResource
}
{!.Net HL7Connect.Fhir.ResourceList}
TFhirResourceList = class (TFHIRObjectList)
private
function GetItemN(index : Integer) : TFhirResource;
procedure SetItemN(index : Integer; value : TFhirResource);
public
{!script hide}
function Link : TFhirResourceList; Overload;
function Clone : TFhirResourceList; Overload;
function GetEnumerator : TFhirResourceListEnumerator;
{!script show}
{@member AddItem
Add an already existing FhirResource to the end of the list.
}
procedure AddItem(value : TFhirResource); overload;
{@member IndexOf
See if an item is already in the list. returns -1 if not in the list
}
{@member IndexOf
See if an item is already in the list. returns -1 if not in the list
}
function IndexOf(value : TFhirResource) : Integer;
{@member InsertItem
Insert an existing FhirResource before the designated index (0 = first item)
}
procedure InsertItem(index : Integer; value : TFhirResource);
{@member Item
Get the iIndexth FhirResource. (0 = first item)
}
{@member Item
Get the iIndexth FhirResource. (0 = first item)
}
procedure SetItemByIndex(index : Integer; value : TFhirResource);
{@member Count
The number of items in the collection
}
function Item(index : Integer) : TFhirResource;
{@member Count
The number of items in the collection
}
function Count : Integer; Overload;
{@member remove
Remove the indexth item. The first item is index 0.
}
procedure Remove(index : Integer);
{@member ClearItems
Remove All Items from the list
}
procedure ClearItems;
Property FhirResources[index : Integer] : TFhirResource read GetItemN write SetItemN; default;
End;
{@Class TFhirAdverseReaction : TFhirResource
Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance.
}
{!.Net HL7Connect.Fhir.AdverseReaction}
TFhirAdverseReaction = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FDate : TFhirDateTime;
FSubject : TFhirResourceReference{TFhirPatient};
FDidNotOccurFlag : TFhirBoolean;
FRecorder : TFhirResourceReference{Resource};
FsymptomList : TFhirAdverseReactionSymptomList;
FexposureList : TFhirAdverseReactionExposureList;
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetDidNotOccurFlag(value : TFhirBoolean);
Function GetDidNotOccurFlagST : Boolean;
Procedure SetDidNotOccurFlagST(value : Boolean);
Procedure SetRecorder(value : TFhirResourceReference{Resource});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirAdverseReaction; overload;
function Clone : TFhirAdverseReaction; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member date
The date (and possibly time) when the reaction began.
}
{@member date
Typed access to The date (and possibly time) when the reaction began.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member subject
The subject of the adverse reaction.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member didNotOccurFlag
If true, indicates that no reaction occurred.
}
{@member didNotOccurFlag
Typed access to If true, indicates that no reaction occurred.
}
property didNotOccurFlag : Boolean read GetDidNotOccurFlagST write SetDidNotOccurFlagST;
property didNotOccurFlagObject : TFhirBoolean read FDidNotOccurFlag write SetDidNotOccurFlag;
{@member recorder
Identifies the individual responsible for the information in the reaction record.
}
property recorder : TFhirResourceReference{Resource} read FRecorder write SetRecorder;
property recorderObject : TFhirResourceReference{Resource} read FRecorder write SetRecorder;
{@member symptomList
The signs and symptoms that were observed as part of the reaction.
}
property symptomList : TFhirAdverseReactionSymptomList read FSymptomList;
{@member exposureList
An exposure to a substance that preceded a reaction occurrence.
}
property exposureList : TFhirAdverseReactionExposureList read FExposureList;
end;
{@Class TFhirAlert : TFhirResource
Prospective warnings of potential issues when providing care to the patient.
}
{!.Net HL7Connect.Fhir.Alert}
TFhirAlert = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FCategory : TFhirCodeableConcept;
FStatus : TFhirEnum;
FSubject : TFhirResourceReference{TFhirPatient};
FAuthor : TFhirResourceReference{Resource};
FNote : TFhirString;
Procedure SetCategory(value : TFhirCodeableConcept);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirAlertStatus;
Procedure SetStatusST(value : TFhirAlertStatus);
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetAuthor(value : TFhirResourceReference{Resource});
Procedure SetNote(value : TFhirString);
Function GetNoteST : String;
Procedure SetNoteST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirAlert; overload;
function Clone : TFhirAlert; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifier assigned to the alert for external use (outside the FHIR environment).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member category
Allows an alert to be divided into different categories like clinical, administrative etc.
}
property category : TFhirCodeableConcept read FCategory write SetCategory;
property categoryObject : TFhirCodeableConcept read FCategory write SetCategory;
{@member status
Supports basic workflow.
}
property status : TFhirAlertStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member subject
The person who this alert concerns.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member author
The person or device that created the alert.
}
property author : TFhirResourceReference{Resource} read FAuthor write SetAuthor;
property authorObject : TFhirResourceReference{Resource} read FAuthor write SetAuthor;
{@member note
The textual component of the alert to display to the user.
}
{@member note
Typed access to The textual component of the alert to display to the user.
}
property note : String read GetNoteST write SetNoteST;
property noteObject : TFhirString read FNote write SetNote;
end;
{@Class TFhirAllergyIntolerance : TFhirResource
Indicates the patient has a susceptibility to an adverse reaction upon exposure to a specified substance.
}
{!.Net HL7Connect.Fhir.AllergyIntolerance}
TFhirAllergyIntolerance = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FCriticality : TFhirEnum;
FSensitivityType : TFhirEnum;
FRecordedDate : TFhirDateTime;
FStatus : TFhirEnum;
FSubject : TFhirResourceReference{TFhirPatient};
FRecorder : TFhirResourceReference{Resource};
FSubstance : TFhirResourceReference{TFhirSubstance};
FreactionList : TFhirResourceReferenceList{TFhirAdverseReaction};
FsensitivityTestList : TFhirResourceReferenceList{TFhirObservation};
Procedure SetCriticality(value : TFhirEnum);
Function GetCriticalityST : TFhirCriticality;
Procedure SetCriticalityST(value : TFhirCriticality);
Procedure SetSensitivityType(value : TFhirEnum);
Function GetSensitivityTypeST : TFhirSensitivitytype;
Procedure SetSensitivityTypeST(value : TFhirSensitivitytype);
Procedure SetRecordedDate(value : TFhirDateTime);
Function GetRecordedDateST : TDateTimeEx;
Procedure SetRecordedDateST(value : TDateTimeEx);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirSensitivitystatus;
Procedure SetStatusST(value : TFhirSensitivitystatus);
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetRecorder(value : TFhirResourceReference{Resource});
Procedure SetSubstance(value : TFhirResourceReference{TFhirSubstance});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirAllergyIntolerance; overload;
function Clone : TFhirAllergyIntolerance; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
This records identifiers associated with this allergy/intolerance concern that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member criticality
Criticality of the sensitivity.
}
property criticality : TFhirCriticality read GetCriticalityST write SetCriticalityST;
property criticalityObject : TFhirEnum read FCriticality write SetCriticality;
{@member sensitivityType
Type of the sensitivity.
}
property sensitivityType : TFhirSensitivitytype read GetSensitivityTypeST write SetSensitivityTypeST;
property sensitivityTypeObject : TFhirEnum read FSensitivityType write SetSensitivityType;
{@member recordedDate
Date when the sensitivity was recorded.
}
{@member recordedDate
Typed access to Date when the sensitivity was recorded.
}
property recordedDate : TDateTimeEx read GetRecordedDateST write SetRecordedDateST;
property recordedDateObject : TFhirDateTime read FRecordedDate write SetRecordedDate;
{@member status
Status of the sensitivity.
}
property status : TFhirSensitivitystatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member subject
The patient who has the allergy or intolerance.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member recorder
Indicates who has responsibility for the record.
}
property recorder : TFhirResourceReference{Resource} read FRecorder write SetRecorder;
property recorderObject : TFhirResourceReference{Resource} read FRecorder write SetRecorder;
{@member substance
The substance that causes the sensitivity.
}
property substance : TFhirResourceReference{TFhirSubstance} read FSubstance write SetSubstance;
property substanceObject : TFhirResourceReference{TFhirSubstance} read FSubstance write SetSubstance;
{@member reactionList
Reactions associated with the sensitivity.
}
property reactionList : TFhirResourceReferenceList{TFhirAdverseReaction} read FReactionList;
{@member sensitivityTestList
Observations that confirm or refute the sensitivity.
}
property sensitivityTestList : TFhirResourceReferenceList{TFhirObservation} read FSensitivityTestList;
end;
{@Class TFhirCarePlan : TFhirResource
Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.
}
{!.Net HL7Connect.Fhir.CarePlan}
TFhirCarePlan = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FPatient : TFhirResourceReference{TFhirPatient};
FStatus : TFhirEnum;
FPeriod : TFhirPeriod;
FModified : TFhirDateTime;
FconcernList : TFhirResourceReferenceList{TFhirCondition};
FparticipantList : TFhirCarePlanParticipantList;
FgoalList : TFhirCarePlanGoalList;
FactivityList : TFhirCarePlanActivityList;
FNotes : TFhirString;
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirCarePlanStatus;
Procedure SetStatusST(value : TFhirCarePlanStatus);
Procedure SetPeriod(value : TFhirPeriod);
Procedure SetModified(value : TFhirDateTime);
Function GetModifiedST : TDateTimeEx;
Procedure SetModifiedST(value : TDateTimeEx);
Procedure SetNotes(value : TFhirString);
Function GetNotesST : String;
Procedure SetNotesST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirCarePlan; overload;
function Clone : TFhirCarePlan; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
This records identifiers associated with this care plan that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member patient
Identifies the patient/subject whose intended care is described by the plan.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member status
Indicates whether the plan is currently being acted upon, represents future intentions or is now just historical record.
}
property status : TFhirCarePlanStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member period
Indicates when the plan did (or is intended to) come into effect and end.
}
property period : TFhirPeriod read FPeriod write SetPeriod;
property periodObject : TFhirPeriod read FPeriod write SetPeriod;
{@member modified
Identifies the most recent date on which the plan has been revised.
}
{@member modified
Typed access to Identifies the most recent date on which the plan has been revised.
}
property modified : TDateTimeEx read GetModifiedST write SetModifiedST;
property modifiedObject : TFhirDateTime read FModified write SetModified;
{@member concernList
Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.
}
property concernList : TFhirResourceReferenceList{TFhirCondition} read FConcernList;
{@member participantList
Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.
}
property participantList : TFhirCarePlanParticipantList read FParticipantList;
{@member goalList
Describes the intended objective(s) of carrying out the Care Plan.
}
property goalList : TFhirCarePlanGoalList read FGoalList;
{@member activityList
Identifies a planned action to occur as part of the plan. For example, a medication to be used, lab tests to perform, self-monitoring, education, etc.
}
property activityList : TFhirCarePlanActivityList read FActivityList;
{@member notes
General notes about the care plan not covered elsewhere.
}
{@member notes
Typed access to General notes about the care plan not covered elsewhere.
}
property notes : String read GetNotesST write SetNotesST;
property notesObject : TFhirString read FNotes write SetNotes;
end;
{@Class TFhirComposition : TFhirResource
A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement.
}
{!.Net HL7Connect.Fhir.Composition}
TFhirComposition = class (TFhirResource)
private
FIdentifier : TFhirIdentifier;
FDate : TFhirDateTime;
FType_ : TFhirCodeableConcept;
FClass_ : TFhirCodeableConcept;
FTitle : TFhirString;
FStatus : TFhirEnum;
FConfidentiality : TFhirCoding;
FSubject : TFhirResourceReference{Resource};
FauthorList : TFhirResourceReferenceList{Resource};
FattesterList : TFhirCompositionAttesterList;
FCustodian : TFhirResourceReference{TFhirOrganization};
FEvent : TFhirCompositionEvent;
FEncounter : TFhirResourceReference{TFhirEncounter};
FsectionList : TFhirCompositionSectionList;
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetClass_(value : TFhirCodeableConcept);
Procedure SetTitle(value : TFhirString);
Function GetTitleST : String;
Procedure SetTitleST(value : String);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirCompositionStatus;
Procedure SetStatusST(value : TFhirCompositionStatus);
Procedure SetConfidentiality(value : TFhirCoding);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetCustodian(value : TFhirResourceReference{TFhirOrganization});
Procedure SetEvent(value : TFhirCompositionEvent);
Procedure SetEncounter(value : TFhirResourceReference{TFhirEncounter});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirComposition; overload;
function Clone : TFhirComposition; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
Logical Identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member date
The composition editing time, when the composition was last logically changed by the author.
}
{@member date
Typed access to The composition editing time, when the composition was last logically changed by the author.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member type_
Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member class_
A categorization for the type of the composition. This may be implied by or derived from the code specified in the Composition Type.
}
property class_ : TFhirCodeableConcept read FClass_ write SetClass_;
property class_Object : TFhirCodeableConcept read FClass_ write SetClass_;
{@member title
Official human-readable label for the composition.
}
{@member title
Typed access to Official human-readable label for the composition.
}
property title : String read GetTitleST write SetTitleST;
property titleObject : TFhirString read FTitle write SetTitle;
{@member status
The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
}
property status : TFhirCompositionStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member confidentiality
The code specifying the level of confidentiality of the Composition.
}
property confidentiality : TFhirCoding read FConfidentiality write SetConfidentiality;
property confidentialityObject : TFhirCoding read FConfidentiality write SetConfidentiality;
{@member subject
Who or what the composition is about. The composition can be about a person, (patient or healthcare practitioner), a device (I.e. machine) or even a group of subjects (such as a document about a herd of livestock, or a set of patients that share a common exposure).
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member authorList
Identifies who is responsible for the information in the composition. (Not necessarily who typed it in.).
}
property authorList : TFhirResourceReferenceList{Resource} read FAuthorList;
{@member attesterList
A participant who has attested to the accuracy of the composition/document.
}
property attesterList : TFhirCompositionAttesterList read FAttesterList;
{@member custodian
Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.
}
property custodian : TFhirResourceReference{TFhirOrganization} read FCustodian write SetCustodian;
property custodianObject : TFhirResourceReference{TFhirOrganization} read FCustodian write SetCustodian;
{@member event
The main event/act/item, such as a colonoscopy or an appendectomy, being documented.
}
property event : TFhirCompositionEvent read FEvent write SetEvent;
property eventObject : TFhirCompositionEvent read FEvent write SetEvent;
{@member encounter
Describes the clinical encounter or type of care this documentation is associated with.
}
property encounter : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
property encounterObject : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
{@member sectionList
The root of the sections that make up the composition.
}
property sectionList : TFhirCompositionSectionList read FSectionList;
end;
{@Class TFhirConceptMap : TFhirResource
A statement of relationships from one set of concepts to one or more other concept systems.
}
{!.Net HL7Connect.Fhir.ConceptMap}
TFhirConceptMap = class (TFhirResource)
private
FIdentifier : TFhirString;
FVersion : TFhirString;
FName : TFhirString;
FPublisher : TFhirString;
FtelecomList : TFhirContactList;
FDescription : TFhirString;
FCopyright : TFhirString;
FStatus : TFhirEnum;
FExperimental : TFhirBoolean;
FDate : TFhirDateTime;
FSource : TFhirResourceReference{TFhirValueSet};
FTarget : TFhirResourceReference{TFhirValueSet};
FconceptList : TFhirConceptMapConceptList;
Procedure SetIdentifier(value : TFhirString);
Function GetIdentifierST : String;
Procedure SetIdentifierST(value : String);
Procedure SetVersion(value : TFhirString);
Function GetVersionST : String;
Procedure SetVersionST(value : String);
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetPublisher(value : TFhirString);
Function GetPublisherST : String;
Procedure SetPublisherST(value : String);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetCopyright(value : TFhirString);
Function GetCopyrightST : String;
Procedure SetCopyrightST(value : String);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirValuesetStatus;
Procedure SetStatusST(value : TFhirValuesetStatus);
Procedure SetExperimental(value : TFhirBoolean);
Function GetExperimentalST : Boolean;
Procedure SetExperimentalST(value : Boolean);
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetSource(value : TFhirResourceReference{TFhirValueSet});
Procedure SetTarget(value : TFhirResourceReference{TFhirValueSet});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirConceptMap; overload;
function Clone : TFhirConceptMap; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
The identifier that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
{@member identifier
Typed access to The identifier that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
property identifier : String read GetIdentifierST write SetIdentifierST;
property identifierObject : TFhirString read FIdentifier write SetIdentifier;
{@member version
The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
{@member version
Typed access to The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
property version : String read GetVersionST write SetVersionST;
property versionObject : TFhirString read FVersion write SetVersion;
{@member name
A free text natural language name describing the concept map.
}
{@member name
Typed access to A free text natural language name describing the concept map.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member publisher
The name of the individual or organization that published the concept map.
}
{@member publisher
Typed access to The name of the individual or organization that published the concept map.
}
property publisher : String read GetPublisherST write SetPublisherST;
property publisherObject : TFhirString read FPublisher write SetPublisher;
{@member telecomList
Contacts of the publisher to assist a user in finding and communicating with the publisher.
}
property telecomList : TFhirContactList read FTelecomList;
{@member description
A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.
}
{@member description
Typed access to A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member copyright
A copyright statement relating to the concept map and/or its contents.
}
{@member copyright
Typed access to A copyright statement relating to the concept map and/or its contents.
}
property copyright : String read GetCopyrightST write SetCopyrightST;
property copyrightObject : TFhirString read FCopyright write SetCopyright;
{@member status
The status of the concept map.
}
property status : TFhirValuesetStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member experimental
This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
{@member experimental
Typed access to This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
property experimental : Boolean read GetExperimentalST write SetExperimentalST;
property experimentalObject : TFhirBoolean read FExperimental write SetExperimental;
{@member date
The date that the concept map status was last changed.
}
{@member date
Typed access to The date that the concept map status was last changed.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member source
The source value set that specifies the concepts that are being mapped.
}
property source : TFhirResourceReference{TFhirValueSet} read FSource write SetSource;
property sourceObject : TFhirResourceReference{TFhirValueSet} read FSource write SetSource;
{@member target
The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.
}
property target : TFhirResourceReference{TFhirValueSet} read FTarget write SetTarget;
property targetObject : TFhirResourceReference{TFhirValueSet} read FTarget write SetTarget;
{@member conceptList
Mappings for a concept from the source valueset.
}
property conceptList : TFhirConceptMapConceptList read FConceptList;
end;
{@Class TFhirCondition : TFhirResource
Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.
}
{!.Net HL7Connect.Fhir.Condition}
TFhirCondition = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FSubject : TFhirResourceReference{TFhirPatient};
FEncounter : TFhirResourceReference{TFhirEncounter};
FAsserter : TFhirResourceReference{Resource};
FDateAsserted : TFhirDate;
FCode : TFhirCodeableConcept;
FCategory : TFhirCodeableConcept;
FStatus : TFhirEnum;
FCertainty : TFhirCodeableConcept;
FSeverity : TFhirCodeableConcept;
FOnset : TFhirType;
FAbatement : TFhirType;
FStage : TFhirConditionStage;
FevidenceList : TFhirConditionEvidenceList;
FlocationList : TFhirConditionLocationList;
FrelatedItemList : TFhirConditionRelatedItemList;
FNotes : TFhirString;
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetEncounter(value : TFhirResourceReference{TFhirEncounter});
Procedure SetAsserter(value : TFhirResourceReference{Resource});
Procedure SetDateAsserted(value : TFhirDate);
Function GetDateAssertedST : TDateTimeEx;
Procedure SetDateAssertedST(value : TDateTimeEx);
Procedure SetCode(value : TFhirCodeableConcept);
Procedure SetCategory(value : TFhirCodeableConcept);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirConditionStatus;
Procedure SetStatusST(value : TFhirConditionStatus);
Procedure SetCertainty(value : TFhirCodeableConcept);
Procedure SetSeverity(value : TFhirCodeableConcept);
Procedure SetOnset(value : TFhirType);
Procedure SetAbatement(value : TFhirType);
Procedure SetStage(value : TFhirConditionStage);
Procedure SetNotes(value : TFhirString);
Function GetNotesST : String;
Procedure SetNotesST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirCondition; overload;
function Clone : TFhirCondition; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
This records identifiers associated with this condition that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member subject
Indicates the patient who the condition record is associated with.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member encounter
Encounter during which the condition was first asserted.
}
property encounter : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
property encounterObject : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
{@member asserter
Person who takes responsibility for asserting the existence of the condition as part of the electronic record.
}
property asserter : TFhirResourceReference{Resource} read FAsserter write SetAsserter;
property asserterObject : TFhirResourceReference{Resource} read FAsserter write SetAsserter;
{@member dateAsserted
Estimated or actual date the condition/problem/diagnosis was first detected/suspected.
}
{@member dateAsserted
Typed access to Estimated or actual date the condition/problem/diagnosis was first detected/suspected.
}
property dateAsserted : TDateTimeEx read GetDateAssertedST write SetDateAssertedST;
property dateAssertedObject : TFhirDate read FDateAsserted write SetDateAsserted;
{@member code
Identification of the condition, problem or diagnosis.
}
property code : TFhirCodeableConcept read FCode write SetCode;
property codeObject : TFhirCodeableConcept read FCode write SetCode;
{@member category
A category assigned to the condition. E.g. complaint | symptom | finding | diagnosis.
}
property category : TFhirCodeableConcept read FCategory write SetCategory;
property categoryObject : TFhirCodeableConcept read FCategory write SetCategory;
{@member status
The clinical status of the condition.
}
property status : TFhirConditionStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member certainty
The degree of confidence that this condition is correct.
}
property certainty : TFhirCodeableConcept read FCertainty write SetCertainty;
property certaintyObject : TFhirCodeableConcept read FCertainty write SetCertainty;
{@member severity
A subjective assessment of the severity of the condition as evaluated by the clinician.
}
property severity : TFhirCodeableConcept read FSeverity write SetSeverity;
property severityObject : TFhirCodeableConcept read FSeverity write SetSeverity;
{@member onset
Estimated or actual date the condition began, in the opinion of the clinician.
}
property onset : TFhirType read FOnset write SetOnset;
property onsetObject : TFhirType read FOnset write SetOnset;
{@member abatement
The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.
}
property abatement : TFhirType read FAbatement write SetAbatement;
property abatementObject : TFhirType read FAbatement write SetAbatement;
{@member stage
Clinical stage or grade of a condition. May include formal severity assessments.
}
property stage : TFhirConditionStage read FStage write SetStage;
property stageObject : TFhirConditionStage read FStage write SetStage;
{@member evidenceList
Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.
}
property evidenceList : TFhirConditionEvidenceList read FEvidenceList;
{@member locationList
The anatomical location where this condition manifests itself.
}
property locationList : TFhirConditionLocationList read FLocationList;
{@member relatedItemList
Further conditions, problems, diagnoses, procedures or events that are related in some way to this condition, or the substance that caused/triggered this Condition.
}
property relatedItemList : TFhirConditionRelatedItemList read FRelatedItemList;
{@member notes
Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.
}
{@member notes
Typed access to Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.
}
property notes : String read GetNotesST write SetNotesST;
property notesObject : TFhirString read FNotes write SetNotes;
end;
{@Class TFhirConformance : TFhirResource
A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.
}
{!.Net HL7Connect.Fhir.Conformance}
TFhirConformance = class (TFhirResource)
private
FIdentifier : TFhirString;
FVersion : TFhirString;
FName : TFhirString;
FPublisher : TFhirString;
FtelecomList : TFhirContactList;
FDescription : TFhirString;
FStatus : TFhirEnum;
FExperimental : TFhirBoolean;
FDate : TFhirDateTime;
FSoftware : TFhirConformanceSoftware;
FImplementation_ : TFhirConformanceImplementation;
FFhirVersion : TFhirId;
FAcceptUnknown : TFhirBoolean;
FformatList : TFhirCodeList;
FprofileList : TFhirResourceReferenceList{TFhirProfile};
FrestList : TFhirConformanceRestList;
FmessagingList : TFhirConformanceMessagingList;
FdocumentList : TFhirConformanceDocumentList;
Procedure SetIdentifier(value : TFhirString);
Function GetIdentifierST : String;
Procedure SetIdentifierST(value : String);
Procedure SetVersion(value : TFhirString);
Function GetVersionST : String;
Procedure SetVersionST(value : String);
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetPublisher(value : TFhirString);
Function GetPublisherST : String;
Procedure SetPublisherST(value : String);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirConformanceStatementStatus;
Procedure SetStatusST(value : TFhirConformanceStatementStatus);
Procedure SetExperimental(value : TFhirBoolean);
Function GetExperimentalST : Boolean;
Procedure SetExperimentalST(value : Boolean);
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetSoftware(value : TFhirConformanceSoftware);
Procedure SetImplementation_(value : TFhirConformanceImplementation);
Procedure SetFhirVersion(value : TFhirId);
Function GetFhirVersionST : String;
Procedure SetFhirVersionST(value : String);
Procedure SetAcceptUnknown(value : TFhirBoolean);
Function GetAcceptUnknownST : Boolean;
Procedure SetAcceptUnknownST(value : Boolean);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirConformance; overload;
function Clone : TFhirConformance; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
The identifier that is used to identify this conformance statement when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
{@member identifier
Typed access to The identifier that is used to identify this conformance statement when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
property identifier : String read GetIdentifierST write SetIdentifierST;
property identifierObject : TFhirString read FIdentifier write SetIdentifier;
{@member version
The identifier that is used to identify this version of the conformance statement when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
{@member version
Typed access to The identifier that is used to identify this version of the conformance statement when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
property version : String read GetVersionST write SetVersionST;
property versionObject : TFhirString read FVersion write SetVersion;
{@member name
A free text natural language name identifying the conformance statement.
}
{@member name
Typed access to A free text natural language name identifying the conformance statement.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member publisher
Name of Organization publishing this conformance statement.
}
{@member publisher
Typed access to Name of Organization publishing this conformance statement.
}
property publisher : String read GetPublisherST write SetPublisherST;
property publisherObject : TFhirString read FPublisher write SetPublisher;
{@member telecomList
Contacts for Organization relevant to this conformance statement. The contacts may be a website, email, phone numbers, etc.
}
property telecomList : TFhirContactList read FTelecomList;
{@member description
A free text natural language description of the conformance statement and its use. Typically, this is used when the profile describes a desired rather than an actual solution, for example as a formal expression of requirements as part of an RFP.
}
{@member description
Typed access to A free text natural language description of the conformance statement and its use. Typically, this is used when the profile describes a desired rather than an actual solution, for example as a formal expression of requirements as part of an RFP.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member status
The status of this conformance statement.
}
property status : TFhirConformanceStatementStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member experimental
A flag to indicate that this conformance statement is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
{@member experimental
Typed access to A flag to indicate that this conformance statement is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
property experimental : Boolean read GetExperimentalST write SetExperimentalST;
property experimentalObject : TFhirBoolean read FExperimental write SetExperimental;
{@member date
The date when the conformance statement was published.
}
{@member date
Typed access to The date when the conformance statement was published.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member software
Software that is covered by this conformance statement. It is used when the profile describes the capabilities of a particular software version, independent of an installation.
}
property software : TFhirConformanceSoftware read FSoftware write SetSoftware;
property softwareObject : TFhirConformanceSoftware read FSoftware write SetSoftware;
{@member implementation_
Identifies a specific implementation instance that is described by the conformance statement - i.e. a particular installation, rather than the capabilities of a software program.
}
property implementation_ : TFhirConformanceImplementation read FImplementation_ write SetImplementation_;
property implementation_Object : TFhirConformanceImplementation read FImplementation_ write SetImplementation_;
{@member fhirVersion
The version of the FHIR specification on which this conformance statement is based.
}
{@member fhirVersion
Typed access to The version of the FHIR specification on which this conformance statement is based.
}
property fhirVersion : String read GetFhirVersionST write SetFhirVersionST;
property fhirVersionObject : TFhirId read FFhirVersion write SetFhirVersion;
{@member acceptUnknown
A flag that indicates whether the application accepts unknown elements as part of a resource.
}
{@member acceptUnknown
Typed access to A flag that indicates whether the application accepts unknown elements as part of a resource.
}
property acceptUnknown : Boolean read GetAcceptUnknownST write SetAcceptUnknownST;
property acceptUnknownObject : TFhirBoolean read FAcceptUnknown write SetAcceptUnknown;
{@member formatList
A list of the formats supported by this implementation.
}
property formatList : TFhirCodeList read FFormatList;
{@member profileList
A list of profiles supported by the system. For a server, "supported by the system" means the system hosts/produces a set of recourses, conformant to a particular profile, and allows its clients to search using this profile and to find appropriate data. For a client, it means the system will search by this profile and process data according to the guidance implicit in the profile.
}
property profileList : TFhirResourceReferenceList{TFhirProfile} read FProfileList;
{@member restList
A definition of the restful capabilities of the solution, if any.
}
property restList : TFhirConformanceRestList read FRestList;
{@member messagingList
A description of the messaging capabilities of the solution.
}
property messagingList : TFhirConformanceMessagingList read FMessagingList;
{@member documentList
A document definition.
}
property documentList : TFhirConformanceDocumentList read FDocumentList;
end;
{@Class TFhirDevice : TFhirResource
This resource identifies an instance of a manufactured thing that is used in the provision of healthcare without being substantially changed through that activity. The device may be a machine, an insert, a computer, an application, etc. This includes durable (reusable) medical equipment as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.
}
{!.Net HL7Connect.Fhir.Device}
TFhirDevice = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FType_ : TFhirCodeableConcept;
FManufacturer : TFhirString;
FModel : TFhirString;
FVersion : TFhirString;
FExpiry : TFhirDate;
FUdi : TFhirString;
FLotNumber : TFhirString;
FOwner : TFhirResourceReference{TFhirOrganization};
FLocation : TFhirResourceReference{TFhirLocation};
FPatient : TFhirResourceReference{TFhirPatient};
FcontactList : TFhirContactList;
FUrl : TFhirUri;
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetManufacturer(value : TFhirString);
Function GetManufacturerST : String;
Procedure SetManufacturerST(value : String);
Procedure SetModel(value : TFhirString);
Function GetModelST : String;
Procedure SetModelST(value : String);
Procedure SetVersion(value : TFhirString);
Function GetVersionST : String;
Procedure SetVersionST(value : String);
Procedure SetExpiry(value : TFhirDate);
Function GetExpiryST : TDateTimeEx;
Procedure SetExpiryST(value : TDateTimeEx);
Procedure SetUdi(value : TFhirString);
Function GetUdiST : String;
Procedure SetUdiST(value : String);
Procedure SetLotNumber(value : TFhirString);
Function GetLotNumberST : String;
Procedure SetLotNumberST(value : String);
Procedure SetOwner(value : TFhirResourceReference{TFhirOrganization});
Procedure SetLocation(value : TFhirResourceReference{TFhirLocation});
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
Procedure SetUrl(value : TFhirUri);
Function GetUrlST : String;
Procedure SetUrlST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirDevice; overload;
function Clone : TFhirDevice; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifiers assigned to this device by various organizations. The most likely organizations to assign identifiers are the manufacturer and the owner, though regulatory agencies may also assign an identifier. The identifiers identify the particular device, not the kind of device.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member type_
A kind of this device.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member manufacturer
A name of the manufacturer.
}
{@member manufacturer
Typed access to A name of the manufacturer.
}
property manufacturer : String read GetManufacturerST write SetManufacturerST;
property manufacturerObject : TFhirString read FManufacturer write SetManufacturer;
{@member model
The "model" - an identifier assigned by the manufacturer to identify the product by its type. This number is shared by the all devices sold as the same type.
}
{@member model
Typed access to The "model" - an identifier assigned by the manufacturer to identify the product by its type. This number is shared by the all devices sold as the same type.
}
property model : String read GetModelST write SetModelST;
property modelObject : TFhirString read FModel write SetModel;
{@member version
The version of the device, if the device has multiple releases under the same model, or if the device is software or carries firmware.
}
{@member version
Typed access to The version of the device, if the device has multiple releases under the same model, or if the device is software or carries firmware.
}
property version : String read GetVersionST write SetVersionST;
property versionObject : TFhirString read FVersion write SetVersion;
{@member expiry
Date of expiry of this device (if applicable).
}
{@member expiry
Typed access to Date of expiry of this device (if applicable).
}
property expiry : TDateTimeEx read GetExpiryST write SetExpiryST;
property expiryObject : TFhirDate read FExpiry write SetExpiry;
{@member udi
FDA Mandated Unique Device Identifier. Use the human readable information (the content that the user sees, which is sometimes different to the exact syntax represented in the barcode) - see http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.
}
{@member udi
Typed access to FDA Mandated Unique Device Identifier. Use the human readable information (the content that the user sees, which is sometimes different to the exact syntax represented in the barcode) - see http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.
}
property udi : String read GetUdiST write SetUdiST;
property udiObject : TFhirString read FUdi write SetUdi;
{@member lotNumber
Lot number assigned by the manufacturer.
}
{@member lotNumber
Typed access to Lot number assigned by the manufacturer.
}
property lotNumber : String read GetLotNumberST write SetLotNumberST;
property lotNumberObject : TFhirString read FLotNumber write SetLotNumber;
{@member owner
An organization that is responsible for the provision and ongoing maintenance of the device.
}
property owner : TFhirResourceReference{TFhirOrganization} read FOwner write SetOwner;
property ownerObject : TFhirResourceReference{TFhirOrganization} read FOwner write SetOwner;
{@member location
The resource may be found in a literal location (i.e. GPS coordinates), a logical place (i.e. "in/with the patient"), or a coded location.
}
property location : TFhirResourceReference{TFhirLocation} read FLocation write SetLocation;
property locationObject : TFhirResourceReference{TFhirLocation} read FLocation write SetLocation;
{@member patient
Patient information, if the resource is affixed to a person.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member contactList
Contact details for an organization or a particular human that is responsible for the device.
}
property contactList : TFhirContactList read FContactList;
{@member url
A network address on which the device may be contacted directly.
}
{@member url
Typed access to A network address on which the device may be contacted directly.
}
property url : String read GetUrlST write SetUrlST;
property urlObject : TFhirUri read FUrl write SetUrl;
end;
{@Class TFhirDeviceObservationReport : TFhirResource
Describes the data produced by a device at a point in time.
}
{!.Net HL7Connect.Fhir.DeviceObservationReport}
TFhirDeviceObservationReport = class (TFhirResource)
private
FInstant : TFhirInstant;
FIdentifier : TFhirIdentifier;
FSource : TFhirResourceReference{TFhirDevice};
FSubject : TFhirResourceReference{Resource};
FvirtualDeviceList : TFhirDeviceObservationReportVirtualDeviceList;
Procedure SetInstant(value : TFhirInstant);
Function GetInstantST : TDateTimeEx;
Procedure SetInstantST(value : TDateTimeEx);
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetSource(value : TFhirResourceReference{TFhirDevice});
Procedure SetSubject(value : TFhirResourceReference{Resource});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirDeviceObservationReport; overload;
function Clone : TFhirDeviceObservationReport; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member instant
The point in time that the values are reported.
}
{@member instant
Typed access to The point in time that the values are reported.
}
property instant : TDateTimeEx read GetInstantST write SetInstantST;
property instantObject : TFhirInstant read FInstant write SetInstant;
{@member identifier
An identifier assigned to this observation bu the source device that made the observation.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member source
Identification information for the device that is the source of the data.
}
property source : TFhirResourceReference{TFhirDevice} read FSource write SetSource;
property sourceObject : TFhirResourceReference{TFhirDevice} read FSource write SetSource;
{@member subject
The subject of the measurement.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member virtualDeviceList
A medical-related subsystem of a medical device.
}
property virtualDeviceList : TFhirDeviceObservationReportVirtualDeviceList read FVirtualDeviceList;
end;
{@Class TFhirDiagnosticOrder : TFhirResource
A request for a diagnostic investigation service to be performed.
}
{!.Net HL7Connect.Fhir.DiagnosticOrder}
TFhirDiagnosticOrder = class (TFhirResource)
private
FSubject : TFhirResourceReference{Resource};
FOrderer : TFhirResourceReference{TFhirPractitioner};
FidentifierList : TFhirIdentifierList;
FEncounter : TFhirResourceReference{TFhirEncounter};
FClinicalNotes : TFhirString;
FspecimenList : TFhirResourceReferenceList{TFhirSpecimen};
FStatus : TFhirEnum;
FPriority : TFhirEnum;
FeventList : TFhirDiagnosticOrderEventList;
FitemList : TFhirDiagnosticOrderItemList;
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetOrderer(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetEncounter(value : TFhirResourceReference{TFhirEncounter});
Procedure SetClinicalNotes(value : TFhirString);
Function GetClinicalNotesST : String;
Procedure SetClinicalNotesST(value : String);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirDiagnosticOrderStatus;
Procedure SetStatusST(value : TFhirDiagnosticOrderStatus);
Procedure SetPriority(value : TFhirEnum);
Function GetPriorityST : TFhirDiagnosticOrderPriority;
Procedure SetPriorityST(value : TFhirDiagnosticOrderPriority);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirDiagnosticOrder; overload;
function Clone : TFhirDiagnosticOrder; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member subject
Who or what the investigation is to be performed on. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member orderer
The practitioner that holds legal responsibility for ordering the investigation.
}
property orderer : TFhirResourceReference{TFhirPractitioner} read FOrderer write SetOrderer;
property ordererObject : TFhirResourceReference{TFhirPractitioner} read FOrderer write SetOrderer;
{@member identifierList
Identifiers assigned to this order by the order or by the receiver.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member encounter
An encounter that provides additional informaton about the healthcare context in which this request is made.
}
property encounter : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
property encounterObject : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
{@member clinicalNotes
An explanation or justification for why this diagnostic investigation is being requested.
}
{@member clinicalNotes
Typed access to An explanation or justification for why this diagnostic investigation is being requested.
}
property clinicalNotes : String read GetClinicalNotesST write SetClinicalNotesST;
property clinicalNotesObject : TFhirString read FClinicalNotes write SetClinicalNotes;
{@member specimenList
One or more specimens that the diagnostic investigation is about.
}
property specimenList : TFhirResourceReferenceList{TFhirSpecimen} read FSpecimenList;
{@member status
The status of the order.
}
property status : TFhirDiagnosticOrderStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member priority
The clinical priority associated with this order.
}
property priority : TFhirDiagnosticOrderPriority read GetPriorityST write SetPriorityST;
property priorityObject : TFhirEnum read FPriority write SetPriority;
{@member eventList
A summary of the events of interest that have occurred as the request is processed. E.g. when the order was made, various processing steps (specimens received), when it was completed.
}
property eventList : TFhirDiagnosticOrderEventList read FEventList;
{@member itemList
The specific diagnostic investigations that are requested as part of this request. Sometimes, there can only be one item per request, but in most contexts, more than one investigation can be requested.
}
property itemList : TFhirDiagnosticOrderItemList read FItemList;
end;
{@Class TFhirDiagnosticReport : TFhirResource
The findings and interpretation of diagnostic tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretation, and formatted representation of diagnostic reports.
}
{!.Net HL7Connect.Fhir.DiagnosticReport}
TFhirDiagnosticReport = class (TFhirResource)
private
FName : TFhirCodeableConcept;
FStatus : TFhirEnum;
FIssued : TFhirDateTime;
FSubject : TFhirResourceReference{Resource};
FPerformer : TFhirResourceReference{Resource};
FIdentifier : TFhirIdentifier;
FrequestDetailList : TFhirResourceReferenceList{TFhirDiagnosticOrder};
FServiceCategory : TFhirCodeableConcept;
FDiagnostic : TFhirType;
FspecimenList : TFhirResourceReferenceList{TFhirSpecimen};
FresultList : TFhirResourceReferenceList{TFhirObservation};
FimagingStudyList : TFhirResourceReferenceList{TFhirImagingStudy};
FimageList : TFhirDiagnosticReportImageList;
FConclusion : TFhirString;
FcodedDiagnosisList : TFhirCodeableConceptList;
FpresentedFormList : TFhirAttachmentList;
Procedure SetName(value : TFhirCodeableConcept);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirDiagnosticReportStatus;
Procedure SetStatusST(value : TFhirDiagnosticReportStatus);
Procedure SetIssued(value : TFhirDateTime);
Function GetIssuedST : TDateTimeEx;
Procedure SetIssuedST(value : TDateTimeEx);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetPerformer(value : TFhirResourceReference{Resource});
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetServiceCategory(value : TFhirCodeableConcept);
Procedure SetDiagnostic(value : TFhirType);
Procedure SetConclusion(value : TFhirString);
Function GetConclusionST : String;
Procedure SetConclusionST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirDiagnosticReport; overload;
function Clone : TFhirDiagnosticReport; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member name
A code or name that describes this diagnostic report.
}
property name : TFhirCodeableConcept read FName write SetName;
property nameObject : TFhirCodeableConcept read FName write SetName;
{@member status
The status of the diagnostic report as a whole.
}
property status : TFhirDiagnosticReportStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member issued
The date and/or time that this version of the report was released from the source diagnostic service.
}
{@member issued
Typed access to The date and/or time that this version of the report was released from the source diagnostic service.
}
property issued : TDateTimeEx read GetIssuedST write SetIssuedST;
property issuedObject : TFhirDateTime read FIssued write SetIssued;
{@member subject
The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member performer
The diagnostic service that is responsible for issuing the report.
}
property performer : TFhirResourceReference{Resource} read FPerformer write SetPerformer;
property performerObject : TFhirResourceReference{Resource} read FPerformer write SetPerformer;
{@member identifier
The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member requestDetailList
Details concerning a test requested.
}
property requestDetailList : TFhirResourceReferenceList{TFhirDiagnosticOrder} read FRequestDetailList;
{@member serviceCategory
The section of the diagnostic service that performs the examination e.g. biochemistry, hematology, MRI.
}
property serviceCategory : TFhirCodeableConcept read FServiceCategory write SetServiceCategory;
property serviceCategoryObject : TFhirCodeableConcept read FServiceCategory write SetServiceCategory;
{@member diagnostic
The time or time-period the observed values are related to. This is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.
}
property diagnostic : TFhirType read FDiagnostic write SetDiagnostic;
property diagnosticObject : TFhirType read FDiagnostic write SetDiagnostic;
{@member specimenList
Details about the specimens on which this Disagnostic report is based.
}
property specimenList : TFhirResourceReferenceList{TFhirSpecimen} read FSpecimenList;
{@member resultList
Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").
}
property resultList : TFhirResourceReferenceList{TFhirObservation} read FResultList;
{@member imagingStudyList
One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.
}
property imagingStudyList : TFhirResourceReferenceList{TFhirImagingStudy} read FImagingStudyList;
{@member imageList
A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).
}
property imageList : TFhirDiagnosticReportImageList read FImageList;
{@member conclusion
Concise and clinically contextualized narrative interpretation of the diagnostic report.
}
{@member conclusion
Typed access to Concise and clinically contextualized narrative interpretation of the diagnostic report.
}
property conclusion : String read GetConclusionST write SetConclusionST;
property conclusionObject : TFhirString read FConclusion write SetConclusion;
{@member codedDiagnosisList
Codes for the conclusion.
}
property codedDiagnosisList : TFhirCodeableConceptList read FCodedDiagnosisList;
{@member presentedFormList
Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.
}
property presentedFormList : TFhirAttachmentList read FPresentedFormList;
end;
{@Class TFhirDocumentManifest : TFhirResource
A manifest that defines a set of documents.
}
{!.Net HL7Connect.Fhir.DocumentManifest}
TFhirDocumentManifest = class (TFhirResource)
private
FMasterIdentifier : TFhirIdentifier;
FidentifierList : TFhirIdentifierList;
FsubjectList : TFhirResourceReferenceList{Resource};
FrecipientList : TFhirResourceReferenceList{Resource};
FType_ : TFhirCodeableConcept;
FauthorList : TFhirResourceReferenceList{Resource};
FCreated : TFhirDateTime;
FSource : TFhirUri;
FStatus : TFhirEnum;
FSupercedes : TFhirResourceReference{TFhirDocumentManifest};
FDescription : TFhirString;
FConfidentiality : TFhirCodeableConcept;
FcontentList : TFhirResourceReferenceList{Resource};
Procedure SetMasterIdentifier(value : TFhirIdentifier);
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetCreated(value : TFhirDateTime);
Function GetCreatedST : TDateTimeEx;
Procedure SetCreatedST(value : TDateTimeEx);
Procedure SetSource(value : TFhirUri);
Function GetSourceST : String;
Procedure SetSourceST(value : String);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirDocumentReferenceStatus;
Procedure SetStatusST(value : TFhirDocumentReferenceStatus);
Procedure SetSupercedes(value : TFhirResourceReference{TFhirDocumentManifest});
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetConfidentiality(value : TFhirCodeableConcept);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirDocumentManifest; overload;
function Clone : TFhirDocumentManifest; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member masterIdentifier
A single identifier that uniquely identifies this manifest. Principally used to refer to the manifest in non-FHIR contexts.
}
property masterIdentifier : TFhirIdentifier read FMasterIdentifier write SetMasterIdentifier;
property masterIdentifierObject : TFhirIdentifier read FMasterIdentifier write SetMasterIdentifier;
{@member identifierList
Other identifiers associated with the document, including version independent, source record and workflow related identifiers.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member subjectList
Who or what the set of documents is about. The documents can be about a person, (patient or healthcare practitioner), a device (i.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure). If the documents cross more than one subject, then more than one subject is allowed here (unusual use case).
}
property subjectList : TFhirResourceReferenceList{Resource} read FSubjectList;
{@member recipientList
A patient, practitioner, or organization for which this set of documents is intended.
}
property recipientList : TFhirResourceReferenceList{Resource} read FRecipientList;
{@member type_
Specifies the kind of this set of documents (e.g. Patient Summary, Discharge Summary, Prescription, etc.). The type of a set of documents may be the same as one of the documents in it - especially if there is only one - but it may be wider.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member authorList
Identifies who is responsible for adding the information to the document.
}
property authorList : TFhirResourceReferenceList{Resource} read FAuthorList;
{@member created
When the document manifest was created for submission to the server (not necessarily the same thing as the actual resource last modified time, since it may be modified, replicated etc).
}
{@member created
Typed access to When the document manifest was created for submission to the server (not necessarily the same thing as the actual resource last modified time, since it may be modified, replicated etc).
}
property created : TDateTimeEx read GetCreatedST write SetCreatedST;
property createdObject : TFhirDateTime read FCreated write SetCreated;
{@member source
Identifies the source system, application, or software that produced the document manifest.
}
{@member source
Typed access to Identifies the source system, application, or software that produced the document manifest.
}
property source : String read GetSourceST write SetSourceST;
property sourceObject : TFhirUri read FSource write SetSource;
{@member status
The status of this document manifest.
}
property status : TFhirDocumentReferenceStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member supercedes
Whether this document manifest replaces another.
}
property supercedes : TFhirResourceReference{TFhirDocumentManifest} read FSupercedes write SetSupercedes;
property supercedesObject : TFhirResourceReference{TFhirDocumentManifest} read FSupercedes write SetSupercedes;
{@member description
Human-readable description of the source document. This is sometimes known as the "title".
}
{@member description
Typed access to Human-readable description of the source document. This is sometimes known as the "title".
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member confidentiality
A code specifying the level of confidentiality of this set of Documents.
}
property confidentiality : TFhirCodeableConcept read FConfidentiality write SetConfidentiality;
property confidentialityObject : TFhirCodeableConcept read FConfidentiality write SetConfidentiality;
{@member contentList
The list of resources that describe the parts of this document reference. Usually, these would be document references, but direct references to binary attachments and images are also allowed.
}
property contentList : TFhirResourceReferenceList{Resource} read FContentList;
end;
{@Class TFhirDocumentReference : TFhirResource
A reference to a document.
}
{!.Net HL7Connect.Fhir.DocumentReference}
TFhirDocumentReference = class (TFhirResource)
private
FMasterIdentifier : TFhirIdentifier;
FidentifierList : TFhirIdentifierList;
FSubject : TFhirResourceReference{Resource};
FType_ : TFhirCodeableConcept;
FClass_ : TFhirCodeableConcept;
FauthorList : TFhirResourceReferenceList{Resource};
FCustodian : TFhirResourceReference{TFhirOrganization};
FPolicyManager : TFhirUri;
FAuthenticator : TFhirResourceReference{Resource};
FCreated : TFhirDateTime;
FIndexed : TFhirInstant;
FStatus : TFhirEnum;
FDocStatus : TFhirCodeableConcept;
FrelatesToList : TFhirDocumentReferenceRelatesToList;
FDescription : TFhirString;
FconfidentialityList : TFhirCodeableConceptList;
FPrimaryLanguage : TFhirCode;
FMimeType : TFhirCode;
FformatList : TFhirUriList;
FSize : TFhirInteger;
FHash : TFhirString;
FLocation : TFhirUri;
FService : TFhirDocumentReferenceService;
FContext : TFhirDocumentReferenceContext;
Procedure SetMasterIdentifier(value : TFhirIdentifier);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetClass_(value : TFhirCodeableConcept);
Procedure SetCustodian(value : TFhirResourceReference{TFhirOrganization});
Procedure SetPolicyManager(value : TFhirUri);
Function GetPolicyManagerST : String;
Procedure SetPolicyManagerST(value : String);
Procedure SetAuthenticator(value : TFhirResourceReference{Resource});
Procedure SetCreated(value : TFhirDateTime);
Function GetCreatedST : TDateTimeEx;
Procedure SetCreatedST(value : TDateTimeEx);
Procedure SetIndexed(value : TFhirInstant);
Function GetIndexedST : TDateTimeEx;
Procedure SetIndexedST(value : TDateTimeEx);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirDocumentReferenceStatus;
Procedure SetStatusST(value : TFhirDocumentReferenceStatus);
Procedure SetDocStatus(value : TFhirCodeableConcept);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetPrimaryLanguage(value : TFhirCode);
Function GetPrimaryLanguageST : String;
Procedure SetPrimaryLanguageST(value : String);
Procedure SetMimeType(value : TFhirCode);
Function GetMimeTypeST : String;
Procedure SetMimeTypeST(value : String);
Procedure SetSize(value : TFhirInteger);
Function GetSizeST : String;
Procedure SetSizeST(value : String);
Procedure SetHash(value : TFhirString);
Function GetHashST : String;
Procedure SetHashST(value : String);
Procedure SetLocation(value : TFhirUri);
Function GetLocationST : String;
Procedure SetLocationST(value : String);
Procedure SetService(value : TFhirDocumentReferenceService);
Procedure SetContext(value : TFhirDocumentReferenceContext);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirDocumentReference; overload;
function Clone : TFhirDocumentReference; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member masterIdentifier
Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.
}
property masterIdentifier : TFhirIdentifier read FMasterIdentifier write SetMasterIdentifier;
property masterIdentifierObject : TFhirIdentifier read FMasterIdentifier write SetMasterIdentifier;
{@member identifierList
Other identifiers associated with the document, including version independent, source record and workflow related identifiers.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member subject
Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (I.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member type_
Specifies the particular kind of document (e.g. Patient Summary, Discharge Summary, Prescription, etc.).
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member class_
A categorization for the type of the document. This may be implied by or derived from the code specified in the Document Type.
}
property class_ : TFhirCodeableConcept read FClass_ write SetClass_;
property class_Object : TFhirCodeableConcept read FClass_ write SetClass_;
{@member authorList
Identifies who is responsible for adding the information to the document.
}
property authorList : TFhirResourceReferenceList{Resource} read FAuthorList;
{@member custodian
Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.
}
property custodian : TFhirResourceReference{TFhirOrganization} read FCustodian write SetCustodian;
property custodianObject : TFhirResourceReference{TFhirOrganization} read FCustodian write SetCustodian;
{@member policyManager
A reference to a domain or server that manages policies under which the document is accessed and/or made available.
}
{@member policyManager
Typed access to A reference to a domain or server that manages policies under which the document is accessed and/or made available.
}
property policyManager : String read GetPolicyManagerST write SetPolicyManagerST;
property policyManagerObject : TFhirUri read FPolicyManager write SetPolicyManager;
{@member authenticator
Which person or organization authenticates that this document is valid.
}
property authenticator : TFhirResourceReference{Resource} read FAuthenticator write SetAuthenticator;
property authenticatorObject : TFhirResourceReference{Resource} read FAuthenticator write SetAuthenticator;
{@member created
When the document was created.
}
{@member created
Typed access to When the document was created.
}
property created : TDateTimeEx read GetCreatedST write SetCreatedST;
property createdObject : TFhirDateTime read FCreated write SetCreated;
{@member indexed
When the document reference was created.
}
{@member indexed
Typed access to When the document reference was created.
}
property indexed : TDateTimeEx read GetIndexedST write SetIndexedST;
property indexedObject : TFhirInstant read FIndexed write SetIndexed;
{@member status
The status of this document reference.
}
property status : TFhirDocumentReferenceStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member docStatus
The status of the underlying document.
}
property docStatus : TFhirCodeableConcept read FDocStatus write SetDocStatus;
property docStatusObject : TFhirCodeableConcept read FDocStatus write SetDocStatus;
{@member relatesToList
Relationships that this document has with other document references that already exist.
}
property relatesToList : TFhirDocumentReferenceRelatesToList read FRelatesToList;
{@member description
Human-readable description of the source document. This is sometimes known as the "title".
}
{@member description
Typed access to Human-readable description of the source document. This is sometimes known as the "title".
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member confidentialityList
A code specifying the level of confidentiality of the XDS Document.
}
property confidentialityList : TFhirCodeableConceptList read FConfidentialityList;
{@member primaryLanguage
The primary language in which the source document is written.
}
{@member primaryLanguage
Typed access to The primary language in which the source document is written.
}
property primaryLanguage : String read GetPrimaryLanguageST write SetPrimaryLanguageST;
property primaryLanguageObject : TFhirCode read FPrimaryLanguage write SetPrimaryLanguage;
{@member mimeType
The mime type of the source document.
}
{@member mimeType
Typed access to The mime type of the source document.
}
property mimeType : String read GetMimeTypeST write SetMimeTypeST;
property mimeTypeObject : TFhirCode read FMimeType write SetMimeType;
{@member formatList
An identifier that identifies that the format and content of the document conforms to additional rules beyond the base format indicated in the mimeType.
}
property formatList : TFhirUriList read FFormatList;
{@member size
The size of the source document this reference refers to in bytes.
}
{@member size
Typed access to The size of the source document this reference refers to in bytes.
}
property size : String read GetSizeST write SetSizeST;
property sizeObject : TFhirInteger read FSize write SetSize;
{@member hash
A hash of the source document to ensure that changes have not occurred.
}
{@member hash
Typed access to A hash of the source document to ensure that changes have not occurred.
}
property hash : String read GetHashST write SetHashST;
property hashObject : TFhirString read FHash write SetHash;
{@member location
A url at which the document can be accessed.
}
{@member location
Typed access to A url at which the document can be accessed.
}
property location : String read GetLocationST write SetLocationST;
property locationObject : TFhirUri read FLocation write SetLocation;
{@member service
A description of a service call that can be used to retrieve the document.
}
property service : TFhirDocumentReferenceService read FService write SetService;
property serviceObject : TFhirDocumentReferenceService read FService write SetService;
{@member context
The clinical context in which the document was prepared.
}
property context : TFhirDocumentReferenceContext read FContext write SetContext;
property contextObject : TFhirDocumentReferenceContext read FContext write SetContext;
end;
{@Class TFhirEncounter : TFhirResource
An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.
}
{!.Net HL7Connect.Fhir.Encounter}
TFhirEncounter = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FStatus : TFhirEnum;
FClass_ : TFhirEnum;
Ftype_List : TFhirCodeableConceptList;
FSubject : TFhirResourceReference{TFhirPatient};
FparticipantList : TFhirEncounterParticipantList;
FPeriod : TFhirPeriod;
FLength : TFhirQuantity;
FReason : TFhirCodeableConcept;
FIndication : TFhirResourceReference{Resource};
FPriority : TFhirCodeableConcept;
FHospitalization : TFhirEncounterHospitalization;
FlocationList : TFhirEncounterLocationList;
FServiceProvider : TFhirResourceReference{TFhirOrganization};
FPartOf : TFhirResourceReference{TFhirEncounter};
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirEncounterState;
Procedure SetStatusST(value : TFhirEncounterState);
Procedure SetClass_(value : TFhirEnum);
Function GetClass_ST : TFhirEncounterClass;
Procedure SetClass_ST(value : TFhirEncounterClass);
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetPeriod(value : TFhirPeriod);
Procedure SetLength(value : TFhirQuantity);
Procedure SetReason(value : TFhirCodeableConcept);
Procedure SetIndication(value : TFhirResourceReference{Resource});
Procedure SetPriority(value : TFhirCodeableConcept);
Procedure SetHospitalization(value : TFhirEncounterHospitalization);
Procedure SetServiceProvider(value : TFhirResourceReference{TFhirOrganization});
Procedure SetPartOf(value : TFhirResourceReference{TFhirEncounter});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirEncounter; overload;
function Clone : TFhirEncounter; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifier(s) by which this encounter is known.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member status
planned | in progress | onleave | finished | cancelled.
}
property status : TFhirEncounterState read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member class_
inpatient | outpatient | ambulatory | emergency +.
}
property class_ : TFhirEncounterClass read GetClass_ST write SetClass_ST;
property class_Object : TFhirEnum read FClass_ write SetClass_;
{@member type_List
Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).
}
property type_List : TFhirCodeableConceptList read FType_List;
{@member subject
The patient present at the encounter.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member participantList
The main practitioner responsible for providing the service.
}
property participantList : TFhirEncounterParticipantList read FParticipantList;
{@member period
The start and end time of the encounter.
}
property period : TFhirPeriod read FPeriod write SetPeriod;
property periodObject : TFhirPeriod read FPeriod write SetPeriod;
{@member length
Quantity of time the encounter lasted. This excludes the time during leaves of absence.
}
property length : TFhirQuantity read FLength write SetLength;
property lengthObject : TFhirQuantity read FLength write SetLength;
{@member reason
Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.
}
property reason : TFhirCodeableConcept read FReason write SetReason;
property reasonObject : TFhirCodeableConcept read FReason write SetReason;
{@member indication
Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis.
}
property indication : TFhirResourceReference{Resource} read FIndication write SetIndication;
property indicationObject : TFhirResourceReference{Resource} read FIndication write SetIndication;
{@member priority
Indicates the urgency of the encounter.
}
property priority : TFhirCodeableConcept read FPriority write SetPriority;
property priorityObject : TFhirCodeableConcept read FPriority write SetPriority;
{@member hospitalization
Details about an admission to a clinic.
}
property hospitalization : TFhirEncounterHospitalization read FHospitalization write SetHospitalization;
property hospitalizationObject : TFhirEncounterHospitalization read FHospitalization write SetHospitalization;
{@member locationList
List of locations at which the patient has been.
}
property locationList : TFhirEncounterLocationList read FLocationList;
{@member serviceProvider
Department or team providing care.
}
property serviceProvider : TFhirResourceReference{TFhirOrganization} read FServiceProvider write SetServiceProvider;
property serviceProviderObject : TFhirResourceReference{TFhirOrganization} read FServiceProvider write SetServiceProvider;
{@member partOf
Another Encounter of which this encounter is a part of (administratively or in time).
}
property partOf : TFhirResourceReference{TFhirEncounter} read FPartOf write SetPartOf;
property partOfObject : TFhirResourceReference{TFhirEncounter} read FPartOf write SetPartOf;
end;
{@Class TFhirFamilyHistory : TFhirResource
Significant health events and conditions for people related to the subject relevant in the context of care for the subject.
}
{!.Net HL7Connect.Fhir.FamilyHistory}
TFhirFamilyHistory = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FSubject : TFhirResourceReference{TFhirPatient};
FNote : TFhirString;
FrelationList : TFhirFamilyHistoryRelationList;
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetNote(value : TFhirString);
Function GetNoteST : String;
Procedure SetNoteST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirFamilyHistory; overload;
function Clone : TFhirFamilyHistory; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
This records identifiers associated with this family history record that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member subject
The person who this history concerns.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member note
Conveys information about family history not specific to individual relations.
}
{@member note
Typed access to Conveys information about family history not specific to individual relations.
}
property note : String read GetNoteST write SetNoteST;
property noteObject : TFhirString read FNote write SetNote;
{@member relationList
The related person. Each FamilyHistory resource contains the entire family history for a single person.
}
property relationList : TFhirFamilyHistoryRelationList read FRelationList;
end;
{@Class TFhirGroup : TFhirResource
Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized. I.e. A collection of entities that isn't an Organization.
}
{!.Net HL7Connect.Fhir.Group}
TFhirGroup = class (TFhirResource)
private
FIdentifier : TFhirIdentifier;
FType_ : TFhirEnum;
FActual : TFhirBoolean;
FCode : TFhirCodeableConcept;
FName : TFhirString;
FQuantity : TFhirInteger;
FcharacteristicList : TFhirGroupCharacteristicList;
FmemberList : TFhirResourceReferenceList{Resource};
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetType_(value : TFhirEnum);
Function GetType_ST : TFhirGroupType;
Procedure SetType_ST(value : TFhirGroupType);
Procedure SetActual(value : TFhirBoolean);
Function GetActualST : Boolean;
Procedure SetActualST(value : Boolean);
Procedure SetCode(value : TFhirCodeableConcept);
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetQuantity(value : TFhirInteger);
Function GetQuantityST : String;
Procedure SetQuantityST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirGroup; overload;
function Clone : TFhirGroup; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
A unique business identifier for this group.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member type_
Identifies the broad classification of the kind of resources the group includes.
}
property type_ : TFhirGroupType read GetType_ST write SetType_ST;
property type_Object : TFhirEnum read FType_ write SetType_;
{@member actual
If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals.
}
{@member actual
Typed access to If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals.
}
property actual : Boolean read GetActualST write SetActualST;
property actualObject : TFhirBoolean read FActual write SetActual;
{@member code
Provides a specific type of resource the group includes. E.g. "cow", "syringe", etc.
}
property code : TFhirCodeableConcept read FCode write SetCode;
property codeObject : TFhirCodeableConcept read FCode write SetCode;
{@member name
A label assigned to the group for human identification and communication.
}
{@member name
Typed access to A label assigned to the group for human identification and communication.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member quantity
A count of the number of resource instances that are part of the group.
}
{@member quantity
Typed access to A count of the number of resource instances that are part of the group.
}
property quantity : String read GetQuantityST write SetQuantityST;
property quantityObject : TFhirInteger read FQuantity write SetQuantity;
{@member characteristicList
Identifies the traits shared by members of the group.
}
property characteristicList : TFhirGroupCharacteristicList read FCharacteristicList;
{@member memberList
Identifies the resource instances that are members of the group.
}
property memberList : TFhirResourceReferenceList{Resource} read FMemberList;
end;
{@Class TFhirImagingStudy : TFhirResource
Manifest of a set of images produced in study. The set of images may include every image in the study, or it may be an incomplete sample, such as a list of key images.
}
{!.Net HL7Connect.Fhir.ImagingStudy}
TFhirImagingStudy = class (TFhirResource)
private
FDateTime : TFhirDateTime;
FSubject : TFhirResourceReference{TFhirPatient};
FUid : TFhirOid;
FAccessionNo : TFhirIdentifier;
FidentifierList : TFhirIdentifierList;
ForderList : TFhirResourceReferenceList{TFhirDiagnosticOrder};
FModality : TFhirEnumList;
FReferrer : TFhirResourceReference{TFhirPractitioner};
FAvailability : TFhirEnum;
FUrl : TFhirUri;
FNumberOfSeries : TFhirInteger;
FNumberOfInstances : TFhirInteger;
FClinicalInformation : TFhirString;
Fprocedure_List : TFhirCodingList;
FInterpreter : TFhirResourceReference{TFhirPractitioner};
FDescription : TFhirString;
FseriesList : TFhirImagingStudySeriesList;
Procedure SetDateTime(value : TFhirDateTime);
Function GetDateTimeST : TDateTimeEx;
Procedure SetDateTimeST(value : TDateTimeEx);
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetUid(value : TFhirOid);
Function GetUidST : String;
Procedure SetUidST(value : String);
Procedure SetAccessionNo(value : TFhirIdentifier);
Procedure SetReferrer(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetAvailability(value : TFhirEnum);
Function GetAvailabilityST : TFhirInstanceAvailability;
Procedure SetAvailabilityST(value : TFhirInstanceAvailability);
Procedure SetUrl(value : TFhirUri);
Function GetUrlST : String;
Procedure SetUrlST(value : String);
Procedure SetNumberOfSeries(value : TFhirInteger);
Function GetNumberOfSeriesST : String;
Procedure SetNumberOfSeriesST(value : String);
Procedure SetNumberOfInstances(value : TFhirInteger);
Function GetNumberOfInstancesST : String;
Procedure SetNumberOfInstancesST(value : String);
Procedure SetClinicalInformation(value : TFhirString);
Function GetClinicalInformationST : String;
Procedure SetClinicalInformationST(value : String);
Procedure SetInterpreter(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirImagingStudy; overload;
function Clone : TFhirImagingStudy; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member dateTime
Date and Time the study took place.
}
{@member dateTime
Typed access to Date and Time the study took place.
}
property dateTime : TDateTimeEx read GetDateTimeST write SetDateTimeST;
property dateTimeObject : TFhirDateTime read FDateTime write SetDateTime;
{@member subject
Who the images are of.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member uid
Formal identifier for the study.
}
{@member uid
Typed access to Formal identifier for the study.
}
property uid : String read GetUidST write SetUidST;
property uidObject : TFhirOid read FUid write SetUid;
{@member accessionNo
Accession Number.
}
property accessionNo : TFhirIdentifier read FAccessionNo write SetAccessionNo;
property accessionNoObject : TFhirIdentifier read FAccessionNo write SetAccessionNo;
{@member identifierList
Other identifiers for the study.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member orderList
A list of the diagnostic orders that resulted in this imaging study being performed.
}
property orderList : TFhirResourceReferenceList{TFhirDiagnosticOrder} read FOrderList;
property modality : TFhirEnumList read FModality;
{@member referrer
The requesting/referring physician.
}
property referrer : TFhirResourceReference{TFhirPractitioner} read FReferrer write SetReferrer;
property referrerObject : TFhirResourceReference{TFhirPractitioner} read FReferrer write SetReferrer;
{@member availability
Availability of study (online, offline or nearline).
}
property availability : TFhirInstanceAvailability read GetAvailabilityST write SetAvailabilityST;
property availabilityObject : TFhirEnum read FAvailability write SetAvailability;
{@member url
WADO-RS URI where Study is available.
}
{@member url
Typed access to WADO-RS URI where Study is available.
}
property url : String read GetUrlST write SetUrlST;
property urlObject : TFhirUri read FUrl write SetUrl;
{@member numberOfSeries
Number of Series in Study.
}
{@member numberOfSeries
Typed access to Number of Series in Study.
}
property numberOfSeries : String read GetNumberOfSeriesST write SetNumberOfSeriesST;
property numberOfSeriesObject : TFhirInteger read FNumberOfSeries write SetNumberOfSeries;
{@member numberOfInstances
Number of SOP Instances in Study.
}
{@member numberOfInstances
Typed access to Number of SOP Instances in Study.
}
property numberOfInstances : String read GetNumberOfInstancesST write SetNumberOfInstancesST;
property numberOfInstancesObject : TFhirInteger read FNumberOfInstances write SetNumberOfInstances;
{@member clinicalInformation
Diagnoses etc provided with request.
}
{@member clinicalInformation
Typed access to Diagnoses etc provided with request.
}
property clinicalInformation : String read GetClinicalInformationST write SetClinicalInformationST;
property clinicalInformationObject : TFhirString read FClinicalInformation write SetClinicalInformation;
{@member procedure_List
Type of procedure performed.
}
property procedure_List : TFhirCodingList read FProcedure_List;
{@member interpreter
Who read study and interpreted the images.
}
property interpreter : TFhirResourceReference{TFhirPractitioner} read FInterpreter write SetInterpreter;
property interpreterObject : TFhirResourceReference{TFhirPractitioner} read FInterpreter write SetInterpreter;
{@member description
Institution-generated description or classification of the Study (component) performed.
}
{@member description
Typed access to Institution-generated description or classification of the Study (component) performed.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member seriesList
Each study has one or more series of image instances.
}
property seriesList : TFhirImagingStudySeriesList read FSeriesList;
end;
{@Class TFhirImmunization : TFhirResource
Immunization event information.
}
{!.Net HL7Connect.Fhir.Immunization}
TFhirImmunization = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FDate : TFhirDateTime;
FVaccineType : TFhirCodeableConcept;
FSubject : TFhirResourceReference{TFhirPatient};
FRefusedIndicator : TFhirBoolean;
FReported : TFhirBoolean;
FPerformer : TFhirResourceReference{TFhirPractitioner};
FRequester : TFhirResourceReference{TFhirPractitioner};
FManufacturer : TFhirResourceReference{TFhirOrganization};
FLocation : TFhirResourceReference{TFhirLocation};
FLotNumber : TFhirString;
FExpirationDate : TFhirDate;
FSite : TFhirCodeableConcept;
FRoute : TFhirCodeableConcept;
FDoseQuantity : TFhirQuantity;
FExplanation : TFhirImmunizationExplanation;
FreactionList : TFhirImmunizationReactionList;
FvaccinationProtocolList : TFhirImmunizationVaccinationProtocolList;
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetVaccineType(value : TFhirCodeableConcept);
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetRefusedIndicator(value : TFhirBoolean);
Function GetRefusedIndicatorST : Boolean;
Procedure SetRefusedIndicatorST(value : Boolean);
Procedure SetReported(value : TFhirBoolean);
Function GetReportedST : Boolean;
Procedure SetReportedST(value : Boolean);
Procedure SetPerformer(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetRequester(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetManufacturer(value : TFhirResourceReference{TFhirOrganization});
Procedure SetLocation(value : TFhirResourceReference{TFhirLocation});
Procedure SetLotNumber(value : TFhirString);
Function GetLotNumberST : String;
Procedure SetLotNumberST(value : String);
Procedure SetExpirationDate(value : TFhirDate);
Function GetExpirationDateST : TDateTimeEx;
Procedure SetExpirationDateST(value : TDateTimeEx);
Procedure SetSite(value : TFhirCodeableConcept);
Procedure SetRoute(value : TFhirCodeableConcept);
Procedure SetDoseQuantity(value : TFhirQuantity);
Procedure SetExplanation(value : TFhirImmunizationExplanation);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirImmunization; overload;
function Clone : TFhirImmunization; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
A unique identifier assigned to this adverse reaction record.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member date
Date vaccine administered or was to be administered.
}
{@member date
Typed access to Date vaccine administered or was to be administered.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member vaccineType
Vaccine that was administered or was to be administered.
}
property vaccineType : TFhirCodeableConcept read FVaccineType write SetVaccineType;
property vaccineTypeObject : TFhirCodeableConcept read FVaccineType write SetVaccineType;
{@member subject
The patient to whom the vaccine was to be administered.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member refusedIndicator
Indicates if the vaccination was refused.
}
{@member refusedIndicator
Typed access to Indicates if the vaccination was refused.
}
property refusedIndicator : Boolean read GetRefusedIndicatorST write SetRefusedIndicatorST;
property refusedIndicatorObject : TFhirBoolean read FRefusedIndicator write SetRefusedIndicator;
{@member reported
True if this administration was reported rather than directly administered.
}
{@member reported
Typed access to True if this administration was reported rather than directly administered.
}
property reported : Boolean read GetReportedST write SetReportedST;
property reportedObject : TFhirBoolean read FReported write SetReported;
{@member performer
Clinician who administered the vaccine.
}
property performer : TFhirResourceReference{TFhirPractitioner} read FPerformer write SetPerformer;
property performerObject : TFhirResourceReference{TFhirPractitioner} read FPerformer write SetPerformer;
{@member requester
Clinician who ordered the vaccination.
}
property requester : TFhirResourceReference{TFhirPractitioner} read FRequester write SetRequester;
property requesterObject : TFhirResourceReference{TFhirPractitioner} read FRequester write SetRequester;
{@member manufacturer
Name of vaccine manufacturer.
}
property manufacturer : TFhirResourceReference{TFhirOrganization} read FManufacturer write SetManufacturer;
property manufacturerObject : TFhirResourceReference{TFhirOrganization} read FManufacturer write SetManufacturer;
{@member location
The service delivery location where the vaccine administration occurred.
}
property location : TFhirResourceReference{TFhirLocation} read FLocation write SetLocation;
property locationObject : TFhirResourceReference{TFhirLocation} read FLocation write SetLocation;
{@member lotNumber
Lot number of the vaccine product.
}
{@member lotNumber
Typed access to Lot number of the vaccine product.
}
property lotNumber : String read GetLotNumberST write SetLotNumberST;
property lotNumberObject : TFhirString read FLotNumber write SetLotNumber;
{@member expirationDate
Date vaccine batch expires.
}
{@member expirationDate
Typed access to Date vaccine batch expires.
}
property expirationDate : TDateTimeEx read GetExpirationDateST write SetExpirationDateST;
property expirationDateObject : TFhirDate read FExpirationDate write SetExpirationDate;
{@member site
Body site where vaccine was administered.
}
property site : TFhirCodeableConcept read FSite write SetSite;
property siteObject : TFhirCodeableConcept read FSite write SetSite;
{@member route
The path by which the vaccine product is taken into the body.
}
property route : TFhirCodeableConcept read FRoute write SetRoute;
property routeObject : TFhirCodeableConcept read FRoute write SetRoute;
{@member doseQuantity
The quantity of vaccine product that was administered.
}
property doseQuantity : TFhirQuantity read FDoseQuantity write SetDoseQuantity;
property doseQuantityObject : TFhirQuantity read FDoseQuantity write SetDoseQuantity;
{@member explanation
Reasons why a vaccine was administered or refused.
}
property explanation : TFhirImmunizationExplanation read FExplanation write SetExplanation;
property explanationObject : TFhirImmunizationExplanation read FExplanation write SetExplanation;
{@member reactionList
Categorical data indicating that an adverse event is associated in time to an immunization.
}
property reactionList : TFhirImmunizationReactionList read FReactionList;
{@member vaccinationProtocolList
Contains information about the protocol(s) under which the vaccine was administered.
}
property vaccinationProtocolList : TFhirImmunizationVaccinationProtocolList read FVaccinationProtocolList;
end;
{@Class TFhirImmunizationRecommendation : TFhirResource
A patient's point-of-time immunization status and recommendation with optional supporting justification.
}
{!.Net HL7Connect.Fhir.ImmunizationRecommendation}
TFhirImmunizationRecommendation = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FSubject : TFhirResourceReference{TFhirPatient};
FrecommendationList : TFhirImmunizationRecommendationRecommendationList;
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirImmunizationRecommendation; overload;
function Clone : TFhirImmunizationRecommendation; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
A unique identifier assigned to this particular recommendation record.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member subject
The patient who is the subject of the profile.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member recommendationList
Vaccine administration recommendations.
}
property recommendationList : TFhirImmunizationRecommendationRecommendationList read FRecommendationList;
end;
{@Class TFhirList : TFhirResource
A set of information summarized from a list of other resources.
}
{!.Net HL7Connect.Fhir.List}
TFhirList = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FCode : TFhirCodeableConcept;
FSubject : TFhirResourceReference{Resource};
FSource : TFhirResourceReference{Resource};
FDate : TFhirDateTime;
FOrdered : TFhirBoolean;
FMode : TFhirEnum;
FentryList : TFhirListEntryList;
FEmptyReason : TFhirCodeableConcept;
Procedure SetCode(value : TFhirCodeableConcept);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetSource(value : TFhirResourceReference{Resource});
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetOrdered(value : TFhirBoolean);
Function GetOrderedST : Boolean;
Procedure SetOrderedST(value : Boolean);
Procedure SetMode(value : TFhirEnum);
Function GetModeST : TFhirListMode;
Procedure SetModeST(value : TFhirListMode);
Procedure SetEmptyReason(value : TFhirCodeableConcept);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirList; overload;
function Clone : TFhirList; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifier for the List assigned for business purposes outside the context of FHIR.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member code
This code defines the purpose of the list - why it was created.
}
property code : TFhirCodeableConcept read FCode write SetCode;
property codeObject : TFhirCodeableConcept read FCode write SetCode;
{@member subject
The common subject (or patient) of the resources that are in the list, if there is one.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member source
The entity responsible for deciding what the contents of the list were.
}
property source : TFhirResourceReference{Resource} read FSource write SetSource;
property sourceObject : TFhirResourceReference{Resource} read FSource write SetSource;
{@member date
The date that the list was prepared.
}
{@member date
Typed access to The date that the list was prepared.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member ordered
Whether items in the list have a meaningful order.
}
{@member ordered
Typed access to Whether items in the list have a meaningful order.
}
property ordered : Boolean read GetOrderedST write SetOrderedST;
property orderedObject : TFhirBoolean read FOrdered write SetOrdered;
{@member mode
How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
}
property mode : TFhirListMode read GetModeST write SetModeST;
property modeObject : TFhirEnum read FMode write SetMode;
{@member entryList
Entries in this list.
}
property entryList : TFhirListEntryList read FEntryList;
{@member emptyReason
If the list is empty, why the list is empty.
}
property emptyReason : TFhirCodeableConcept read FEmptyReason write SetEmptyReason;
property emptyReasonObject : TFhirCodeableConcept read FEmptyReason write SetEmptyReason;
end;
{@Class TFhirLocation : TFhirResource
Details and position information for a physical place where services are provided and resources and participants may be stored, found, contained or accommodated.
}
{!.Net HL7Connect.Fhir.Location}
TFhirLocation = class (TFhirResource)
private
FIdentifier : TFhirIdentifier;
FName : TFhirString;
FDescription : TFhirString;
FType_ : TFhirCodeableConcept;
FtelecomList : TFhirContactList;
FAddress : TFhirAddress;
FPhysicalType : TFhirCodeableConcept;
FPosition : TFhirLocationPosition;
FManagingOrganization : TFhirResourceReference{TFhirOrganization};
FStatus : TFhirEnum;
FPartOf : TFhirResourceReference{TFhirLocation};
FMode : TFhirEnum;
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetAddress(value : TFhirAddress);
Procedure SetPhysicalType(value : TFhirCodeableConcept);
Procedure SetPosition(value : TFhirLocationPosition);
Procedure SetManagingOrganization(value : TFhirResourceReference{TFhirOrganization});
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirLocationStatus;
Procedure SetStatusST(value : TFhirLocationStatus);
Procedure SetPartOf(value : TFhirResourceReference{TFhirLocation});
Procedure SetMode(value : TFhirEnum);
Function GetModeST : TFhirLocationMode;
Procedure SetModeST(value : TFhirLocationMode);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirLocation; overload;
function Clone : TFhirLocation; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
Unique code or number identifying the location to its users.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member name
Name of the location as used by humans. Does not need to be unique.
}
{@member name
Typed access to Name of the location as used by humans. Does not need to be unique.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member description
Description of the Location, which helps in finding or referencing the place.
}
{@member description
Typed access to Description of the Location, which helps in finding or referencing the place.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member type_
Indicates the type of function performed at the location.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member telecomList
The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.
}
property telecomList : TFhirContactList read FTelecomList;
{@member address
Physical location.
}
property address : TFhirAddress read FAddress write SetAddress;
property addressObject : TFhirAddress read FAddress write SetAddress;
{@member physicalType
Physical form of the location, e.g. building, room, vehicle, road.
}
property physicalType : TFhirCodeableConcept read FPhysicalType write SetPhysicalType;
property physicalTypeObject : TFhirCodeableConcept read FPhysicalType write SetPhysicalType;
{@member position
The absolute geographic location of the Location, expressed in a KML compatible manner (see notes below for KML).
}
property position : TFhirLocationPosition read FPosition write SetPosition;
property positionObject : TFhirLocationPosition read FPosition write SetPosition;
{@member managingOrganization
The organization that is responsible for the provisioning and upkeep of the location.
}
property managingOrganization : TFhirResourceReference{TFhirOrganization} read FManagingOrganization write SetManagingOrganization;
property managingOrganizationObject : TFhirResourceReference{TFhirOrganization} read FManagingOrganization write SetManagingOrganization;
{@member status
active | suspended | inactive.
}
property status : TFhirLocationStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member partOf
Another Location which this Location is physically part of.
}
property partOf : TFhirResourceReference{TFhirLocation} read FPartOf write SetPartOf;
property partOfObject : TFhirResourceReference{TFhirLocation} read FPartOf write SetPartOf;
{@member mode
Indicates whether a resource instance represents a specific location or a class of locations.
}
property mode : TFhirLocationMode read GetModeST write SetModeST;
property modeObject : TFhirEnum read FMode write SetMode;
end;
{@Class TFhirMedia : TFhirResource
A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.
}
{!.Net HL7Connect.Fhir.Media}
TFhirMedia = class (TFhirResource)
private
FType_ : TFhirEnum;
FSubtype : TFhirCodeableConcept;
FidentifierList : TFhirIdentifierList;
FDateTime : TFhirDateTime;
FSubject : TFhirResourceReference{Resource};
FOperator : TFhirResourceReference{TFhirPractitioner};
FView : TFhirCodeableConcept;
FDeviceName : TFhirString;
FHeight : TFhirInteger;
FWidth : TFhirInteger;
FFrames : TFhirInteger;
FLength : TFhirInteger;
FContent : TFhirAttachment;
Procedure SetType_(value : TFhirEnum);
Function GetType_ST : TFhirMediaType;
Procedure SetType_ST(value : TFhirMediaType);
Procedure SetSubtype(value : TFhirCodeableConcept);
Procedure SetDateTime(value : TFhirDateTime);
Function GetDateTimeST : TDateTimeEx;
Procedure SetDateTimeST(value : TDateTimeEx);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetOperator(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetView(value : TFhirCodeableConcept);
Procedure SetDeviceName(value : TFhirString);
Function GetDeviceNameST : String;
Procedure SetDeviceNameST(value : String);
Procedure SetHeight(value : TFhirInteger);
Function GetHeightST : String;
Procedure SetHeightST(value : String);
Procedure SetWidth(value : TFhirInteger);
Function GetWidthST : String;
Procedure SetWidthST(value : String);
Procedure SetFrames(value : TFhirInteger);
Function GetFramesST : String;
Procedure SetFramesST(value : String);
Procedure SetLength(value : TFhirInteger);
Function GetLengthST : String;
Procedure SetLengthST(value : String);
Procedure SetContent(value : TFhirAttachment);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirMedia; overload;
function Clone : TFhirMedia; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member type_
Whether the media is a photo (still image), an audio recording, or a video recording.
}
property type_ : TFhirMediaType read GetType_ST write SetType_ST;
property type_Object : TFhirEnum read FType_ write SetType_;
{@member subtype
Details of the type of the media - usually, how it was acquired (what type of device). If images sourced from a DICOM system, are wrapped in a Media resource, then this is the modality.
}
property subtype : TFhirCodeableConcept read FSubtype write SetSubtype;
property subtypeObject : TFhirCodeableConcept read FSubtype write SetSubtype;
{@member identifierList
Identifiers associated with the image - these may include identifiers for the image itself, identifiers for the context of its collection (e.g. series ids) and context ids such as accession numbers or other workflow identifiers.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member dateTime
When the media was originally recorded. For video and audio, if the length of the recording is not insignificant, this is the end of the recording.
}
{@member dateTime
Typed access to When the media was originally recorded. For video and audio, if the length of the recording is not insignificant, this is the end of the recording.
}
property dateTime : TDateTimeEx read GetDateTimeST write SetDateTimeST;
property dateTimeObject : TFhirDateTime read FDateTime write SetDateTime;
{@member subject
Who/What this Media is a record of.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member operator
The person who administered the collection of the image.
}
property operator : TFhirResourceReference{TFhirPractitioner} read FOperator write SetOperator;
property operatorObject : TFhirResourceReference{TFhirPractitioner} read FOperator write SetOperator;
{@member view
The name of the imaging view e.g Lateral or Antero-posterior (AP).
}
property view : TFhirCodeableConcept read FView write SetView;
property viewObject : TFhirCodeableConcept read FView write SetView;
{@member deviceName
The name of the device / manufacturer of the device that was used to make the recording.
}
{@member deviceName
Typed access to The name of the device / manufacturer of the device that was used to make the recording.
}
property deviceName : String read GetDeviceNameST write SetDeviceNameST;
property deviceNameObject : TFhirString read FDeviceName write SetDeviceName;
{@member height
Height of the image in pixels(photo/video).
}
{@member height
Typed access to Height of the image in pixels(photo/video).
}
property height : String read GetHeightST write SetHeightST;
property heightObject : TFhirInteger read FHeight write SetHeight;
{@member width
Width of the image in pixels (photo/video).
}
{@member width
Typed access to Width of the image in pixels (photo/video).
}
property width : String read GetWidthST write SetWidthST;
property widthObject : TFhirInteger read FWidth write SetWidth;
{@member frames
The number of frames in a photo. This is used with a multi-page fax, or an imaging acquisition context that takes multiple slices in a single image, or an animated gif. If there is more than one frame, this SHALL have a value in order to alert interface software that a multi-frame capable rendering widget is required.
}
{@member frames
Typed access to The number of frames in a photo. This is used with a multi-page fax, or an imaging acquisition context that takes multiple slices in a single image, or an animated gif. If there is more than one frame, this SHALL have a value in order to alert interface software that a multi-frame capable rendering widget is required.
}
property frames : String read GetFramesST write SetFramesST;
property framesObject : TFhirInteger read FFrames write SetFrames;
{@member length
The length of the recording in seconds - for audio and video.
}
{@member length
Typed access to The length of the recording in seconds - for audio and video.
}
property length : String read GetLengthST write SetLengthST;
property lengthObject : TFhirInteger read FLength write SetLength;
{@member content
The actual content of the media - inline or by direct reference to the media source file.
}
property content : TFhirAttachment read FContent write SetContent;
property contentObject : TFhirAttachment read FContent write SetContent;
end;
{@Class TFhirMedication : TFhirResource
Primarily used for identification and definition of Medication, but also covers ingredients and packaging.
}
{!.Net HL7Connect.Fhir.Medication}
TFhirMedication = class (TFhirResource)
private
FName : TFhirString;
FCode : TFhirCodeableConcept;
FIsBrand : TFhirBoolean;
FManufacturer : TFhirResourceReference{TFhirOrganization};
FKind : TFhirEnum;
FProduct : TFhirMedicationProduct;
FPackage : TFhirMedicationPackage;
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetCode(value : TFhirCodeableConcept);
Procedure SetIsBrand(value : TFhirBoolean);
Function GetIsBrandST : Boolean;
Procedure SetIsBrandST(value : Boolean);
Procedure SetManufacturer(value : TFhirResourceReference{TFhirOrganization});
Procedure SetKind(value : TFhirEnum);
Function GetKindST : TFhirMedicationKind;
Procedure SetKindST(value : TFhirMedicationKind);
Procedure SetProduct(value : TFhirMedicationProduct);
Procedure SetPackage(value : TFhirMedicationPackage);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirMedication; overload;
function Clone : TFhirMedication; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member name
The common/commercial name of the medication absent information such as strength, form, etc. E.g. Acetaminophen, Tylenol 3, etc. The fully coordinated name is communicated as the display of Medication.code.
}
{@member name
Typed access to The common/commercial name of the medication absent information such as strength, form, etc. E.g. Acetaminophen, Tylenol 3, etc. The fully coordinated name is communicated as the display of Medication.code.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member code
A code (or set of codes) that identify this medication. Usage note: This could be a standard drug code such as a drug regulator code, RxNorm code, SNOMED CT code, etc. It could also be a local formulary code, optionally with translations to the standard drug codes.
}
property code : TFhirCodeableConcept read FCode write SetCode;
property codeObject : TFhirCodeableConcept read FCode write SetCode;
{@member isBrand
Set to true if the item is attributable to a specific manufacturer (even if we don't know who that is).
}
{@member isBrand
Typed access to Set to true if the item is attributable to a specific manufacturer (even if we don't know who that is).
}
property isBrand : Boolean read GetIsBrandST write SetIsBrandST;
property isBrandObject : TFhirBoolean read FIsBrand write SetIsBrand;
{@member manufacturer
Describes the details of the manufacturer.
}
property manufacturer : TFhirResourceReference{TFhirOrganization} read FManufacturer write SetManufacturer;
property manufacturerObject : TFhirResourceReference{TFhirOrganization} read FManufacturer write SetManufacturer;
{@member kind
Medications are either a single administrable product or a package that contains one or more products.
}
property kind : TFhirMedicationKind read GetKindST write SetKindST;
property kindObject : TFhirEnum read FKind write SetKind;
{@member product
Information that only applies to products (not packages).
}
property product : TFhirMedicationProduct read FProduct write SetProduct;
property productObject : TFhirMedicationProduct read FProduct write SetProduct;
{@member package
Information that only applies to packages (not products).
}
property package : TFhirMedicationPackage read FPackage write SetPackage;
property packageObject : TFhirMedicationPackage read FPackage write SetPackage;
end;
{@Class TFhirMedicationAdministration : TFhirResource
Describes the event of a patient being given a dose of a medication. This may be as simple as swallowing a tablet or it may be a long running infusion.
Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.
}
{!.Net HL7Connect.Fhir.MedicationAdministration}
TFhirMedicationAdministration = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FStatus : TFhirEnum;
FPatient : TFhirResourceReference{TFhirPatient};
FPractitioner : TFhirResourceReference{TFhirPractitioner};
FEncounter : TFhirResourceReference{TFhirEncounter};
FPrescription : TFhirResourceReference{TFhirMedicationPrescription};
FWasNotGiven : TFhirBoolean;
FreasonNotGivenList : TFhirCodeableConceptList;
FWhenGiven : TFhirPeriod;
FMedication : TFhirResourceReference{TFhirMedication};
FdeviceList : TFhirResourceReferenceList{TFhirDevice};
FdosageList : TFhirMedicationAdministrationDosageList;
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirMedicationAdminStatus;
Procedure SetStatusST(value : TFhirMedicationAdminStatus);
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
Procedure SetPractitioner(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetEncounter(value : TFhirResourceReference{TFhirEncounter});
Procedure SetPrescription(value : TFhirResourceReference{TFhirMedicationPrescription});
Procedure SetWasNotGiven(value : TFhirBoolean);
Function GetWasNotGivenST : Boolean;
Procedure SetWasNotGivenST(value : Boolean);
Procedure SetWhenGiven(value : TFhirPeriod);
Procedure SetMedication(value : TFhirResourceReference{TFhirMedication});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirMedicationAdministration; overload;
function Clone : TFhirMedicationAdministration; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
External identifier - FHIR will generate its own internal IDs (probably URLs) which do not need to be explicitly managed by the resource. The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event. Particularly important if these records have to be updated.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member status
Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way.
}
property status : TFhirMedicationAdminStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member patient
The person or animal to whom the medication was given.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member practitioner
The individual who was responsible for giving the medication to the patient.
}
property practitioner : TFhirResourceReference{TFhirPractitioner} read FPractitioner write SetPractitioner;
property practitionerObject : TFhirResourceReference{TFhirPractitioner} read FPractitioner write SetPractitioner;
{@member encounter
The visit or admission the or other contact between patient and health care provider the medication administration was performed as part of.
}
property encounter : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
property encounterObject : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
{@member prescription
The original request, instruction or authority to perform the administration.
}
property prescription : TFhirResourceReference{TFhirMedicationPrescription} read FPrescription write SetPrescription;
property prescriptionObject : TFhirResourceReference{TFhirMedicationPrescription} read FPrescription write SetPrescription;
{@member wasNotGiven
Set this to true if the record is saying that the medication was NOT administered.
}
{@member wasNotGiven
Typed access to Set this to true if the record is saying that the medication was NOT administered.
}
property wasNotGiven : Boolean read GetWasNotGivenST write SetWasNotGivenST;
property wasNotGivenObject : TFhirBoolean read FWasNotGiven write SetWasNotGiven;
{@member reasonNotGivenList
A code indicating why the administration was not performed.
}
property reasonNotGivenList : TFhirCodeableConceptList read FReasonNotGivenList;
{@member whenGiven
An interval of time during which the administration took place. For many administrations, such as swallowing a tablet the lower and upper values of the interval will be the same.
}
property whenGiven : TFhirPeriod read FWhenGiven write SetWhenGiven;
property whenGivenObject : TFhirPeriod read FWhenGiven write SetWhenGiven;
{@member medication
Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.
}
property medication : TFhirResourceReference{TFhirMedication} read FMedication write SetMedication;
property medicationObject : TFhirResourceReference{TFhirMedication} read FMedication write SetMedication;
{@member deviceList
The device used in administering the medication to the patient. E.g. a particular infusion pump.
}
property deviceList : TFhirResourceReferenceList{TFhirDevice} read FDeviceList;
{@member dosageList
Provides details of how much of the medication was administered.
}
property dosageList : TFhirMedicationAdministrationDosageList read FDosageList;
end;
{@Class TFhirMedicationDispense : TFhirResource
Dispensing a medication to a named patient. This includes a description of the supply provided and the instructions for administering the medication.
}
{!.Net HL7Connect.Fhir.MedicationDispense}
TFhirMedicationDispense = class (TFhirResource)
private
FIdentifier : TFhirIdentifier;
FStatus : TFhirEnum;
FPatient : TFhirResourceReference{TFhirPatient};
FDispenser : TFhirResourceReference{TFhirPractitioner};
FauthorizingPrescriptionList : TFhirResourceReferenceList{TFhirMedicationPrescription};
FdispenseList : TFhirMedicationDispenseDispenseList;
FSubstitution : TFhirMedicationDispenseSubstitution;
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirMedicationDispenseStatus;
Procedure SetStatusST(value : TFhirMedicationDispenseStatus);
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
Procedure SetDispenser(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetSubstitution(value : TFhirMedicationDispenseSubstitution);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirMedicationDispense; overload;
function Clone : TFhirMedicationDispense; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member status
A code specifying the state of the set of dispense events.
}
property status : TFhirMedicationDispenseStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member patient
A link to a resource representing the person to whom the medication will be given.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member dispenser
The individual responsible for dispensing the medication.
}
property dispenser : TFhirResourceReference{TFhirPractitioner} read FDispenser write SetDispenser;
property dispenserObject : TFhirResourceReference{TFhirPractitioner} read FDispenser write SetDispenser;
{@member authorizingPrescriptionList
Indicates the medication order that is being dispensed against.
}
property authorizingPrescriptionList : TFhirResourceReferenceList{TFhirMedicationPrescription} read FAuthorizingPrescriptionList;
{@member dispenseList
Indicates the details of the dispense event such as the days supply and quantity of medication dispensed.
}
property dispenseList : TFhirMedicationDispenseDispenseList read FDispenseList;
{@member substitution
Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected but doesn't happen, in other cases substitution is not expected but does happen. This block explains what substitition did or did not happen and why.
}
property substitution : TFhirMedicationDispenseSubstitution read FSubstitution write SetSubstitution;
property substitutionObject : TFhirMedicationDispenseSubstitution read FSubstitution write SetSubstitution;
end;
{@Class TFhirMedicationPrescription : TFhirResource
An order for both supply of the medication and the instructions for administration of the medicine to a patient.
}
{!.Net HL7Connect.Fhir.MedicationPrescription}
TFhirMedicationPrescription = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FDateWritten : TFhirDateTime;
FStatus : TFhirEnum;
FPatient : TFhirResourceReference{TFhirPatient};
FPrescriber : TFhirResourceReference{TFhirPractitioner};
FEncounter : TFhirResourceReference{TFhirEncounter};
FReason : TFhirType;
FMedication : TFhirResourceReference{TFhirMedication};
FdosageInstructionList : TFhirMedicationPrescriptionDosageInstructionList;
FDispense : TFhirMedicationPrescriptionDispense;
FSubstitution : TFhirMedicationPrescriptionSubstitution;
Procedure SetDateWritten(value : TFhirDateTime);
Function GetDateWrittenST : TDateTimeEx;
Procedure SetDateWrittenST(value : TDateTimeEx);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirMedicationPrescriptionStatus;
Procedure SetStatusST(value : TFhirMedicationPrescriptionStatus);
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
Procedure SetPrescriber(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetEncounter(value : TFhirResourceReference{TFhirEncounter});
Procedure SetReason(value : TFhirType);
Procedure SetMedication(value : TFhirResourceReference{TFhirMedication});
Procedure SetDispense(value : TFhirMedicationPrescriptionDispense);
Procedure SetSubstitution(value : TFhirMedicationPrescriptionSubstitution);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirMedicationPrescription; overload;
function Clone : TFhirMedicationPrescription; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
External identifier - one that would be used by another non-FHIR system - for example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an erntire workflow process where records have to be tracked through an entire system.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member dateWritten
The date (and perhaps time) when the prescription was written.
}
{@member dateWritten
Typed access to The date (and perhaps time) when the prescription was written.
}
property dateWritten : TDateTimeEx read GetDateWrittenST write SetDateWrittenST;
property dateWrittenObject : TFhirDateTime read FDateWritten write SetDateWritten;
{@member status
A code specifying the state of the order. Generally this will be active or completed state.
}
property status : TFhirMedicationPrescriptionStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member patient
A link to a resource representing the person to whom the medication will be given.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member prescriber
The healthcare professional responsible for authorizing the prescription.
}
property prescriber : TFhirResourceReference{TFhirPractitioner} read FPrescriber write SetPrescriber;
property prescriberObject : TFhirResourceReference{TFhirPractitioner} read FPrescriber write SetPrescriber;
{@member encounter
A link to a resource that identifies the particular occurrence of contact between patient and health care provider.
}
property encounter : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
property encounterObject : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
{@member reason
Can be the reason or the indication for writing the prescription.
}
property reason : TFhirType read FReason write SetReason;
property reasonObject : TFhirType read FReason write SetReason;
{@member medication
Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.
}
property medication : TFhirResourceReference{TFhirMedication} read FMedication write SetMedication;
property medicationObject : TFhirResourceReference{TFhirMedication} read FMedication write SetMedication;
{@member dosageInstructionList
Indicates how the medication is to be used by the patient.
}
property dosageInstructionList : TFhirMedicationPrescriptionDosageInstructionList read FDosageInstructionList;
{@member dispense
Deals with details of the dispense part of the order.
}
property dispense : TFhirMedicationPrescriptionDispense read FDispense write SetDispense;
property dispenseObject : TFhirMedicationPrescriptionDispense read FDispense write SetDispense;
{@member substitution
Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen, and in others it does not matter. This block explains the prescriber's intent. If nothing is specified substitution may be done.
}
property substitution : TFhirMedicationPrescriptionSubstitution read FSubstitution write SetSubstitution;
property substitutionObject : TFhirMedicationPrescriptionSubstitution read FSubstitution write SetSubstitution;
end;
{@Class TFhirMedicationStatement : TFhirResource
A record of medication being taken by a patient, or that the medication has been given to a patient where the record is the result of a report from the patient or another clinician.
}
{!.Net HL7Connect.Fhir.MedicationStatement}
TFhirMedicationStatement = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FPatient : TFhirResourceReference{TFhirPatient};
FWasNotGiven : TFhirBoolean;
FreasonNotGivenList : TFhirCodeableConceptList;
FWhenGiven : TFhirPeriod;
FMedication : TFhirResourceReference{TFhirMedication};
FdeviceList : TFhirResourceReferenceList{TFhirDevice};
FdosageList : TFhirMedicationStatementDosageList;
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
Procedure SetWasNotGiven(value : TFhirBoolean);
Function GetWasNotGivenST : Boolean;
Procedure SetWasNotGivenST(value : Boolean);
Procedure SetWhenGiven(value : TFhirPeriod);
Procedure SetMedication(value : TFhirResourceReference{TFhirMedication});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirMedicationStatement; overload;
function Clone : TFhirMedicationStatement; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
External identifier - FHIR will generate its own internal IDs (probably URLs) which do not need to be explicitly managed by the resource. The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event. Particularly important if these records have to be updated.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member patient
The person or animal who is /was taking the medication.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member wasNotGiven
Set this to true if the record is saying that the medication was NOT taken.
}
{@member wasNotGiven
Typed access to Set this to true if the record is saying that the medication was NOT taken.
}
property wasNotGiven : Boolean read GetWasNotGivenST write SetWasNotGivenST;
property wasNotGivenObject : TFhirBoolean read FWasNotGiven write SetWasNotGiven;
{@member reasonNotGivenList
A code indicating why the medication was not taken.
}
property reasonNotGivenList : TFhirCodeableConceptList read FReasonNotGivenList;
{@member whenGiven
The interval of time during which it is being asserted that the patient was taking the medication.
}
property whenGiven : TFhirPeriod read FWhenGiven write SetWhenGiven;
property whenGivenObject : TFhirPeriod read FWhenGiven write SetWhenGiven;
{@member medication
Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.
}
property medication : TFhirResourceReference{TFhirMedication} read FMedication write SetMedication;
property medicationObject : TFhirResourceReference{TFhirMedication} read FMedication write SetMedication;
{@member deviceList
An identifier or a link to a resource that identifies a device used in administering the medication to the patient.
}
property deviceList : TFhirResourceReferenceList{TFhirDevice} read FDeviceList;
{@member dosageList
Indicates how the medication is/was used by the patient.
}
property dosageList : TFhirMedicationStatementDosageList read FDosageList;
end;
{@Class TFhirMessageHeader : TFhirResource
The header for a message exchange that is either requesting or responding to an action. The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.
}
{!.Net HL7Connect.Fhir.MessageHeader}
TFhirMessageHeader = class (TFhirResource)
private
FIdentifier : TFhirId;
FTimestamp : TFhirInstant;
FEvent : TFhirCoding;
FResponse : TFhirMessageHeaderResponse;
FSource : TFhirMessageHeaderSource;
FdestinationList : TFhirMessageHeaderDestinationList;
FEnterer : TFhirResourceReference{TFhirPractitioner};
FAuthor : TFhirResourceReference{TFhirPractitioner};
FReceiver : TFhirResourceReference{Resource};
FResponsible : TFhirResourceReference{Resource};
FReason : TFhirCodeableConcept;
FdataList : TFhirResourceReferenceList{Resource};
Procedure SetIdentifier(value : TFhirId);
Function GetIdentifierST : String;
Procedure SetIdentifierST(value : String);
Procedure SetTimestamp(value : TFhirInstant);
Function GetTimestampST : TDateTimeEx;
Procedure SetTimestampST(value : TDateTimeEx);
Procedure SetEvent(value : TFhirCoding);
Procedure SetResponse(value : TFhirMessageHeaderResponse);
Procedure SetSource(value : TFhirMessageHeaderSource);
Procedure SetEnterer(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetAuthor(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetReceiver(value : TFhirResourceReference{Resource});
Procedure SetResponsible(value : TFhirResourceReference{Resource});
Procedure SetReason(value : TFhirCodeableConcept);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirMessageHeader; overload;
function Clone : TFhirMessageHeader; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
The identifier of this message.
}
{@member identifier
Typed access to The identifier of this message.
}
property identifier : String read GetIdentifierST write SetIdentifierST;
property identifierObject : TFhirId read FIdentifier write SetIdentifier;
{@member timestamp
The time that the message was sent.
}
{@member timestamp
Typed access to The time that the message was sent.
}
property timestamp : TDateTimeEx read GetTimestampST write SetTimestampST;
property timestampObject : TFhirInstant read FTimestamp write SetTimestamp;
{@member event
Code that identifies the event this message represents and connects it with it's definition. Events defined as part of the FHIR specification have the system value "http://hl7.org/fhir/message-type".
}
property event : TFhirCoding read FEvent write SetEvent;
property eventObject : TFhirCoding read FEvent write SetEvent;
{@member response
Information about the message that this message is a response to. Only present if this message is a response.
}
property response : TFhirMessageHeaderResponse read FResponse write SetResponse;
property responseObject : TFhirMessageHeaderResponse read FResponse write SetResponse;
{@member source
The source application from which this message originated.
}
property source : TFhirMessageHeaderSource read FSource write SetSource;
property sourceObject : TFhirMessageHeaderSource read FSource write SetSource;
{@member destinationList
The destination application which the message is intended for.
}
property destinationList : TFhirMessageHeaderDestinationList read FDestinationList;
{@member enterer
The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.
}
property enterer : TFhirResourceReference{TFhirPractitioner} read FEnterer write SetEnterer;
property entererObject : TFhirResourceReference{TFhirPractitioner} read FEnterer write SetEnterer;
{@member author
The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.
}
property author : TFhirResourceReference{TFhirPractitioner} read FAuthor write SetAuthor;
property authorObject : TFhirResourceReference{TFhirPractitioner} read FAuthor write SetAuthor;
{@member receiver
Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.
}
property receiver : TFhirResourceReference{Resource} read FReceiver write SetReceiver;
property receiverObject : TFhirResourceReference{Resource} read FReceiver write SetReceiver;
{@member responsible
The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.
}
property responsible : TFhirResourceReference{Resource} read FResponsible write SetResponsible;
property responsibleObject : TFhirResourceReference{Resource} read FResponsible write SetResponsible;
{@member reason
Coded indication of the cause for the event - indicates a reason for the occurance of the event that is a focus of this message.
}
property reason : TFhirCodeableConcept read FReason write SetReason;
property reasonObject : TFhirCodeableConcept read FReason write SetReason;
{@member dataList
The actual data of the message - a reference to the root/focus class of the event.
}
property dataList : TFhirResourceReferenceList{Resource} read FDataList;
end;
{@Class TFhirObservation : TFhirResource
Measurements and simple assertions made about a patient, device or other subject.
}
{!.Net HL7Connect.Fhir.Observation}
TFhirObservation = class (TFhirResource)
private
FName : TFhirCodeableConcept;
FValue : TFhirType;
FInterpretation : TFhirCodeableConcept;
FComments : TFhirString;
FApplies : TFhirType;
FIssued : TFhirInstant;
FStatus : TFhirEnum;
FReliability : TFhirEnum;
FBodySite : TFhirCodeableConcept;
FMethod : TFhirCodeableConcept;
FIdentifier : TFhirIdentifier;
FSubject : TFhirResourceReference{Resource};
FSpecimen : TFhirResourceReference{TFhirSpecimen};
FperformerList : TFhirResourceReferenceList{Resource};
FreferenceRangeList : TFhirObservationReferenceRangeList;
FrelatedList : TFhirObservationRelatedList;
Procedure SetName(value : TFhirCodeableConcept);
Procedure SetValue(value : TFhirType);
Procedure SetInterpretation(value : TFhirCodeableConcept);
Procedure SetComments(value : TFhirString);
Function GetCommentsST : String;
Procedure SetCommentsST(value : String);
Procedure SetApplies(value : TFhirType);
Procedure SetIssued(value : TFhirInstant);
Function GetIssuedST : TDateTimeEx;
Procedure SetIssuedST(value : TDateTimeEx);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirObservationStatus;
Procedure SetStatusST(value : TFhirObservationStatus);
Procedure SetReliability(value : TFhirEnum);
Function GetReliabilityST : TFhirObservationReliability;
Procedure SetReliabilityST(value : TFhirObservationReliability);
Procedure SetBodySite(value : TFhirCodeableConcept);
Procedure SetMethod(value : TFhirCodeableConcept);
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetSpecimen(value : TFhirResourceReference{TFhirSpecimen});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirObservation; overload;
function Clone : TFhirObservation; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member name
Describes what was observed. Sometimes this is called the observation "code".
}
property name : TFhirCodeableConcept read FName write SetName;
property nameObject : TFhirCodeableConcept read FName write SetName;
{@member value
The information determined as a result of making the observation, if the information has a simple value.
}
property value : TFhirType read FValue write SetValue;
property valueObject : TFhirType read FValue write SetValue;
{@member interpretation
The assessment made based on the result of the observation.
}
property interpretation : TFhirCodeableConcept read FInterpretation write SetInterpretation;
property interpretationObject : TFhirCodeableConcept read FInterpretation write SetInterpretation;
{@member comments
May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.
}
{@member comments
Typed access to May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.
}
property comments : String read GetCommentsST write SetCommentsST;
property commentsObject : TFhirString read FComments write SetComments;
{@member applies
The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.
}
property applies : TFhirType read FApplies write SetApplies;
property appliesObject : TFhirType read FApplies write SetApplies;
{@member issued
Date/Time this was made available.
}
{@member issued
Typed access to Date/Time this was made available.
}
property issued : TDateTimeEx read GetIssuedST write SetIssuedST;
property issuedObject : TFhirInstant read FIssued write SetIssued;
{@member status
The status of the result value.
}
property status : TFhirObservationStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member reliability
An estimate of the degree to which quality issues have impacted on the value reported.
}
property reliability : TFhirObservationReliability read GetReliabilityST write SetReliabilityST;
property reliabilityObject : TFhirEnum read FReliability write SetReliability;
{@member bodySite
Indicates where on the subject's body the observation was made.
}
property bodySite : TFhirCodeableConcept read FBodySite write SetBodySite;
property bodySiteObject : TFhirCodeableConcept read FBodySite write SetBodySite;
{@member method
Indicates the mechanism used to perform the observation.
}
property method : TFhirCodeableConcept read FMethod write SetMethod;
property methodObject : TFhirCodeableConcept read FMethod write SetMethod;
{@member identifier
A unique identifier for the simple observation.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member subject
The thing the observation is being made about.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member specimen
The specimen that was used when this observation was made.
}
property specimen : TFhirResourceReference{TFhirSpecimen} read FSpecimen write SetSpecimen;
property specimenObject : TFhirResourceReference{TFhirSpecimen} read FSpecimen write SetSpecimen;
{@member performerList
Who was responsible for asserting the observed value as "true".
}
property performerList : TFhirResourceReferenceList{Resource} read FPerformerList;
{@member referenceRangeList
Guidance on how to interpret the value by comparison to a normal or recommended range.
}
property referenceRangeList : TFhirObservationReferenceRangeList read FReferenceRangeList;
{@member relatedList
Related observations - either components, or previous observations, or statements of derivation.
}
property relatedList : TFhirObservationRelatedList read FRelatedList;
end;
{@Class TFhirOperationOutcome : TFhirResource
A collection of error, warning or information messages that result from a system action.
}
{!.Net HL7Connect.Fhir.OperationOutcome}
TFhirOperationOutcome = class (TFhirResource)
private
FissueList : TFhirOperationOutcomeIssueList;
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirOperationOutcome; overload;
function Clone : TFhirOperationOutcome; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member issueList
An error, warning or information message that results from a system action.
}
property issueList : TFhirOperationOutcomeIssueList read FIssueList;
end;
{@Class TFhirOrder : TFhirResource
A request to perform an action.
}
{!.Net HL7Connect.Fhir.Order}
TFhirOrder = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FDate : TFhirDateTime;
FSubject : TFhirResourceReference{TFhirPatient};
FSource : TFhirResourceReference{TFhirPractitioner};
FTarget : TFhirResourceReference{Resource};
FReason : TFhirType;
FAuthority : TFhirResourceReference{Resource};
FWhen : TFhirOrderWhen;
FdetailList : TFhirResourceReferenceList{Resource};
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetSource(value : TFhirResourceReference{TFhirPractitioner});
Procedure SetTarget(value : TFhirResourceReference{Resource});
Procedure SetReason(value : TFhirType);
Procedure SetAuthority(value : TFhirResourceReference{Resource});
Procedure SetWhen(value : TFhirOrderWhen);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirOrder; overload;
function Clone : TFhirOrder; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifiers assigned to this order by the orderer or by the receiver.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member date
When the order was made.
}
{@member date
Typed access to When the order was made.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member subject
Patient this order is about.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member source
Who initiated the order.
}
property source : TFhirResourceReference{TFhirPractitioner} read FSource write SetSource;
property sourceObject : TFhirResourceReference{TFhirPractitioner} read FSource write SetSource;
{@member target
Who is intended to fulfill the order.
}
property target : TFhirResourceReference{Resource} read FTarget write SetTarget;
property targetObject : TFhirResourceReference{Resource} read FTarget write SetTarget;
{@member reason
Text - why the order was made.
}
property reason : TFhirType read FReason write SetReason;
property reasonObject : TFhirType read FReason write SetReason;
{@member authority
If required by policy.
}
property authority : TFhirResourceReference{Resource} read FAuthority write SetAuthority;
property authorityObject : TFhirResourceReference{Resource} read FAuthority write SetAuthority;
{@member when
When order should be fulfilled.
}
property when : TFhirOrderWhen read FWhen write SetWhen;
property whenObject : TFhirOrderWhen read FWhen write SetWhen;
{@member detailList
What action is being ordered.
}
property detailList : TFhirResourceReferenceList{Resource} read FDetailList;
end;
{@Class TFhirOrderResponse : TFhirResource
A response to an order.
}
{!.Net HL7Connect.Fhir.OrderResponse}
TFhirOrderResponse = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FRequest : TFhirResourceReference{TFhirOrder};
FDate : TFhirDateTime;
FWho : TFhirResourceReference{Resource};
FAuthority : TFhirType;
FCode : TFhirEnum;
FDescription : TFhirString;
FfulfillmentList : TFhirResourceReferenceList{Resource};
Procedure SetRequest(value : TFhirResourceReference{TFhirOrder});
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetWho(value : TFhirResourceReference{Resource});
Procedure SetAuthority(value : TFhirType);
Procedure SetCode(value : TFhirEnum);
Function GetCodeST : TFhirOrderOutcomeCode;
Procedure SetCodeST(value : TFhirOrderOutcomeCode);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirOrderResponse; overload;
function Clone : TFhirOrderResponse; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member request
A reference to the order that this is in response to.
}
property request : TFhirResourceReference{TFhirOrder} read FRequest write SetRequest;
property requestObject : TFhirResourceReference{TFhirOrder} read FRequest write SetRequest;
{@member date
The date and time at which this order response was made (created/posted).
}
{@member date
Typed access to The date and time at which this order response was made (created/posted).
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member who
The person, organization, or device credited with making the response.
}
property who : TFhirResourceReference{Resource} read FWho write SetWho;
property whoObject : TFhirResourceReference{Resource} read FWho write SetWho;
{@member authority
A reference to an authority policy that is the reason for the response. Usually this is used when the order is rejected, to provide a reason for rejection.
}
property authority : TFhirType read FAuthority write SetAuthority;
property authorityObject : TFhirType read FAuthority write SetAuthority;
{@member code
What this response says about the status of the original order.
}
property code : TFhirOrderOutcomeCode read GetCodeST write SetCodeST;
property codeObject : TFhirEnum read FCode write SetCode;
{@member description
Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.
}
{@member description
Typed access to Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member fulfillmentList
Links to resources that provide details of the outcome of performing the order. E.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.
}
property fulfillmentList : TFhirResourceReferenceList{Resource} read FFulfillmentList;
end;
{@Class TFhirOrganization : TFhirResource
A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action. Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.
}
{!.Net HL7Connect.Fhir.Organization}
TFhirOrganization = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FName : TFhirString;
FType_ : TFhirCodeableConcept;
FtelecomList : TFhirContactList;
FaddressList : TFhirAddressList;
FPartOf : TFhirResourceReference{TFhirOrganization};
FcontactList : TFhirOrganizationContactList;
FlocationList : TFhirResourceReferenceList{TFhirLocation};
FActive : TFhirBoolean;
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetPartOf(value : TFhirResourceReference{TFhirOrganization});
Procedure SetActive(value : TFhirBoolean);
Function GetActiveST : Boolean;
Procedure SetActiveST(value : Boolean);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirOrganization; overload;
function Clone : TFhirOrganization; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifier for the organization that is used to identify the organization across multiple disparate systems.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member name
A name associated with the organization.
}
{@member name
Typed access to A name associated with the organization.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member type_
The kind of organization that this is.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member telecomList
A contact detail for the organization.
}
property telecomList : TFhirContactList read FTelecomList;
{@member addressList
An address for the organization.
}
property addressList : TFhirAddressList read FAddressList;
{@member partOf
The organization of which this organization forms a part.
}
property partOf : TFhirResourceReference{TFhirOrganization} read FPartOf write SetPartOf;
property partOfObject : TFhirResourceReference{TFhirOrganization} read FPartOf write SetPartOf;
{@member contactList
Contact for the organization for a certain purpose.
}
property contactList : TFhirOrganizationContactList read FContactList;
{@member locationList
Location(s) the organization uses to provide services.
}
property locationList : TFhirResourceReferenceList{TFhirLocation} read FLocationList;
{@member active
Whether the organization's record is still in active use.
}
{@member active
Typed access to Whether the organization's record is still in active use.
}
property active : Boolean read GetActiveST write SetActiveST;
property activeObject : TFhirBoolean read FActive write SetActive;
end;
{@Class TFhirOther : TFhirResource
Other is a conformant for handling resource concepts not yet defined for FHIR or outside HL7's scope of interest.
}
{!.Net HL7Connect.Fhir.Other}
TFhirOther = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FCode : TFhirCodeableConcept;
FSubject : TFhirResourceReference{Resource};
FAuthor : TFhirResourceReference{Resource};
FCreated : TFhirDate;
Procedure SetCode(value : TFhirCodeableConcept);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetAuthor(value : TFhirResourceReference{Resource});
Procedure SetCreated(value : TFhirDate);
Function GetCreatedST : TDateTimeEx;
Procedure SetCreatedST(value : TDateTimeEx);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirOther; overload;
function Clone : TFhirOther; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifier assigned to the resource for business purposes, outside the context of FHIR.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member code
Identifies the 'type' of resource - equivalent to the resource name for other resources.
}
property code : TFhirCodeableConcept read FCode write SetCode;
property codeObject : TFhirCodeableConcept read FCode write SetCode;
{@member subject
Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member author
Indicates who was responsible for creating the resource instance.
}
property author : TFhirResourceReference{Resource} read FAuthor write SetAuthor;
property authorObject : TFhirResourceReference{Resource} read FAuthor write SetAuthor;
{@member created
Identifies when the resource was first created.
}
{@member created
Typed access to Identifies when the resource was first created.
}
property created : TDateTimeEx read GetCreatedST write SetCreatedST;
property createdObject : TFhirDate read FCreated write SetCreated;
end;
{@Class TFhirPatient : TFhirResource
Demographics and other administrative information about a person or animal receiving care or other health-related services.
}
{!.Net HL7Connect.Fhir.Patient}
TFhirPatient = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FnameList : TFhirHumanNameList;
FtelecomList : TFhirContactList;
FGender : TFhirCodeableConcept;
FBirthDate : TFhirDateTime;
FDeceased : TFhirType;
FaddressList : TFhirAddressList;
FMaritalStatus : TFhirCodeableConcept;
FMultipleBirth : TFhirType;
FphotoList : TFhirAttachmentList;
FcontactList : TFhirPatientContactList;
FAnimal : TFhirPatientAnimal;
FcommunicationList : TFhirCodeableConceptList;
FcareProviderList : TFhirResourceReferenceList{Resource};
FManagingOrganization : TFhirResourceReference{TFhirOrganization};
Flink_List : TFhirPatientLinkList;
FActive : TFhirBoolean;
Procedure SetGender(value : TFhirCodeableConcept);
Procedure SetBirthDate(value : TFhirDateTime);
Function GetBirthDateST : TDateTimeEx;
Procedure SetBirthDateST(value : TDateTimeEx);
Procedure SetDeceased(value : TFhirType);
Procedure SetMaritalStatus(value : TFhirCodeableConcept);
Procedure SetMultipleBirth(value : TFhirType);
Procedure SetAnimal(value : TFhirPatientAnimal);
Procedure SetManagingOrganization(value : TFhirResourceReference{TFhirOrganization});
Procedure SetActive(value : TFhirBoolean);
Function GetActiveST : Boolean;
Procedure SetActiveST(value : Boolean);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirPatient; overload;
function Clone : TFhirPatient; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
An identifier that applies to this person as a patient.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member nameList
A name associated with the individual.
}
property nameList : TFhirHumanNameList read FNameList;
{@member telecomList
A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.
}
property telecomList : TFhirContactList read FTelecomList;
{@member gender
Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.
}
property gender : TFhirCodeableConcept read FGender write SetGender;
property genderObject : TFhirCodeableConcept read FGender write SetGender;
{@member birthDate
The date and time of birth for the individual.
}
{@member birthDate
Typed access to The date and time of birth for the individual.
}
property birthDate : TDateTimeEx read GetBirthDateST write SetBirthDateST;
property birthDateObject : TFhirDateTime read FBirthDate write SetBirthDate;
{@member deceased
Indicates if the individual is deceased or not.
}
property deceased : TFhirType read FDeceased write SetDeceased;
property deceasedObject : TFhirType read FDeceased write SetDeceased;
{@member addressList
Addresses for the individual.
}
property addressList : TFhirAddressList read FAddressList;
{@member maritalStatus
This field contains a patient's most recent marital (civil) status.
}
property maritalStatus : TFhirCodeableConcept read FMaritalStatus write SetMaritalStatus;
property maritalStatusObject : TFhirCodeableConcept read FMaritalStatus write SetMaritalStatus;
{@member multipleBirth
Indicates whether the patient is part of a multiple or indicates the actual birth order.
}
property multipleBirth : TFhirType read FMultipleBirth write SetMultipleBirth;
property multipleBirthObject : TFhirType read FMultipleBirth write SetMultipleBirth;
{@member photoList
Image of the person.
}
property photoList : TFhirAttachmentList read FPhotoList;
{@member contactList
A contact party (e.g. guardian, partner, friend) for the patient.
}
property contactList : TFhirPatientContactList read FContactList;
{@member animal
This element has a value if the patient is an animal.
}
property animal : TFhirPatientAnimal read FAnimal write SetAnimal;
property animalObject : TFhirPatientAnimal read FAnimal write SetAnimal;
{@member communicationList
Languages which may be used to communicate with the patient about his or her health.
}
property communicationList : TFhirCodeableConceptList read FCommunicationList;
{@member careProviderList
Patient's nominated care provider.
}
property careProviderList : TFhirResourceReferenceList{Resource} read FCareProviderList;
{@member managingOrganization
Organization that is the custodian of the patient record.
}
property managingOrganization : TFhirResourceReference{TFhirOrganization} read FManagingOrganization write SetManagingOrganization;
property managingOrganizationObject : TFhirResourceReference{TFhirOrganization} read FManagingOrganization write SetManagingOrganization;
{@member link_List
Link to another patient resource that concerns the same actual person.
}
property link_List : TFhirPatientLinkList read FLink_List;
{@member active
Whether this patient record is in active use.
}
{@member active
Typed access to Whether this patient record is in active use.
}
property active : Boolean read GetActiveST write SetActiveST;
property activeObject : TFhirBoolean read FActive write SetActive;
end;
{@Class TFhirPractitioner : TFhirResource
A person who is directly or indirectly involved in the provisioning of healthcare.
}
{!.Net HL7Connect.Fhir.Practitioner}
TFhirPractitioner = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FName : TFhirHumanName;
FtelecomList : TFhirContactList;
FAddress : TFhirAddress;
FGender : TFhirCodeableConcept;
FBirthDate : TFhirDateTime;
FphotoList : TFhirAttachmentList;
FOrganization : TFhirResourceReference{TFhirOrganization};
FroleList : TFhirCodeableConceptList;
FspecialtyList : TFhirCodeableConceptList;
FPeriod : TFhirPeriod;
FlocationList : TFhirResourceReferenceList{TFhirLocation};
FqualificationList : TFhirPractitionerQualificationList;
FcommunicationList : TFhirCodeableConceptList;
Procedure SetName(value : TFhirHumanName);
Procedure SetAddress(value : TFhirAddress);
Procedure SetGender(value : TFhirCodeableConcept);
Procedure SetBirthDate(value : TFhirDateTime);
Function GetBirthDateST : TDateTimeEx;
Procedure SetBirthDateST(value : TDateTimeEx);
Procedure SetOrganization(value : TFhirResourceReference{TFhirOrganization});
Procedure SetPeriod(value : TFhirPeriod);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirPractitioner; overload;
function Clone : TFhirPractitioner; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
An identifier that applies to this person in this role.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member name
A name associated with the person.
}
property name : TFhirHumanName read FName write SetName;
property nameObject : TFhirHumanName read FName write SetName;
{@member telecomList
A contact detail for the practitioner, e.g. a telephone number or an email address.
}
property telecomList : TFhirContactList read FTelecomList;
{@member address
The postal address where the practitioner can be found or visited or to which mail can be delivered.
}
property address : TFhirAddress read FAddress write SetAddress;
property addressObject : TFhirAddress read FAddress write SetAddress;
{@member gender
Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
}
property gender : TFhirCodeableConcept read FGender write SetGender;
property genderObject : TFhirCodeableConcept read FGender write SetGender;
{@member birthDate
The date and time of birth for the practitioner.
}
{@member birthDate
Typed access to The date and time of birth for the practitioner.
}
property birthDate : TDateTimeEx read GetBirthDateST write SetBirthDateST;
property birthDateObject : TFhirDateTime read FBirthDate write SetBirthDate;
{@member photoList
Image of the person.
}
property photoList : TFhirAttachmentList read FPhotoList;
{@member organization
The organization that the practitioner represents.
}
property organization : TFhirResourceReference{TFhirOrganization} read FOrganization write SetOrganization;
property organizationObject : TFhirResourceReference{TFhirOrganization} read FOrganization write SetOrganization;
{@member roleList
Roles which this practitioner is authorized to perform for the organization.
}
property roleList : TFhirCodeableConceptList read FRoleList;
{@member specialtyList
Specific specialty of the practitioner.
}
property specialtyList : TFhirCodeableConceptList read FSpecialtyList;
{@member period
The period during which the person is authorized to act as a practitioner in these role(s) for the organization.
}
property period : TFhirPeriod read FPeriod write SetPeriod;
property periodObject : TFhirPeriod read FPeriod write SetPeriod;
{@member locationList
The location(s) at which this practitioner provides care.
}
property locationList : TFhirResourceReferenceList{TFhirLocation} read FLocationList;
{@member qualificationList
Qualifications obtained by training and certification.
}
property qualificationList : TFhirPractitionerQualificationList read FQualificationList;
{@member communicationList
A language the practitioner is able to use in patient communication.
}
property communicationList : TFhirCodeableConceptList read FCommunicationList;
end;
{@Class TFhirProcedure : TFhirResource
An action that is performed on a patient. This can be a physical 'thing' like an operation, or less invasive like counseling or hypnotherapy.
}
{!.Net HL7Connect.Fhir.Procedure}
TFhirProcedure = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FSubject : TFhirResourceReference{TFhirPatient};
FType_ : TFhirCodeableConcept;
FbodySiteList : TFhirCodeableConceptList;
FindicationList : TFhirCodeableConceptList;
FperformerList : TFhirProcedurePerformerList;
FDate : TFhirPeriod;
FEncounter : TFhirResourceReference{TFhirEncounter};
FOutcome : TFhirString;
FreportList : TFhirResourceReferenceList{TFhirDiagnosticReport};
FcomplicationList : TFhirCodeableConceptList;
FFollowUp : TFhirString;
FrelatedItemList : TFhirProcedureRelatedItemList;
FNotes : TFhirString;
Procedure SetSubject(value : TFhirResourceReference{TFhirPatient});
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetDate(value : TFhirPeriod);
Procedure SetEncounter(value : TFhirResourceReference{TFhirEncounter});
Procedure SetOutcome(value : TFhirString);
Function GetOutcomeST : String;
Procedure SetOutcomeST(value : String);
Procedure SetFollowUp(value : TFhirString);
Function GetFollowUpST : String;
Procedure SetFollowUpST(value : String);
Procedure SetNotes(value : TFhirString);
Function GetNotesST : String;
Procedure SetNotesST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirProcedure; overload;
function Clone : TFhirProcedure; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
This records identifiers associated with this procedure that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member subject
The person on whom the procedure was performed.
}
property subject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{TFhirPatient} read FSubject write SetSubject;
{@member type_
The specific procedure that is performed. Use text if the exact nature of the procedure can't be coded.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member bodySiteList
Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.
}
property bodySiteList : TFhirCodeableConceptList read FBodySiteList;
{@member indicationList
The reason why the procedure was performed. This may be due to a Condition, may be coded entity of some type, or may simply be present as text.
}
property indicationList : TFhirCodeableConceptList read FIndicationList;
{@member performerList
Limited to 'real' people rather than equipment.
}
property performerList : TFhirProcedurePerformerList read FPerformerList;
{@member date
The dates over which the procedure was performed. Allows a period to support complex procedures that span more that one date, and also allows for the length of the procedure to be captured.
}
property date : TFhirPeriod read FDate write SetDate;
property dateObject : TFhirPeriod read FDate write SetDate;
{@member encounter
The encounter during which the procedure was performed.
}
property encounter : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
property encounterObject : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
{@member outcome
What was the outcome of the procedure - did it resolve reasons why the procedure was performed?.
}
{@member outcome
Typed access to What was the outcome of the procedure - did it resolve reasons why the procedure was performed?.
}
property outcome : String read GetOutcomeST write SetOutcomeST;
property outcomeObject : TFhirString read FOutcome write SetOutcome;
{@member reportList
This could be a histology result. There could potentially be multiple reports - e.g. if this was a procedure that made multiple biopsies.
}
property reportList : TFhirResourceReferenceList{TFhirDiagnosticReport} read FReportList;
{@member complicationList
Any complications that occurred during the procedure, or in the immediate post-operative period. These are generally tracked separately from the notes, which typically will describe the procedure itself rather than any 'post procedure' issues.
}
property complicationList : TFhirCodeableConceptList read FComplicationList;
{@member followUp
If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or potentially could be more complex in which case the CarePlan resource can be used.
}
{@member followUp
Typed access to If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or potentially could be more complex in which case the CarePlan resource can be used.
}
property followUp : String read GetFollowUpST write SetFollowUpST;
property followUpObject : TFhirString read FFollowUp write SetFollowUp;
{@member relatedItemList
Procedures may be related to other items such as procedures or medications. For example treating wound dehiscence following a previous procedure.
}
property relatedItemList : TFhirProcedureRelatedItemList read FRelatedItemList;
{@member notes
Any other notes about the procedure - e.g. the operative notes.
}
{@member notes
Typed access to Any other notes about the procedure - e.g. the operative notes.
}
property notes : String read GetNotesST write SetNotesST;
property notesObject : TFhirString read FNotes write SetNotes;
end;
{@Class TFhirProfile : TFhirResource
A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.
}
{!.Net HL7Connect.Fhir.Profile}
TFhirProfile = class (TFhirResource)
private
FIdentifier : TFhirString;
FVersion : TFhirString;
FName : TFhirString;
FPublisher : TFhirString;
FtelecomList : TFhirContactList;
FDescription : TFhirString;
FcodeList : TFhirCodingList;
FStatus : TFhirEnum;
FExperimental : TFhirBoolean;
FDate : TFhirDateTime;
FRequirements : TFhirString;
FFhirVersion : TFhirId;
FmappingList : TFhirProfileMappingList;
FstructureList : TFhirProfileStructureList;
FextensionDefnList : TFhirProfileExtensionDefnList;
FqueryList : TFhirProfileQueryList;
Procedure SetIdentifier(value : TFhirString);
Function GetIdentifierST : String;
Procedure SetIdentifierST(value : String);
Procedure SetVersion(value : TFhirString);
Function GetVersionST : String;
Procedure SetVersionST(value : String);
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetPublisher(value : TFhirString);
Function GetPublisherST : String;
Procedure SetPublisherST(value : String);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirResourceProfileStatus;
Procedure SetStatusST(value : TFhirResourceProfileStatus);
Procedure SetExperimental(value : TFhirBoolean);
Function GetExperimentalST : Boolean;
Procedure SetExperimentalST(value : Boolean);
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetRequirements(value : TFhirString);
Function GetRequirementsST : String;
Procedure SetRequirementsST(value : String);
Procedure SetFhirVersion(value : TFhirId);
Function GetFhirVersionST : String;
Procedure SetFhirVersionST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirProfile; overload;
function Clone : TFhirProfile; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
The identifier that is used to identify this profile when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
{@member identifier
Typed access to The identifier that is used to identify this profile when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
property identifier : String read GetIdentifierST write SetIdentifierST;
property identifierObject : TFhirString read FIdentifier write SetIdentifier;
{@member version
The identifier that is used to identify this version of the profile when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
{@member version
Typed access to The identifier that is used to identify this version of the profile when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
property version : String read GetVersionST write SetVersionST;
property versionObject : TFhirString read FVersion write SetVersion;
{@member name
A free text natural language name identifying the Profile.
}
{@member name
Typed access to A free text natural language name identifying the Profile.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member publisher
Details of the individual or organization who accepts responsibility for publishing the profile.
}
{@member publisher
Typed access to Details of the individual or organization who accepts responsibility for publishing the profile.
}
property publisher : String read GetPublisherST write SetPublisherST;
property publisherObject : TFhirString read FPublisher write SetPublisher;
{@member telecomList
Contact details to assist a user in finding and communicating with the publisher.
}
property telecomList : TFhirContactList read FTelecomList;
{@member description
A free text natural language description of the profile and its use.
}
{@member description
Typed access to A free text natural language description of the profile and its use.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member codeList
A set of terms from external terminologies that may be used to assist with indexing and searching of templates.
}
property codeList : TFhirCodingList read FCodeList;
{@member status
The status of the profile.
}
property status : TFhirResourceProfileStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member experimental
This profile was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
{@member experimental
Typed access to This profile was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
property experimental : Boolean read GetExperimentalST write SetExperimentalST;
property experimentalObject : TFhirBoolean read FExperimental write SetExperimental;
{@member date
The date that this version of the profile was published.
}
{@member date
Typed access to The date that this version of the profile was published.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member requirements
The Scope and Usage that this profile was created to meet.
}
{@member requirements
Typed access to The Scope and Usage that this profile was created to meet.
}
property requirements : String read GetRequirementsST write SetRequirementsST;
property requirementsObject : TFhirString read FRequirements write SetRequirements;
{@member fhirVersion
The version of the FHIR specification on which this profile is based.
}
{@member fhirVersion
Typed access to The version of the FHIR specification on which this profile is based.
}
property fhirVersion : String read GetFhirVersionST write SetFhirVersionST;
property fhirVersionObject : TFhirId read FFhirVersion write SetFhirVersion;
{@member mappingList
An external specification that the content is mapped to.
}
property mappingList : TFhirProfileMappingList read FMappingList;
{@member structureList
A constraint statement about what contents a resource or data type may have.
}
property structureList : TFhirProfileStructureList read FStructureList;
{@member extensionDefnList
An extension defined as part of the profile.
}
property extensionDefnList : TFhirProfileExtensionDefnList read FExtensionDefnList;
{@member queryList
Definition of a named query and its parameters and their meaning.
}
property queryList : TFhirProfileQueryList read FQueryList;
end;
{@Class TFhirProvenance : TFhirResource
Provenance information that describes the activity that led to the creation of a set of resources. This information can be used to help determine their reliability or trace where the information in them came from. The focus of the provenance resource is record keeping, audit and traceability, and not explicit statements of clinical significance.
}
{!.Net HL7Connect.Fhir.Provenance}
TFhirProvenance = class (TFhirResource)
private
FtargetList : TFhirResourceReferenceList{Resource};
FPeriod : TFhirPeriod;
FRecorded : TFhirInstant;
FReason : TFhirCodeableConcept;
FLocation : TFhirResourceReference{TFhirLocation};
FpolicyList : TFhirUriList;
FagentList : TFhirProvenanceAgentList;
FentityList : TFhirProvenanceEntityList;
FIntegritySignature : TFhirString;
Procedure SetPeriod(value : TFhirPeriod);
Procedure SetRecorded(value : TFhirInstant);
Function GetRecordedST : TDateTimeEx;
Procedure SetRecordedST(value : TDateTimeEx);
Procedure SetReason(value : TFhirCodeableConcept);
Procedure SetLocation(value : TFhirResourceReference{TFhirLocation});
Procedure SetIntegritySignature(value : TFhirString);
Function GetIntegritySignatureST : String;
Procedure SetIntegritySignatureST(value : String);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirProvenance; overload;
function Clone : TFhirProvenance; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member targetList
The resource(s) that were generated by the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity.
}
property targetList : TFhirResourceReferenceList{Resource} read FTargetList;
{@member period
The period during which the activity occurred.
}
property period : TFhirPeriod read FPeriod write SetPeriod;
property periodObject : TFhirPeriod read FPeriod write SetPeriod;
{@member recorded
The instant of time at which the activity was recorded.
}
{@member recorded
Typed access to The instant of time at which the activity was recorded.
}
property recorded : TDateTimeEx read GetRecordedST write SetRecordedST;
property recordedObject : TFhirInstant read FRecorded write SetRecorded;
{@member reason
The reason that the activity was taking place.
}
property reason : TFhirCodeableConcept read FReason write SetReason;
property reasonObject : TFhirCodeableConcept read FReason write SetReason;
{@member location
Where the activity occurred, if relevant.
}
property location : TFhirResourceReference{TFhirLocation} read FLocation write SetLocation;
property locationObject : TFhirResourceReference{TFhirLocation} read FLocation write SetLocation;
{@member policyList
Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.
}
property policyList : TFhirUriList read FPolicyList;
{@member agentList
An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the activity taking place. An agent can be a person, a piece of software, an inanimate object, an organization, or other entities that may be ascribed responsibility.
}
property agentList : TFhirProvenanceAgentList read FAgentList;
{@member entityList
An entity used in this activity.
}
property entityList : TFhirProvenanceEntityList read FEntityList;
{@member integritySignature
A digital signature on the target resource(s). The signature should match a Provenance.agent.reference in the provenance resource. The signature is only added to support checking cryptographic integrity of the resource, and not to represent workflow and clinical aspects of the signing process, or to support non-repudiation.
}
{@member integritySignature
Typed access to A digital signature on the target resource(s). The signature should match a Provenance.agent.reference in the provenance resource. The signature is only added to support checking cryptographic integrity of the resource, and not to represent workflow and clinical aspects of the signing process, or to support non-repudiation.
}
property integritySignature : String read GetIntegritySignatureST write SetIntegritySignatureST;
property integritySignatureObject : TFhirString read FIntegritySignature write SetIntegritySignature;
end;
{@Class TFhirQuery : TFhirResource
A description of a query with a set of parameters.
}
{!.Net HL7Connect.Fhir.Query}
TFhirQuery = class (TFhirResource)
private
FIdentifier : TFhirUri;
FparameterList : TFhirExtensionList;
FResponse : TFhirQueryResponse;
Procedure SetIdentifier(value : TFhirUri);
Function GetIdentifierST : String;
Procedure SetIdentifierST(value : String);
Procedure SetResponse(value : TFhirQueryResponse);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirQuery; overload;
function Clone : TFhirQuery; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
Links query and its response(s).
}
{@member identifier
Typed access to Links query and its response(s).
}
property identifier : String read GetIdentifierST write SetIdentifierST;
property identifierObject : TFhirUri read FIdentifier write SetIdentifier;
{@member parameterList
Set of query parameters with values.
}
property parameterList : TFhirExtensionList read FParameterList;
{@member response
If this is a response to a query.
}
property response : TFhirQueryResponse read FResponse write SetResponse;
property responseObject : TFhirQueryResponse read FResponse write SetResponse;
end;
{@Class TFhirQuestionnaire : TFhirResource
A structured set of questions and their answers. The Questionnaire may contain questions, answers or both. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions.
}
{!.Net HL7Connect.Fhir.Questionnaire}
TFhirQuestionnaire = class (TFhirResource)
private
FStatus : TFhirEnum;
FAuthored : TFhirDateTime;
FSubject : TFhirResourceReference{Resource};
FAuthor : TFhirResourceReference{Resource};
FSource : TFhirResourceReference{Resource};
FName : TFhirCodeableConcept;
FidentifierList : TFhirIdentifierList;
FEncounter : TFhirResourceReference{TFhirEncounter};
FGroup : TFhirQuestionnaireGroup;
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirQuestionnaireStatus;
Procedure SetStatusST(value : TFhirQuestionnaireStatus);
Procedure SetAuthored(value : TFhirDateTime);
Function GetAuthoredST : TDateTimeEx;
Procedure SetAuthoredST(value : TDateTimeEx);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetAuthor(value : TFhirResourceReference{Resource});
Procedure SetSource(value : TFhirResourceReference{Resource});
Procedure SetName(value : TFhirCodeableConcept);
Procedure SetEncounter(value : TFhirResourceReference{TFhirEncounter});
Procedure SetGroup(value : TFhirQuestionnaireGroup);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirQuestionnaire; overload;
function Clone : TFhirQuestionnaire; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member status
The lifecycle status of the questionnaire as a whole.
}
property status : TFhirQuestionnaireStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member authored
The date and/or time that this version of the questionnaire was authored.
}
{@member authored
Typed access to The date and/or time that this version of the questionnaire was authored.
}
property authored : TDateTimeEx read GetAuthoredST write SetAuthoredST;
property authoredObject : TFhirDateTime read FAuthored write SetAuthored;
{@member subject
The subject of the questionnaires: this is the patient that the answers apply to, but this person is not necessarily the source of information.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member author
Person who received the answers to the questions in the Questionnaire and recorded them in the system.
}
property author : TFhirResourceReference{Resource} read FAuthor write SetAuthor;
property authorObject : TFhirResourceReference{Resource} read FAuthor write SetAuthor;
{@member source
The person who answered the questions about the subject. Only used when this is not the subject him/herself.
}
property source : TFhirResourceReference{Resource} read FSource write SetSource;
property sourceObject : TFhirResourceReference{Resource} read FSource write SetSource;
{@member name
Structured name for a predefined list of questions this questionnaire is responding to.
}
property name : TFhirCodeableConcept read FName write SetName;
property nameObject : TFhirCodeableConcept read FName write SetName;
{@member identifierList
This records identifiers associated with this question/answer set that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member encounter
Encounter during which this questionnaire answers were collected. When there were multiple encounters, this is the one considered most relevant to the context of the answers.
}
property encounter : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
property encounterObject : TFhirResourceReference{TFhirEncounter} read FEncounter write SetEncounter;
{@member group
A group of questions to a possibly similarly grouped set of questions in the questionnaire.
}
property group : TFhirQuestionnaireGroup read FGroup write SetGroup;
property groupObject : TFhirQuestionnaireGroup read FGroup write SetGroup;
end;
{@Class TFhirRelatedPerson : TFhirResource
Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.
}
{!.Net HL7Connect.Fhir.RelatedPerson}
TFhirRelatedPerson = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FPatient : TFhirResourceReference{TFhirPatient};
FRelationship : TFhirCodeableConcept;
FName : TFhirHumanName;
FtelecomList : TFhirContactList;
FGender : TFhirCodeableConcept;
FAddress : TFhirAddress;
FphotoList : TFhirAttachmentList;
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
Procedure SetRelationship(value : TFhirCodeableConcept);
Procedure SetName(value : TFhirHumanName);
Procedure SetGender(value : TFhirCodeableConcept);
Procedure SetAddress(value : TFhirAddress);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirRelatedPerson; overload;
function Clone : TFhirRelatedPerson; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Identifier for a person within a particular scope.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member patient
The patient this person is related to.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member relationship
The nature of the relationship between a patient and the related person.
}
property relationship : TFhirCodeableConcept read FRelationship write SetRelationship;
property relationshipObject : TFhirCodeableConcept read FRelationship write SetRelationship;
{@member name
A name associated with the person.
}
property name : TFhirHumanName read FName write SetName;
property nameObject : TFhirHumanName read FName write SetName;
{@member telecomList
A contact detail for the person, e.g. a telephone number or an email address.
}
property telecomList : TFhirContactList read FTelecomList;
{@member gender
Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
}
property gender : TFhirCodeableConcept read FGender write SetGender;
property genderObject : TFhirCodeableConcept read FGender write SetGender;
{@member address
Address where the related person can be contacted or visited.
}
property address : TFhirAddress read FAddress write SetAddress;
property addressObject : TFhirAddress read FAddress write SetAddress;
{@member photoList
Image of the person.
}
property photoList : TFhirAttachmentList read FPhotoList;
end;
{@Class TFhirSecurityEvent : TFhirResource
A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.
}
{!.Net HL7Connect.Fhir.SecurityEvent}
TFhirSecurityEvent = class (TFhirResource)
private
FEvent : TFhirSecurityEventEvent;
FparticipantList : TFhirSecurityEventParticipantList;
FSource : TFhirSecurityEventSource;
Fobject_List : TFhirSecurityEventObjectList;
Procedure SetEvent(value : TFhirSecurityEventEvent);
Procedure SetSource(value : TFhirSecurityEventSource);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirSecurityEvent; overload;
function Clone : TFhirSecurityEvent; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member event
Identifies the name, action type, time, and disposition of the audited event.
}
property event : TFhirSecurityEventEvent read FEvent write SetEvent;
property eventObject : TFhirSecurityEventEvent read FEvent write SetEvent;
{@member participantList
A person, a hardware device or software process.
}
property participantList : TFhirSecurityEventParticipantList read FParticipantList;
{@member source
Application systems and processes.
}
property source : TFhirSecurityEventSource read FSource write SetSource;
property sourceObject : TFhirSecurityEventSource read FSource write SetSource;
{@member object_List
Specific instances of data or objects that have been accessed.
}
property object_List : TFhirSecurityEventObjectList read FObject_List;
end;
{@Class TFhirSpecimen : TFhirResource
Sample for analysis.
}
{!.Net HL7Connect.Fhir.Specimen}
TFhirSpecimen = class (TFhirResource)
private
FidentifierList : TFhirIdentifierList;
FType_ : TFhirCodeableConcept;
FsourceList : TFhirSpecimenSourceList;
FSubject : TFhirResourceReference{Resource};
FAccessionIdentifier : TFhirIdentifier;
FReceivedTime : TFhirDateTime;
FCollection : TFhirSpecimenCollection;
FtreatmentList : TFhirSpecimenTreatmentList;
FcontainerList : TFhirSpecimenContainerList;
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetSubject(value : TFhirResourceReference{Resource});
Procedure SetAccessionIdentifier(value : TFhirIdentifier);
Procedure SetReceivedTime(value : TFhirDateTime);
Function GetReceivedTimeST : TDateTimeEx;
Procedure SetReceivedTimeST(value : TDateTimeEx);
Procedure SetCollection(value : TFhirSpecimenCollection);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirSpecimen; overload;
function Clone : TFhirSpecimen; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifierList
Id for specimen.
}
property identifierList : TFhirIdentifierList read FIdentifierList;
{@member type_
Kind of material that forms the specimen.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member sourceList
Parent specimen from which the focal specimen was a component.
}
property sourceList : TFhirSpecimenSourceList read FSourceList;
{@member subject
Where the specimen came from. This may be the patient(s) or from the environment or a device.
}
property subject : TFhirResourceReference{Resource} read FSubject write SetSubject;
property subjectObject : TFhirResourceReference{Resource} read FSubject write SetSubject;
{@member accessionIdentifier
The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.
}
property accessionIdentifier : TFhirIdentifier read FAccessionIdentifier write SetAccessionIdentifier;
property accessionIdentifierObject : TFhirIdentifier read FAccessionIdentifier write SetAccessionIdentifier;
{@member receivedTime
Time when specimen was received for processing or testing.
}
{@member receivedTime
Typed access to Time when specimen was received for processing or testing.
}
property receivedTime : TDateTimeEx read GetReceivedTimeST write SetReceivedTimeST;
property receivedTimeObject : TFhirDateTime read FReceivedTime write SetReceivedTime;
{@member collection
Details concerning the specimen collection.
}
property collection : TFhirSpecimenCollection read FCollection write SetCollection;
property collectionObject : TFhirSpecimenCollection read FCollection write SetCollection;
{@member treatmentList
Details concerning treatment and processing steps for the specimen.
}
property treatmentList : TFhirSpecimenTreatmentList read FTreatmentList;
{@member containerList
The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.
}
property containerList : TFhirSpecimenContainerList read FContainerList;
end;
{@Class TFhirSubstance : TFhirResource
A homogeneous material with a definite composition.
}
{!.Net HL7Connect.Fhir.Substance}
TFhirSubstance = class (TFhirResource)
private
FType_ : TFhirCodeableConcept;
FDescription : TFhirString;
FInstance : TFhirSubstanceInstance;
FingredientList : TFhirSubstanceIngredientList;
Procedure SetType_(value : TFhirCodeableConcept);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetInstance(value : TFhirSubstanceInstance);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirSubstance; overload;
function Clone : TFhirSubstance; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member type_
A code (or set of codes) that identify this substance.
}
property type_ : TFhirCodeableConcept read FType_ write SetType_;
property type_Object : TFhirCodeableConcept read FType_ write SetType_;
{@member description
A description of the substance - its appearance, handling requirements, and other usage notes.
}
{@member description
Typed access to A description of the substance - its appearance, handling requirements, and other usage notes.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member instance
Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance.
}
property instance : TFhirSubstanceInstance read FInstance write SetInstance;
property instanceObject : TFhirSubstanceInstance read FInstance write SetInstance;
{@member ingredientList
A substance can be composed of other substances.
}
property ingredientList : TFhirSubstanceIngredientList read FIngredientList;
end;
{@Class TFhirSupply : TFhirResource
A supply - a request for something, and provision of what is supplied.
}
{!.Net HL7Connect.Fhir.Supply}
TFhirSupply = class (TFhirResource)
private
FKind : TFhirCodeableConcept;
FIdentifier : TFhirIdentifier;
FStatus : TFhirEnum;
FOrderedItem : TFhirResourceReference{Resource};
FPatient : TFhirResourceReference{TFhirPatient};
FdispenseList : TFhirSupplyDispenseList;
Procedure SetKind(value : TFhirCodeableConcept);
Procedure SetIdentifier(value : TFhirIdentifier);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirValuesetSupplyStatus;
Procedure SetStatusST(value : TFhirValuesetSupplyStatus);
Procedure SetOrderedItem(value : TFhirResourceReference{Resource});
Procedure SetPatient(value : TFhirResourceReference{TFhirPatient});
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirSupply; overload;
function Clone : TFhirSupply; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member kind
Category of supply, e.g. central, non-stock, etc. This is used to support work flows associated with the supply process.
}
property kind : TFhirCodeableConcept read FKind write SetKind;
property kindObject : TFhirCodeableConcept read FKind write SetKind;
{@member identifier
Unique identifier for this supply request.
}
property identifier : TFhirIdentifier read FIdentifier write SetIdentifier;
property identifierObject : TFhirIdentifier read FIdentifier write SetIdentifier;
{@member status
Status of the supply request.
}
property status : TFhirValuesetSupplyStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member orderedItem
The item that is requested to be supplied.
}
property orderedItem : TFhirResourceReference{Resource} read FOrderedItem write SetOrderedItem;
property orderedItemObject : TFhirResourceReference{Resource} read FOrderedItem write SetOrderedItem;
{@member patient
A link to a resource representing the person whom the ordered item is for.
}
property patient : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
property patientObject : TFhirResourceReference{TFhirPatient} read FPatient write SetPatient;
{@member dispenseList
Indicates the details of the dispense event such as the days supply and quantity of a supply dispensed.
}
property dispenseList : TFhirSupplyDispenseList read FDispenseList;
end;
{@Class TFhirValueSet : TFhirResource
A value set specifies a set of codes drawn from one or more code systems.
}
{!.Net HL7Connect.Fhir.ValueSet}
TFhirValueSet = class (TFhirResource)
private
FIdentifier : TFhirString;
FVersion : TFhirString;
FName : TFhirString;
FPublisher : TFhirString;
FtelecomList : TFhirContactList;
FDescription : TFhirString;
FCopyright : TFhirString;
FStatus : TFhirEnum;
FExperimental : TFhirBoolean;
FExtensible : TFhirBoolean;
FDate : TFhirDateTime;
FDefine : TFhirValueSetDefine;
FCompose : TFhirValueSetCompose;
FExpansion : TFhirValueSetExpansion;
Procedure SetIdentifier(value : TFhirString);
Function GetIdentifierST : String;
Procedure SetIdentifierST(value : String);
Procedure SetVersion(value : TFhirString);
Function GetVersionST : String;
Procedure SetVersionST(value : String);
Procedure SetName(value : TFhirString);
Function GetNameST : String;
Procedure SetNameST(value : String);
Procedure SetPublisher(value : TFhirString);
Function GetPublisherST : String;
Procedure SetPublisherST(value : String);
Procedure SetDescription(value : TFhirString);
Function GetDescriptionST : String;
Procedure SetDescriptionST(value : String);
Procedure SetCopyright(value : TFhirString);
Function GetCopyrightST : String;
Procedure SetCopyrightST(value : String);
Procedure SetStatus(value : TFhirEnum);
Function GetStatusST : TFhirValuesetStatus;
Procedure SetStatusST(value : TFhirValuesetStatus);
Procedure SetExperimental(value : TFhirBoolean);
Function GetExperimentalST : Boolean;
Procedure SetExperimentalST(value : Boolean);
Procedure SetExtensible(value : TFhirBoolean);
Function GetExtensibleST : Boolean;
Procedure SetExtensibleST(value : Boolean);
Procedure SetDate(value : TFhirDateTime);
Function GetDateST : TDateTimeEx;
Procedure SetDateST(value : TDateTimeEx);
Procedure SetDefine(value : TFhirValueSetDefine);
Procedure SetCompose(value : TFhirValueSetCompose);
Procedure SetExpansion(value : TFhirValueSetExpansion);
protected
Procedure GetChildrenByName(child_name : string; list : TFHIRObjectList); override;
Procedure ListProperties(oList : TFHIRPropertyList; bInheritedProperties : Boolean); Override;
Function GetHasASummary : Boolean; Override;
function GetResourceType : TFhirResourceType; override;
public
constructor Create; Override;
destructor Destroy; override;
{!script hide}
procedure Assign(oSource : TAdvObject); override;
function Link : TFhirValueSet; overload;
function Clone : TFhirValueSet; overload;
procedure setProperty(propName : string; propValue : TFHIRObject); override;
function FhirType : string; override;
{!script show}
published
{@member identifier
The identifier that is used to identify this value set when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
{@member identifier
Typed access to The identifier that is used to identify this value set when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).
}
property identifier : String read GetIdentifierST write SetIdentifierST;
property identifierObject : TFhirString read FIdentifier write SetIdentifier;
{@member version
The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
{@member version
Typed access to The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
}
property version : String read GetVersionST write SetVersionST;
property versionObject : TFhirString read FVersion write SetVersion;
{@member name
A free text natural language name describing the value set.
}
{@member name
Typed access to A free text natural language name describing the value set.
}
property name : String read GetNameST write SetNameST;
property nameObject : TFhirString read FName write SetName;
{@member publisher
The name of the individual or organization that published the value set.
}
{@member publisher
Typed access to The name of the individual or organization that published the value set.
}
property publisher : String read GetPublisherST write SetPublisherST;
property publisherObject : TFhirString read FPublisher write SetPublisher;
{@member telecomList
Contacts of the publisher to assist a user in finding and communicating with the publisher.
}
property telecomList : TFhirContactList read FTelecomList;
{@member description
A free text natural language description of the use of the value set - reason for definition, conditions of use, etc.
}
{@member description
Typed access to A free text natural language description of the use of the value set - reason for definition, conditions of use, etc.
}
property description : String read GetDescriptionST write SetDescriptionST;
property descriptionObject : TFhirString read FDescription write SetDescription;
{@member copyright
A copyright statement relating to the value set and/or its contents.
}
{@member copyright
Typed access to A copyright statement relating to the value set and/or its contents.
}
property copyright : String read GetCopyrightST write SetCopyrightST;
property copyrightObject : TFhirString read FCopyright write SetCopyright;
{@member status
The status of the value set.
}
property status : TFhirValuesetStatus read GetStatusST write SetStatusST;
property statusObject : TFhirEnum read FStatus write SetStatus;
{@member experimental
This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
{@member experimental
Typed access to This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
}
property experimental : Boolean read GetExperimentalST write SetExperimentalST;
property experimentalObject : TFhirBoolean read FExperimental write SetExperimental;
{@member extensible
Whether this is intended to be used with an extensible binding or not.
}
{@member extensible
Typed access to Whether this is intended to be used with an extensible binding or not.
}
property extensible : Boolean read GetExtensibleST write SetExtensibleST;
property extensibleObject : TFhirBoolean read FExtensible write SetExtensible;
{@member date
The date that the value set status was last changed.
}
{@member date
Typed access to The date that the value set status was last changed.
}
property date : TDateTimeEx read GetDateST write SetDateST;
property dateObject : TFhirDateTime read FDate write SetDate;
{@member define
When value set defines its own codes.
}
property define : TFhirValueSetDefine read FDefine write SetDefine;
property defineObject : TFhirValueSetDefine read FDefine write SetDefine;
{@member compose
When value set includes codes from elsewhere.
}
property compose : TFhirValueSetCompose read FCompose write SetCompose;
property composeObject : TFhirValueSetCompose read FCompose write SetCompose;
{@member expansion
When value set is an expansion.
}
property expansion : TFhirValueSetExpansion read FExpansion write SetExpansion;
property expansionObject : TFhirValueSetExpansion read FExpansion write SetExpansion;
end;
TFhirResourceFactory = class (TFHIRBaseFactory)
public
{@member newEnum
create a new enum
}
{!script nolink}
function newEnum : TFhirEnum;
{@member makeEnum
create a new enum with the given value
}
{!script nolink}
function makeEnum(value : String) : TFhirEnum;
{@member newInteger
create a new integer
}
{!script nolink}
function newInteger : TFhirInteger;
{@member makeInteger
create a new integer with the given value
}
{!script nolink}
function makeInteger(value : String) : TFhirInteger;
{@member newDateTime
create a new dateTime
}
{!script nolink}
function newDateTime : TFhirDateTime;
{@member makeDateTime
create a new dateTime with the given value
}
{!script nolink}
function makeDateTime(value : TDateTimeEx) : TFhirDateTime;
{@member newDate
create a new date
}
{!script nolink}
function newDate : TFhirDate;
{@member makeDate
create a new date with the given value
}
{!script nolink}
function makeDate(value : TDateTimeEx) : TFhirDate;
{@member newDecimal
create a new decimal
}
{!script nolink}
function newDecimal : TFhirDecimal;
{@member makeDecimal
create a new decimal with the given value
}
{!script nolink}
function makeDecimal(value : String) : TFhirDecimal;
{@member newUri
create a new uri
}
{!script nolink}
function newUri : TFhirUri;
{@member makeUri
create a new uri with the given value
}
{!script nolink}
function makeUri(value : String) : TFhirUri;
{@member newBase64Binary
create a new base64Binary
}
{!script nolink}
function newBase64Binary : TFhirBase64Binary;
{@member makeBase64Binary
create a new base64Binary with the given value
}
{!script nolink}
function makeBase64Binary(value : String) : TFhirBase64Binary;
{@member newString
create a new string
}
{!script nolink}
function newString : TFhirString;
{@member makeString
create a new string with the given value
}
{!script nolink}
function makeString(value : String) : TFhirString;
{@member newBoolean
create a new boolean
}
{!script nolink}
function newBoolean : TFhirBoolean;
{@member makeBoolean
create a new boolean with the given value
}
{!script nolink}
function makeBoolean(value : Boolean) : TFhirBoolean;
{@member newInstant
create a new instant
}
{!script nolink}
function newInstant : TFhirInstant;
{@member makeInstant
create a new instant with the given value
}
{!script nolink}
function makeInstant(value : TDateTimeEx) : TFhirInstant;
{@member newCode
create a new code
}
{!script nolink}
function newCode : TFhirCode;
{@member makeCode
create a new code with the given value
}
{!script nolink}
function makeCode(value : String) : TFhirCode;
{@member newId
create a new id
}
{!script nolink}
function newId : TFhirId;
{@member makeId
create a new id with the given value
}
{!script nolink}
function makeId(value : String) : TFhirId;
{@member newOid
create a new oid
}
{!script nolink}
function newOid : TFhirOid;
{@member makeOid
create a new oid with the given value
}
{!script nolink}
function makeOid(value : String) : TFhirOid;
{@member newUuid
create a new uuid
}
{!script nolink}
function newUuid : TFhirUuid;
{@member makeUuid
create a new uuid with the given value
}
{!script nolink}
function makeUuid(value : String) : TFhirUuid;
{@member newExtension
create a new Extension
}
{!script nolink}
function newExtension : TFhirExtension;
{@member newNarrative
create a new Narrative
}
{!script nolink}
function newNarrative : TFhirNarrative;
{@member newPeriod
create a new Period
}
{!script nolink}
function newPeriod : TFhirPeriod;
{@member newCoding
create a new Coding
}
{!script nolink}
function newCoding : TFhirCoding;
{@member newRange
create a new Range
}
{!script nolink}
function newRange : TFhirRange;
{@member newQuantity
create a new Quantity
}
{!script nolink}
function newQuantity : TFhirQuantity;
{@member newAttachment
create a new Attachment
}
{!script nolink}
function newAttachment : TFhirAttachment;
{@member newRatio
create a new Ratio
}
{!script nolink}
function newRatio : TFhirRatio;
{@member newSampledData
create a new SampledData
}
{!script nolink}
function newSampledData : TFhirSampledData;
{@member newResourceReference
create a new ResourceReference
}
{!script nolink}
function newResourceReference : TFhirResourceReference;
{@member newCodeableConcept
create a new CodeableConcept
}
{!script nolink}
function newCodeableConcept : TFhirCodeableConcept;
{@member newIdentifier
create a new Identifier
}
{!script nolink}
function newIdentifier : TFhirIdentifier;
{@member newScheduleRepeat
create a new repeat
}
{!script nolink}
function newScheduleRepeat : TFhirScheduleRepeat;
{@member newSchedule
create a new Schedule
}
{!script nolink}
function newSchedule : TFhirSchedule;
{@member newContact
create a new Contact
}
{!script nolink}
function newContact : TFhirContact;
{@member newAddress
create a new Address
}
{!script nolink}
function newAddress : TFhirAddress;
{@member newHumanName
create a new HumanName
}
{!script nolink}
function newHumanName : TFhirHumanName;
{@member newAdverseReactionSymptom
create a new symptom
}
{!script nolink}
function newAdverseReactionSymptom : TFhirAdverseReactionSymptom;
{@member newAdverseReactionExposure
create a new exposure
}
{!script nolink}
function newAdverseReactionExposure : TFhirAdverseReactionExposure;
{@member newAdverseReaction
create a new AdverseReaction
}
{!script nolink}
function newAdverseReaction : TFhirAdverseReaction;
{@member newAlert
create a new Alert
}
{!script nolink}
function newAlert : TFhirAlert;
{@member newAllergyIntolerance
create a new AllergyIntolerance
}
{!script nolink}
function newAllergyIntolerance : TFhirAllergyIntolerance;
{@member newCarePlanParticipant
create a new participant
}
{!script nolink}
function newCarePlanParticipant : TFhirCarePlanParticipant;
{@member newCarePlanGoal
create a new goal
}
{!script nolink}
function newCarePlanGoal : TFhirCarePlanGoal;
{@member newCarePlanActivity
create a new activity
}
{!script nolink}
function newCarePlanActivity : TFhirCarePlanActivity;
{@member newCarePlanActivitySimple
create a new simple
}
{!script nolink}
function newCarePlanActivitySimple : TFhirCarePlanActivitySimple;
{@member newCarePlan
create a new CarePlan
}
{!script nolink}
function newCarePlan : TFhirCarePlan;
{@member newCompositionAttester
create a new attester
}
{!script nolink}
function newCompositionAttester : TFhirCompositionAttester;
{@member newCompositionEvent
create a new event
}
{!script nolink}
function newCompositionEvent : TFhirCompositionEvent;
{@member newCompositionSection
create a new section
}
{!script nolink}
function newCompositionSection : TFhirCompositionSection;
{@member newComposition
create a new Composition
}
{!script nolink}
function newComposition : TFhirComposition;
{@member newConceptMapConcept
create a new concept
}
{!script nolink}
function newConceptMapConcept : TFhirConceptMapConcept;
{@member newConceptMapConceptDependsOn
create a new dependsOn
}
{!script nolink}
function newConceptMapConceptDependsOn : TFhirConceptMapConceptDependsOn;
{@member newConceptMapConceptMap
create a new map
}
{!script nolink}
function newConceptMapConceptMap : TFhirConceptMapConceptMap;
{@member newConceptMap
create a new ConceptMap
}
{!script nolink}
function newConceptMap : TFhirConceptMap;
{@member newConditionStage
create a new stage
}
{!script nolink}
function newConditionStage : TFhirConditionStage;
{@member newConditionEvidence
create a new evidence
}
{!script nolink}
function newConditionEvidence : TFhirConditionEvidence;
{@member newConditionLocation
create a new location
}
{!script nolink}
function newConditionLocation : TFhirConditionLocation;
{@member newConditionRelatedItem
create a new relatedItem
}
{!script nolink}
function newConditionRelatedItem : TFhirConditionRelatedItem;
{@member newCondition
create a new Condition
}
{!script nolink}
function newCondition : TFhirCondition;
{@member newConformanceSoftware
create a new software
}
{!script nolink}
function newConformanceSoftware : TFhirConformanceSoftware;
{@member newConformanceImplementation
create a new implementation
}
{!script nolink}
function newConformanceImplementation : TFhirConformanceImplementation;
{@member newConformanceRest
create a new rest
}
{!script nolink}
function newConformanceRest : TFhirConformanceRest;
{@member newConformanceRestSecurity
create a new security
}
{!script nolink}
function newConformanceRestSecurity : TFhirConformanceRestSecurity;
{@member newConformanceRestSecurityCertificate
create a new certificate
}
{!script nolink}
function newConformanceRestSecurityCertificate : TFhirConformanceRestSecurityCertificate;
{@member newConformanceRestResource
create a new resource
}
{!script nolink}
function newConformanceRestResource : TFhirConformanceRestResource;
{@member newConformanceRestResourceOperation
create a new operation
}
{!script nolink}
function newConformanceRestResourceOperation : TFhirConformanceRestResourceOperation;
{@member newConformanceRestResourceSearchParam
create a new searchParam
}
{!script nolink}
function newConformanceRestResourceSearchParam : TFhirConformanceRestResourceSearchParam;
{@member newConformanceRestOperation
create a new operation
}
{!script nolink}
function newConformanceRestOperation : TFhirConformanceRestOperation;
{@member newConformanceRestQuery
create a new query
}
{!script nolink}
function newConformanceRestQuery : TFhirConformanceRestQuery;
{@member newConformanceMessaging
create a new messaging
}
{!script nolink}
function newConformanceMessaging : TFhirConformanceMessaging;
{@member newConformanceMessagingEvent
create a new event
}
{!script nolink}
function newConformanceMessagingEvent : TFhirConformanceMessagingEvent;
{@member newConformanceDocument
create a new document
}
{!script nolink}
function newConformanceDocument : TFhirConformanceDocument;
{@member newConformance
create a new Conformance
}
{!script nolink}
function newConformance : TFhirConformance;
{@member newDevice
create a new Device
}
{!script nolink}
function newDevice : TFhirDevice;
{@member newDeviceObservationReportVirtualDevice
create a new virtualDevice
}
{!script nolink}
function newDeviceObservationReportVirtualDevice : TFhirDeviceObservationReportVirtualDevice;
{@member newDeviceObservationReportVirtualDeviceChannel
create a new channel
}
{!script nolink}
function newDeviceObservationReportVirtualDeviceChannel : TFhirDeviceObservationReportVirtualDeviceChannel;
{@member newDeviceObservationReportVirtualDeviceChannelMetric
create a new metric
}
{!script nolink}
function newDeviceObservationReportVirtualDeviceChannelMetric : TFhirDeviceObservationReportVirtualDeviceChannelMetric;
{@member newDeviceObservationReport
create a new DeviceObservationReport
}
{!script nolink}
function newDeviceObservationReport : TFhirDeviceObservationReport;
{@member newDiagnosticOrderEvent
create a new event
}
{!script nolink}
function newDiagnosticOrderEvent : TFhirDiagnosticOrderEvent;
{@member newDiagnosticOrderItem
create a new item
}
{!script nolink}
function newDiagnosticOrderItem : TFhirDiagnosticOrderItem;
{@member newDiagnosticOrder
create a new DiagnosticOrder
}
{!script nolink}
function newDiagnosticOrder : TFhirDiagnosticOrder;
{@member newDiagnosticReportImage
create a new image
}
{!script nolink}
function newDiagnosticReportImage : TFhirDiagnosticReportImage;
{@member newDiagnosticReport
create a new DiagnosticReport
}
{!script nolink}
function newDiagnosticReport : TFhirDiagnosticReport;
{@member newDocumentManifest
create a new DocumentManifest
}
{!script nolink}
function newDocumentManifest : TFhirDocumentManifest;
{@member newDocumentReferenceRelatesTo
create a new relatesTo
}
{!script nolink}
function newDocumentReferenceRelatesTo : TFhirDocumentReferenceRelatesTo;
{@member newDocumentReferenceService
create a new service
}
{!script nolink}
function newDocumentReferenceService : TFhirDocumentReferenceService;
{@member newDocumentReferenceServiceParameter
create a new parameter
}
{!script nolink}
function newDocumentReferenceServiceParameter : TFhirDocumentReferenceServiceParameter;
{@member newDocumentReferenceContext
create a new context
}
{!script nolink}
function newDocumentReferenceContext : TFhirDocumentReferenceContext;
{@member newDocumentReference
create a new DocumentReference
}
{!script nolink}
function newDocumentReference : TFhirDocumentReference;
{@member newEncounterParticipant
create a new participant
}
{!script nolink}
function newEncounterParticipant : TFhirEncounterParticipant;
{@member newEncounterHospitalization
create a new hospitalization
}
{!script nolink}
function newEncounterHospitalization : TFhirEncounterHospitalization;
{@member newEncounterHospitalizationAccomodation
create a new accomodation
}
{!script nolink}
function newEncounterHospitalizationAccomodation : TFhirEncounterHospitalizationAccomodation;
{@member newEncounterLocation
create a new location
}
{!script nolink}
function newEncounterLocation : TFhirEncounterLocation;
{@member newEncounter
create a new Encounter
}
{!script nolink}
function newEncounter : TFhirEncounter;
{@member newFamilyHistoryRelation
create a new relation
}
{!script nolink}
function newFamilyHistoryRelation : TFhirFamilyHistoryRelation;
{@member newFamilyHistoryRelationCondition
create a new condition
}
{!script nolink}
function newFamilyHistoryRelationCondition : TFhirFamilyHistoryRelationCondition;
{@member newFamilyHistory
create a new FamilyHistory
}
{!script nolink}
function newFamilyHistory : TFhirFamilyHistory;
{@member newGroupCharacteristic
create a new characteristic
}
{!script nolink}
function newGroupCharacteristic : TFhirGroupCharacteristic;
{@member newGroup
create a new Group
}
{!script nolink}
function newGroup : TFhirGroup;
{@member newImagingStudySeries
create a new series
}
{!script nolink}
function newImagingStudySeries : TFhirImagingStudySeries;
{@member newImagingStudySeriesInstance
create a new instance
}
{!script nolink}
function newImagingStudySeriesInstance : TFhirImagingStudySeriesInstance;
{@member newImagingStudy
create a new ImagingStudy
}
{!script nolink}
function newImagingStudy : TFhirImagingStudy;
{@member newImmunizationExplanation
create a new explanation
}
{!script nolink}
function newImmunizationExplanation : TFhirImmunizationExplanation;
{@member newImmunizationReaction
create a new reaction
}
{!script nolink}
function newImmunizationReaction : TFhirImmunizationReaction;
{@member newImmunizationVaccinationProtocol
create a new vaccinationProtocol
}
{!script nolink}
function newImmunizationVaccinationProtocol : TFhirImmunizationVaccinationProtocol;
{@member newImmunization
create a new Immunization
}
{!script nolink}
function newImmunization : TFhirImmunization;
{@member newImmunizationRecommendationRecommendation
create a new recommendation
}
{!script nolink}
function newImmunizationRecommendationRecommendation : TFhirImmunizationRecommendationRecommendation;
{@member newImmunizationRecommendationRecommendationDateCriterion
create a new dateCriterion
}
{!script nolink}
function newImmunizationRecommendationRecommendationDateCriterion : TFhirImmunizationRecommendationRecommendationDateCriterion;
{@member newImmunizationRecommendationRecommendationProtocol
create a new protocol
}
{!script nolink}
function newImmunizationRecommendationRecommendationProtocol : TFhirImmunizationRecommendationRecommendationProtocol;
{@member newImmunizationRecommendation
create a new ImmunizationRecommendation
}
{!script nolink}
function newImmunizationRecommendation : TFhirImmunizationRecommendation;
{@member newListEntry
create a new entry
}
{!script nolink}
function newListEntry : TFhirListEntry;
{@member newList
create a new List
}
{!script nolink}
function newList : TFhirList;
{@member newLocationPosition
create a new position
}
{!script nolink}
function newLocationPosition : TFhirLocationPosition;
{@member newLocation
create a new Location
}
{!script nolink}
function newLocation : TFhirLocation;
{@member newMedia
create a new Media
}
{!script nolink}
function newMedia : TFhirMedia;
{@member newMedicationProduct
create a new product
}
{!script nolink}
function newMedicationProduct : TFhirMedicationProduct;
{@member newMedicationProductIngredient
create a new ingredient
}
{!script nolink}
function newMedicationProductIngredient : TFhirMedicationProductIngredient;
{@member newMedicationPackage
create a new package
}
{!script nolink}
function newMedicationPackage : TFhirMedicationPackage;
{@member newMedicationPackageContent
create a new content
}
{!script nolink}
function newMedicationPackageContent : TFhirMedicationPackageContent;
{@member newMedication
create a new Medication
}
{!script nolink}
function newMedication : TFhirMedication;
{@member newMedicationAdministrationDosage
create a new dosage
}
{!script nolink}
function newMedicationAdministrationDosage : TFhirMedicationAdministrationDosage;
{@member newMedicationAdministration
create a new MedicationAdministration
}
{!script nolink}
function newMedicationAdministration : TFhirMedicationAdministration;
{@member newMedicationDispenseDispense
create a new dispense
}
{!script nolink}
function newMedicationDispenseDispense : TFhirMedicationDispenseDispense;
{@member newMedicationDispenseDispenseDosage
create a new dosage
}
{!script nolink}
function newMedicationDispenseDispenseDosage : TFhirMedicationDispenseDispenseDosage;
{@member newMedicationDispenseSubstitution
create a new substitution
}
{!script nolink}
function newMedicationDispenseSubstitution : TFhirMedicationDispenseSubstitution;
{@member newMedicationDispense
create a new MedicationDispense
}
{!script nolink}
function newMedicationDispense : TFhirMedicationDispense;
{@member newMedicationPrescriptionDosageInstruction
create a new dosageInstruction
}
{!script nolink}
function newMedicationPrescriptionDosageInstruction : TFhirMedicationPrescriptionDosageInstruction;
{@member newMedicationPrescriptionDispense
create a new dispense
}
{!script nolink}
function newMedicationPrescriptionDispense : TFhirMedicationPrescriptionDispense;
{@member newMedicationPrescriptionSubstitution
create a new substitution
}
{!script nolink}
function newMedicationPrescriptionSubstitution : TFhirMedicationPrescriptionSubstitution;
{@member newMedicationPrescription
create a new MedicationPrescription
}
{!script nolink}
function newMedicationPrescription : TFhirMedicationPrescription;
{@member newMedicationStatementDosage
create a new dosage
}
{!script nolink}
function newMedicationStatementDosage : TFhirMedicationStatementDosage;
{@member newMedicationStatement
create a new MedicationStatement
}
{!script nolink}
function newMedicationStatement : TFhirMedicationStatement;
{@member newMessageHeaderResponse
create a new response
}
{!script nolink}
function newMessageHeaderResponse : TFhirMessageHeaderResponse;
{@member newMessageHeaderSource
create a new source
}
{!script nolink}
function newMessageHeaderSource : TFhirMessageHeaderSource;
{@member newMessageHeaderDestination
create a new destination
}
{!script nolink}
function newMessageHeaderDestination : TFhirMessageHeaderDestination;
{@member newMessageHeader
create a new MessageHeader
}
{!script nolink}
function newMessageHeader : TFhirMessageHeader;
{@member newObservationReferenceRange
create a new referenceRange
}
{!script nolink}
function newObservationReferenceRange : TFhirObservationReferenceRange;
{@member newObservationRelated
create a new related
}
{!script nolink}
function newObservationRelated : TFhirObservationRelated;
{@member newObservation
create a new Observation
}
{!script nolink}
function newObservation : TFhirObservation;
{@member newOperationOutcomeIssue
create a new issue
}
{!script nolink}
function newOperationOutcomeIssue : TFhirOperationOutcomeIssue;
{@member newOperationOutcome
create a new OperationOutcome
}
{!script nolink}
function newOperationOutcome : TFhirOperationOutcome;
{@member newOrderWhen
create a new when
}
{!script nolink}
function newOrderWhen : TFhirOrderWhen;
{@member newOrder
create a new Order
}
{!script nolink}
function newOrder : TFhirOrder;
{@member newOrderResponse
create a new OrderResponse
}
{!script nolink}
function newOrderResponse : TFhirOrderResponse;
{@member newOrganizationContact
create a new contact
}
{!script nolink}
function newOrganizationContact : TFhirOrganizationContact;
{@member newOrganization
create a new Organization
}
{!script nolink}
function newOrganization : TFhirOrganization;
{@member newOther
create a new Other
}
{!script nolink}
function newOther : TFhirOther;
{@member newPatientContact
create a new contact
}
{!script nolink}
function newPatientContact : TFhirPatientContact;
{@member newPatientAnimal
create a new animal
}
{!script nolink}
function newPatientAnimal : TFhirPatientAnimal;
{@member newPatientLink
create a new link
}
{!script nolink}
function newPatientLink : TFhirPatientLink;
{@member newPatient
create a new Patient
}
{!script nolink}
function newPatient : TFhirPatient;
{@member newPractitionerQualification
create a new qualification
}
{!script nolink}
function newPractitionerQualification : TFhirPractitionerQualification;
{@member newPractitioner
create a new Practitioner
}
{!script nolink}
function newPractitioner : TFhirPractitioner;
{@member newProcedurePerformer
create a new performer
}
{!script nolink}
function newProcedurePerformer : TFhirProcedurePerformer;
{@member newProcedureRelatedItem
create a new relatedItem
}
{!script nolink}
function newProcedureRelatedItem : TFhirProcedureRelatedItem;
{@member newProcedure
create a new Procedure
}
{!script nolink}
function newProcedure : TFhirProcedure;
{@member newProfileMapping
create a new mapping
}
{!script nolink}
function newProfileMapping : TFhirProfileMapping;
{@member newProfileStructure
create a new structure
}
{!script nolink}
function newProfileStructure : TFhirProfileStructure;
{@member newProfileStructureElement
create a new element
}
{!script nolink}
function newProfileStructureElement : TFhirProfileStructureElement;
{@member newProfileStructureElementSlicing
create a new slicing
}
{!script nolink}
function newProfileStructureElementSlicing : TFhirProfileStructureElementSlicing;
{@member newProfileStructureElementDefinition
create a new definition
}
{!script nolink}
function newProfileStructureElementDefinition : TFhirProfileStructureElementDefinition;
{@member newProfileStructureElementDefinitionType
create a new type
}
{!script nolink}
function newProfileStructureElementDefinitionType : TFhirProfileStructureElementDefinitionType;
{@member newProfileStructureElementDefinitionConstraint
create a new constraint
}
{!script nolink}
function newProfileStructureElementDefinitionConstraint : TFhirProfileStructureElementDefinitionConstraint;
{@member newProfileStructureElementDefinitionBinding
create a new binding
}
{!script nolink}
function newProfileStructureElementDefinitionBinding : TFhirProfileStructureElementDefinitionBinding;
{@member newProfileStructureElementDefinitionMapping
create a new mapping
}
{!script nolink}
function newProfileStructureElementDefinitionMapping : TFhirProfileStructureElementDefinitionMapping;
{@member newProfileStructureSearchParam
create a new searchParam
}
{!script nolink}
function newProfileStructureSearchParam : TFhirProfileStructureSearchParam;
{@member newProfileExtensionDefn
create a new extensionDefn
}
{!script nolink}
function newProfileExtensionDefn : TFhirProfileExtensionDefn;
{@member newProfileQuery
create a new query
}
{!script nolink}
function newProfileQuery : TFhirProfileQuery;
{@member newProfile
create a new Profile
}
{!script nolink}
function newProfile : TFhirProfile;
{@member newProvenanceAgent
create a new agent
}
{!script nolink}
function newProvenanceAgent : TFhirProvenanceAgent;
{@member newProvenanceEntity
create a new entity
}
{!script nolink}
function newProvenanceEntity : TFhirProvenanceEntity;
{@member newProvenance
create a new Provenance
}
{!script nolink}
function newProvenance : TFhirProvenance;
{@member newQueryResponse
create a new response
}
{!script nolink}
function newQueryResponse : TFhirQueryResponse;
{@member newQuery
create a new Query
}
{!script nolink}
function newQuery : TFhirQuery;
{@member newQuestionnaireGroup
create a new group
}
{!script nolink}
function newQuestionnaireGroup : TFhirQuestionnaireGroup;
{@member newQuestionnaireGroupQuestion
create a new question
}
{!script nolink}
function newQuestionnaireGroupQuestion : TFhirQuestionnaireGroupQuestion;
{@member newQuestionnaire
create a new Questionnaire
}
{!script nolink}
function newQuestionnaire : TFhirQuestionnaire;
{@member newRelatedPerson
create a new RelatedPerson
}
{!script nolink}
function newRelatedPerson : TFhirRelatedPerson;
{@member newSecurityEventEvent
create a new event
}
{!script nolink}
function newSecurityEventEvent : TFhirSecurityEventEvent;
{@member newSecurityEventParticipant
create a new participant
}
{!script nolink}
function newSecurityEventParticipant : TFhirSecurityEventParticipant;
{@member newSecurityEventParticipantNetwork
create a new network
}
{!script nolink}
function newSecurityEventParticipantNetwork : TFhirSecurityEventParticipantNetwork;
{@member newSecurityEventSource
create a new source
}
{!script nolink}
function newSecurityEventSource : TFhirSecurityEventSource;
{@member newSecurityEventObject
create a new object
}
{!script nolink}
function newSecurityEventObject : TFhirSecurityEventObject;
{@member newSecurityEventObjectDetail
create a new detail
}
{!script nolink}
function newSecurityEventObjectDetail : TFhirSecurityEventObjectDetail;
{@member newSecurityEvent
create a new SecurityEvent
}
{!script nolink}
function newSecurityEvent : TFhirSecurityEvent;
{@member newSpecimenSource
create a new source
}
{!script nolink}
function newSpecimenSource : TFhirSpecimenSource;
{@member newSpecimenCollection
create a new collection
}
{!script nolink}
function newSpecimenCollection : TFhirSpecimenCollection;
{@member newSpecimenTreatment
create a new treatment
}
{!script nolink}
function newSpecimenTreatment : TFhirSpecimenTreatment;
{@member newSpecimenContainer
create a new container
}
{!script nolink}
function newSpecimenContainer : TFhirSpecimenContainer;
{@member newSpecimen
create a new Specimen
}
{!script nolink}
function newSpecimen : TFhirSpecimen;
{@member newSubstanceInstance
create a new instance
}
{!script nolink}
function newSubstanceInstance : TFhirSubstanceInstance;
{@member newSubstanceIngredient
create a new ingredient
}
{!script nolink}
function newSubstanceIngredient : TFhirSubstanceIngredient;
{@member newSubstance
create a new Substance
}
{!script nolink}
function newSubstance : TFhirSubstance;
{@member newSupplyDispense
create a new dispense
}
{!script nolink}
function newSupplyDispense : TFhirSupplyDispense;
{@member newSupply
create a new Supply
}
{!script nolink}
function newSupply : TFhirSupply;
{@member newValueSetDefine
create a new define
}
{!script nolink}
function newValueSetDefine : TFhirValueSetDefine;
{@member newValueSetDefineConcept
create a new concept
}
{!script nolink}
function newValueSetDefineConcept : TFhirValueSetDefineConcept;
{@member newValueSetCompose
create a new compose
}
{!script nolink}
function newValueSetCompose : TFhirValueSetCompose;
{@member newValueSetComposeInclude
create a new include
}
{!script nolink}
function newValueSetComposeInclude : TFhirValueSetComposeInclude;
{@member newValueSetComposeIncludeFilter
create a new filter
}
{!script nolink}
function newValueSetComposeIncludeFilter : TFhirValueSetComposeIncludeFilter;
{@member newValueSetExpansion
create a new expansion
}
{!script nolink}
function newValueSetExpansion : TFhirValueSetExpansion;
{@member newValueSetExpansionContains
create a new contains
}
{!script nolink}
function newValueSetExpansionContains : TFhirValueSetExpansionContains;
{@member newValueSet
create a new ValueSet
}
{!script nolink}
function newValueSet : TFhirValueSet;
function makeByName(const name : String) : TFHIRElement;
end;
implementation
{ TFhirResource }
constructor TFhirResource.Create;
begin
FContainedList := TFhirResourceList.create;
inherited;
end;
destructor TFhirResource.Destroy;
begin
FText.Free;
FContainedList.Free;
inherited;
end;
procedure TFhirResource.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'contained') then
list.addAll(FContainedList);
if (child_name = 'text') then
list.add(text.Link);
end;
procedure TFhirResource.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'contained', 'Resource', FContainedList.Link));
oList.add(TFHIRProperty.create(self, 'text', 'Narrative', FText.Link));
end;
procedure TFhirResource.Assign(oSource : TAdvObject);
begin
inherited;
FFormat := TFhirResource(oSource).FFormat;
containedList.assign(TFhirResource(oSource).containedList);
text := TFhirResource(oSource).text.Clone;
end;
function TFhirResource.Link : TFhirResource;
begin
result := TFhirResource(inherited Link);
end;
function TFhirResource.Clone : TFhirResource;
begin
result := TFhirResource(inherited Clone);
end;
procedure TFhirResource.SetText(value : TFhirNarrative);
begin
FText.Free;
FText := value;
end;
procedure TFhirResource.SetLanguage(value : TFhirCode);
begin
FLanguage.Free;
FLanguage := value;
end;
constructor TFhirBinary.Create;
begin
inherited;
FContent := TAdvBuffer.create;
end;
destructor TFhirBinary.Destroy;
begin
FContent.free;
inherited;
end;
function TFhirBinary.GetResourceType : TFhirResourceType;
begin
result := frtBinary;
end;
function TFhirBinary.GetHasASummary : Boolean;
begin
result := false;
end;
{ TFhirResourceListEnumerator }
Constructor TFhirResourceListEnumerator.Create(list : TFhirResourceList);
begin
inherited Create;
FIndex := -1;
FList := list;
end;
Destructor TFhirResourceListEnumerator.Destroy;
begin
FList.Free;
inherited;
end;
function TFhirResourceListEnumerator.MoveNext : boolean;
begin
Result := FIndex < FList.count;
if Result then
Inc(FIndex);
end;
function TFhirResourceListEnumerator.GetCurrent : TFhirResource;
begin
Result := FList[FIndex];
end;
{ TFhirResourceList }
procedure TFhirResourceList.AddItem(value: TFhirResource);
begin
assert(value.ClassName = 'TFhirResource', 'Attempt to add an item of type '+value.ClassName+' to a List of TFhirResource');
add(value);
end;
procedure TFhirResourceList.ClearItems;
begin
Clear;
end;
function TFhirResourceList.GetEnumerator : TFhirResourceListEnumerator;
begin
result := TFhirResourceListEnumerator.Create(self.link);
end;
function TFhirResourceList.Clone: TFhirResourceList;
begin
result := TFhirResourceList(inherited Clone);
end;
function TFhirResourceList.Count: Integer;
begin
result := Inherited Count;
end;
function TFhirResourceList.GetItemN(index: Integer): TFhirResource;
begin
result := TFhirResource(ObjectByIndex[index]);
end;
function TFhirResourceList.IndexOf(value: TFhirResource): Integer;
begin
result := IndexByReference(value);
end;
procedure TFhirResourceList.InsertItem(index: Integer; value: TFhirResource);
begin
assert(value is TFhirResource);
Inherited Insert(index, value);
end;
function TFhirResourceList.Item(index: Integer): TFhirResource;
begin
result := TFhirResource(ObjectByIndex[index]);
end;
function TFhirResourceList.Link: TFhirResourceList;
begin
result := TFhirResourceList(inherited Link);
end;
procedure TFhirResourceList.Remove(index: Integer);
begin
DeleteByIndex(index);
end;
procedure TFhirResourceList.SetItemByIndex(index: Integer; value: TFhirResource);
begin
assert(value is TFhirResource);
FhirResources[index] := value;
end;
procedure TFhirResourceList.SetItemN(index: Integer; value: TFhirResource);
begin
assert(value is TFhirResource);
ObjectByIndex[index] := value;
end;
{ TFhirAdverseReaction }
constructor TFhirAdverseReaction.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FSymptomList := TFhirAdverseReactionSymptomList.Create;
FExposureList := TFhirAdverseReactionExposureList.Create;
end;
destructor TFhirAdverseReaction.Destroy;
begin
FIdentifierList.Free;
FDate.free;
FSubject.free;
FDidNotOccurFlag.free;
FRecorder.free;
FSymptomList.Free;
FExposureList.Free;
inherited;
end;
function TFhirAdverseReaction.GetResourceType : TFhirResourceType;
begin
result := frtAdverseReaction;
end;
function TFhirAdverseReaction.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirAdverseReaction.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirAdverseReaction(oSource).FIdentifierList);
dateObject := TFhirAdverseReaction(oSource).dateObject.Clone;
subject := TFhirAdverseReaction(oSource).subject.Clone;
didNotOccurFlagObject := TFhirAdverseReaction(oSource).didNotOccurFlagObject.Clone;
recorder := TFhirAdverseReaction(oSource).recorder.Clone;
FSymptomList.Assign(TFhirAdverseReaction(oSource).FSymptomList);
FExposureList.Assign(TFhirAdverseReaction(oSource).FExposureList);
end;
procedure TFhirAdverseReaction.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'didNotOccurFlag') Then
list.add(FDidNotOccurFlag.Link);
if (child_name = 'recorder') Then
list.add(FRecorder.Link);
if (child_name = 'symptom') Then
list.addAll(FSymptomList);
if (child_name = 'exposure') Then
list.addAll(FExposureList);
end;
procedure TFhirAdverseReaction.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'didNotOccurFlag', 'boolean', FDidNotOccurFlag.Link));{2}
oList.add(TFHIRProperty.create(self, 'recorder', 'Resource(Practitioner|Patient)', FRecorder.Link));{2}
oList.add(TFHIRProperty.create(self, 'symptom', '', FSymptomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'exposure', '', FExposureList.Link)){3};
end;
procedure TFhirAdverseReaction.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'didNotOccurFlag') then DidNotOccurFlagObject := propValue as TFhirBoolean{5a}
else if (propName = 'recorder') then Recorder := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'symptom') then SymptomList.add(propValue as TFhirAdverseReactionSymptom){2}
else if (propName = 'exposure') then ExposureList.add(propValue as TFhirAdverseReactionExposure){2}
else inherited;
end;
function TFhirAdverseReaction.FhirType : string;
begin
result := 'AdverseReaction';
end;
function TFhirAdverseReaction.Link : TFhirAdverseReaction;
begin
result := TFhirAdverseReaction(inherited Link);
end;
function TFhirAdverseReaction.Clone : TFhirAdverseReaction;
begin
result := TFhirAdverseReaction(inherited Clone);
end;
{ TFhirAdverseReaction }
Procedure TFhirAdverseReaction.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirAdverseReaction.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirAdverseReaction.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirAdverseReaction.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirAdverseReaction.SetDidNotOccurFlag(value : TFhirBoolean);
begin
FDidNotOccurFlag.free;
FDidNotOccurFlag := value;
end;
Function TFhirAdverseReaction.GetDidNotOccurFlagST : Boolean;
begin
if FDidNotOccurFlag = nil then
result := false
else
result := FDidNotOccurFlag.value;
end;
Procedure TFhirAdverseReaction.SetDidNotOccurFlagST(value : Boolean);
begin
if FDidNotOccurFlag = nil then
FDidNotOccurFlag := TFhirBoolean.create;
FDidNotOccurFlag.value := value
end;
Procedure TFhirAdverseReaction.SetRecorder(value : TFhirResourceReference{Resource});
begin
FRecorder.free;
FRecorder := value;
end;
{ TFhirAlert }
constructor TFhirAlert.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
end;
destructor TFhirAlert.Destroy;
begin
FIdentifierList.Free;
FCategory.free;
FStatus.free;
FSubject.free;
FAuthor.free;
FNote.free;
inherited;
end;
function TFhirAlert.GetResourceType : TFhirResourceType;
begin
result := frtAlert;
end;
function TFhirAlert.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirAlert.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirAlert(oSource).FIdentifierList);
category := TFhirAlert(oSource).category.Clone;
FStatus := TFhirAlert(oSource).FStatus.Link;
subject := TFhirAlert(oSource).subject.Clone;
author := TFhirAlert(oSource).author.Clone;
noteObject := TFhirAlert(oSource).noteObject.Clone;
end;
procedure TFhirAlert.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'category') Then
list.add(FCategory.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'author') Then
list.add(FAuthor.Link);
if (child_name = 'note') Then
list.add(FNote.Link);
end;
procedure TFhirAlert.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'category', 'CodeableConcept', FCategory.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'author', 'Resource(Practitioner|Patient|Device)', FAuthor.Link));{2}
oList.add(TFHIRProperty.create(self, 'note', 'string', FNote.Link));{2}
end;
procedure TFhirAlert.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'category') then Category := propValue as TFhirCodeableConcept{4b}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'author') then Author := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'note') then NoteObject := propValue as TFhirString{5a}
else inherited;
end;
function TFhirAlert.FhirType : string;
begin
result := 'Alert';
end;
function TFhirAlert.Link : TFhirAlert;
begin
result := TFhirAlert(inherited Link);
end;
function TFhirAlert.Clone : TFhirAlert;
begin
result := TFhirAlert(inherited Clone);
end;
{ TFhirAlert }
Procedure TFhirAlert.SetCategory(value : TFhirCodeableConcept);
begin
FCategory.free;
FCategory := value;
end;
Procedure TFhirAlert.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirAlert.GetStatusST : TFhirAlertStatus;
begin
if FStatus = nil then
result := TFhirAlertStatus(0)
else
result := TFhirAlertStatus(StringArrayIndexOfSensitive(CODES_TFhirAlertStatus, FStatus.value));
end;
Procedure TFhirAlert.SetStatusST(value : TFhirAlertStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirAlertStatus[value]);
end;
Procedure TFhirAlert.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirAlert.SetAuthor(value : TFhirResourceReference{Resource});
begin
FAuthor.free;
FAuthor := value;
end;
Procedure TFhirAlert.SetNote(value : TFhirString);
begin
FNote.free;
FNote := value;
end;
Function TFhirAlert.GetNoteST : String;
begin
if FNote = nil then
result := ''
else
result := FNote.value;
end;
Procedure TFhirAlert.SetNoteST(value : String);
begin
if value <> '' then
begin
if FNote = nil then
FNote := TFhirString.create;
FNote.value := value
end
else if FNote <> nil then
FNote.value := '';
end;
{ TFhirAllergyIntolerance }
constructor TFhirAllergyIntolerance.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FReactionList := TFhirResourceReferenceList{TFhirAdverseReaction}.Create;
FSensitivityTestList := TFhirResourceReferenceList{TFhirObservation}.Create;
end;
destructor TFhirAllergyIntolerance.Destroy;
begin
FIdentifierList.Free;
FCriticality.free;
FSensitivityType.free;
FRecordedDate.free;
FStatus.free;
FSubject.free;
FRecorder.free;
FSubstance.free;
FReactionList.Free;
FSensitivityTestList.Free;
inherited;
end;
function TFhirAllergyIntolerance.GetResourceType : TFhirResourceType;
begin
result := frtAllergyIntolerance;
end;
function TFhirAllergyIntolerance.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirAllergyIntolerance.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirAllergyIntolerance(oSource).FIdentifierList);
FCriticality := TFhirAllergyIntolerance(oSource).FCriticality.Link;
FSensitivityType := TFhirAllergyIntolerance(oSource).FSensitivityType.Link;
recordedDateObject := TFhirAllergyIntolerance(oSource).recordedDateObject.Clone;
FStatus := TFhirAllergyIntolerance(oSource).FStatus.Link;
subject := TFhirAllergyIntolerance(oSource).subject.Clone;
recorder := TFhirAllergyIntolerance(oSource).recorder.Clone;
substance := TFhirAllergyIntolerance(oSource).substance.Clone;
FReactionList.Assign(TFhirAllergyIntolerance(oSource).FReactionList);
FSensitivityTestList.Assign(TFhirAllergyIntolerance(oSource).FSensitivityTestList);
end;
procedure TFhirAllergyIntolerance.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'criticality') Then
list.add(FCriticality.Link);
if (child_name = 'sensitivityType') Then
list.add(FSensitivityType.Link);
if (child_name = 'recordedDate') Then
list.add(FRecordedDate.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'recorder') Then
list.add(FRecorder.Link);
if (child_name = 'substance') Then
list.add(FSubstance.Link);
if (child_name = 'reaction') Then
list.addAll(FReactionList);
if (child_name = 'sensitivityTest') Then
list.addAll(FSensitivityTestList);
end;
procedure TFhirAllergyIntolerance.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'criticality', 'code', FCriticality.Link));{1}
oList.add(TFHIRProperty.create(self, 'sensitivityType', 'code', FSensitivityType.Link));{1}
oList.add(TFHIRProperty.create(self, 'recordedDate', 'dateTime', FRecordedDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'recorder', 'Resource(Practitioner|Patient)', FRecorder.Link));{2}
oList.add(TFHIRProperty.create(self, 'substance', 'Resource(Substance)', FSubstance.Link));{2}
oList.add(TFHIRProperty.create(self, 'reaction', 'Resource(AdverseReaction)', FReactionList.Link)){3};
oList.add(TFHIRProperty.create(self, 'sensitivityTest', 'Resource(Observation)', FSensitivityTestList.Link)){3};
end;
procedure TFhirAllergyIntolerance.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'criticality') then CriticalityObject := propValue as TFHIREnum
else if (propName = 'sensitivityType') then SensitivityTypeObject := propValue as TFHIREnum
else if (propName = 'recordedDate') then RecordedDateObject := propValue as TFhirDateTime{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'recorder') then Recorder := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'substance') then Substance := propValue as TFhirResourceReference{TFhirSubstance}{4b}
else if (propName = 'reaction') then ReactionList.add(propValue as TFhirResourceReference{TFhirAdverseReaction}){2}
else if (propName = 'sensitivityTest') then SensitivityTestList.add(propValue as TFhirResourceReference{TFhirObservation}){2}
else inherited;
end;
function TFhirAllergyIntolerance.FhirType : string;
begin
result := 'AllergyIntolerance';
end;
function TFhirAllergyIntolerance.Link : TFhirAllergyIntolerance;
begin
result := TFhirAllergyIntolerance(inherited Link);
end;
function TFhirAllergyIntolerance.Clone : TFhirAllergyIntolerance;
begin
result := TFhirAllergyIntolerance(inherited Clone);
end;
{ TFhirAllergyIntolerance }
Procedure TFhirAllergyIntolerance.SetCriticality(value : TFhirEnum);
begin
FCriticality.free;
FCriticality := value;
end;
Function TFhirAllergyIntolerance.GetCriticalityST : TFhirCriticality;
begin
if FCriticality = nil then
result := TFhirCriticality(0)
else
result := TFhirCriticality(StringArrayIndexOfSensitive(CODES_TFhirCriticality, FCriticality.value));
end;
Procedure TFhirAllergyIntolerance.SetCriticalityST(value : TFhirCriticality);
begin
if ord(value) = 0 then
CriticalityObject := nil
else
CriticalityObject := TFhirEnum.create(CODES_TFhirCriticality[value]);
end;
Procedure TFhirAllergyIntolerance.SetSensitivityType(value : TFhirEnum);
begin
FSensitivityType.free;
FSensitivityType := value;
end;
Function TFhirAllergyIntolerance.GetSensitivityTypeST : TFhirSensitivitytype;
begin
if FSensitivityType = nil then
result := TFhirSensitivitytype(0)
else
result := TFhirSensitivitytype(StringArrayIndexOfSensitive(CODES_TFhirSensitivitytype, FSensitivityType.value));
end;
Procedure TFhirAllergyIntolerance.SetSensitivityTypeST(value : TFhirSensitivitytype);
begin
if ord(value) = 0 then
SensitivityTypeObject := nil
else
SensitivityTypeObject := TFhirEnum.create(CODES_TFhirSensitivitytype[value]);
end;
Procedure TFhirAllergyIntolerance.SetRecordedDate(value : TFhirDateTime);
begin
FRecordedDate.free;
FRecordedDate := value;
end;
Function TFhirAllergyIntolerance.GetRecordedDateST : TDateTimeEx;
begin
if FRecordedDate = nil then
result := nil
else
result := FRecordedDate.value;
end;
Procedure TFhirAllergyIntolerance.SetRecordedDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FRecordedDate = nil then
FRecordedDate := TFhirDateTime.create;
FRecordedDate.value := value
end
else if FRecordedDate <> nil then
FRecordedDate.value := nil;
end;
Procedure TFhirAllergyIntolerance.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirAllergyIntolerance.GetStatusST : TFhirSensitivitystatus;
begin
if FStatus = nil then
result := TFhirSensitivitystatus(0)
else
result := TFhirSensitivitystatus(StringArrayIndexOfSensitive(CODES_TFhirSensitivitystatus, FStatus.value));
end;
Procedure TFhirAllergyIntolerance.SetStatusST(value : TFhirSensitivitystatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirSensitivitystatus[value]);
end;
Procedure TFhirAllergyIntolerance.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirAllergyIntolerance.SetRecorder(value : TFhirResourceReference{Resource});
begin
FRecorder.free;
FRecorder := value;
end;
Procedure TFhirAllergyIntolerance.SetSubstance(value : TFhirResourceReference{TFhirSubstance});
begin
FSubstance.free;
FSubstance := value;
end;
{ TFhirCarePlan }
constructor TFhirCarePlan.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FConcernList := TFhirResourceReferenceList{TFhirCondition}.Create;
FParticipantList := TFhirCarePlanParticipantList.Create;
FGoalList := TFhirCarePlanGoalList.Create;
FActivityList := TFhirCarePlanActivityList.Create;
end;
destructor TFhirCarePlan.Destroy;
begin
FIdentifierList.Free;
FPatient.free;
FStatus.free;
FPeriod.free;
FModified.free;
FConcernList.Free;
FParticipantList.Free;
FGoalList.Free;
FActivityList.Free;
FNotes.free;
inherited;
end;
function TFhirCarePlan.GetResourceType : TFhirResourceType;
begin
result := frtCarePlan;
end;
function TFhirCarePlan.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirCarePlan.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirCarePlan(oSource).FIdentifierList);
patient := TFhirCarePlan(oSource).patient.Clone;
FStatus := TFhirCarePlan(oSource).FStatus.Link;
period := TFhirCarePlan(oSource).period.Clone;
modifiedObject := TFhirCarePlan(oSource).modifiedObject.Clone;
FConcernList.Assign(TFhirCarePlan(oSource).FConcernList);
FParticipantList.Assign(TFhirCarePlan(oSource).FParticipantList);
FGoalList.Assign(TFhirCarePlan(oSource).FGoalList);
FActivityList.Assign(TFhirCarePlan(oSource).FActivityList);
notesObject := TFhirCarePlan(oSource).notesObject.Clone;
end;
procedure TFhirCarePlan.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'period') Then
list.add(FPeriod.Link);
if (child_name = 'modified') Then
list.add(FModified.Link);
if (child_name = 'concern') Then
list.addAll(FConcernList);
if (child_name = 'participant') Then
list.addAll(FParticipantList);
if (child_name = 'goal') Then
list.addAll(FGoalList);
if (child_name = 'activity') Then
list.addAll(FActivityList);
if (child_name = 'notes') Then
list.add(FNotes.Link);
end;
procedure TFhirCarePlan.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'period', 'Period', FPeriod.Link));{2}
oList.add(TFHIRProperty.create(self, 'modified', 'dateTime', FModified.Link));{2}
oList.add(TFHIRProperty.create(self, 'concern', 'Resource(Condition)', FConcernList.Link)){3};
oList.add(TFHIRProperty.create(self, 'participant', '', FParticipantList.Link)){3};
oList.add(TFHIRProperty.create(self, 'goal', '', FGoalList.Link)){3};
oList.add(TFHIRProperty.create(self, 'activity', '', FActivityList.Link)){3};
oList.add(TFHIRProperty.create(self, 'notes', 'string', FNotes.Link));{2}
end;
procedure TFhirCarePlan.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'period') then Period := propValue as TFhirPeriod{4b}
else if (propName = 'modified') then ModifiedObject := propValue as TFhirDateTime{5a}
else if (propName = 'concern') then ConcernList.add(propValue as TFhirResourceReference{TFhirCondition}){2}
else if (propName = 'participant') then ParticipantList.add(propValue as TFhirCarePlanParticipant){2}
else if (propName = 'goal') then GoalList.add(propValue as TFhirCarePlanGoal){2}
else if (propName = 'activity') then ActivityList.add(propValue as TFhirCarePlanActivity){2}
else if (propName = 'notes') then NotesObject := propValue as TFhirString{5a}
else inherited;
end;
function TFhirCarePlan.FhirType : string;
begin
result := 'CarePlan';
end;
function TFhirCarePlan.Link : TFhirCarePlan;
begin
result := TFhirCarePlan(inherited Link);
end;
function TFhirCarePlan.Clone : TFhirCarePlan;
begin
result := TFhirCarePlan(inherited Clone);
end;
{ TFhirCarePlan }
Procedure TFhirCarePlan.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
Procedure TFhirCarePlan.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirCarePlan.GetStatusST : TFhirCarePlanStatus;
begin
if FStatus = nil then
result := TFhirCarePlanStatus(0)
else
result := TFhirCarePlanStatus(StringArrayIndexOfSensitive(CODES_TFhirCarePlanStatus, FStatus.value));
end;
Procedure TFhirCarePlan.SetStatusST(value : TFhirCarePlanStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirCarePlanStatus[value]);
end;
Procedure TFhirCarePlan.SetPeriod(value : TFhirPeriod);
begin
FPeriod.free;
FPeriod := value;
end;
Procedure TFhirCarePlan.SetModified(value : TFhirDateTime);
begin
FModified.free;
FModified := value;
end;
Function TFhirCarePlan.GetModifiedST : TDateTimeEx;
begin
if FModified = nil then
result := nil
else
result := FModified.value;
end;
Procedure TFhirCarePlan.SetModifiedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FModified = nil then
FModified := TFhirDateTime.create;
FModified.value := value
end
else if FModified <> nil then
FModified.value := nil;
end;
Procedure TFhirCarePlan.SetNotes(value : TFhirString);
begin
FNotes.free;
FNotes := value;
end;
Function TFhirCarePlan.GetNotesST : String;
begin
if FNotes = nil then
result := ''
else
result := FNotes.value;
end;
Procedure TFhirCarePlan.SetNotesST(value : String);
begin
if value <> '' then
begin
if FNotes = nil then
FNotes := TFhirString.create;
FNotes.value := value
end
else if FNotes <> nil then
FNotes.value := '';
end;
{ TFhirComposition }
constructor TFhirComposition.Create;
begin
inherited;
FAuthorList := TFhirResourceReferenceList{Resource}.Create;
FAttesterList := TFhirCompositionAttesterList.Create;
FSectionList := TFhirCompositionSectionList.Create;
end;
destructor TFhirComposition.Destroy;
begin
FIdentifier.free;
FDate.free;
FType_.free;
FClass_.free;
FTitle.free;
FStatus.free;
FConfidentiality.free;
FSubject.free;
FAuthorList.Free;
FAttesterList.Free;
FCustodian.free;
FEvent.free;
FEncounter.free;
FSectionList.Free;
inherited;
end;
function TFhirComposition.GetResourceType : TFhirResourceType;
begin
result := frtComposition;
end;
function TFhirComposition.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirComposition.Assign(oSource : TAdvObject);
begin
inherited;
identifier := TFhirComposition(oSource).identifier.Clone;
dateObject := TFhirComposition(oSource).dateObject.Clone;
type_ := TFhirComposition(oSource).type_.Clone;
class_ := TFhirComposition(oSource).class_.Clone;
titleObject := TFhirComposition(oSource).titleObject.Clone;
FStatus := TFhirComposition(oSource).FStatus.Link;
confidentiality := TFhirComposition(oSource).confidentiality.Clone;
subject := TFhirComposition(oSource).subject.Clone;
FAuthorList.Assign(TFhirComposition(oSource).FAuthorList);
FAttesterList.Assign(TFhirComposition(oSource).FAttesterList);
custodian := TFhirComposition(oSource).custodian.Clone;
event := TFhirComposition(oSource).event.Clone;
encounter := TFhirComposition(oSource).encounter.Clone;
FSectionList.Assign(TFhirComposition(oSource).FSectionList);
end;
procedure TFhirComposition.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'class') Then
list.add(FClass_.Link);
if (child_name = 'title') Then
list.add(FTitle.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'confidentiality') Then
list.add(FConfidentiality.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'author') Then
list.addAll(FAuthorList);
if (child_name = 'attester') Then
list.addAll(FAttesterList);
if (child_name = 'custodian') Then
list.add(FCustodian.Link);
if (child_name = 'event') Then
list.add(FEvent.Link);
if (child_name = 'encounter') Then
list.add(FEncounter.Link);
if (child_name = 'section') Then
list.addAll(FSectionList);
end;
procedure TFhirComposition.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'class', 'CodeableConcept', FClass_.Link));{2}
oList.add(TFHIRProperty.create(self, 'title', 'string', FTitle.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'confidentiality', 'Coding', FConfidentiality.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Practitioner|Group|Device|Location)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'author', 'Resource(Practitioner|Device|Patient|RelatedPerson)', FAuthorList.Link)){3};
oList.add(TFHIRProperty.create(self, 'attester', '', FAttesterList.Link)){3};
oList.add(TFHIRProperty.create(self, 'custodian', 'Resource(Organization)', FCustodian.Link));{2}
oList.add(TFHIRProperty.create(self, 'event', '', FEvent.Link));{2}
oList.add(TFHIRProperty.create(self, 'encounter', 'Resource(Encounter)', FEncounter.Link));{2}
oList.add(TFHIRProperty.create(self, 'section', '', FSectionList.Link)){3};
end;
procedure TFhirComposition.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'class') then Class_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'title') then TitleObject := propValue as TFhirString{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'confidentiality') then Confidentiality := propValue as TFhirCoding{4b}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'author') then AuthorList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'attester') then AttesterList.add(propValue as TFhirCompositionAttester){2}
else if (propName = 'custodian') then Custodian := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'event') then Event := propValue as TFhirCompositionEvent{4b}
else if (propName = 'encounter') then Encounter := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else if (propName = 'section') then SectionList.add(propValue as TFhirCompositionSection){2}
else inherited;
end;
function TFhirComposition.FhirType : string;
begin
result := 'Composition';
end;
function TFhirComposition.Link : TFhirComposition;
begin
result := TFhirComposition(inherited Link);
end;
function TFhirComposition.Clone : TFhirComposition;
begin
result := TFhirComposition(inherited Clone);
end;
{ TFhirComposition }
Procedure TFhirComposition.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirComposition.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirComposition.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirComposition.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirComposition.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirComposition.SetClass_(value : TFhirCodeableConcept);
begin
FClass_.free;
FClass_ := value;
end;
Procedure TFhirComposition.SetTitle(value : TFhirString);
begin
FTitle.free;
FTitle := value;
end;
Function TFhirComposition.GetTitleST : String;
begin
if FTitle = nil then
result := ''
else
result := FTitle.value;
end;
Procedure TFhirComposition.SetTitleST(value : String);
begin
if value <> '' then
begin
if FTitle = nil then
FTitle := TFhirString.create;
FTitle.value := value
end
else if FTitle <> nil then
FTitle.value := '';
end;
Procedure TFhirComposition.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirComposition.GetStatusST : TFhirCompositionStatus;
begin
if FStatus = nil then
result := TFhirCompositionStatus(0)
else
result := TFhirCompositionStatus(StringArrayIndexOfSensitive(CODES_TFhirCompositionStatus, FStatus.value));
end;
Procedure TFhirComposition.SetStatusST(value : TFhirCompositionStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirCompositionStatus[value]);
end;
Procedure TFhirComposition.SetConfidentiality(value : TFhirCoding);
begin
FConfidentiality.free;
FConfidentiality := value;
end;
Procedure TFhirComposition.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirComposition.SetCustodian(value : TFhirResourceReference{TFhirOrganization});
begin
FCustodian.free;
FCustodian := value;
end;
Procedure TFhirComposition.SetEvent(value : TFhirCompositionEvent);
begin
FEvent.free;
FEvent := value;
end;
Procedure TFhirComposition.SetEncounter(value : TFhirResourceReference{TFhirEncounter});
begin
FEncounter.free;
FEncounter := value;
end;
{ TFhirConceptMap }
constructor TFhirConceptMap.Create;
begin
inherited;
FTelecomList := TFhirContactList.Create;
FConceptList := TFhirConceptMapConceptList.Create;
end;
destructor TFhirConceptMap.Destroy;
begin
FIdentifier.free;
FVersion.free;
FName.free;
FPublisher.free;
FTelecomList.Free;
FDescription.free;
FCopyright.free;
FStatus.free;
FExperimental.free;
FDate.free;
FSource.free;
FTarget.free;
FConceptList.Free;
inherited;
end;
function TFhirConceptMap.GetResourceType : TFhirResourceType;
begin
result := frtConceptMap;
end;
function TFhirConceptMap.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirConceptMap.Assign(oSource : TAdvObject);
begin
inherited;
identifierObject := TFhirConceptMap(oSource).identifierObject.Clone;
versionObject := TFhirConceptMap(oSource).versionObject.Clone;
nameObject := TFhirConceptMap(oSource).nameObject.Clone;
publisherObject := TFhirConceptMap(oSource).publisherObject.Clone;
FTelecomList.Assign(TFhirConceptMap(oSource).FTelecomList);
descriptionObject := TFhirConceptMap(oSource).descriptionObject.Clone;
copyrightObject := TFhirConceptMap(oSource).copyrightObject.Clone;
FStatus := TFhirConceptMap(oSource).FStatus.Link;
experimentalObject := TFhirConceptMap(oSource).experimentalObject.Clone;
dateObject := TFhirConceptMap(oSource).dateObject.Clone;
source := TFhirConceptMap(oSource).source.Clone;
target := TFhirConceptMap(oSource).target.Clone;
FConceptList.Assign(TFhirConceptMap(oSource).FConceptList);
end;
procedure TFhirConceptMap.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'version') Then
list.add(FVersion.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'publisher') Then
list.add(FPublisher.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'copyright') Then
list.add(FCopyright.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'experimental') Then
list.add(FExperimental.Link);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'target') Then
list.add(FTarget.Link);
if (child_name = 'concept') Then
list.addAll(FConceptList);
end;
procedure TFhirConceptMap.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'string', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'version', 'string', FVersion.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'publisher', 'string', FPublisher.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'copyright', 'string', FCopyright.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'experimental', 'boolean', FExperimental.Link));{2}
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', 'Resource(ValueSet)', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'target', 'Resource(ValueSet)', FTarget.Link));{2}
oList.add(TFHIRProperty.create(self, 'concept', '', FConceptList.Link)){3};
end;
procedure TFhirConceptMap.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierObject := propValue as TFhirString{5a}
else if (propName = 'version') then VersionObject := propValue as TFhirString{5a}
else if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'publisher') then PublisherObject := propValue as TFhirString{5a}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'copyright') then CopyrightObject := propValue as TFhirString{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'experimental') then ExperimentalObject := propValue as TFhirBoolean{5a}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'source') then Source := propValue as TFhirResourceReference{TFhirValueSet}{4b}
else if (propName = 'target') then Target := propValue as TFhirResourceReference{TFhirValueSet}{4b}
else if (propName = 'concept') then ConceptList.add(propValue as TFhirConceptMapConcept){2}
else inherited;
end;
function TFhirConceptMap.FhirType : string;
begin
result := 'ConceptMap';
end;
function TFhirConceptMap.Link : TFhirConceptMap;
begin
result := TFhirConceptMap(inherited Link);
end;
function TFhirConceptMap.Clone : TFhirConceptMap;
begin
result := TFhirConceptMap(inherited Clone);
end;
{ TFhirConceptMap }
Procedure TFhirConceptMap.SetIdentifier(value : TFhirString);
begin
FIdentifier.free;
FIdentifier := value;
end;
Function TFhirConceptMap.GetIdentifierST : String;
begin
if FIdentifier = nil then
result := ''
else
result := FIdentifier.value;
end;
Procedure TFhirConceptMap.SetIdentifierST(value : String);
begin
if value <> '' then
begin
if FIdentifier = nil then
FIdentifier := TFhirString.create;
FIdentifier.value := value
end
else if FIdentifier <> nil then
FIdentifier.value := '';
end;
Procedure TFhirConceptMap.SetVersion(value : TFhirString);
begin
FVersion.free;
FVersion := value;
end;
Function TFhirConceptMap.GetVersionST : String;
begin
if FVersion = nil then
result := ''
else
result := FVersion.value;
end;
Procedure TFhirConceptMap.SetVersionST(value : String);
begin
if value <> '' then
begin
if FVersion = nil then
FVersion := TFhirString.create;
FVersion.value := value
end
else if FVersion <> nil then
FVersion.value := '';
end;
Procedure TFhirConceptMap.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirConceptMap.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirConceptMap.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirConceptMap.SetPublisher(value : TFhirString);
begin
FPublisher.free;
FPublisher := value;
end;
Function TFhirConceptMap.GetPublisherST : String;
begin
if FPublisher = nil then
result := ''
else
result := FPublisher.value;
end;
Procedure TFhirConceptMap.SetPublisherST(value : String);
begin
if value <> '' then
begin
if FPublisher = nil then
FPublisher := TFhirString.create;
FPublisher.value := value
end
else if FPublisher <> nil then
FPublisher.value := '';
end;
Procedure TFhirConceptMap.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirConceptMap.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirConceptMap.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirConceptMap.SetCopyright(value : TFhirString);
begin
FCopyright.free;
FCopyright := value;
end;
Function TFhirConceptMap.GetCopyrightST : String;
begin
if FCopyright = nil then
result := ''
else
result := FCopyright.value;
end;
Procedure TFhirConceptMap.SetCopyrightST(value : String);
begin
if value <> '' then
begin
if FCopyright = nil then
FCopyright := TFhirString.create;
FCopyright.value := value
end
else if FCopyright <> nil then
FCopyright.value := '';
end;
Procedure TFhirConceptMap.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirConceptMap.GetStatusST : TFhirValuesetStatus;
begin
if FStatus = nil then
result := TFhirValuesetStatus(0)
else
result := TFhirValuesetStatus(StringArrayIndexOfSensitive(CODES_TFhirValuesetStatus, FStatus.value));
end;
Procedure TFhirConceptMap.SetStatusST(value : TFhirValuesetStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirValuesetStatus[value]);
end;
Procedure TFhirConceptMap.SetExperimental(value : TFhirBoolean);
begin
FExperimental.free;
FExperimental := value;
end;
Function TFhirConceptMap.GetExperimentalST : Boolean;
begin
if FExperimental = nil then
result := false
else
result := FExperimental.value;
end;
Procedure TFhirConceptMap.SetExperimentalST(value : Boolean);
begin
if FExperimental = nil then
FExperimental := TFhirBoolean.create;
FExperimental.value := value
end;
Procedure TFhirConceptMap.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirConceptMap.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirConceptMap.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirConceptMap.SetSource(value : TFhirResourceReference{TFhirValueSet});
begin
FSource.free;
FSource := value;
end;
Procedure TFhirConceptMap.SetTarget(value : TFhirResourceReference{TFhirValueSet});
begin
FTarget.free;
FTarget := value;
end;
{ TFhirCondition }
constructor TFhirCondition.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FEvidenceList := TFhirConditionEvidenceList.Create;
FLocationList := TFhirConditionLocationList.Create;
FRelatedItemList := TFhirConditionRelatedItemList.Create;
end;
destructor TFhirCondition.Destroy;
begin
FIdentifierList.Free;
FSubject.free;
FEncounter.free;
FAsserter.free;
FDateAsserted.free;
FCode.free;
FCategory.free;
FStatus.free;
FCertainty.free;
FSeverity.free;
FOnset.free;
FAbatement.free;
FStage.free;
FEvidenceList.Free;
FLocationList.Free;
FRelatedItemList.Free;
FNotes.free;
inherited;
end;
function TFhirCondition.GetResourceType : TFhirResourceType;
begin
result := frtCondition;
end;
function TFhirCondition.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirCondition.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirCondition(oSource).FIdentifierList);
subject := TFhirCondition(oSource).subject.Clone;
encounter := TFhirCondition(oSource).encounter.Clone;
asserter := TFhirCondition(oSource).asserter.Clone;
dateAssertedObject := TFhirCondition(oSource).dateAssertedObject.Clone;
code := TFhirCondition(oSource).code.Clone;
category := TFhirCondition(oSource).category.Clone;
FStatus := TFhirCondition(oSource).FStatus.Link;
certainty := TFhirCondition(oSource).certainty.Clone;
severity := TFhirCondition(oSource).severity.Clone;
onset := TFhirCondition(oSource).onset.Clone;
abatement := TFhirCondition(oSource).abatement.Clone;
stage := TFhirCondition(oSource).stage.Clone;
FEvidenceList.Assign(TFhirCondition(oSource).FEvidenceList);
FLocationList.Assign(TFhirCondition(oSource).FLocationList);
FRelatedItemList.Assign(TFhirCondition(oSource).FRelatedItemList);
notesObject := TFhirCondition(oSource).notesObject.Clone;
end;
procedure TFhirCondition.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'encounter') Then
list.add(FEncounter.Link);
if (child_name = 'asserter') Then
list.add(FAsserter.Link);
if (child_name = 'dateAsserted') Then
list.add(FDateAsserted.Link);
if (child_name = 'code') Then
list.add(FCode.Link);
if (child_name = 'category') Then
list.add(FCategory.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'certainty') Then
list.add(FCertainty.Link);
if (child_name = 'severity') Then
list.add(FSeverity.Link);
if (child_name = 'onset[x]') Then
list.add(FOnset.Link);
if (child_name = 'abatement[x]') Then
list.add(FAbatement.Link);
if (child_name = 'stage') Then
list.add(FStage.Link);
if (child_name = 'evidence') Then
list.addAll(FEvidenceList);
if (child_name = 'location') Then
list.addAll(FLocationList);
if (child_name = 'relatedItem') Then
list.addAll(FRelatedItemList);
if (child_name = 'notes') Then
list.add(FNotes.Link);
end;
procedure TFhirCondition.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'encounter', 'Resource(Encounter)', FEncounter.Link));{2}
oList.add(TFHIRProperty.create(self, 'asserter', 'Resource(Practitioner|Patient)', FAsserter.Link));{2}
oList.add(TFHIRProperty.create(self, 'dateAsserted', 'date', FDateAsserted.Link));{2}
oList.add(TFHIRProperty.create(self, 'code', 'CodeableConcept', FCode.Link));{2}
oList.add(TFHIRProperty.create(self, 'category', 'CodeableConcept', FCategory.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'certainty', 'CodeableConcept', FCertainty.Link));{2}
oList.add(TFHIRProperty.create(self, 'severity', 'CodeableConcept', FSeverity.Link));{2}
oList.add(TFHIRProperty.create(self, 'onset[x]', 'date|Age', FOnset.Link));{2}
oList.add(TFHIRProperty.create(self, 'abatement[x]', 'date|Age|boolean', FAbatement.Link));{2}
oList.add(TFHIRProperty.create(self, 'stage', '', FStage.Link));{2}
oList.add(TFHIRProperty.create(self, 'evidence', '', FEvidenceList.Link)){3};
oList.add(TFHIRProperty.create(self, 'location', '', FLocationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'relatedItem', '', FRelatedItemList.Link)){3};
oList.add(TFHIRProperty.create(self, 'notes', 'string', FNotes.Link));{2}
end;
procedure TFhirCondition.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'encounter') then Encounter := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else if (propName = 'asserter') then Asserter := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'dateAsserted') then DateAssertedObject := propValue as TFhirDate{5a}
else if (propName = 'code') then Code := propValue as TFhirCodeableConcept{4b}
else if (propName = 'category') then Category := propValue as TFhirCodeableConcept{4b}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'certainty') then Certainty := propValue as TFhirCodeableConcept{4b}
else if (propName = 'severity') then Severity := propValue as TFhirCodeableConcept{4b}
else if (propName.startsWith('onset')) then Onset := propValue as TFhirType{4}
else if (propName.startsWith('abatement')) then Abatement := propValue as TFhirType{4}
else if (propName = 'stage') then Stage := propValue as TFhirConditionStage{4b}
else if (propName = 'evidence') then EvidenceList.add(propValue as TFhirConditionEvidence){2}
else if (propName = 'location') then LocationList.add(propValue as TFhirConditionLocation){2}
else if (propName = 'relatedItem') then RelatedItemList.add(propValue as TFhirConditionRelatedItem){2}
else if (propName = 'notes') then NotesObject := propValue as TFhirString{5a}
else inherited;
end;
function TFhirCondition.FhirType : string;
begin
result := 'Condition';
end;
function TFhirCondition.Link : TFhirCondition;
begin
result := TFhirCondition(inherited Link);
end;
function TFhirCondition.Clone : TFhirCondition;
begin
result := TFhirCondition(inherited Clone);
end;
{ TFhirCondition }
Procedure TFhirCondition.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirCondition.SetEncounter(value : TFhirResourceReference{TFhirEncounter});
begin
FEncounter.free;
FEncounter := value;
end;
Procedure TFhirCondition.SetAsserter(value : TFhirResourceReference{Resource});
begin
FAsserter.free;
FAsserter := value;
end;
Procedure TFhirCondition.SetDateAsserted(value : TFhirDate);
begin
FDateAsserted.free;
FDateAsserted := value;
end;
Function TFhirCondition.GetDateAssertedST : TDateTimeEx;
begin
if FDateAsserted = nil then
result := nil
else
result := FDateAsserted.value;
end;
Procedure TFhirCondition.SetDateAssertedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDateAsserted = nil then
FDateAsserted := TFhirDate.create;
FDateAsserted.value := value
end
else if FDateAsserted <> nil then
FDateAsserted.value := nil;
end;
Procedure TFhirCondition.SetCode(value : TFhirCodeableConcept);
begin
FCode.free;
FCode := value;
end;
Procedure TFhirCondition.SetCategory(value : TFhirCodeableConcept);
begin
FCategory.free;
FCategory := value;
end;
Procedure TFhirCondition.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirCondition.GetStatusST : TFhirConditionStatus;
begin
if FStatus = nil then
result := TFhirConditionStatus(0)
else
result := TFhirConditionStatus(StringArrayIndexOfSensitive(CODES_TFhirConditionStatus, FStatus.value));
end;
Procedure TFhirCondition.SetStatusST(value : TFhirConditionStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirConditionStatus[value]);
end;
Procedure TFhirCondition.SetCertainty(value : TFhirCodeableConcept);
begin
FCertainty.free;
FCertainty := value;
end;
Procedure TFhirCondition.SetSeverity(value : TFhirCodeableConcept);
begin
FSeverity.free;
FSeverity := value;
end;
Procedure TFhirCondition.SetOnset(value : TFhirType);
begin
FOnset.free;
FOnset := value;
end;
Procedure TFhirCondition.SetAbatement(value : TFhirType);
begin
FAbatement.free;
FAbatement := value;
end;
Procedure TFhirCondition.SetStage(value : TFhirConditionStage);
begin
FStage.free;
FStage := value;
end;
Procedure TFhirCondition.SetNotes(value : TFhirString);
begin
FNotes.free;
FNotes := value;
end;
Function TFhirCondition.GetNotesST : String;
begin
if FNotes = nil then
result := ''
else
result := FNotes.value;
end;
Procedure TFhirCondition.SetNotesST(value : String);
begin
if value <> '' then
begin
if FNotes = nil then
FNotes := TFhirString.create;
FNotes.value := value
end
else if FNotes <> nil then
FNotes.value := '';
end;
{ TFhirConformance }
constructor TFhirConformance.Create;
begin
inherited;
FTelecomList := TFhirContactList.Create;
FFormatList := TFhirCodeList.Create;
FProfileList := TFhirResourceReferenceList{TFhirProfile}.Create;
FRestList := TFhirConformanceRestList.Create;
FMessagingList := TFhirConformanceMessagingList.Create;
FDocumentList := TFhirConformanceDocumentList.Create;
end;
destructor TFhirConformance.Destroy;
begin
FIdentifier.free;
FVersion.free;
FName.free;
FPublisher.free;
FTelecomList.Free;
FDescription.free;
FStatus.free;
FExperimental.free;
FDate.free;
FSoftware.free;
FImplementation_.free;
FFhirVersion.free;
FAcceptUnknown.free;
FFormatList.Free;
FProfileList.Free;
FRestList.Free;
FMessagingList.Free;
FDocumentList.Free;
inherited;
end;
function TFhirConformance.GetResourceType : TFhirResourceType;
begin
result := frtConformance;
end;
function TFhirConformance.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirConformance.Assign(oSource : TAdvObject);
begin
inherited;
identifierObject := TFhirConformance(oSource).identifierObject.Clone;
versionObject := TFhirConformance(oSource).versionObject.Clone;
nameObject := TFhirConformance(oSource).nameObject.Clone;
publisherObject := TFhirConformance(oSource).publisherObject.Clone;
FTelecomList.Assign(TFhirConformance(oSource).FTelecomList);
descriptionObject := TFhirConformance(oSource).descriptionObject.Clone;
FStatus := TFhirConformance(oSource).FStatus.Link;
experimentalObject := TFhirConformance(oSource).experimentalObject.Clone;
dateObject := TFhirConformance(oSource).dateObject.Clone;
software := TFhirConformance(oSource).software.Clone;
implementation_ := TFhirConformance(oSource).implementation_.Clone;
fhirVersionObject := TFhirConformance(oSource).fhirVersionObject.Clone;
acceptUnknownObject := TFhirConformance(oSource).acceptUnknownObject.Clone;
FFormatList.Assign(TFhirConformance(oSource).FFormatList);
FProfileList.Assign(TFhirConformance(oSource).FProfileList);
FRestList.Assign(TFhirConformance(oSource).FRestList);
FMessagingList.Assign(TFhirConformance(oSource).FMessagingList);
FDocumentList.Assign(TFhirConformance(oSource).FDocumentList);
end;
procedure TFhirConformance.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'version') Then
list.add(FVersion.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'publisher') Then
list.add(FPublisher.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'experimental') Then
list.add(FExperimental.Link);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'software') Then
list.add(FSoftware.Link);
if (child_name = 'implementation') Then
list.add(FImplementation_.Link);
if (child_name = 'fhirVersion') Then
list.add(FFhirVersion.Link);
if (child_name = 'acceptUnknown') Then
list.add(FAcceptUnknown.Link);
if (child_name = 'format') Then
list.addAll(FFormatList);
if (child_name = 'profile') Then
list.addAll(FProfileList);
if (child_name = 'rest') Then
list.addAll(FRestList);
if (child_name = 'messaging') Then
list.addAll(FMessagingList);
if (child_name = 'document') Then
list.addAll(FDocumentList);
end;
procedure TFhirConformance.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'string', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'version', 'string', FVersion.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'publisher', 'string', FPublisher.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'experimental', 'boolean', FExperimental.Link));{2}
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'software', '', FSoftware.Link));{2}
oList.add(TFHIRProperty.create(self, 'implementation', '', FImplementation_.Link));{2}
oList.add(TFHIRProperty.create(self, 'fhirVersion', 'id', FFhirVersion.Link));{2}
oList.add(TFHIRProperty.create(self, 'acceptUnknown', 'boolean', FAcceptUnknown.Link));{2}
oList.add(TFHIRProperty.create(self, 'format', 'code', FFormatList.Link)){3};
oList.add(TFHIRProperty.create(self, 'profile', 'Resource(Profile)', FProfileList.Link)){3};
oList.add(TFHIRProperty.create(self, 'rest', '', FRestList.Link)){3};
oList.add(TFHIRProperty.create(self, 'messaging', '', FMessagingList.Link)){3};
oList.add(TFHIRProperty.create(self, 'document', '', FDocumentList.Link)){3};
end;
procedure TFhirConformance.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierObject := propValue as TFhirString{5a}
else if (propName = 'version') then VersionObject := propValue as TFhirString{5a}
else if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'publisher') then PublisherObject := propValue as TFhirString{5a}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'experimental') then ExperimentalObject := propValue as TFhirBoolean{5a}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'software') then Software := propValue as TFhirConformanceSoftware{4b}
else if (propName = 'implementation') then Implementation_ := propValue as TFhirConformanceImplementation{4b}
else if (propName = 'fhirVersion') then FhirVersionObject := propValue as TFhirId{5a}
else if (propName = 'acceptUnknown') then AcceptUnknownObject := propValue as TFhirBoolean{5a}
else if (propName = 'format') then FormatList.add(propValue as TFhirCode){2}
else if (propName = 'profile') then ProfileList.add(propValue as TFhirResourceReference{TFhirProfile}){2}
else if (propName = 'rest') then RestList.add(propValue as TFhirConformanceRest){2}
else if (propName = 'messaging') then MessagingList.add(propValue as TFhirConformanceMessaging){2}
else if (propName = 'document') then DocumentList.add(propValue as TFhirConformanceDocument){2}
else inherited;
end;
function TFhirConformance.FhirType : string;
begin
result := 'Conformance';
end;
function TFhirConformance.Link : TFhirConformance;
begin
result := TFhirConformance(inherited Link);
end;
function TFhirConformance.Clone : TFhirConformance;
begin
result := TFhirConformance(inherited Clone);
end;
{ TFhirConformance }
Procedure TFhirConformance.SetIdentifier(value : TFhirString);
begin
FIdentifier.free;
FIdentifier := value;
end;
Function TFhirConformance.GetIdentifierST : String;
begin
if FIdentifier = nil then
result := ''
else
result := FIdentifier.value;
end;
Procedure TFhirConformance.SetIdentifierST(value : String);
begin
if value <> '' then
begin
if FIdentifier = nil then
FIdentifier := TFhirString.create;
FIdentifier.value := value
end
else if FIdentifier <> nil then
FIdentifier.value := '';
end;
Procedure TFhirConformance.SetVersion(value : TFhirString);
begin
FVersion.free;
FVersion := value;
end;
Function TFhirConformance.GetVersionST : String;
begin
if FVersion = nil then
result := ''
else
result := FVersion.value;
end;
Procedure TFhirConformance.SetVersionST(value : String);
begin
if value <> '' then
begin
if FVersion = nil then
FVersion := TFhirString.create;
FVersion.value := value
end
else if FVersion <> nil then
FVersion.value := '';
end;
Procedure TFhirConformance.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirConformance.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirConformance.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirConformance.SetPublisher(value : TFhirString);
begin
FPublisher.free;
FPublisher := value;
end;
Function TFhirConformance.GetPublisherST : String;
begin
if FPublisher = nil then
result := ''
else
result := FPublisher.value;
end;
Procedure TFhirConformance.SetPublisherST(value : String);
begin
if value <> '' then
begin
if FPublisher = nil then
FPublisher := TFhirString.create;
FPublisher.value := value
end
else if FPublisher <> nil then
FPublisher.value := '';
end;
Procedure TFhirConformance.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirConformance.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirConformance.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirConformance.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirConformance.GetStatusST : TFhirConformanceStatementStatus;
begin
if FStatus = nil then
result := TFhirConformanceStatementStatus(0)
else
result := TFhirConformanceStatementStatus(StringArrayIndexOfSensitive(CODES_TFhirConformanceStatementStatus, FStatus.value));
end;
Procedure TFhirConformance.SetStatusST(value : TFhirConformanceStatementStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirConformanceStatementStatus[value]);
end;
Procedure TFhirConformance.SetExperimental(value : TFhirBoolean);
begin
FExperimental.free;
FExperimental := value;
end;
Function TFhirConformance.GetExperimentalST : Boolean;
begin
if FExperimental = nil then
result := false
else
result := FExperimental.value;
end;
Procedure TFhirConformance.SetExperimentalST(value : Boolean);
begin
if FExperimental = nil then
FExperimental := TFhirBoolean.create;
FExperimental.value := value
end;
Procedure TFhirConformance.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirConformance.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirConformance.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirConformance.SetSoftware(value : TFhirConformanceSoftware);
begin
FSoftware.free;
FSoftware := value;
end;
Procedure TFhirConformance.SetImplementation_(value : TFhirConformanceImplementation);
begin
FImplementation_.free;
FImplementation_ := value;
end;
Procedure TFhirConformance.SetFhirVersion(value : TFhirId);
begin
FFhirVersion.free;
FFhirVersion := value;
end;
Function TFhirConformance.GetFhirVersionST : String;
begin
if FFhirVersion = nil then
result := ''
else
result := FFhirVersion.value;
end;
Procedure TFhirConformance.SetFhirVersionST(value : String);
begin
if value <> '' then
begin
if FFhirVersion = nil then
FFhirVersion := TFhirId.create;
FFhirVersion.value := value
end
else if FFhirVersion <> nil then
FFhirVersion.value := '';
end;
Procedure TFhirConformance.SetAcceptUnknown(value : TFhirBoolean);
begin
FAcceptUnknown.free;
FAcceptUnknown := value;
end;
Function TFhirConformance.GetAcceptUnknownST : Boolean;
begin
if FAcceptUnknown = nil then
result := false
else
result := FAcceptUnknown.value;
end;
Procedure TFhirConformance.SetAcceptUnknownST(value : Boolean);
begin
if FAcceptUnknown = nil then
FAcceptUnknown := TFhirBoolean.create;
FAcceptUnknown.value := value
end;
{ TFhirDevice }
constructor TFhirDevice.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FContactList := TFhirContactList.Create;
end;
destructor TFhirDevice.Destroy;
begin
FIdentifierList.Free;
FType_.free;
FManufacturer.free;
FModel.free;
FVersion.free;
FExpiry.free;
FUdi.free;
FLotNumber.free;
FOwner.free;
FLocation.free;
FPatient.free;
FContactList.Free;
FUrl.free;
inherited;
end;
function TFhirDevice.GetResourceType : TFhirResourceType;
begin
result := frtDevice;
end;
function TFhirDevice.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirDevice.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirDevice(oSource).FIdentifierList);
type_ := TFhirDevice(oSource).type_.Clone;
manufacturerObject := TFhirDevice(oSource).manufacturerObject.Clone;
modelObject := TFhirDevice(oSource).modelObject.Clone;
versionObject := TFhirDevice(oSource).versionObject.Clone;
expiryObject := TFhirDevice(oSource).expiryObject.Clone;
udiObject := TFhirDevice(oSource).udiObject.Clone;
lotNumberObject := TFhirDevice(oSource).lotNumberObject.Clone;
owner := TFhirDevice(oSource).owner.Clone;
location := TFhirDevice(oSource).location.Clone;
patient := TFhirDevice(oSource).patient.Clone;
FContactList.Assign(TFhirDevice(oSource).FContactList);
urlObject := TFhirDevice(oSource).urlObject.Clone;
end;
procedure TFhirDevice.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'manufacturer') Then
list.add(FManufacturer.Link);
if (child_name = 'model') Then
list.add(FModel.Link);
if (child_name = 'version') Then
list.add(FVersion.Link);
if (child_name = 'expiry') Then
list.add(FExpiry.Link);
if (child_name = 'udi') Then
list.add(FUdi.Link);
if (child_name = 'lotNumber') Then
list.add(FLotNumber.Link);
if (child_name = 'owner') Then
list.add(FOwner.Link);
if (child_name = 'location') Then
list.add(FLocation.Link);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'contact') Then
list.addAll(FContactList);
if (child_name = 'url') Then
list.add(FUrl.Link);
end;
procedure TFhirDevice.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'manufacturer', 'string', FManufacturer.Link));{2}
oList.add(TFHIRProperty.create(self, 'model', 'string', FModel.Link));{2}
oList.add(TFHIRProperty.create(self, 'version', 'string', FVersion.Link));{2}
oList.add(TFHIRProperty.create(self, 'expiry', 'date', FExpiry.Link));{2}
oList.add(TFHIRProperty.create(self, 'udi', 'string', FUdi.Link));{2}
oList.add(TFHIRProperty.create(self, 'lotNumber', 'string', FLotNumber.Link));{2}
oList.add(TFHIRProperty.create(self, 'owner', 'Resource(Organization)', FOwner.Link));{2}
oList.add(TFHIRProperty.create(self, 'location', 'Resource(Location)', FLocation.Link));{2}
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'contact', 'Contact', FContactList.Link)){3};
oList.add(TFHIRProperty.create(self, 'url', 'uri', FUrl.Link));{2}
end;
procedure TFhirDevice.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'manufacturer') then ManufacturerObject := propValue as TFhirString{5a}
else if (propName = 'model') then ModelObject := propValue as TFhirString{5a}
else if (propName = 'version') then VersionObject := propValue as TFhirString{5a}
else if (propName = 'expiry') then ExpiryObject := propValue as TFhirDate{5a}
else if (propName = 'udi') then UdiObject := propValue as TFhirString{5a}
else if (propName = 'lotNumber') then LotNumberObject := propValue as TFhirString{5a}
else if (propName = 'owner') then Owner := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'location') then Location := propValue as TFhirResourceReference{TFhirLocation}{4b}
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'contact') then ContactList.add(propValue as TFhirContact){2}
else if (propName = 'url') then UrlObject := propValue as TFhirUri{5a}
else inherited;
end;
function TFhirDevice.FhirType : string;
begin
result := 'Device';
end;
function TFhirDevice.Link : TFhirDevice;
begin
result := TFhirDevice(inherited Link);
end;
function TFhirDevice.Clone : TFhirDevice;
begin
result := TFhirDevice(inherited Clone);
end;
{ TFhirDevice }
Procedure TFhirDevice.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirDevice.SetManufacturer(value : TFhirString);
begin
FManufacturer.free;
FManufacturer := value;
end;
Function TFhirDevice.GetManufacturerST : String;
begin
if FManufacturer = nil then
result := ''
else
result := FManufacturer.value;
end;
Procedure TFhirDevice.SetManufacturerST(value : String);
begin
if value <> '' then
begin
if FManufacturer = nil then
FManufacturer := TFhirString.create;
FManufacturer.value := value
end
else if FManufacturer <> nil then
FManufacturer.value := '';
end;
Procedure TFhirDevice.SetModel(value : TFhirString);
begin
FModel.free;
FModel := value;
end;
Function TFhirDevice.GetModelST : String;
begin
if FModel = nil then
result := ''
else
result := FModel.value;
end;
Procedure TFhirDevice.SetModelST(value : String);
begin
if value <> '' then
begin
if FModel = nil then
FModel := TFhirString.create;
FModel.value := value
end
else if FModel <> nil then
FModel.value := '';
end;
Procedure TFhirDevice.SetVersion(value : TFhirString);
begin
FVersion.free;
FVersion := value;
end;
Function TFhirDevice.GetVersionST : String;
begin
if FVersion = nil then
result := ''
else
result := FVersion.value;
end;
Procedure TFhirDevice.SetVersionST(value : String);
begin
if value <> '' then
begin
if FVersion = nil then
FVersion := TFhirString.create;
FVersion.value := value
end
else if FVersion <> nil then
FVersion.value := '';
end;
Procedure TFhirDevice.SetExpiry(value : TFhirDate);
begin
FExpiry.free;
FExpiry := value;
end;
Function TFhirDevice.GetExpiryST : TDateTimeEx;
begin
if FExpiry = nil then
result := nil
else
result := FExpiry.value;
end;
Procedure TFhirDevice.SetExpiryST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FExpiry = nil then
FExpiry := TFhirDate.create;
FExpiry.value := value
end
else if FExpiry <> nil then
FExpiry.value := nil;
end;
Procedure TFhirDevice.SetUdi(value : TFhirString);
begin
FUdi.free;
FUdi := value;
end;
Function TFhirDevice.GetUdiST : String;
begin
if FUdi = nil then
result := ''
else
result := FUdi.value;
end;
Procedure TFhirDevice.SetUdiST(value : String);
begin
if value <> '' then
begin
if FUdi = nil then
FUdi := TFhirString.create;
FUdi.value := value
end
else if FUdi <> nil then
FUdi.value := '';
end;
Procedure TFhirDevice.SetLotNumber(value : TFhirString);
begin
FLotNumber.free;
FLotNumber := value;
end;
Function TFhirDevice.GetLotNumberST : String;
begin
if FLotNumber = nil then
result := ''
else
result := FLotNumber.value;
end;
Procedure TFhirDevice.SetLotNumberST(value : String);
begin
if value <> '' then
begin
if FLotNumber = nil then
FLotNumber := TFhirString.create;
FLotNumber.value := value
end
else if FLotNumber <> nil then
FLotNumber.value := '';
end;
Procedure TFhirDevice.SetOwner(value : TFhirResourceReference{TFhirOrganization});
begin
FOwner.free;
FOwner := value;
end;
Procedure TFhirDevice.SetLocation(value : TFhirResourceReference{TFhirLocation});
begin
FLocation.free;
FLocation := value;
end;
Procedure TFhirDevice.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
Procedure TFhirDevice.SetUrl(value : TFhirUri);
begin
FUrl.free;
FUrl := value;
end;
Function TFhirDevice.GetUrlST : String;
begin
if FUrl = nil then
result := ''
else
result := FUrl.value;
end;
Procedure TFhirDevice.SetUrlST(value : String);
begin
if value <> '' then
begin
if FUrl = nil then
FUrl := TFhirUri.create;
FUrl.value := value
end
else if FUrl <> nil then
FUrl.value := '';
end;
{ TFhirDeviceObservationReport }
constructor TFhirDeviceObservationReport.Create;
begin
inherited;
FVirtualDeviceList := TFhirDeviceObservationReportVirtualDeviceList.Create;
end;
destructor TFhirDeviceObservationReport.Destroy;
begin
FInstant.free;
FIdentifier.free;
FSource.free;
FSubject.free;
FVirtualDeviceList.Free;
inherited;
end;
function TFhirDeviceObservationReport.GetResourceType : TFhirResourceType;
begin
result := frtDeviceObservationReport;
end;
function TFhirDeviceObservationReport.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirDeviceObservationReport.Assign(oSource : TAdvObject);
begin
inherited;
instantObject := TFhirDeviceObservationReport(oSource).instantObject.Clone;
identifier := TFhirDeviceObservationReport(oSource).identifier.Clone;
source := TFhirDeviceObservationReport(oSource).source.Clone;
subject := TFhirDeviceObservationReport(oSource).subject.Clone;
FVirtualDeviceList.Assign(TFhirDeviceObservationReport(oSource).FVirtualDeviceList);
end;
procedure TFhirDeviceObservationReport.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'instant') Then
list.add(FInstant.Link);
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'virtualDevice') Then
list.addAll(FVirtualDeviceList);
end;
procedure TFhirDeviceObservationReport.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'instant', 'instant', FInstant.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', 'Resource(Device)', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Device|Location)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'virtualDevice', '', FVirtualDeviceList.Link)){3};
end;
procedure TFhirDeviceObservationReport.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'instant') then InstantObject := propValue as TFhirInstant{5a}
else if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'source') then Source := propValue as TFhirResourceReference{TFhirDevice}{4b}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'virtualDevice') then VirtualDeviceList.add(propValue as TFhirDeviceObservationReportVirtualDevice){2}
else inherited;
end;
function TFhirDeviceObservationReport.FhirType : string;
begin
result := 'DeviceObservationReport';
end;
function TFhirDeviceObservationReport.Link : TFhirDeviceObservationReport;
begin
result := TFhirDeviceObservationReport(inherited Link);
end;
function TFhirDeviceObservationReport.Clone : TFhirDeviceObservationReport;
begin
result := TFhirDeviceObservationReport(inherited Clone);
end;
{ TFhirDeviceObservationReport }
Procedure TFhirDeviceObservationReport.SetInstant(value : TFhirInstant);
begin
FInstant.free;
FInstant := value;
end;
Function TFhirDeviceObservationReport.GetInstantST : TDateTimeEx;
begin
if FInstant = nil then
result := nil
else
result := FInstant.value;
end;
Procedure TFhirDeviceObservationReport.SetInstantST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FInstant = nil then
FInstant := TFhirInstant.create;
FInstant.value := value
end
else if FInstant <> nil then
FInstant.value := nil;
end;
Procedure TFhirDeviceObservationReport.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirDeviceObservationReport.SetSource(value : TFhirResourceReference{TFhirDevice});
begin
FSource.free;
FSource := value;
end;
Procedure TFhirDeviceObservationReport.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
{ TFhirDiagnosticOrder }
constructor TFhirDiagnosticOrder.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FSpecimenList := TFhirResourceReferenceList{TFhirSpecimen}.Create;
FEventList := TFhirDiagnosticOrderEventList.Create;
FItemList := TFhirDiagnosticOrderItemList.Create;
end;
destructor TFhirDiagnosticOrder.Destroy;
begin
FSubject.free;
FOrderer.free;
FIdentifierList.Free;
FEncounter.free;
FClinicalNotes.free;
FSpecimenList.Free;
FStatus.free;
FPriority.free;
FEventList.Free;
FItemList.Free;
inherited;
end;
function TFhirDiagnosticOrder.GetResourceType : TFhirResourceType;
begin
result := frtDiagnosticOrder;
end;
function TFhirDiagnosticOrder.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirDiagnosticOrder.Assign(oSource : TAdvObject);
begin
inherited;
subject := TFhirDiagnosticOrder(oSource).subject.Clone;
orderer := TFhirDiagnosticOrder(oSource).orderer.Clone;
FIdentifierList.Assign(TFhirDiagnosticOrder(oSource).FIdentifierList);
encounter := TFhirDiagnosticOrder(oSource).encounter.Clone;
clinicalNotesObject := TFhirDiagnosticOrder(oSource).clinicalNotesObject.Clone;
FSpecimenList.Assign(TFhirDiagnosticOrder(oSource).FSpecimenList);
FStatus := TFhirDiagnosticOrder(oSource).FStatus.Link;
FPriority := TFhirDiagnosticOrder(oSource).FPriority.Link;
FEventList.Assign(TFhirDiagnosticOrder(oSource).FEventList);
FItemList.Assign(TFhirDiagnosticOrder(oSource).FItemList);
end;
procedure TFhirDiagnosticOrder.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'orderer') Then
list.add(FOrderer.Link);
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'encounter') Then
list.add(FEncounter.Link);
if (child_name = 'clinicalNotes') Then
list.add(FClinicalNotes.Link);
if (child_name = 'specimen') Then
list.addAll(FSpecimenList);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'priority') Then
list.add(FPriority.Link);
if (child_name = 'event') Then
list.addAll(FEventList);
if (child_name = 'item') Then
list.addAll(FItemList);
end;
procedure TFhirDiagnosticOrder.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Group|Location|Device)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'orderer', 'Resource(Practitioner)', FOrderer.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'encounter', 'Resource(Encounter)', FEncounter.Link));{2}
oList.add(TFHIRProperty.create(self, 'clinicalNotes', 'string', FClinicalNotes.Link));{2}
oList.add(TFHIRProperty.create(self, 'specimen', 'Resource(Specimen)', FSpecimenList.Link)){3};
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'priority', 'code', FPriority.Link));{1}
oList.add(TFHIRProperty.create(self, 'event', '', FEventList.Link)){3};
oList.add(TFHIRProperty.create(self, 'item', '', FItemList.Link)){3};
end;
procedure TFhirDiagnosticOrder.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'orderer') then Orderer := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'encounter') then Encounter := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else if (propName = 'clinicalNotes') then ClinicalNotesObject := propValue as TFhirString{5a}
else if (propName = 'specimen') then SpecimenList.add(propValue as TFhirResourceReference{TFhirSpecimen}){2}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'priority') then PriorityObject := propValue as TFHIREnum
else if (propName = 'event') then EventList.add(propValue as TFhirDiagnosticOrderEvent){2}
else if (propName = 'item') then ItemList.add(propValue as TFhirDiagnosticOrderItem){2}
else inherited;
end;
function TFhirDiagnosticOrder.FhirType : string;
begin
result := 'DiagnosticOrder';
end;
function TFhirDiagnosticOrder.Link : TFhirDiagnosticOrder;
begin
result := TFhirDiagnosticOrder(inherited Link);
end;
function TFhirDiagnosticOrder.Clone : TFhirDiagnosticOrder;
begin
result := TFhirDiagnosticOrder(inherited Clone);
end;
{ TFhirDiagnosticOrder }
Procedure TFhirDiagnosticOrder.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirDiagnosticOrder.SetOrderer(value : TFhirResourceReference{TFhirPractitioner});
begin
FOrderer.free;
FOrderer := value;
end;
Procedure TFhirDiagnosticOrder.SetEncounter(value : TFhirResourceReference{TFhirEncounter});
begin
FEncounter.free;
FEncounter := value;
end;
Procedure TFhirDiagnosticOrder.SetClinicalNotes(value : TFhirString);
begin
FClinicalNotes.free;
FClinicalNotes := value;
end;
Function TFhirDiagnosticOrder.GetClinicalNotesST : String;
begin
if FClinicalNotes = nil then
result := ''
else
result := FClinicalNotes.value;
end;
Procedure TFhirDiagnosticOrder.SetClinicalNotesST(value : String);
begin
if value <> '' then
begin
if FClinicalNotes = nil then
FClinicalNotes := TFhirString.create;
FClinicalNotes.value := value
end
else if FClinicalNotes <> nil then
FClinicalNotes.value := '';
end;
Procedure TFhirDiagnosticOrder.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirDiagnosticOrder.GetStatusST : TFhirDiagnosticOrderStatus;
begin
if FStatus = nil then
result := TFhirDiagnosticOrderStatus(0)
else
result := TFhirDiagnosticOrderStatus(StringArrayIndexOfSensitive(CODES_TFhirDiagnosticOrderStatus, FStatus.value));
end;
Procedure TFhirDiagnosticOrder.SetStatusST(value : TFhirDiagnosticOrderStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirDiagnosticOrderStatus[value]);
end;
Procedure TFhirDiagnosticOrder.SetPriority(value : TFhirEnum);
begin
FPriority.free;
FPriority := value;
end;
Function TFhirDiagnosticOrder.GetPriorityST : TFhirDiagnosticOrderPriority;
begin
if FPriority = nil then
result := TFhirDiagnosticOrderPriority(0)
else
result := TFhirDiagnosticOrderPriority(StringArrayIndexOfSensitive(CODES_TFhirDiagnosticOrderPriority, FPriority.value));
end;
Procedure TFhirDiagnosticOrder.SetPriorityST(value : TFhirDiagnosticOrderPriority);
begin
if ord(value) = 0 then
PriorityObject := nil
else
PriorityObject := TFhirEnum.create(CODES_TFhirDiagnosticOrderPriority[value]);
end;
{ TFhirDiagnosticReport }
constructor TFhirDiagnosticReport.Create;
begin
inherited;
FRequestDetailList := TFhirResourceReferenceList{TFhirDiagnosticOrder}.Create;
FSpecimenList := TFhirResourceReferenceList{TFhirSpecimen}.Create;
FResultList := TFhirResourceReferenceList{TFhirObservation}.Create;
FImagingStudyList := TFhirResourceReferenceList{TFhirImagingStudy}.Create;
FImageList := TFhirDiagnosticReportImageList.Create;
FCodedDiagnosisList := TFhirCodeableConceptList.Create;
FPresentedFormList := TFhirAttachmentList.Create;
end;
destructor TFhirDiagnosticReport.Destroy;
begin
FName.free;
FStatus.free;
FIssued.free;
FSubject.free;
FPerformer.free;
FIdentifier.free;
FRequestDetailList.Free;
FServiceCategory.free;
FDiagnostic.free;
FSpecimenList.Free;
FResultList.Free;
FImagingStudyList.Free;
FImageList.Free;
FConclusion.free;
FCodedDiagnosisList.Free;
FPresentedFormList.Free;
inherited;
end;
function TFhirDiagnosticReport.GetResourceType : TFhirResourceType;
begin
result := frtDiagnosticReport;
end;
function TFhirDiagnosticReport.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirDiagnosticReport.Assign(oSource : TAdvObject);
begin
inherited;
name := TFhirDiagnosticReport(oSource).name.Clone;
FStatus := TFhirDiagnosticReport(oSource).FStatus.Link;
issuedObject := TFhirDiagnosticReport(oSource).issuedObject.Clone;
subject := TFhirDiagnosticReport(oSource).subject.Clone;
performer := TFhirDiagnosticReport(oSource).performer.Clone;
identifier := TFhirDiagnosticReport(oSource).identifier.Clone;
FRequestDetailList.Assign(TFhirDiagnosticReport(oSource).FRequestDetailList);
serviceCategory := TFhirDiagnosticReport(oSource).serviceCategory.Clone;
diagnostic := TFhirDiagnosticReport(oSource).diagnostic.Clone;
FSpecimenList.Assign(TFhirDiagnosticReport(oSource).FSpecimenList);
FResultList.Assign(TFhirDiagnosticReport(oSource).FResultList);
FImagingStudyList.Assign(TFhirDiagnosticReport(oSource).FImagingStudyList);
FImageList.Assign(TFhirDiagnosticReport(oSource).FImageList);
conclusionObject := TFhirDiagnosticReport(oSource).conclusionObject.Clone;
FCodedDiagnosisList.Assign(TFhirDiagnosticReport(oSource).FCodedDiagnosisList);
FPresentedFormList.Assign(TFhirDiagnosticReport(oSource).FPresentedFormList);
end;
procedure TFhirDiagnosticReport.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'issued') Then
list.add(FIssued.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'performer') Then
list.add(FPerformer.Link);
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'requestDetail') Then
list.addAll(FRequestDetailList);
if (child_name = 'serviceCategory') Then
list.add(FServiceCategory.Link);
if (child_name = 'diagnostic[x]') Then
list.add(FDiagnostic.Link);
if (child_name = 'specimen') Then
list.addAll(FSpecimenList);
if (child_name = 'result') Then
list.addAll(FResultList);
if (child_name = 'imagingStudy') Then
list.addAll(FImagingStudyList);
if (child_name = 'image') Then
list.addAll(FImageList);
if (child_name = 'conclusion') Then
list.add(FConclusion.Link);
if (child_name = 'codedDiagnosis') Then
list.addAll(FCodedDiagnosisList);
if (child_name = 'presentedForm') Then
list.addAll(FPresentedFormList);
end;
procedure TFhirDiagnosticReport.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'name', 'CodeableConcept', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'issued', 'dateTime', FIssued.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Group|Device|Location)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'performer', 'Resource(Practitioner|Organization)', FPerformer.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'requestDetail', 'Resource(DiagnosticOrder)', FRequestDetailList.Link)){3};
oList.add(TFHIRProperty.create(self, 'serviceCategory', 'CodeableConcept', FServiceCategory.Link));{2}
oList.add(TFHIRProperty.create(self, 'diagnostic[x]', 'dateTime|Period', FDiagnostic.Link));{2}
oList.add(TFHIRProperty.create(self, 'specimen', 'Resource(Specimen)', FSpecimenList.Link)){3};
oList.add(TFHIRProperty.create(self, 'result', 'Resource(Observation)', FResultList.Link)){3};
oList.add(TFHIRProperty.create(self, 'imagingStudy', 'Resource(ImagingStudy)', FImagingStudyList.Link)){3};
oList.add(TFHIRProperty.create(self, 'image', '', FImageList.Link)){3};
oList.add(TFHIRProperty.create(self, 'conclusion', 'string', FConclusion.Link));{2}
oList.add(TFHIRProperty.create(self, 'codedDiagnosis', 'CodeableConcept', FCodedDiagnosisList.Link)){3};
oList.add(TFHIRProperty.create(self, 'presentedForm', 'Attachment', FPresentedFormList.Link)){3};
end;
procedure TFhirDiagnosticReport.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'name') then Name := propValue as TFhirCodeableConcept{4b}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'issued') then IssuedObject := propValue as TFhirDateTime{5a}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'performer') then Performer := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'requestDetail') then RequestDetailList.add(propValue as TFhirResourceReference{TFhirDiagnosticOrder}){2}
else if (propName = 'serviceCategory') then ServiceCategory := propValue as TFhirCodeableConcept{4b}
else if (propName.startsWith('diagnostic')) then Diagnostic := propValue as TFhirType{4}
else if (propName = 'specimen') then SpecimenList.add(propValue as TFhirResourceReference{TFhirSpecimen}){2}
else if (propName = 'result') then ResultList.add(propValue as TFhirResourceReference{TFhirObservation}){2}
else if (propName = 'imagingStudy') then ImagingStudyList.add(propValue as TFhirResourceReference{TFhirImagingStudy}){2}
else if (propName = 'image') then ImageList.add(propValue as TFhirDiagnosticReportImage){2}
else if (propName = 'conclusion') then ConclusionObject := propValue as TFhirString{5a}
else if (propName = 'codedDiagnosis') then CodedDiagnosisList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'presentedForm') then PresentedFormList.add(propValue as TFhirAttachment){2}
else inherited;
end;
function TFhirDiagnosticReport.FhirType : string;
begin
result := 'DiagnosticReport';
end;
function TFhirDiagnosticReport.Link : TFhirDiagnosticReport;
begin
result := TFhirDiagnosticReport(inherited Link);
end;
function TFhirDiagnosticReport.Clone : TFhirDiagnosticReport;
begin
result := TFhirDiagnosticReport(inherited Clone);
end;
{ TFhirDiagnosticReport }
Procedure TFhirDiagnosticReport.SetName(value : TFhirCodeableConcept);
begin
FName.free;
FName := value;
end;
Procedure TFhirDiagnosticReport.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirDiagnosticReport.GetStatusST : TFhirDiagnosticReportStatus;
begin
if FStatus = nil then
result := TFhirDiagnosticReportStatus(0)
else
result := TFhirDiagnosticReportStatus(StringArrayIndexOfSensitive(CODES_TFhirDiagnosticReportStatus, FStatus.value));
end;
Procedure TFhirDiagnosticReport.SetStatusST(value : TFhirDiagnosticReportStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirDiagnosticReportStatus[value]);
end;
Procedure TFhirDiagnosticReport.SetIssued(value : TFhirDateTime);
begin
FIssued.free;
FIssued := value;
end;
Function TFhirDiagnosticReport.GetIssuedST : TDateTimeEx;
begin
if FIssued = nil then
result := nil
else
result := FIssued.value;
end;
Procedure TFhirDiagnosticReport.SetIssuedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FIssued = nil then
FIssued := TFhirDateTime.create;
FIssued.value := value
end
else if FIssued <> nil then
FIssued.value := nil;
end;
Procedure TFhirDiagnosticReport.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirDiagnosticReport.SetPerformer(value : TFhirResourceReference{Resource});
begin
FPerformer.free;
FPerformer := value;
end;
Procedure TFhirDiagnosticReport.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirDiagnosticReport.SetServiceCategory(value : TFhirCodeableConcept);
begin
FServiceCategory.free;
FServiceCategory := value;
end;
Procedure TFhirDiagnosticReport.SetDiagnostic(value : TFhirType);
begin
FDiagnostic.free;
FDiagnostic := value;
end;
Procedure TFhirDiagnosticReport.SetConclusion(value : TFhirString);
begin
FConclusion.free;
FConclusion := value;
end;
Function TFhirDiagnosticReport.GetConclusionST : String;
begin
if FConclusion = nil then
result := ''
else
result := FConclusion.value;
end;
Procedure TFhirDiagnosticReport.SetConclusionST(value : String);
begin
if value <> '' then
begin
if FConclusion = nil then
FConclusion := TFhirString.create;
FConclusion.value := value
end
else if FConclusion <> nil then
FConclusion.value := '';
end;
{ TFhirDocumentManifest }
constructor TFhirDocumentManifest.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FSubjectList := TFhirResourceReferenceList{Resource}.Create;
FRecipientList := TFhirResourceReferenceList{Resource}.Create;
FAuthorList := TFhirResourceReferenceList{Resource}.Create;
FContentList := TFhirResourceReferenceList{Resource}.Create;
end;
destructor TFhirDocumentManifest.Destroy;
begin
FMasterIdentifier.free;
FIdentifierList.Free;
FSubjectList.Free;
FRecipientList.Free;
FType_.free;
FAuthorList.Free;
FCreated.free;
FSource.free;
FStatus.free;
FSupercedes.free;
FDescription.free;
FConfidentiality.free;
FContentList.Free;
inherited;
end;
function TFhirDocumentManifest.GetResourceType : TFhirResourceType;
begin
result := frtDocumentManifest;
end;
function TFhirDocumentManifest.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirDocumentManifest.Assign(oSource : TAdvObject);
begin
inherited;
masterIdentifier := TFhirDocumentManifest(oSource).masterIdentifier.Clone;
FIdentifierList.Assign(TFhirDocumentManifest(oSource).FIdentifierList);
FSubjectList.Assign(TFhirDocumentManifest(oSource).FSubjectList);
FRecipientList.Assign(TFhirDocumentManifest(oSource).FRecipientList);
type_ := TFhirDocumentManifest(oSource).type_.Clone;
FAuthorList.Assign(TFhirDocumentManifest(oSource).FAuthorList);
createdObject := TFhirDocumentManifest(oSource).createdObject.Clone;
sourceObject := TFhirDocumentManifest(oSource).sourceObject.Clone;
FStatus := TFhirDocumentManifest(oSource).FStatus.Link;
supercedes := TFhirDocumentManifest(oSource).supercedes.Clone;
descriptionObject := TFhirDocumentManifest(oSource).descriptionObject.Clone;
confidentiality := TFhirDocumentManifest(oSource).confidentiality.Clone;
FContentList.Assign(TFhirDocumentManifest(oSource).FContentList);
end;
procedure TFhirDocumentManifest.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'masterIdentifier') Then
list.add(FMasterIdentifier.Link);
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'subject') Then
list.addAll(FSubjectList);
if (child_name = 'recipient') Then
list.addAll(FRecipientList);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'author') Then
list.addAll(FAuthorList);
if (child_name = 'created') Then
list.add(FCreated.Link);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'supercedes') Then
list.add(FSupercedes.Link);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'confidentiality') Then
list.add(FConfidentiality.Link);
if (child_name = 'content') Then
list.addAll(FContentList);
end;
procedure TFhirDocumentManifest.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'masterIdentifier', 'Identifier', FMasterIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Practitioner|Group|Device)', FSubjectList.Link)){3};
oList.add(TFHIRProperty.create(self, 'recipient', 'Resource(Patient|Practitioner|Organization)', FRecipientList.Link)){3};
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'author', 'Resource(Practitioner|Device|Patient|RelatedPerson)', FAuthorList.Link)){3};
oList.add(TFHIRProperty.create(self, 'created', 'dateTime', FCreated.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', 'uri', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'supercedes', 'Resource(DocumentManifest)', FSupercedes.Link));{2}
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'confidentiality', 'CodeableConcept', FConfidentiality.Link));{2}
oList.add(TFHIRProperty.create(self, 'content', 'Resource(DocumentReference|Binary|Media)', FContentList.Link)){3};
end;
procedure TFhirDocumentManifest.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'masterIdentifier') then MasterIdentifier := propValue as TFhirIdentifier{4b}
else if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'subject') then SubjectList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'recipient') then RecipientList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'author') then AuthorList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'created') then CreatedObject := propValue as TFhirDateTime{5a}
else if (propName = 'source') then SourceObject := propValue as TFhirUri{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'supercedes') then Supercedes := propValue as TFhirResourceReference{TFhirDocumentManifest}{4b}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'confidentiality') then Confidentiality := propValue as TFhirCodeableConcept{4b}
else if (propName = 'content') then ContentList.add(propValue as TFhirResourceReference{Resource}){2}
else inherited;
end;
function TFhirDocumentManifest.FhirType : string;
begin
result := 'DocumentManifest';
end;
function TFhirDocumentManifest.Link : TFhirDocumentManifest;
begin
result := TFhirDocumentManifest(inherited Link);
end;
function TFhirDocumentManifest.Clone : TFhirDocumentManifest;
begin
result := TFhirDocumentManifest(inherited Clone);
end;
{ TFhirDocumentManifest }
Procedure TFhirDocumentManifest.SetMasterIdentifier(value : TFhirIdentifier);
begin
FMasterIdentifier.free;
FMasterIdentifier := value;
end;
Procedure TFhirDocumentManifest.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirDocumentManifest.SetCreated(value : TFhirDateTime);
begin
FCreated.free;
FCreated := value;
end;
Function TFhirDocumentManifest.GetCreatedST : TDateTimeEx;
begin
if FCreated = nil then
result := nil
else
result := FCreated.value;
end;
Procedure TFhirDocumentManifest.SetCreatedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FCreated = nil then
FCreated := TFhirDateTime.create;
FCreated.value := value
end
else if FCreated <> nil then
FCreated.value := nil;
end;
Procedure TFhirDocumentManifest.SetSource(value : TFhirUri);
begin
FSource.free;
FSource := value;
end;
Function TFhirDocumentManifest.GetSourceST : String;
begin
if FSource = nil then
result := ''
else
result := FSource.value;
end;
Procedure TFhirDocumentManifest.SetSourceST(value : String);
begin
if value <> '' then
begin
if FSource = nil then
FSource := TFhirUri.create;
FSource.value := value
end
else if FSource <> nil then
FSource.value := '';
end;
Procedure TFhirDocumentManifest.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirDocumentManifest.GetStatusST : TFhirDocumentReferenceStatus;
begin
if FStatus = nil then
result := TFhirDocumentReferenceStatus(0)
else
result := TFhirDocumentReferenceStatus(StringArrayIndexOfSensitive(CODES_TFhirDocumentReferenceStatus, FStatus.value));
end;
Procedure TFhirDocumentManifest.SetStatusST(value : TFhirDocumentReferenceStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirDocumentReferenceStatus[value]);
end;
Procedure TFhirDocumentManifest.SetSupercedes(value : TFhirResourceReference{TFhirDocumentManifest});
begin
FSupercedes.free;
FSupercedes := value;
end;
Procedure TFhirDocumentManifest.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirDocumentManifest.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirDocumentManifest.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirDocumentManifest.SetConfidentiality(value : TFhirCodeableConcept);
begin
FConfidentiality.free;
FConfidentiality := value;
end;
{ TFhirDocumentReference }
constructor TFhirDocumentReference.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FAuthorList := TFhirResourceReferenceList{Resource}.Create;
FRelatesToList := TFhirDocumentReferenceRelatesToList.Create;
FConfidentialityList := TFhirCodeableConceptList.Create;
FFormatList := TFhirUriList.Create;
end;
destructor TFhirDocumentReference.Destroy;
begin
FMasterIdentifier.free;
FIdentifierList.Free;
FSubject.free;
FType_.free;
FClass_.free;
FAuthorList.Free;
FCustodian.free;
FPolicyManager.free;
FAuthenticator.free;
FCreated.free;
FIndexed.free;
FStatus.free;
FDocStatus.free;
FRelatesToList.Free;
FDescription.free;
FConfidentialityList.Free;
FPrimaryLanguage.free;
FMimeType.free;
FFormatList.Free;
FSize.free;
FHash.free;
FLocation.free;
FService.free;
FContext.free;
inherited;
end;
function TFhirDocumentReference.GetResourceType : TFhirResourceType;
begin
result := frtDocumentReference;
end;
function TFhirDocumentReference.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirDocumentReference.Assign(oSource : TAdvObject);
begin
inherited;
masterIdentifier := TFhirDocumentReference(oSource).masterIdentifier.Clone;
FIdentifierList.Assign(TFhirDocumentReference(oSource).FIdentifierList);
subject := TFhirDocumentReference(oSource).subject.Clone;
type_ := TFhirDocumentReference(oSource).type_.Clone;
class_ := TFhirDocumentReference(oSource).class_.Clone;
FAuthorList.Assign(TFhirDocumentReference(oSource).FAuthorList);
custodian := TFhirDocumentReference(oSource).custodian.Clone;
policyManagerObject := TFhirDocumentReference(oSource).policyManagerObject.Clone;
authenticator := TFhirDocumentReference(oSource).authenticator.Clone;
createdObject := TFhirDocumentReference(oSource).createdObject.Clone;
indexedObject := TFhirDocumentReference(oSource).indexedObject.Clone;
FStatus := TFhirDocumentReference(oSource).FStatus.Link;
docStatus := TFhirDocumentReference(oSource).docStatus.Clone;
FRelatesToList.Assign(TFhirDocumentReference(oSource).FRelatesToList);
descriptionObject := TFhirDocumentReference(oSource).descriptionObject.Clone;
FConfidentialityList.Assign(TFhirDocumentReference(oSource).FConfidentialityList);
primaryLanguageObject := TFhirDocumentReference(oSource).primaryLanguageObject.Clone;
mimeTypeObject := TFhirDocumentReference(oSource).mimeTypeObject.Clone;
FFormatList.Assign(TFhirDocumentReference(oSource).FFormatList);
sizeObject := TFhirDocumentReference(oSource).sizeObject.Clone;
hashObject := TFhirDocumentReference(oSource).hashObject.Clone;
locationObject := TFhirDocumentReference(oSource).locationObject.Clone;
service := TFhirDocumentReference(oSource).service.Clone;
context := TFhirDocumentReference(oSource).context.Clone;
end;
procedure TFhirDocumentReference.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'masterIdentifier') Then
list.add(FMasterIdentifier.Link);
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'class') Then
list.add(FClass_.Link);
if (child_name = 'author') Then
list.addAll(FAuthorList);
if (child_name = 'custodian') Then
list.add(FCustodian.Link);
if (child_name = 'policyManager') Then
list.add(FPolicyManager.Link);
if (child_name = 'authenticator') Then
list.add(FAuthenticator.Link);
if (child_name = 'created') Then
list.add(FCreated.Link);
if (child_name = 'indexed') Then
list.add(FIndexed.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'docStatus') Then
list.add(FDocStatus.Link);
if (child_name = 'relatesTo') Then
list.addAll(FRelatesToList);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'confidentiality') Then
list.addAll(FConfidentialityList);
if (child_name = 'primaryLanguage') Then
list.add(FPrimaryLanguage.Link);
if (child_name = 'mimeType') Then
list.add(FMimeType.Link);
if (child_name = 'format') Then
list.addAll(FFormatList);
if (child_name = 'size') Then
list.add(FSize.Link);
if (child_name = 'hash') Then
list.add(FHash.Link);
if (child_name = 'location') Then
list.add(FLocation.Link);
if (child_name = 'service') Then
list.add(FService.Link);
if (child_name = 'context') Then
list.add(FContext.Link);
end;
procedure TFhirDocumentReference.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'masterIdentifier', 'Identifier', FMasterIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Practitioner|Group|Device)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'class', 'CodeableConcept', FClass_.Link));{2}
oList.add(TFHIRProperty.create(self, 'author', 'Resource(Practitioner|Device|Patient|RelatedPerson)', FAuthorList.Link)){3};
oList.add(TFHIRProperty.create(self, 'custodian', 'Resource(Organization)', FCustodian.Link));{2}
oList.add(TFHIRProperty.create(self, 'policyManager', 'uri', FPolicyManager.Link));{2}
oList.add(TFHIRProperty.create(self, 'authenticator', 'Resource(Practitioner|Organization)', FAuthenticator.Link));{2}
oList.add(TFHIRProperty.create(self, 'created', 'dateTime', FCreated.Link));{2}
oList.add(TFHIRProperty.create(self, 'indexed', 'instant', FIndexed.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'docStatus', 'CodeableConcept', FDocStatus.Link));{2}
oList.add(TFHIRProperty.create(self, 'relatesTo', '', FRelatesToList.Link)){3};
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'confidentiality', 'CodeableConcept', FConfidentialityList.Link)){3};
oList.add(TFHIRProperty.create(self, 'primaryLanguage', 'code', FPrimaryLanguage.Link));{2}
oList.add(TFHIRProperty.create(self, 'mimeType', 'code', FMimeType.Link));{2}
oList.add(TFHIRProperty.create(self, 'format', 'uri', FFormatList.Link)){3};
oList.add(TFHIRProperty.create(self, 'size', 'integer', FSize.Link));{2}
oList.add(TFHIRProperty.create(self, 'hash', 'string', FHash.Link));{2}
oList.add(TFHIRProperty.create(self, 'location', 'uri', FLocation.Link));{2}
oList.add(TFHIRProperty.create(self, 'service', '', FService.Link));{2}
oList.add(TFHIRProperty.create(self, 'context', '', FContext.Link));{2}
end;
procedure TFhirDocumentReference.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'masterIdentifier') then MasterIdentifier := propValue as TFhirIdentifier{4b}
else if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'class') then Class_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'author') then AuthorList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'custodian') then Custodian := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'policyManager') then PolicyManagerObject := propValue as TFhirUri{5a}
else if (propName = 'authenticator') then Authenticator := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'created') then CreatedObject := propValue as TFhirDateTime{5a}
else if (propName = 'indexed') then IndexedObject := propValue as TFhirInstant{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'docStatus') then DocStatus := propValue as TFhirCodeableConcept{4b}
else if (propName = 'relatesTo') then RelatesToList.add(propValue as TFhirDocumentReferenceRelatesTo){2}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'confidentiality') then ConfidentialityList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'primaryLanguage') then
if propValue is TFHIRCode then
PrimaryLanguageObject := propValue as TFhirCode{5}
else if propValue is TFHIREnum then
PrimaryLanguageObject := TFHIRCode.create(TFHIREnum(propValue).value)
else
raise Exception.Create('Type mismatch: cannot convert from "'+propValue.className+'" to "TFHIRCode"'){5a}
else if (propName = 'mimeType') then
if propValue is TFHIRCode then
MimeTypeObject := propValue as TFhirCode{5}
else if propValue is TFHIREnum then
MimeTypeObject := TFHIRCode.create(TFHIREnum(propValue).value)
else
raise Exception.Create('Type mismatch: cannot convert from "'+propValue.className+'" to "TFHIRCode"'){5a}
else if (propName = 'format') then FormatList.add(propValue as TFhirUri){2}
else if (propName = 'size') then SizeObject := propValue as TFhirInteger{5a}
else if (propName = 'hash') then HashObject := propValue as TFhirString{5a}
else if (propName = 'location') then LocationObject := propValue as TFhirUri{5a}
else if (propName = 'service') then Service := propValue as TFhirDocumentReferenceService{4b}
else if (propName = 'context') then Context := propValue as TFhirDocumentReferenceContext{4b}
else inherited;
end;
function TFhirDocumentReference.FhirType : string;
begin
result := 'DocumentReference';
end;
function TFhirDocumentReference.Link : TFhirDocumentReference;
begin
result := TFhirDocumentReference(inherited Link);
end;
function TFhirDocumentReference.Clone : TFhirDocumentReference;
begin
result := TFhirDocumentReference(inherited Clone);
end;
{ TFhirDocumentReference }
Procedure TFhirDocumentReference.SetMasterIdentifier(value : TFhirIdentifier);
begin
FMasterIdentifier.free;
FMasterIdentifier := value;
end;
Procedure TFhirDocumentReference.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirDocumentReference.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirDocumentReference.SetClass_(value : TFhirCodeableConcept);
begin
FClass_.free;
FClass_ := value;
end;
Procedure TFhirDocumentReference.SetCustodian(value : TFhirResourceReference{TFhirOrganization});
begin
FCustodian.free;
FCustodian := value;
end;
Procedure TFhirDocumentReference.SetPolicyManager(value : TFhirUri);
begin
FPolicyManager.free;
FPolicyManager := value;
end;
Function TFhirDocumentReference.GetPolicyManagerST : String;
begin
if FPolicyManager = nil then
result := ''
else
result := FPolicyManager.value;
end;
Procedure TFhirDocumentReference.SetPolicyManagerST(value : String);
begin
if value <> '' then
begin
if FPolicyManager = nil then
FPolicyManager := TFhirUri.create;
FPolicyManager.value := value
end
else if FPolicyManager <> nil then
FPolicyManager.value := '';
end;
Procedure TFhirDocumentReference.SetAuthenticator(value : TFhirResourceReference{Resource});
begin
FAuthenticator.free;
FAuthenticator := value;
end;
Procedure TFhirDocumentReference.SetCreated(value : TFhirDateTime);
begin
FCreated.free;
FCreated := value;
end;
Function TFhirDocumentReference.GetCreatedST : TDateTimeEx;
begin
if FCreated = nil then
result := nil
else
result := FCreated.value;
end;
Procedure TFhirDocumentReference.SetCreatedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FCreated = nil then
FCreated := TFhirDateTime.create;
FCreated.value := value
end
else if FCreated <> nil then
FCreated.value := nil;
end;
Procedure TFhirDocumentReference.SetIndexed(value : TFhirInstant);
begin
FIndexed.free;
FIndexed := value;
end;
Function TFhirDocumentReference.GetIndexedST : TDateTimeEx;
begin
if FIndexed = nil then
result := nil
else
result := FIndexed.value;
end;
Procedure TFhirDocumentReference.SetIndexedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FIndexed = nil then
FIndexed := TFhirInstant.create;
FIndexed.value := value
end
else if FIndexed <> nil then
FIndexed.value := nil;
end;
Procedure TFhirDocumentReference.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirDocumentReference.GetStatusST : TFhirDocumentReferenceStatus;
begin
if FStatus = nil then
result := TFhirDocumentReferenceStatus(0)
else
result := TFhirDocumentReferenceStatus(StringArrayIndexOfSensitive(CODES_TFhirDocumentReferenceStatus, FStatus.value));
end;
Procedure TFhirDocumentReference.SetStatusST(value : TFhirDocumentReferenceStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirDocumentReferenceStatus[value]);
end;
Procedure TFhirDocumentReference.SetDocStatus(value : TFhirCodeableConcept);
begin
FDocStatus.free;
FDocStatus := value;
end;
Procedure TFhirDocumentReference.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirDocumentReference.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirDocumentReference.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirDocumentReference.SetPrimaryLanguage(value : TFhirCode);
begin
FPrimaryLanguage.free;
FPrimaryLanguage := value;
end;
Function TFhirDocumentReference.GetPrimaryLanguageST : String;
begin
if FPrimaryLanguage = nil then
result := ''
else
result := FPrimaryLanguage.value;
end;
Procedure TFhirDocumentReference.SetPrimaryLanguageST(value : String);
begin
if value <> '' then
begin
if FPrimaryLanguage = nil then
FPrimaryLanguage := TFhirCode.create;
FPrimaryLanguage.value := value
end
else if FPrimaryLanguage <> nil then
FPrimaryLanguage.value := '';
end;
Procedure TFhirDocumentReference.SetMimeType(value : TFhirCode);
begin
FMimeType.free;
FMimeType := value;
end;
Function TFhirDocumentReference.GetMimeTypeST : String;
begin
if FMimeType = nil then
result := ''
else
result := FMimeType.value;
end;
Procedure TFhirDocumentReference.SetMimeTypeST(value : String);
begin
if value <> '' then
begin
if FMimeType = nil then
FMimeType := TFhirCode.create;
FMimeType.value := value
end
else if FMimeType <> nil then
FMimeType.value := '';
end;
Procedure TFhirDocumentReference.SetSize(value : TFhirInteger);
begin
FSize.free;
FSize := value;
end;
Function TFhirDocumentReference.GetSizeST : String;
begin
if FSize = nil then
result := ''
else
result := FSize.value;
end;
Procedure TFhirDocumentReference.SetSizeST(value : String);
begin
if value <> '' then
begin
if FSize = nil then
FSize := TFhirInteger.create;
FSize.value := value
end
else if FSize <> nil then
FSize.value := '';
end;
Procedure TFhirDocumentReference.SetHash(value : TFhirString);
begin
FHash.free;
FHash := value;
end;
Function TFhirDocumentReference.GetHashST : String;
begin
if FHash = nil then
result := ''
else
result := FHash.value;
end;
Procedure TFhirDocumentReference.SetHashST(value : String);
begin
if value <> '' then
begin
if FHash = nil then
FHash := TFhirString.create;
FHash.value := value
end
else if FHash <> nil then
FHash.value := '';
end;
Procedure TFhirDocumentReference.SetLocation(value : TFhirUri);
begin
FLocation.free;
FLocation := value;
end;
Function TFhirDocumentReference.GetLocationST : String;
begin
if FLocation = nil then
result := ''
else
result := FLocation.value;
end;
Procedure TFhirDocumentReference.SetLocationST(value : String);
begin
if value <> '' then
begin
if FLocation = nil then
FLocation := TFhirUri.create;
FLocation.value := value
end
else if FLocation <> nil then
FLocation.value := '';
end;
Procedure TFhirDocumentReference.SetService(value : TFhirDocumentReferenceService);
begin
FService.free;
FService := value;
end;
Procedure TFhirDocumentReference.SetContext(value : TFhirDocumentReferenceContext);
begin
FContext.free;
FContext := value;
end;
{ TFhirEncounter }
constructor TFhirEncounter.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FType_List := TFhirCodeableConceptList.Create;
FParticipantList := TFhirEncounterParticipantList.Create;
FLocationList := TFhirEncounterLocationList.Create;
end;
destructor TFhirEncounter.Destroy;
begin
FIdentifierList.Free;
FStatus.free;
FClass_.free;
FType_List.Free;
FSubject.free;
FParticipantList.Free;
FPeriod.free;
FLength.free;
FReason.free;
FIndication.free;
FPriority.free;
FHospitalization.free;
FLocationList.Free;
FServiceProvider.free;
FPartOf.free;
inherited;
end;
function TFhirEncounter.GetResourceType : TFhirResourceType;
begin
result := frtEncounter;
end;
function TFhirEncounter.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirEncounter.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirEncounter(oSource).FIdentifierList);
FStatus := TFhirEncounter(oSource).FStatus.Link;
FClass_ := TFhirEncounter(oSource).FClass_.Link;
FType_List.Assign(TFhirEncounter(oSource).FType_List);
subject := TFhirEncounter(oSource).subject.Clone;
FParticipantList.Assign(TFhirEncounter(oSource).FParticipantList);
period := TFhirEncounter(oSource).period.Clone;
length := TFhirEncounter(oSource).length.Clone;
reason := TFhirEncounter(oSource).reason.Clone;
indication := TFhirEncounter(oSource).indication.Clone;
priority := TFhirEncounter(oSource).priority.Clone;
hospitalization := TFhirEncounter(oSource).hospitalization.Clone;
FLocationList.Assign(TFhirEncounter(oSource).FLocationList);
serviceProvider := TFhirEncounter(oSource).serviceProvider.Clone;
partOf := TFhirEncounter(oSource).partOf.Clone;
end;
procedure TFhirEncounter.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'class') Then
list.add(FClass_.Link);
if (child_name = 'type') Then
list.addAll(FType_List);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'participant') Then
list.addAll(FParticipantList);
if (child_name = 'period') Then
list.add(FPeriod.Link);
if (child_name = 'length') Then
list.add(FLength.Link);
if (child_name = 'reason') Then
list.add(FReason.Link);
if (child_name = 'indication') Then
list.add(FIndication.Link);
if (child_name = 'priority') Then
list.add(FPriority.Link);
if (child_name = 'hospitalization') Then
list.add(FHospitalization.Link);
if (child_name = 'location') Then
list.addAll(FLocationList);
if (child_name = 'serviceProvider') Then
list.add(FServiceProvider.Link);
if (child_name = 'partOf') Then
list.add(FPartOf.Link);
end;
procedure TFhirEncounter.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'class', 'code', FClass_.Link));{1}
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_List.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'participant', '', FParticipantList.Link)){3};
oList.add(TFHIRProperty.create(self, 'period', 'Period', FPeriod.Link));{2}
oList.add(TFHIRProperty.create(self, 'length', 'Duration', FLength.Link));{2}
oList.add(TFHIRProperty.create(self, 'reason', 'CodeableConcept', FReason.Link));{2}
oList.add(TFHIRProperty.create(self, 'indication', 'Resource(Any)', FIndication.Link));{2}
oList.add(TFHIRProperty.create(self, 'priority', 'CodeableConcept', FPriority.Link));{2}
oList.add(TFHIRProperty.create(self, 'hospitalization', '', FHospitalization.Link));{2}
oList.add(TFHIRProperty.create(self, 'location', '', FLocationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'serviceProvider', 'Resource(Organization)', FServiceProvider.Link));{2}
oList.add(TFHIRProperty.create(self, 'partOf', 'Resource(Encounter)', FPartOf.Link));{2}
end;
procedure TFhirEncounter.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'class') then Class_Object := propValue as TFHIREnum
else if (propName = 'type') then Type_List.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'participant') then ParticipantList.add(propValue as TFhirEncounterParticipant){2}
else if (propName = 'period') then Period := propValue as TFhirPeriod{4b}
else if (propName = 'length') then Length := propValue as TFhirQuantity{4b}
else if (propName = 'reason') then Reason := propValue as TFhirCodeableConcept{4b}
else if (propName = 'indication') then Indication := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'priority') then Priority := propValue as TFhirCodeableConcept{4b}
else if (propName = 'hospitalization') then Hospitalization := propValue as TFhirEncounterHospitalization{4b}
else if (propName = 'location') then LocationList.add(propValue as TFhirEncounterLocation){2}
else if (propName = 'serviceProvider') then ServiceProvider := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'partOf') then PartOf := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else inherited;
end;
function TFhirEncounter.FhirType : string;
begin
result := 'Encounter';
end;
function TFhirEncounter.Link : TFhirEncounter;
begin
result := TFhirEncounter(inherited Link);
end;
function TFhirEncounter.Clone : TFhirEncounter;
begin
result := TFhirEncounter(inherited Clone);
end;
{ TFhirEncounter }
Procedure TFhirEncounter.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirEncounter.GetStatusST : TFhirEncounterState;
begin
if FStatus = nil then
result := TFhirEncounterState(0)
else
result := TFhirEncounterState(StringArrayIndexOfSensitive(CODES_TFhirEncounterState, FStatus.value));
end;
Procedure TFhirEncounter.SetStatusST(value : TFhirEncounterState);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirEncounterState[value]);
end;
Procedure TFhirEncounter.SetClass_(value : TFhirEnum);
begin
FClass_.free;
FClass_ := value;
end;
Function TFhirEncounter.GetClass_ST : TFhirEncounterClass;
begin
if FClass_ = nil then
result := TFhirEncounterClass(0)
else
result := TFhirEncounterClass(StringArrayIndexOfSensitive(CODES_TFhirEncounterClass, FClass_.value));
end;
Procedure TFhirEncounter.SetClass_ST(value : TFhirEncounterClass);
begin
if ord(value) = 0 then
Class_Object := nil
else
Class_Object := TFhirEnum.create(CODES_TFhirEncounterClass[value]);
end;
Procedure TFhirEncounter.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirEncounter.SetPeriod(value : TFhirPeriod);
begin
FPeriod.free;
FPeriod := value;
end;
Procedure TFhirEncounter.SetLength(value : TFhirQuantity);
begin
FLength.free;
FLength := value;
end;
Procedure TFhirEncounter.SetReason(value : TFhirCodeableConcept);
begin
FReason.free;
FReason := value;
end;
Procedure TFhirEncounter.SetIndication(value : TFhirResourceReference{Resource});
begin
FIndication.free;
FIndication := value;
end;
Procedure TFhirEncounter.SetPriority(value : TFhirCodeableConcept);
begin
FPriority.free;
FPriority := value;
end;
Procedure TFhirEncounter.SetHospitalization(value : TFhirEncounterHospitalization);
begin
FHospitalization.free;
FHospitalization := value;
end;
Procedure TFhirEncounter.SetServiceProvider(value : TFhirResourceReference{TFhirOrganization});
begin
FServiceProvider.free;
FServiceProvider := value;
end;
Procedure TFhirEncounter.SetPartOf(value : TFhirResourceReference{TFhirEncounter});
begin
FPartOf.free;
FPartOf := value;
end;
{ TFhirFamilyHistory }
constructor TFhirFamilyHistory.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FRelationList := TFhirFamilyHistoryRelationList.Create;
end;
destructor TFhirFamilyHistory.Destroy;
begin
FIdentifierList.Free;
FSubject.free;
FNote.free;
FRelationList.Free;
inherited;
end;
function TFhirFamilyHistory.GetResourceType : TFhirResourceType;
begin
result := frtFamilyHistory;
end;
function TFhirFamilyHistory.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirFamilyHistory.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirFamilyHistory(oSource).FIdentifierList);
subject := TFhirFamilyHistory(oSource).subject.Clone;
noteObject := TFhirFamilyHistory(oSource).noteObject.Clone;
FRelationList.Assign(TFhirFamilyHistory(oSource).FRelationList);
end;
procedure TFhirFamilyHistory.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'note') Then
list.add(FNote.Link);
if (child_name = 'relation') Then
list.addAll(FRelationList);
end;
procedure TFhirFamilyHistory.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'note', 'string', FNote.Link));{2}
oList.add(TFHIRProperty.create(self, 'relation', '', FRelationList.Link)){3};
end;
procedure TFhirFamilyHistory.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'note') then NoteObject := propValue as TFhirString{5a}
else if (propName = 'relation') then RelationList.add(propValue as TFhirFamilyHistoryRelation){2}
else inherited;
end;
function TFhirFamilyHistory.FhirType : string;
begin
result := 'FamilyHistory';
end;
function TFhirFamilyHistory.Link : TFhirFamilyHistory;
begin
result := TFhirFamilyHistory(inherited Link);
end;
function TFhirFamilyHistory.Clone : TFhirFamilyHistory;
begin
result := TFhirFamilyHistory(inherited Clone);
end;
{ TFhirFamilyHistory }
Procedure TFhirFamilyHistory.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirFamilyHistory.SetNote(value : TFhirString);
begin
FNote.free;
FNote := value;
end;
Function TFhirFamilyHistory.GetNoteST : String;
begin
if FNote = nil then
result := ''
else
result := FNote.value;
end;
Procedure TFhirFamilyHistory.SetNoteST(value : String);
begin
if value <> '' then
begin
if FNote = nil then
FNote := TFhirString.create;
FNote.value := value
end
else if FNote <> nil then
FNote.value := '';
end;
{ TFhirGroup }
constructor TFhirGroup.Create;
begin
inherited;
FCharacteristicList := TFhirGroupCharacteristicList.Create;
FMemberList := TFhirResourceReferenceList{Resource}.Create;
end;
destructor TFhirGroup.Destroy;
begin
FIdentifier.free;
FType_.free;
FActual.free;
FCode.free;
FName.free;
FQuantity.free;
FCharacteristicList.Free;
FMemberList.Free;
inherited;
end;
function TFhirGroup.GetResourceType : TFhirResourceType;
begin
result := frtGroup;
end;
function TFhirGroup.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirGroup.Assign(oSource : TAdvObject);
begin
inherited;
identifier := TFhirGroup(oSource).identifier.Clone;
FType_ := TFhirGroup(oSource).FType_.Link;
actualObject := TFhirGroup(oSource).actualObject.Clone;
code := TFhirGroup(oSource).code.Clone;
nameObject := TFhirGroup(oSource).nameObject.Clone;
quantityObject := TFhirGroup(oSource).quantityObject.Clone;
FCharacteristicList.Assign(TFhirGroup(oSource).FCharacteristicList);
FMemberList.Assign(TFhirGroup(oSource).FMemberList);
end;
procedure TFhirGroup.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'actual') Then
list.add(FActual.Link);
if (child_name = 'code') Then
list.add(FCode.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'quantity') Then
list.add(FQuantity.Link);
if (child_name = 'characteristic') Then
list.addAll(FCharacteristicList);
if (child_name = 'member') Then
list.addAll(FMemberList);
end;
procedure TFhirGroup.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'type', 'code', FType_.Link));{1}
oList.add(TFHIRProperty.create(self, 'actual', 'boolean', FActual.Link));{2}
oList.add(TFHIRProperty.create(self, 'code', 'CodeableConcept', FCode.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'quantity', 'integer', FQuantity.Link));{2}
oList.add(TFHIRProperty.create(self, 'characteristic', '', FCharacteristicList.Link)){3};
oList.add(TFHIRProperty.create(self, 'member', 'Resource(Patient|Practitioner|Device|Medication|Substance)', FMemberList.Link)){3};
end;
procedure TFhirGroup.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'type') then Type_Object := propValue as TFHIREnum
else if (propName = 'actual') then ActualObject := propValue as TFhirBoolean{5a}
else if (propName = 'code') then Code := propValue as TFhirCodeableConcept{4b}
else if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'quantity') then QuantityObject := propValue as TFhirInteger{5a}
else if (propName = 'characteristic') then CharacteristicList.add(propValue as TFhirGroupCharacteristic){2}
else if (propName = 'member') then MemberList.add(propValue as TFhirResourceReference{Resource}){2}
else inherited;
end;
function TFhirGroup.FhirType : string;
begin
result := 'Group';
end;
function TFhirGroup.Link : TFhirGroup;
begin
result := TFhirGroup(inherited Link);
end;
function TFhirGroup.Clone : TFhirGroup;
begin
result := TFhirGroup(inherited Clone);
end;
{ TFhirGroup }
Procedure TFhirGroup.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirGroup.SetType_(value : TFhirEnum);
begin
FType_.free;
FType_ := value;
end;
Function TFhirGroup.GetType_ST : TFhirGroupType;
begin
if FType_ = nil then
result := TFhirGroupType(0)
else
result := TFhirGroupType(StringArrayIndexOfSensitive(CODES_TFhirGroupType, FType_.value));
end;
Procedure TFhirGroup.SetType_ST(value : TFhirGroupType);
begin
if ord(value) = 0 then
Type_Object := nil
else
Type_Object := TFhirEnum.create(CODES_TFhirGroupType[value]);
end;
Procedure TFhirGroup.SetActual(value : TFhirBoolean);
begin
FActual.free;
FActual := value;
end;
Function TFhirGroup.GetActualST : Boolean;
begin
if FActual = nil then
result := false
else
result := FActual.value;
end;
Procedure TFhirGroup.SetActualST(value : Boolean);
begin
if FActual = nil then
FActual := TFhirBoolean.create;
FActual.value := value
end;
Procedure TFhirGroup.SetCode(value : TFhirCodeableConcept);
begin
FCode.free;
FCode := value;
end;
Procedure TFhirGroup.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirGroup.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirGroup.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirGroup.SetQuantity(value : TFhirInteger);
begin
FQuantity.free;
FQuantity := value;
end;
Function TFhirGroup.GetQuantityST : String;
begin
if FQuantity = nil then
result := ''
else
result := FQuantity.value;
end;
Procedure TFhirGroup.SetQuantityST(value : String);
begin
if value <> '' then
begin
if FQuantity = nil then
FQuantity := TFhirInteger.create;
FQuantity.value := value
end
else if FQuantity <> nil then
FQuantity.value := '';
end;
{ TFhirImagingStudy }
constructor TFhirImagingStudy.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FOrderList := TFhirResourceReferenceList{TFhirDiagnosticOrder}.Create;
FModality := TFHIREnumList.Create;
FProcedure_List := TFhirCodingList.Create;
FSeriesList := TFhirImagingStudySeriesList.Create;
end;
destructor TFhirImagingStudy.Destroy;
begin
FDateTime.free;
FSubject.free;
FUid.free;
FAccessionNo.free;
FIdentifierList.Free;
FOrderList.Free;
FModality.Free;
FReferrer.free;
FAvailability.free;
FUrl.free;
FNumberOfSeries.free;
FNumberOfInstances.free;
FClinicalInformation.free;
FProcedure_List.Free;
FInterpreter.free;
FDescription.free;
FSeriesList.Free;
inherited;
end;
function TFhirImagingStudy.GetResourceType : TFhirResourceType;
begin
result := frtImagingStudy;
end;
function TFhirImagingStudy.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirImagingStudy.Assign(oSource : TAdvObject);
begin
inherited;
dateTimeObject := TFhirImagingStudy(oSource).dateTimeObject.Clone;
subject := TFhirImagingStudy(oSource).subject.Clone;
uidObject := TFhirImagingStudy(oSource).uidObject.Clone;
accessionNo := TFhirImagingStudy(oSource).accessionNo.Clone;
FIdentifierList.Assign(TFhirImagingStudy(oSource).FIdentifierList);
FOrderList.Assign(TFhirImagingStudy(oSource).FOrderList);
FModality.Assign(TFhirImagingStudy(oSource).FModality);
referrer := TFhirImagingStudy(oSource).referrer.Clone;
FAvailability := TFhirImagingStudy(oSource).FAvailability.Link;
urlObject := TFhirImagingStudy(oSource).urlObject.Clone;
numberOfSeriesObject := TFhirImagingStudy(oSource).numberOfSeriesObject.Clone;
numberOfInstancesObject := TFhirImagingStudy(oSource).numberOfInstancesObject.Clone;
clinicalInformationObject := TFhirImagingStudy(oSource).clinicalInformationObject.Clone;
FProcedure_List.Assign(TFhirImagingStudy(oSource).FProcedure_List);
interpreter := TFhirImagingStudy(oSource).interpreter.Clone;
descriptionObject := TFhirImagingStudy(oSource).descriptionObject.Clone;
FSeriesList.Assign(TFhirImagingStudy(oSource).FSeriesList);
end;
procedure TFhirImagingStudy.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'dateTime') Then
list.add(FDateTime.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'uid') Then
list.add(FUid.Link);
if (child_name = 'accessionNo') Then
list.add(FAccessionNo.Link);
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'order') Then
list.addAll(FOrderList);
if (child_name = 'modality') Then
list.addAll(FModality);
if (child_name = 'referrer') Then
list.add(FReferrer.Link);
if (child_name = 'availability') Then
list.add(FAvailability.Link);
if (child_name = 'url') Then
list.add(FUrl.Link);
if (child_name = 'numberOfSeries') Then
list.add(FNumberOfSeries.Link);
if (child_name = 'numberOfInstances') Then
list.add(FNumberOfInstances.Link);
if (child_name = 'clinicalInformation') Then
list.add(FClinicalInformation.Link);
if (child_name = 'procedure') Then
list.addAll(FProcedure_List);
if (child_name = 'interpreter') Then
list.add(FInterpreter.Link);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'series') Then
list.addAll(FSeriesList);
end;
procedure TFhirImagingStudy.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'dateTime', 'dateTime', FDateTime.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'uid', 'oid', FUid.Link));{2}
oList.add(TFHIRProperty.create(self, 'accessionNo', 'Identifier', FAccessionNo.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'order', 'Resource(DiagnosticOrder)', FOrderList.Link)){3};
oList.add(TFHIRProperty.create(self, 'modality', 'code', FModality.Link)){3};
oList.add(TFHIRProperty.create(self, 'referrer', 'Resource(Practitioner)', FReferrer.Link));{2}
oList.add(TFHIRProperty.create(self, 'availability', 'code', FAvailability.Link));{1}
oList.add(TFHIRProperty.create(self, 'url', 'uri', FUrl.Link));{2}
oList.add(TFHIRProperty.create(self, 'numberOfSeries', 'integer', FNumberOfSeries.Link));{2}
oList.add(TFHIRProperty.create(self, 'numberOfInstances', 'integer', FNumberOfInstances.Link));{2}
oList.add(TFHIRProperty.create(self, 'clinicalInformation', 'string', FClinicalInformation.Link));{2}
oList.add(TFHIRProperty.create(self, 'procedure', 'Coding', FProcedure_List.Link)){3};
oList.add(TFHIRProperty.create(self, 'interpreter', 'Resource(Practitioner)', FInterpreter.Link));{2}
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'series', '', FSeriesList.Link)){3};
end;
procedure TFhirImagingStudy.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'dateTime') then DateTimeObject := propValue as TFhirDateTime{5a}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'uid') then UidObject := propValue as TFhirOid{5a}
else if (propName = 'accessionNo') then AccessionNo := propValue as TFhirIdentifier{4b}
else if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'order') then OrderList.add(propValue as TFhirResourceReference{TFhirDiagnosticOrder}){2}
else if (propName = 'modality') then FModality.add(propValue as TFHIREnum) {1}
else if (propName = 'referrer') then Referrer := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'availability') then AvailabilityObject := propValue as TFHIREnum
else if (propName = 'url') then UrlObject := propValue as TFhirUri{5a}
else if (propName = 'numberOfSeries') then NumberOfSeriesObject := propValue as TFhirInteger{5a}
else if (propName = 'numberOfInstances') then NumberOfInstancesObject := propValue as TFhirInteger{5a}
else if (propName = 'clinicalInformation') then ClinicalInformationObject := propValue as TFhirString{5a}
else if (propName = 'procedure') then Procedure_List.add(propValue as TFhirCoding){2}
else if (propName = 'interpreter') then Interpreter := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'series') then SeriesList.add(propValue as TFhirImagingStudySeries){2}
else inherited;
end;
function TFhirImagingStudy.FhirType : string;
begin
result := 'ImagingStudy';
end;
function TFhirImagingStudy.Link : TFhirImagingStudy;
begin
result := TFhirImagingStudy(inherited Link);
end;
function TFhirImagingStudy.Clone : TFhirImagingStudy;
begin
result := TFhirImagingStudy(inherited Clone);
end;
{ TFhirImagingStudy }
Procedure TFhirImagingStudy.SetDateTime(value : TFhirDateTime);
begin
FDateTime.free;
FDateTime := value;
end;
Function TFhirImagingStudy.GetDateTimeST : TDateTimeEx;
begin
if FDateTime = nil then
result := nil
else
result := FDateTime.value;
end;
Procedure TFhirImagingStudy.SetDateTimeST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDateTime = nil then
FDateTime := TFhirDateTime.create;
FDateTime.value := value
end
else if FDateTime <> nil then
FDateTime.value := nil;
end;
Procedure TFhirImagingStudy.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirImagingStudy.SetUid(value : TFhirOid);
begin
FUid.free;
FUid := value;
end;
Function TFhirImagingStudy.GetUidST : String;
begin
if FUid = nil then
result := ''
else
result := FUid.value;
end;
Procedure TFhirImagingStudy.SetUidST(value : String);
begin
if value <> '' then
begin
if FUid = nil then
FUid := TFhirOid.create;
FUid.value := value
end
else if FUid <> nil then
FUid.value := '';
end;
Procedure TFhirImagingStudy.SetAccessionNo(value : TFhirIdentifier);
begin
FAccessionNo.free;
FAccessionNo := value;
end;
Procedure TFhirImagingStudy.SetReferrer(value : TFhirResourceReference{TFhirPractitioner});
begin
FReferrer.free;
FReferrer := value;
end;
Procedure TFhirImagingStudy.SetAvailability(value : TFhirEnum);
begin
FAvailability.free;
FAvailability := value;
end;
Function TFhirImagingStudy.GetAvailabilityST : TFhirInstanceAvailability;
begin
if FAvailability = nil then
result := TFhirInstanceAvailability(0)
else
result := TFhirInstanceAvailability(StringArrayIndexOfSensitive(CODES_TFhirInstanceAvailability, FAvailability.value));
end;
Procedure TFhirImagingStudy.SetAvailabilityST(value : TFhirInstanceAvailability);
begin
if ord(value) = 0 then
AvailabilityObject := nil
else
AvailabilityObject := TFhirEnum.create(CODES_TFhirInstanceAvailability[value]);
end;
Procedure TFhirImagingStudy.SetUrl(value : TFhirUri);
begin
FUrl.free;
FUrl := value;
end;
Function TFhirImagingStudy.GetUrlST : String;
begin
if FUrl = nil then
result := ''
else
result := FUrl.value;
end;
Procedure TFhirImagingStudy.SetUrlST(value : String);
begin
if value <> '' then
begin
if FUrl = nil then
FUrl := TFhirUri.create;
FUrl.value := value
end
else if FUrl <> nil then
FUrl.value := '';
end;
Procedure TFhirImagingStudy.SetNumberOfSeries(value : TFhirInteger);
begin
FNumberOfSeries.free;
FNumberOfSeries := value;
end;
Function TFhirImagingStudy.GetNumberOfSeriesST : String;
begin
if FNumberOfSeries = nil then
result := ''
else
result := FNumberOfSeries.value;
end;
Procedure TFhirImagingStudy.SetNumberOfSeriesST(value : String);
begin
if value <> '' then
begin
if FNumberOfSeries = nil then
FNumberOfSeries := TFhirInteger.create;
FNumberOfSeries.value := value
end
else if FNumberOfSeries <> nil then
FNumberOfSeries.value := '';
end;
Procedure TFhirImagingStudy.SetNumberOfInstances(value : TFhirInteger);
begin
FNumberOfInstances.free;
FNumberOfInstances := value;
end;
Function TFhirImagingStudy.GetNumberOfInstancesST : String;
begin
if FNumberOfInstances = nil then
result := ''
else
result := FNumberOfInstances.value;
end;
Procedure TFhirImagingStudy.SetNumberOfInstancesST(value : String);
begin
if value <> '' then
begin
if FNumberOfInstances = nil then
FNumberOfInstances := TFhirInteger.create;
FNumberOfInstances.value := value
end
else if FNumberOfInstances <> nil then
FNumberOfInstances.value := '';
end;
Procedure TFhirImagingStudy.SetClinicalInformation(value : TFhirString);
begin
FClinicalInformation.free;
FClinicalInformation := value;
end;
Function TFhirImagingStudy.GetClinicalInformationST : String;
begin
if FClinicalInformation = nil then
result := ''
else
result := FClinicalInformation.value;
end;
Procedure TFhirImagingStudy.SetClinicalInformationST(value : String);
begin
if value <> '' then
begin
if FClinicalInformation = nil then
FClinicalInformation := TFhirString.create;
FClinicalInformation.value := value
end
else if FClinicalInformation <> nil then
FClinicalInformation.value := '';
end;
Procedure TFhirImagingStudy.SetInterpreter(value : TFhirResourceReference{TFhirPractitioner});
begin
FInterpreter.free;
FInterpreter := value;
end;
Procedure TFhirImagingStudy.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirImagingStudy.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirImagingStudy.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
{ TFhirImmunization }
constructor TFhirImmunization.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FReactionList := TFhirImmunizationReactionList.Create;
FVaccinationProtocolList := TFhirImmunizationVaccinationProtocolList.Create;
end;
destructor TFhirImmunization.Destroy;
begin
FIdentifierList.Free;
FDate.free;
FVaccineType.free;
FSubject.free;
FRefusedIndicator.free;
FReported.free;
FPerformer.free;
FRequester.free;
FManufacturer.free;
FLocation.free;
FLotNumber.free;
FExpirationDate.free;
FSite.free;
FRoute.free;
FDoseQuantity.free;
FExplanation.free;
FReactionList.Free;
FVaccinationProtocolList.Free;
inherited;
end;
function TFhirImmunization.GetResourceType : TFhirResourceType;
begin
result := frtImmunization;
end;
function TFhirImmunization.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirImmunization.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirImmunization(oSource).FIdentifierList);
dateObject := TFhirImmunization(oSource).dateObject.Clone;
vaccineType := TFhirImmunization(oSource).vaccineType.Clone;
subject := TFhirImmunization(oSource).subject.Clone;
refusedIndicatorObject := TFhirImmunization(oSource).refusedIndicatorObject.Clone;
reportedObject := TFhirImmunization(oSource).reportedObject.Clone;
performer := TFhirImmunization(oSource).performer.Clone;
requester := TFhirImmunization(oSource).requester.Clone;
manufacturer := TFhirImmunization(oSource).manufacturer.Clone;
location := TFhirImmunization(oSource).location.Clone;
lotNumberObject := TFhirImmunization(oSource).lotNumberObject.Clone;
expirationDateObject := TFhirImmunization(oSource).expirationDateObject.Clone;
site := TFhirImmunization(oSource).site.Clone;
route := TFhirImmunization(oSource).route.Clone;
doseQuantity := TFhirImmunization(oSource).doseQuantity.Clone;
explanation := TFhirImmunization(oSource).explanation.Clone;
FReactionList.Assign(TFhirImmunization(oSource).FReactionList);
FVaccinationProtocolList.Assign(TFhirImmunization(oSource).FVaccinationProtocolList);
end;
procedure TFhirImmunization.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'vaccineType') Then
list.add(FVaccineType.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'refusedIndicator') Then
list.add(FRefusedIndicator.Link);
if (child_name = 'reported') Then
list.add(FReported.Link);
if (child_name = 'performer') Then
list.add(FPerformer.Link);
if (child_name = 'requester') Then
list.add(FRequester.Link);
if (child_name = 'manufacturer') Then
list.add(FManufacturer.Link);
if (child_name = 'location') Then
list.add(FLocation.Link);
if (child_name = 'lotNumber') Then
list.add(FLotNumber.Link);
if (child_name = 'expirationDate') Then
list.add(FExpirationDate.Link);
if (child_name = 'site') Then
list.add(FSite.Link);
if (child_name = 'route') Then
list.add(FRoute.Link);
if (child_name = 'doseQuantity') Then
list.add(FDoseQuantity.Link);
if (child_name = 'explanation') Then
list.add(FExplanation.Link);
if (child_name = 'reaction') Then
list.addAll(FReactionList);
if (child_name = 'vaccinationProtocol') Then
list.addAll(FVaccinationProtocolList);
end;
procedure TFhirImmunization.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'vaccineType', 'CodeableConcept', FVaccineType.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'refusedIndicator', 'boolean', FRefusedIndicator.Link));{2}
oList.add(TFHIRProperty.create(self, 'reported', 'boolean', FReported.Link));{2}
oList.add(TFHIRProperty.create(self, 'performer', 'Resource(Practitioner)', FPerformer.Link));{2}
oList.add(TFHIRProperty.create(self, 'requester', 'Resource(Practitioner)', FRequester.Link));{2}
oList.add(TFHIRProperty.create(self, 'manufacturer', 'Resource(Organization)', FManufacturer.Link));{2}
oList.add(TFHIRProperty.create(self, 'location', 'Resource(Location)', FLocation.Link));{2}
oList.add(TFHIRProperty.create(self, 'lotNumber', 'string', FLotNumber.Link));{2}
oList.add(TFHIRProperty.create(self, 'expirationDate', 'date', FExpirationDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'site', 'CodeableConcept', FSite.Link));{2}
oList.add(TFHIRProperty.create(self, 'route', 'CodeableConcept', FRoute.Link));{2}
oList.add(TFHIRProperty.create(self, 'doseQuantity', 'Quantity', FDoseQuantity.Link));{2}
oList.add(TFHIRProperty.create(self, 'explanation', '', FExplanation.Link));{2}
oList.add(TFHIRProperty.create(self, 'reaction', '', FReactionList.Link)){3};
oList.add(TFHIRProperty.create(self, 'vaccinationProtocol', '', FVaccinationProtocolList.Link)){3};
end;
procedure TFhirImmunization.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'vaccineType') then VaccineType := propValue as TFhirCodeableConcept{4b}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'refusedIndicator') then RefusedIndicatorObject := propValue as TFhirBoolean{5a}
else if (propName = 'reported') then ReportedObject := propValue as TFhirBoolean{5a}
else if (propName = 'performer') then Performer := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'requester') then Requester := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'manufacturer') then Manufacturer := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'location') then Location := propValue as TFhirResourceReference{TFhirLocation}{4b}
else if (propName = 'lotNumber') then LotNumberObject := propValue as TFhirString{5a}
else if (propName = 'expirationDate') then ExpirationDateObject := propValue as TFhirDate{5a}
else if (propName = 'site') then Site := propValue as TFhirCodeableConcept{4b}
else if (propName = 'route') then Route := propValue as TFhirCodeableConcept{4b}
else if (propName = 'doseQuantity') then DoseQuantity := propValue as TFhirQuantity{4b}
else if (propName = 'explanation') then Explanation := propValue as TFhirImmunizationExplanation{4b}
else if (propName = 'reaction') then ReactionList.add(propValue as TFhirImmunizationReaction){2}
else if (propName = 'vaccinationProtocol') then VaccinationProtocolList.add(propValue as TFhirImmunizationVaccinationProtocol){2}
else inherited;
end;
function TFhirImmunization.FhirType : string;
begin
result := 'Immunization';
end;
function TFhirImmunization.Link : TFhirImmunization;
begin
result := TFhirImmunization(inherited Link);
end;
function TFhirImmunization.Clone : TFhirImmunization;
begin
result := TFhirImmunization(inherited Clone);
end;
{ TFhirImmunization }
Procedure TFhirImmunization.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirImmunization.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirImmunization.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirImmunization.SetVaccineType(value : TFhirCodeableConcept);
begin
FVaccineType.free;
FVaccineType := value;
end;
Procedure TFhirImmunization.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirImmunization.SetRefusedIndicator(value : TFhirBoolean);
begin
FRefusedIndicator.free;
FRefusedIndicator := value;
end;
Function TFhirImmunization.GetRefusedIndicatorST : Boolean;
begin
if FRefusedIndicator = nil then
result := false
else
result := FRefusedIndicator.value;
end;
Procedure TFhirImmunization.SetRefusedIndicatorST(value : Boolean);
begin
if FRefusedIndicator = nil then
FRefusedIndicator := TFhirBoolean.create;
FRefusedIndicator.value := value
end;
Procedure TFhirImmunization.SetReported(value : TFhirBoolean);
begin
FReported.free;
FReported := value;
end;
Function TFhirImmunization.GetReportedST : Boolean;
begin
if FReported = nil then
result := false
else
result := FReported.value;
end;
Procedure TFhirImmunization.SetReportedST(value : Boolean);
begin
if FReported = nil then
FReported := TFhirBoolean.create;
FReported.value := value
end;
Procedure TFhirImmunization.SetPerformer(value : TFhirResourceReference{TFhirPractitioner});
begin
FPerformer.free;
FPerformer := value;
end;
Procedure TFhirImmunization.SetRequester(value : TFhirResourceReference{TFhirPractitioner});
begin
FRequester.free;
FRequester := value;
end;
Procedure TFhirImmunization.SetManufacturer(value : TFhirResourceReference{TFhirOrganization});
begin
FManufacturer.free;
FManufacturer := value;
end;
Procedure TFhirImmunization.SetLocation(value : TFhirResourceReference{TFhirLocation});
begin
FLocation.free;
FLocation := value;
end;
Procedure TFhirImmunization.SetLotNumber(value : TFhirString);
begin
FLotNumber.free;
FLotNumber := value;
end;
Function TFhirImmunization.GetLotNumberST : String;
begin
if FLotNumber = nil then
result := ''
else
result := FLotNumber.value;
end;
Procedure TFhirImmunization.SetLotNumberST(value : String);
begin
if value <> '' then
begin
if FLotNumber = nil then
FLotNumber := TFhirString.create;
FLotNumber.value := value
end
else if FLotNumber <> nil then
FLotNumber.value := '';
end;
Procedure TFhirImmunization.SetExpirationDate(value : TFhirDate);
begin
FExpirationDate.free;
FExpirationDate := value;
end;
Function TFhirImmunization.GetExpirationDateST : TDateTimeEx;
begin
if FExpirationDate = nil then
result := nil
else
result := FExpirationDate.value;
end;
Procedure TFhirImmunization.SetExpirationDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FExpirationDate = nil then
FExpirationDate := TFhirDate.create;
FExpirationDate.value := value
end
else if FExpirationDate <> nil then
FExpirationDate.value := nil;
end;
Procedure TFhirImmunization.SetSite(value : TFhirCodeableConcept);
begin
FSite.free;
FSite := value;
end;
Procedure TFhirImmunization.SetRoute(value : TFhirCodeableConcept);
begin
FRoute.free;
FRoute := value;
end;
Procedure TFhirImmunization.SetDoseQuantity(value : TFhirQuantity);
begin
FDoseQuantity.free;
FDoseQuantity := value;
end;
Procedure TFhirImmunization.SetExplanation(value : TFhirImmunizationExplanation);
begin
FExplanation.free;
FExplanation := value;
end;
{ TFhirImmunizationRecommendation }
constructor TFhirImmunizationRecommendation.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FRecommendationList := TFhirImmunizationRecommendationRecommendationList.Create;
end;
destructor TFhirImmunizationRecommendation.Destroy;
begin
FIdentifierList.Free;
FSubject.free;
FRecommendationList.Free;
inherited;
end;
function TFhirImmunizationRecommendation.GetResourceType : TFhirResourceType;
begin
result := frtImmunizationRecommendation;
end;
function TFhirImmunizationRecommendation.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirImmunizationRecommendation.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirImmunizationRecommendation(oSource).FIdentifierList);
subject := TFhirImmunizationRecommendation(oSource).subject.Clone;
FRecommendationList.Assign(TFhirImmunizationRecommendation(oSource).FRecommendationList);
end;
procedure TFhirImmunizationRecommendation.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'recommendation') Then
list.addAll(FRecommendationList);
end;
procedure TFhirImmunizationRecommendation.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'recommendation', '', FRecommendationList.Link)){3};
end;
procedure TFhirImmunizationRecommendation.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'recommendation') then RecommendationList.add(propValue as TFhirImmunizationRecommendationRecommendation){2}
else inherited;
end;
function TFhirImmunizationRecommendation.FhirType : string;
begin
result := 'ImmunizationRecommendation';
end;
function TFhirImmunizationRecommendation.Link : TFhirImmunizationRecommendation;
begin
result := TFhirImmunizationRecommendation(inherited Link);
end;
function TFhirImmunizationRecommendation.Clone : TFhirImmunizationRecommendation;
begin
result := TFhirImmunizationRecommendation(inherited Clone);
end;
{ TFhirImmunizationRecommendation }
Procedure TFhirImmunizationRecommendation.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
{ TFhirList }
constructor TFhirList.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FEntryList := TFhirListEntryList.Create;
end;
destructor TFhirList.Destroy;
begin
FIdentifierList.Free;
FCode.free;
FSubject.free;
FSource.free;
FDate.free;
FOrdered.free;
FMode.free;
FEntryList.Free;
FEmptyReason.free;
inherited;
end;
function TFhirList.GetResourceType : TFhirResourceType;
begin
result := frtList;
end;
function TFhirList.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirList.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirList(oSource).FIdentifierList);
code := TFhirList(oSource).code.Clone;
subject := TFhirList(oSource).subject.Clone;
source := TFhirList(oSource).source.Clone;
dateObject := TFhirList(oSource).dateObject.Clone;
orderedObject := TFhirList(oSource).orderedObject.Clone;
FMode := TFhirList(oSource).FMode.Link;
FEntryList.Assign(TFhirList(oSource).FEntryList);
emptyReason := TFhirList(oSource).emptyReason.Clone;
end;
procedure TFhirList.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'code') Then
list.add(FCode.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'ordered') Then
list.add(FOrdered.Link);
if (child_name = 'mode') Then
list.add(FMode.Link);
if (child_name = 'entry') Then
list.addAll(FEntryList);
if (child_name = 'emptyReason') Then
list.add(FEmptyReason.Link);
end;
procedure TFhirList.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'code', 'CodeableConcept', FCode.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Group|Device|Location)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', 'Resource(Practitioner|Patient|Device)', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'ordered', 'boolean', FOrdered.Link));{2}
oList.add(TFHIRProperty.create(self, 'mode', 'code', FMode.Link));{1}
oList.add(TFHIRProperty.create(self, 'entry', '', FEntryList.Link)){3};
oList.add(TFHIRProperty.create(self, 'emptyReason', 'CodeableConcept', FEmptyReason.Link));{2}
end;
procedure TFhirList.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'code') then Code := propValue as TFhirCodeableConcept{4b}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'source') then Source := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'ordered') then OrderedObject := propValue as TFhirBoolean{5a}
else if (propName = 'mode') then ModeObject := propValue as TFHIREnum
else if (propName = 'entry') then EntryList.add(propValue as TFhirListEntry){2}
else if (propName = 'emptyReason') then EmptyReason := propValue as TFhirCodeableConcept{4b}
else inherited;
end;
function TFhirList.FhirType : string;
begin
result := 'List';
end;
function TFhirList.Link : TFhirList;
begin
result := TFhirList(inherited Link);
end;
function TFhirList.Clone : TFhirList;
begin
result := TFhirList(inherited Clone);
end;
{ TFhirList }
Procedure TFhirList.SetCode(value : TFhirCodeableConcept);
begin
FCode.free;
FCode := value;
end;
Procedure TFhirList.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirList.SetSource(value : TFhirResourceReference{Resource});
begin
FSource.free;
FSource := value;
end;
Procedure TFhirList.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirList.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirList.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirList.SetOrdered(value : TFhirBoolean);
begin
FOrdered.free;
FOrdered := value;
end;
Function TFhirList.GetOrderedST : Boolean;
begin
if FOrdered = nil then
result := false
else
result := FOrdered.value;
end;
Procedure TFhirList.SetOrderedST(value : Boolean);
begin
if FOrdered = nil then
FOrdered := TFhirBoolean.create;
FOrdered.value := value
end;
Procedure TFhirList.SetMode(value : TFhirEnum);
begin
FMode.free;
FMode := value;
end;
Function TFhirList.GetModeST : TFhirListMode;
begin
if FMode = nil then
result := TFhirListMode(0)
else
result := TFhirListMode(StringArrayIndexOfSensitive(CODES_TFhirListMode, FMode.value));
end;
Procedure TFhirList.SetModeST(value : TFhirListMode);
begin
if ord(value) = 0 then
ModeObject := nil
else
ModeObject := TFhirEnum.create(CODES_TFhirListMode[value]);
end;
Procedure TFhirList.SetEmptyReason(value : TFhirCodeableConcept);
begin
FEmptyReason.free;
FEmptyReason := value;
end;
{ TFhirLocation }
constructor TFhirLocation.Create;
begin
inherited;
FTelecomList := TFhirContactList.Create;
end;
destructor TFhirLocation.Destroy;
begin
FIdentifier.free;
FName.free;
FDescription.free;
FType_.free;
FTelecomList.Free;
FAddress.free;
FPhysicalType.free;
FPosition.free;
FManagingOrganization.free;
FStatus.free;
FPartOf.free;
FMode.free;
inherited;
end;
function TFhirLocation.GetResourceType : TFhirResourceType;
begin
result := frtLocation;
end;
function TFhirLocation.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirLocation.Assign(oSource : TAdvObject);
begin
inherited;
identifier := TFhirLocation(oSource).identifier.Clone;
nameObject := TFhirLocation(oSource).nameObject.Clone;
descriptionObject := TFhirLocation(oSource).descriptionObject.Clone;
type_ := TFhirLocation(oSource).type_.Clone;
FTelecomList.Assign(TFhirLocation(oSource).FTelecomList);
address := TFhirLocation(oSource).address.Clone;
physicalType := TFhirLocation(oSource).physicalType.Clone;
position := TFhirLocation(oSource).position.Clone;
managingOrganization := TFhirLocation(oSource).managingOrganization.Clone;
FStatus := TFhirLocation(oSource).FStatus.Link;
partOf := TFhirLocation(oSource).partOf.Clone;
FMode := TFhirLocation(oSource).FMode.Link;
end;
procedure TFhirLocation.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'address') Then
list.add(FAddress.Link);
if (child_name = 'physicalType') Then
list.add(FPhysicalType.Link);
if (child_name = 'position') Then
list.add(FPosition.Link);
if (child_name = 'managingOrganization') Then
list.add(FManagingOrganization.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'partOf') Then
list.add(FPartOf.Link);
if (child_name = 'mode') Then
list.add(FMode.Link);
end;
procedure TFhirLocation.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'address', 'Address', FAddress.Link));{2}
oList.add(TFHIRProperty.create(self, 'physicalType', 'CodeableConcept', FPhysicalType.Link));{2}
oList.add(TFHIRProperty.create(self, 'position', '', FPosition.Link));{2}
oList.add(TFHIRProperty.create(self, 'managingOrganization', 'Resource(Organization)', FManagingOrganization.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'partOf', 'Resource(Location)', FPartOf.Link));{2}
oList.add(TFHIRProperty.create(self, 'mode', 'code', FMode.Link));{1}
end;
procedure TFhirLocation.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'address') then Address := propValue as TFhirAddress{4b}
else if (propName = 'physicalType') then PhysicalType := propValue as TFhirCodeableConcept{4b}
else if (propName = 'position') then Position := propValue as TFhirLocationPosition{4b}
else if (propName = 'managingOrganization') then ManagingOrganization := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'partOf') then PartOf := propValue as TFhirResourceReference{TFhirLocation}{4b}
else if (propName = 'mode') then ModeObject := propValue as TFHIREnum
else inherited;
end;
function TFhirLocation.FhirType : string;
begin
result := 'Location';
end;
function TFhirLocation.Link : TFhirLocation;
begin
result := TFhirLocation(inherited Link);
end;
function TFhirLocation.Clone : TFhirLocation;
begin
result := TFhirLocation(inherited Clone);
end;
{ TFhirLocation }
Procedure TFhirLocation.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirLocation.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirLocation.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirLocation.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirLocation.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirLocation.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirLocation.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirLocation.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirLocation.SetAddress(value : TFhirAddress);
begin
FAddress.free;
FAddress := value;
end;
Procedure TFhirLocation.SetPhysicalType(value : TFhirCodeableConcept);
begin
FPhysicalType.free;
FPhysicalType := value;
end;
Procedure TFhirLocation.SetPosition(value : TFhirLocationPosition);
begin
FPosition.free;
FPosition := value;
end;
Procedure TFhirLocation.SetManagingOrganization(value : TFhirResourceReference{TFhirOrganization});
begin
FManagingOrganization.free;
FManagingOrganization := value;
end;
Procedure TFhirLocation.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirLocation.GetStatusST : TFhirLocationStatus;
begin
if FStatus = nil then
result := TFhirLocationStatus(0)
else
result := TFhirLocationStatus(StringArrayIndexOfSensitive(CODES_TFhirLocationStatus, FStatus.value));
end;
Procedure TFhirLocation.SetStatusST(value : TFhirLocationStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirLocationStatus[value]);
end;
Procedure TFhirLocation.SetPartOf(value : TFhirResourceReference{TFhirLocation});
begin
FPartOf.free;
FPartOf := value;
end;
Procedure TFhirLocation.SetMode(value : TFhirEnum);
begin
FMode.free;
FMode := value;
end;
Function TFhirLocation.GetModeST : TFhirLocationMode;
begin
if FMode = nil then
result := TFhirLocationMode(0)
else
result := TFhirLocationMode(StringArrayIndexOfSensitive(CODES_TFhirLocationMode, FMode.value));
end;
Procedure TFhirLocation.SetModeST(value : TFhirLocationMode);
begin
if ord(value) = 0 then
ModeObject := nil
else
ModeObject := TFhirEnum.create(CODES_TFhirLocationMode[value]);
end;
{ TFhirMedia }
constructor TFhirMedia.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
end;
destructor TFhirMedia.Destroy;
begin
FType_.free;
FSubtype.free;
FIdentifierList.Free;
FDateTime.free;
FSubject.free;
FOperator.free;
FView.free;
FDeviceName.free;
FHeight.free;
FWidth.free;
FFrames.free;
FLength.free;
FContent.free;
inherited;
end;
function TFhirMedia.GetResourceType : TFhirResourceType;
begin
result := frtMedia;
end;
function TFhirMedia.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirMedia.Assign(oSource : TAdvObject);
begin
inherited;
FType_ := TFhirMedia(oSource).FType_.Link;
subtype := TFhirMedia(oSource).subtype.Clone;
FIdentifierList.Assign(TFhirMedia(oSource).FIdentifierList);
dateTimeObject := TFhirMedia(oSource).dateTimeObject.Clone;
subject := TFhirMedia(oSource).subject.Clone;
operator := TFhirMedia(oSource).operator.Clone;
view := TFhirMedia(oSource).view.Clone;
deviceNameObject := TFhirMedia(oSource).deviceNameObject.Clone;
heightObject := TFhirMedia(oSource).heightObject.Clone;
widthObject := TFhirMedia(oSource).widthObject.Clone;
framesObject := TFhirMedia(oSource).framesObject.Clone;
lengthObject := TFhirMedia(oSource).lengthObject.Clone;
content := TFhirMedia(oSource).content.Clone;
end;
procedure TFhirMedia.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'subtype') Then
list.add(FSubtype.Link);
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'dateTime') Then
list.add(FDateTime.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'operator') Then
list.add(FOperator.Link);
if (child_name = 'view') Then
list.add(FView.Link);
if (child_name = 'deviceName') Then
list.add(FDeviceName.Link);
if (child_name = 'height') Then
list.add(FHeight.Link);
if (child_name = 'width') Then
list.add(FWidth.Link);
if (child_name = 'frames') Then
list.add(FFrames.Link);
if (child_name = 'length') Then
list.add(FLength.Link);
if (child_name = 'content') Then
list.add(FContent.Link);
end;
procedure TFhirMedia.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'type', 'code', FType_.Link));{1}
oList.add(TFHIRProperty.create(self, 'subtype', 'CodeableConcept', FSubtype.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'dateTime', 'dateTime', FDateTime.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Practitioner|Group|Device|Specimen)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'operator', 'Resource(Practitioner)', FOperator.Link));{2}
oList.add(TFHIRProperty.create(self, 'view', 'CodeableConcept', FView.Link));{2}
oList.add(TFHIRProperty.create(self, 'deviceName', 'string', FDeviceName.Link));{2}
oList.add(TFHIRProperty.create(self, 'height', 'integer', FHeight.Link));{2}
oList.add(TFHIRProperty.create(self, 'width', 'integer', FWidth.Link));{2}
oList.add(TFHIRProperty.create(self, 'frames', 'integer', FFrames.Link));{2}
oList.add(TFHIRProperty.create(self, 'length', 'integer', FLength.Link));{2}
oList.add(TFHIRProperty.create(self, 'content', 'Attachment', FContent.Link));{2}
end;
procedure TFhirMedia.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'type') then Type_Object := propValue as TFHIREnum
else if (propName = 'subtype') then Subtype := propValue as TFhirCodeableConcept{4b}
else if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'dateTime') then DateTimeObject := propValue as TFhirDateTime{5a}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'operator') then Operator := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'view') then View := propValue as TFhirCodeableConcept{4b}
else if (propName = 'deviceName') then DeviceNameObject := propValue as TFhirString{5a}
else if (propName = 'height') then HeightObject := propValue as TFhirInteger{5a}
else if (propName = 'width') then WidthObject := propValue as TFhirInteger{5a}
else if (propName = 'frames') then FramesObject := propValue as TFhirInteger{5a}
else if (propName = 'length') then LengthObject := propValue as TFhirInteger{5a}
else if (propName = 'content') then Content := propValue as TFhirAttachment{4b}
else inherited;
end;
function TFhirMedia.FhirType : string;
begin
result := 'Media';
end;
function TFhirMedia.Link : TFhirMedia;
begin
result := TFhirMedia(inherited Link);
end;
function TFhirMedia.Clone : TFhirMedia;
begin
result := TFhirMedia(inherited Clone);
end;
{ TFhirMedia }
Procedure TFhirMedia.SetType_(value : TFhirEnum);
begin
FType_.free;
FType_ := value;
end;
Function TFhirMedia.GetType_ST : TFhirMediaType;
begin
if FType_ = nil then
result := TFhirMediaType(0)
else
result := TFhirMediaType(StringArrayIndexOfSensitive(CODES_TFhirMediaType, FType_.value));
end;
Procedure TFhirMedia.SetType_ST(value : TFhirMediaType);
begin
if ord(value) = 0 then
Type_Object := nil
else
Type_Object := TFhirEnum.create(CODES_TFhirMediaType[value]);
end;
Procedure TFhirMedia.SetSubtype(value : TFhirCodeableConcept);
begin
FSubtype.free;
FSubtype := value;
end;
Procedure TFhirMedia.SetDateTime(value : TFhirDateTime);
begin
FDateTime.free;
FDateTime := value;
end;
Function TFhirMedia.GetDateTimeST : TDateTimeEx;
begin
if FDateTime = nil then
result := nil
else
result := FDateTime.value;
end;
Procedure TFhirMedia.SetDateTimeST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDateTime = nil then
FDateTime := TFhirDateTime.create;
FDateTime.value := value
end
else if FDateTime <> nil then
FDateTime.value := nil;
end;
Procedure TFhirMedia.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirMedia.SetOperator(value : TFhirResourceReference{TFhirPractitioner});
begin
FOperator.free;
FOperator := value;
end;
Procedure TFhirMedia.SetView(value : TFhirCodeableConcept);
begin
FView.free;
FView := value;
end;
Procedure TFhirMedia.SetDeviceName(value : TFhirString);
begin
FDeviceName.free;
FDeviceName := value;
end;
Function TFhirMedia.GetDeviceNameST : String;
begin
if FDeviceName = nil then
result := ''
else
result := FDeviceName.value;
end;
Procedure TFhirMedia.SetDeviceNameST(value : String);
begin
if value <> '' then
begin
if FDeviceName = nil then
FDeviceName := TFhirString.create;
FDeviceName.value := value
end
else if FDeviceName <> nil then
FDeviceName.value := '';
end;
Procedure TFhirMedia.SetHeight(value : TFhirInteger);
begin
FHeight.free;
FHeight := value;
end;
Function TFhirMedia.GetHeightST : String;
begin
if FHeight = nil then
result := ''
else
result := FHeight.value;
end;
Procedure TFhirMedia.SetHeightST(value : String);
begin
if value <> '' then
begin
if FHeight = nil then
FHeight := TFhirInteger.create;
FHeight.value := value
end
else if FHeight <> nil then
FHeight.value := '';
end;
Procedure TFhirMedia.SetWidth(value : TFhirInteger);
begin
FWidth.free;
FWidth := value;
end;
Function TFhirMedia.GetWidthST : String;
begin
if FWidth = nil then
result := ''
else
result := FWidth.value;
end;
Procedure TFhirMedia.SetWidthST(value : String);
begin
if value <> '' then
begin
if FWidth = nil then
FWidth := TFhirInteger.create;
FWidth.value := value
end
else if FWidth <> nil then
FWidth.value := '';
end;
Procedure TFhirMedia.SetFrames(value : TFhirInteger);
begin
FFrames.free;
FFrames := value;
end;
Function TFhirMedia.GetFramesST : String;
begin
if FFrames = nil then
result := ''
else
result := FFrames.value;
end;
Procedure TFhirMedia.SetFramesST(value : String);
begin
if value <> '' then
begin
if FFrames = nil then
FFrames := TFhirInteger.create;
FFrames.value := value
end
else if FFrames <> nil then
FFrames.value := '';
end;
Procedure TFhirMedia.SetLength(value : TFhirInteger);
begin
FLength.free;
FLength := value;
end;
Function TFhirMedia.GetLengthST : String;
begin
if FLength = nil then
result := ''
else
result := FLength.value;
end;
Procedure TFhirMedia.SetLengthST(value : String);
begin
if value <> '' then
begin
if FLength = nil then
FLength := TFhirInteger.create;
FLength.value := value
end
else if FLength <> nil then
FLength.value := '';
end;
Procedure TFhirMedia.SetContent(value : TFhirAttachment);
begin
FContent.free;
FContent := value;
end;
{ TFhirMedication }
constructor TFhirMedication.Create;
begin
inherited;
end;
destructor TFhirMedication.Destroy;
begin
FName.free;
FCode.free;
FIsBrand.free;
FManufacturer.free;
FKind.free;
FProduct.free;
FPackage.free;
inherited;
end;
function TFhirMedication.GetResourceType : TFhirResourceType;
begin
result := frtMedication;
end;
function TFhirMedication.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirMedication.Assign(oSource : TAdvObject);
begin
inherited;
nameObject := TFhirMedication(oSource).nameObject.Clone;
code := TFhirMedication(oSource).code.Clone;
isBrandObject := TFhirMedication(oSource).isBrandObject.Clone;
manufacturer := TFhirMedication(oSource).manufacturer.Clone;
FKind := TFhirMedication(oSource).FKind.Link;
product := TFhirMedication(oSource).product.Clone;
package := TFhirMedication(oSource).package.Clone;
end;
procedure TFhirMedication.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'code') Then
list.add(FCode.Link);
if (child_name = 'isBrand') Then
list.add(FIsBrand.Link);
if (child_name = 'manufacturer') Then
list.add(FManufacturer.Link);
if (child_name = 'kind') Then
list.add(FKind.Link);
if (child_name = 'product') Then
list.add(FProduct.Link);
if (child_name = 'package') Then
list.add(FPackage.Link);
end;
procedure TFhirMedication.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'code', 'CodeableConcept', FCode.Link));{2}
oList.add(TFHIRProperty.create(self, 'isBrand', 'boolean', FIsBrand.Link));{2}
oList.add(TFHIRProperty.create(self, 'manufacturer', 'Resource(Organization)', FManufacturer.Link));{2}
oList.add(TFHIRProperty.create(self, 'kind', 'code', FKind.Link));{1}
oList.add(TFHIRProperty.create(self, 'product', '', FProduct.Link));{2}
oList.add(TFHIRProperty.create(self, 'package', '', FPackage.Link));{2}
end;
procedure TFhirMedication.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'code') then Code := propValue as TFhirCodeableConcept{4b}
else if (propName = 'isBrand') then IsBrandObject := propValue as TFhirBoolean{5a}
else if (propName = 'manufacturer') then Manufacturer := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'kind') then KindObject := propValue as TFHIREnum
else if (propName = 'product') then Product := propValue as TFhirMedicationProduct{4b}
else if (propName = 'package') then Package := propValue as TFhirMedicationPackage{4b}
else inherited;
end;
function TFhirMedication.FhirType : string;
begin
result := 'Medication';
end;
function TFhirMedication.Link : TFhirMedication;
begin
result := TFhirMedication(inherited Link);
end;
function TFhirMedication.Clone : TFhirMedication;
begin
result := TFhirMedication(inherited Clone);
end;
{ TFhirMedication }
Procedure TFhirMedication.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirMedication.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirMedication.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirMedication.SetCode(value : TFhirCodeableConcept);
begin
FCode.free;
FCode := value;
end;
Procedure TFhirMedication.SetIsBrand(value : TFhirBoolean);
begin
FIsBrand.free;
FIsBrand := value;
end;
Function TFhirMedication.GetIsBrandST : Boolean;
begin
if FIsBrand = nil then
result := false
else
result := FIsBrand.value;
end;
Procedure TFhirMedication.SetIsBrandST(value : Boolean);
begin
if FIsBrand = nil then
FIsBrand := TFhirBoolean.create;
FIsBrand.value := value
end;
Procedure TFhirMedication.SetManufacturer(value : TFhirResourceReference{TFhirOrganization});
begin
FManufacturer.free;
FManufacturer := value;
end;
Procedure TFhirMedication.SetKind(value : TFhirEnum);
begin
FKind.free;
FKind := value;
end;
Function TFhirMedication.GetKindST : TFhirMedicationKind;
begin
if FKind = nil then
result := TFhirMedicationKind(0)
else
result := TFhirMedicationKind(StringArrayIndexOfSensitive(CODES_TFhirMedicationKind, FKind.value));
end;
Procedure TFhirMedication.SetKindST(value : TFhirMedicationKind);
begin
if ord(value) = 0 then
KindObject := nil
else
KindObject := TFhirEnum.create(CODES_TFhirMedicationKind[value]);
end;
Procedure TFhirMedication.SetProduct(value : TFhirMedicationProduct);
begin
FProduct.free;
FProduct := value;
end;
Procedure TFhirMedication.SetPackage(value : TFhirMedicationPackage);
begin
FPackage.free;
FPackage := value;
end;
{ TFhirMedicationAdministration }
constructor TFhirMedicationAdministration.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FReasonNotGivenList := TFhirCodeableConceptList.Create;
FDeviceList := TFhirResourceReferenceList{TFhirDevice}.Create;
FDosageList := TFhirMedicationAdministrationDosageList.Create;
end;
destructor TFhirMedicationAdministration.Destroy;
begin
FIdentifierList.Free;
FStatus.free;
FPatient.free;
FPractitioner.free;
FEncounter.free;
FPrescription.free;
FWasNotGiven.free;
FReasonNotGivenList.Free;
FWhenGiven.free;
FMedication.free;
FDeviceList.Free;
FDosageList.Free;
inherited;
end;
function TFhirMedicationAdministration.GetResourceType : TFhirResourceType;
begin
result := frtMedicationAdministration;
end;
function TFhirMedicationAdministration.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirMedicationAdministration.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirMedicationAdministration(oSource).FIdentifierList);
FStatus := TFhirMedicationAdministration(oSource).FStatus.Link;
patient := TFhirMedicationAdministration(oSource).patient.Clone;
practitioner := TFhirMedicationAdministration(oSource).practitioner.Clone;
encounter := TFhirMedicationAdministration(oSource).encounter.Clone;
prescription := TFhirMedicationAdministration(oSource).prescription.Clone;
wasNotGivenObject := TFhirMedicationAdministration(oSource).wasNotGivenObject.Clone;
FReasonNotGivenList.Assign(TFhirMedicationAdministration(oSource).FReasonNotGivenList);
whenGiven := TFhirMedicationAdministration(oSource).whenGiven.Clone;
medication := TFhirMedicationAdministration(oSource).medication.Clone;
FDeviceList.Assign(TFhirMedicationAdministration(oSource).FDeviceList);
FDosageList.Assign(TFhirMedicationAdministration(oSource).FDosageList);
end;
procedure TFhirMedicationAdministration.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'practitioner') Then
list.add(FPractitioner.Link);
if (child_name = 'encounter') Then
list.add(FEncounter.Link);
if (child_name = 'prescription') Then
list.add(FPrescription.Link);
if (child_name = 'wasNotGiven') Then
list.add(FWasNotGiven.Link);
if (child_name = 'reasonNotGiven') Then
list.addAll(FReasonNotGivenList);
if (child_name = 'whenGiven') Then
list.add(FWhenGiven.Link);
if (child_name = 'medication') Then
list.add(FMedication.Link);
if (child_name = 'device') Then
list.addAll(FDeviceList);
if (child_name = 'dosage') Then
list.addAll(FDosageList);
end;
procedure TFhirMedicationAdministration.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'practitioner', 'Resource(Practitioner)', FPractitioner.Link));{2}
oList.add(TFHIRProperty.create(self, 'encounter', 'Resource(Encounter)', FEncounter.Link));{2}
oList.add(TFHIRProperty.create(self, 'prescription', 'Resource(MedicationPrescription)', FPrescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'wasNotGiven', 'boolean', FWasNotGiven.Link));{2}
oList.add(TFHIRProperty.create(self, 'reasonNotGiven', 'CodeableConcept', FReasonNotGivenList.Link)){3};
oList.add(TFHIRProperty.create(self, 'whenGiven', 'Period', FWhenGiven.Link));{2}
oList.add(TFHIRProperty.create(self, 'medication', 'Resource(Medication)', FMedication.Link));{2}
oList.add(TFHIRProperty.create(self, 'device', 'Resource(Device)', FDeviceList.Link)){3};
oList.add(TFHIRProperty.create(self, 'dosage', '', FDosageList.Link)){3};
end;
procedure TFhirMedicationAdministration.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'practitioner') then Practitioner := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'encounter') then Encounter := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else if (propName = 'prescription') then Prescription := propValue as TFhirResourceReference{TFhirMedicationPrescription}{4b}
else if (propName = 'wasNotGiven') then WasNotGivenObject := propValue as TFhirBoolean{5a}
else if (propName = 'reasonNotGiven') then ReasonNotGivenList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'whenGiven') then WhenGiven := propValue as TFhirPeriod{4b}
else if (propName = 'medication') then Medication := propValue as TFhirResourceReference{TFhirMedication}{4b}
else if (propName = 'device') then DeviceList.add(propValue as TFhirResourceReference{TFhirDevice}){2}
else if (propName = 'dosage') then DosageList.add(propValue as TFhirMedicationAdministrationDosage){2}
else inherited;
end;
function TFhirMedicationAdministration.FhirType : string;
begin
result := 'MedicationAdministration';
end;
function TFhirMedicationAdministration.Link : TFhirMedicationAdministration;
begin
result := TFhirMedicationAdministration(inherited Link);
end;
function TFhirMedicationAdministration.Clone : TFhirMedicationAdministration;
begin
result := TFhirMedicationAdministration(inherited Clone);
end;
{ TFhirMedicationAdministration }
Procedure TFhirMedicationAdministration.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirMedicationAdministration.GetStatusST : TFhirMedicationAdminStatus;
begin
if FStatus = nil then
result := TFhirMedicationAdminStatus(0)
else
result := TFhirMedicationAdminStatus(StringArrayIndexOfSensitive(CODES_TFhirMedicationAdminStatus, FStatus.value));
end;
Procedure TFhirMedicationAdministration.SetStatusST(value : TFhirMedicationAdminStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirMedicationAdminStatus[value]);
end;
Procedure TFhirMedicationAdministration.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
Procedure TFhirMedicationAdministration.SetPractitioner(value : TFhirResourceReference{TFhirPractitioner});
begin
FPractitioner.free;
FPractitioner := value;
end;
Procedure TFhirMedicationAdministration.SetEncounter(value : TFhirResourceReference{TFhirEncounter});
begin
FEncounter.free;
FEncounter := value;
end;
Procedure TFhirMedicationAdministration.SetPrescription(value : TFhirResourceReference{TFhirMedicationPrescription});
begin
FPrescription.free;
FPrescription := value;
end;
Procedure TFhirMedicationAdministration.SetWasNotGiven(value : TFhirBoolean);
begin
FWasNotGiven.free;
FWasNotGiven := value;
end;
Function TFhirMedicationAdministration.GetWasNotGivenST : Boolean;
begin
if FWasNotGiven = nil then
result := false
else
result := FWasNotGiven.value;
end;
Procedure TFhirMedicationAdministration.SetWasNotGivenST(value : Boolean);
begin
if FWasNotGiven = nil then
FWasNotGiven := TFhirBoolean.create;
FWasNotGiven.value := value
end;
Procedure TFhirMedicationAdministration.SetWhenGiven(value : TFhirPeriod);
begin
FWhenGiven.free;
FWhenGiven := value;
end;
Procedure TFhirMedicationAdministration.SetMedication(value : TFhirResourceReference{TFhirMedication});
begin
FMedication.free;
FMedication := value;
end;
{ TFhirMedicationDispense }
constructor TFhirMedicationDispense.Create;
begin
inherited;
FAuthorizingPrescriptionList := TFhirResourceReferenceList{TFhirMedicationPrescription}.Create;
FDispenseList := TFhirMedicationDispenseDispenseList.Create;
end;
destructor TFhirMedicationDispense.Destroy;
begin
FIdentifier.free;
FStatus.free;
FPatient.free;
FDispenser.free;
FAuthorizingPrescriptionList.Free;
FDispenseList.Free;
FSubstitution.free;
inherited;
end;
function TFhirMedicationDispense.GetResourceType : TFhirResourceType;
begin
result := frtMedicationDispense;
end;
function TFhirMedicationDispense.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirMedicationDispense.Assign(oSource : TAdvObject);
begin
inherited;
identifier := TFhirMedicationDispense(oSource).identifier.Clone;
FStatus := TFhirMedicationDispense(oSource).FStatus.Link;
patient := TFhirMedicationDispense(oSource).patient.Clone;
dispenser := TFhirMedicationDispense(oSource).dispenser.Clone;
FAuthorizingPrescriptionList.Assign(TFhirMedicationDispense(oSource).FAuthorizingPrescriptionList);
FDispenseList.Assign(TFhirMedicationDispense(oSource).FDispenseList);
substitution := TFhirMedicationDispense(oSource).substitution.Clone;
end;
procedure TFhirMedicationDispense.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'dispenser') Then
list.add(FDispenser.Link);
if (child_name = 'authorizingPrescription') Then
list.addAll(FAuthorizingPrescriptionList);
if (child_name = 'dispense') Then
list.addAll(FDispenseList);
if (child_name = 'substitution') Then
list.add(FSubstitution.Link);
end;
procedure TFhirMedicationDispense.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'dispenser', 'Resource(Practitioner)', FDispenser.Link));{2}
oList.add(TFHIRProperty.create(self, 'authorizingPrescription', 'Resource(MedicationPrescription)', FAuthorizingPrescriptionList.Link)){3};
oList.add(TFHIRProperty.create(self, 'dispense', '', FDispenseList.Link)){3};
oList.add(TFHIRProperty.create(self, 'substitution', '', FSubstitution.Link));{2}
end;
procedure TFhirMedicationDispense.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'dispenser') then Dispenser := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'authorizingPrescription') then AuthorizingPrescriptionList.add(propValue as TFhirResourceReference{TFhirMedicationPrescription}){2}
else if (propName = 'dispense') then DispenseList.add(propValue as TFhirMedicationDispenseDispense){2}
else if (propName = 'substitution') then Substitution := propValue as TFhirMedicationDispenseSubstitution{4b}
else inherited;
end;
function TFhirMedicationDispense.FhirType : string;
begin
result := 'MedicationDispense';
end;
function TFhirMedicationDispense.Link : TFhirMedicationDispense;
begin
result := TFhirMedicationDispense(inherited Link);
end;
function TFhirMedicationDispense.Clone : TFhirMedicationDispense;
begin
result := TFhirMedicationDispense(inherited Clone);
end;
{ TFhirMedicationDispense }
Procedure TFhirMedicationDispense.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirMedicationDispense.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirMedicationDispense.GetStatusST : TFhirMedicationDispenseStatus;
begin
if FStatus = nil then
result := TFhirMedicationDispenseStatus(0)
else
result := TFhirMedicationDispenseStatus(StringArrayIndexOfSensitive(CODES_TFhirMedicationDispenseStatus, FStatus.value));
end;
Procedure TFhirMedicationDispense.SetStatusST(value : TFhirMedicationDispenseStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirMedicationDispenseStatus[value]);
end;
Procedure TFhirMedicationDispense.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
Procedure TFhirMedicationDispense.SetDispenser(value : TFhirResourceReference{TFhirPractitioner});
begin
FDispenser.free;
FDispenser := value;
end;
Procedure TFhirMedicationDispense.SetSubstitution(value : TFhirMedicationDispenseSubstitution);
begin
FSubstitution.free;
FSubstitution := value;
end;
{ TFhirMedicationPrescription }
constructor TFhirMedicationPrescription.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FDosageInstructionList := TFhirMedicationPrescriptionDosageInstructionList.Create;
end;
destructor TFhirMedicationPrescription.Destroy;
begin
FIdentifierList.Free;
FDateWritten.free;
FStatus.free;
FPatient.free;
FPrescriber.free;
FEncounter.free;
FReason.free;
FMedication.free;
FDosageInstructionList.Free;
FDispense.free;
FSubstitution.free;
inherited;
end;
function TFhirMedicationPrescription.GetResourceType : TFhirResourceType;
begin
result := frtMedicationPrescription;
end;
function TFhirMedicationPrescription.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirMedicationPrescription.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirMedicationPrescription(oSource).FIdentifierList);
dateWrittenObject := TFhirMedicationPrescription(oSource).dateWrittenObject.Clone;
FStatus := TFhirMedicationPrescription(oSource).FStatus.Link;
patient := TFhirMedicationPrescription(oSource).patient.Clone;
prescriber := TFhirMedicationPrescription(oSource).prescriber.Clone;
encounter := TFhirMedicationPrescription(oSource).encounter.Clone;
reason := TFhirMedicationPrescription(oSource).reason.Clone;
medication := TFhirMedicationPrescription(oSource).medication.Clone;
FDosageInstructionList.Assign(TFhirMedicationPrescription(oSource).FDosageInstructionList);
dispense := TFhirMedicationPrescription(oSource).dispense.Clone;
substitution := TFhirMedicationPrescription(oSource).substitution.Clone;
end;
procedure TFhirMedicationPrescription.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'dateWritten') Then
list.add(FDateWritten.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'prescriber') Then
list.add(FPrescriber.Link);
if (child_name = 'encounter') Then
list.add(FEncounter.Link);
if (child_name = 'reason[x]') Then
list.add(FReason.Link);
if (child_name = 'medication') Then
list.add(FMedication.Link);
if (child_name = 'dosageInstruction') Then
list.addAll(FDosageInstructionList);
if (child_name = 'dispense') Then
list.add(FDispense.Link);
if (child_name = 'substitution') Then
list.add(FSubstitution.Link);
end;
procedure TFhirMedicationPrescription.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'dateWritten', 'dateTime', FDateWritten.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'prescriber', 'Resource(Practitioner)', FPrescriber.Link));{2}
oList.add(TFHIRProperty.create(self, 'encounter', 'Resource(Encounter)', FEncounter.Link));{2}
oList.add(TFHIRProperty.create(self, 'reason[x]', 'CodeableConcept|Resource(Condition)', FReason.Link));{2}
oList.add(TFHIRProperty.create(self, 'medication', 'Resource(Medication)', FMedication.Link));{2}
oList.add(TFHIRProperty.create(self, 'dosageInstruction', '', FDosageInstructionList.Link)){3};
oList.add(TFHIRProperty.create(self, 'dispense', '', FDispense.Link));{2}
oList.add(TFHIRProperty.create(self, 'substitution', '', FSubstitution.Link));{2}
end;
procedure TFhirMedicationPrescription.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'dateWritten') then DateWrittenObject := propValue as TFhirDateTime{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'prescriber') then Prescriber := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'encounter') then Encounter := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else if (propName.startsWith('reason')) then Reason := propValue as TFhirType{4}
else if (propName = 'medication') then Medication := propValue as TFhirResourceReference{TFhirMedication}{4b}
else if (propName = 'dosageInstruction') then DosageInstructionList.add(propValue as TFhirMedicationPrescriptionDosageInstruction){2}
else if (propName = 'dispense') then Dispense := propValue as TFhirMedicationPrescriptionDispense{4b}
else if (propName = 'substitution') then Substitution := propValue as TFhirMedicationPrescriptionSubstitution{4b}
else inherited;
end;
function TFhirMedicationPrescription.FhirType : string;
begin
result := 'MedicationPrescription';
end;
function TFhirMedicationPrescription.Link : TFhirMedicationPrescription;
begin
result := TFhirMedicationPrescription(inherited Link);
end;
function TFhirMedicationPrescription.Clone : TFhirMedicationPrescription;
begin
result := TFhirMedicationPrescription(inherited Clone);
end;
{ TFhirMedicationPrescription }
Procedure TFhirMedicationPrescription.SetDateWritten(value : TFhirDateTime);
begin
FDateWritten.free;
FDateWritten := value;
end;
Function TFhirMedicationPrescription.GetDateWrittenST : TDateTimeEx;
begin
if FDateWritten = nil then
result := nil
else
result := FDateWritten.value;
end;
Procedure TFhirMedicationPrescription.SetDateWrittenST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDateWritten = nil then
FDateWritten := TFhirDateTime.create;
FDateWritten.value := value
end
else if FDateWritten <> nil then
FDateWritten.value := nil;
end;
Procedure TFhirMedicationPrescription.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirMedicationPrescription.GetStatusST : TFhirMedicationPrescriptionStatus;
begin
if FStatus = nil then
result := TFhirMedicationPrescriptionStatus(0)
else
result := TFhirMedicationPrescriptionStatus(StringArrayIndexOfSensitive(CODES_TFhirMedicationPrescriptionStatus, FStatus.value));
end;
Procedure TFhirMedicationPrescription.SetStatusST(value : TFhirMedicationPrescriptionStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirMedicationPrescriptionStatus[value]);
end;
Procedure TFhirMedicationPrescription.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
Procedure TFhirMedicationPrescription.SetPrescriber(value : TFhirResourceReference{TFhirPractitioner});
begin
FPrescriber.free;
FPrescriber := value;
end;
Procedure TFhirMedicationPrescription.SetEncounter(value : TFhirResourceReference{TFhirEncounter});
begin
FEncounter.free;
FEncounter := value;
end;
Procedure TFhirMedicationPrescription.SetReason(value : TFhirType);
begin
FReason.free;
FReason := value;
end;
Procedure TFhirMedicationPrescription.SetMedication(value : TFhirResourceReference{TFhirMedication});
begin
FMedication.free;
FMedication := value;
end;
Procedure TFhirMedicationPrescription.SetDispense(value : TFhirMedicationPrescriptionDispense);
begin
FDispense.free;
FDispense := value;
end;
Procedure TFhirMedicationPrescription.SetSubstitution(value : TFhirMedicationPrescriptionSubstitution);
begin
FSubstitution.free;
FSubstitution := value;
end;
{ TFhirMedicationStatement }
constructor TFhirMedicationStatement.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FReasonNotGivenList := TFhirCodeableConceptList.Create;
FDeviceList := TFhirResourceReferenceList{TFhirDevice}.Create;
FDosageList := TFhirMedicationStatementDosageList.Create;
end;
destructor TFhirMedicationStatement.Destroy;
begin
FIdentifierList.Free;
FPatient.free;
FWasNotGiven.free;
FReasonNotGivenList.Free;
FWhenGiven.free;
FMedication.free;
FDeviceList.Free;
FDosageList.Free;
inherited;
end;
function TFhirMedicationStatement.GetResourceType : TFhirResourceType;
begin
result := frtMedicationStatement;
end;
function TFhirMedicationStatement.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirMedicationStatement.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirMedicationStatement(oSource).FIdentifierList);
patient := TFhirMedicationStatement(oSource).patient.Clone;
wasNotGivenObject := TFhirMedicationStatement(oSource).wasNotGivenObject.Clone;
FReasonNotGivenList.Assign(TFhirMedicationStatement(oSource).FReasonNotGivenList);
whenGiven := TFhirMedicationStatement(oSource).whenGiven.Clone;
medication := TFhirMedicationStatement(oSource).medication.Clone;
FDeviceList.Assign(TFhirMedicationStatement(oSource).FDeviceList);
FDosageList.Assign(TFhirMedicationStatement(oSource).FDosageList);
end;
procedure TFhirMedicationStatement.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'wasNotGiven') Then
list.add(FWasNotGiven.Link);
if (child_name = 'reasonNotGiven') Then
list.addAll(FReasonNotGivenList);
if (child_name = 'whenGiven') Then
list.add(FWhenGiven.Link);
if (child_name = 'medication') Then
list.add(FMedication.Link);
if (child_name = 'device') Then
list.addAll(FDeviceList);
if (child_name = 'dosage') Then
list.addAll(FDosageList);
end;
procedure TFhirMedicationStatement.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'wasNotGiven', 'boolean', FWasNotGiven.Link));{2}
oList.add(TFHIRProperty.create(self, 'reasonNotGiven', 'CodeableConcept', FReasonNotGivenList.Link)){3};
oList.add(TFHIRProperty.create(self, 'whenGiven', 'Period', FWhenGiven.Link));{2}
oList.add(TFHIRProperty.create(self, 'medication', 'Resource(Medication)', FMedication.Link));{2}
oList.add(TFHIRProperty.create(self, 'device', 'Resource(Device)', FDeviceList.Link)){3};
oList.add(TFHIRProperty.create(self, 'dosage', '', FDosageList.Link)){3};
end;
procedure TFhirMedicationStatement.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'wasNotGiven') then WasNotGivenObject := propValue as TFhirBoolean{5a}
else if (propName = 'reasonNotGiven') then ReasonNotGivenList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'whenGiven') then WhenGiven := propValue as TFhirPeriod{4b}
else if (propName = 'medication') then Medication := propValue as TFhirResourceReference{TFhirMedication}{4b}
else if (propName = 'device') then DeviceList.add(propValue as TFhirResourceReference{TFhirDevice}){2}
else if (propName = 'dosage') then DosageList.add(propValue as TFhirMedicationStatementDosage){2}
else inherited;
end;
function TFhirMedicationStatement.FhirType : string;
begin
result := 'MedicationStatement';
end;
function TFhirMedicationStatement.Link : TFhirMedicationStatement;
begin
result := TFhirMedicationStatement(inherited Link);
end;
function TFhirMedicationStatement.Clone : TFhirMedicationStatement;
begin
result := TFhirMedicationStatement(inherited Clone);
end;
{ TFhirMedicationStatement }
Procedure TFhirMedicationStatement.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
Procedure TFhirMedicationStatement.SetWasNotGiven(value : TFhirBoolean);
begin
FWasNotGiven.free;
FWasNotGiven := value;
end;
Function TFhirMedicationStatement.GetWasNotGivenST : Boolean;
begin
if FWasNotGiven = nil then
result := false
else
result := FWasNotGiven.value;
end;
Procedure TFhirMedicationStatement.SetWasNotGivenST(value : Boolean);
begin
if FWasNotGiven = nil then
FWasNotGiven := TFhirBoolean.create;
FWasNotGiven.value := value
end;
Procedure TFhirMedicationStatement.SetWhenGiven(value : TFhirPeriod);
begin
FWhenGiven.free;
FWhenGiven := value;
end;
Procedure TFhirMedicationStatement.SetMedication(value : TFhirResourceReference{TFhirMedication});
begin
FMedication.free;
FMedication := value;
end;
{ TFhirMessageHeader }
constructor TFhirMessageHeader.Create;
begin
inherited;
FDestinationList := TFhirMessageHeaderDestinationList.Create;
FDataList := TFhirResourceReferenceList{Resource}.Create;
end;
destructor TFhirMessageHeader.Destroy;
begin
FIdentifier.free;
FTimestamp.free;
FEvent.free;
FResponse.free;
FSource.free;
FDestinationList.Free;
FEnterer.free;
FAuthor.free;
FReceiver.free;
FResponsible.free;
FReason.free;
FDataList.Free;
inherited;
end;
function TFhirMessageHeader.GetResourceType : TFhirResourceType;
begin
result := frtMessageHeader;
end;
function TFhirMessageHeader.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirMessageHeader.Assign(oSource : TAdvObject);
begin
inherited;
identifierObject := TFhirMessageHeader(oSource).identifierObject.Clone;
timestampObject := TFhirMessageHeader(oSource).timestampObject.Clone;
event := TFhirMessageHeader(oSource).event.Clone;
response := TFhirMessageHeader(oSource).response.Clone;
source := TFhirMessageHeader(oSource).source.Clone;
FDestinationList.Assign(TFhirMessageHeader(oSource).FDestinationList);
enterer := TFhirMessageHeader(oSource).enterer.Clone;
author := TFhirMessageHeader(oSource).author.Clone;
receiver := TFhirMessageHeader(oSource).receiver.Clone;
responsible := TFhirMessageHeader(oSource).responsible.Clone;
reason := TFhirMessageHeader(oSource).reason.Clone;
FDataList.Assign(TFhirMessageHeader(oSource).FDataList);
end;
procedure TFhirMessageHeader.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'timestamp') Then
list.add(FTimestamp.Link);
if (child_name = 'event') Then
list.add(FEvent.Link);
if (child_name = 'response') Then
list.add(FResponse.Link);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'destination') Then
list.addAll(FDestinationList);
if (child_name = 'enterer') Then
list.add(FEnterer.Link);
if (child_name = 'author') Then
list.add(FAuthor.Link);
if (child_name = 'receiver') Then
list.add(FReceiver.Link);
if (child_name = 'responsible') Then
list.add(FResponsible.Link);
if (child_name = 'reason') Then
list.add(FReason.Link);
if (child_name = 'data') Then
list.addAll(FDataList);
end;
procedure TFhirMessageHeader.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'id', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'timestamp', 'instant', FTimestamp.Link));{2}
oList.add(TFHIRProperty.create(self, 'event', 'Coding', FEvent.Link));{2}
oList.add(TFHIRProperty.create(self, 'response', '', FResponse.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', '', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'destination', '', FDestinationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'enterer', 'Resource(Practitioner)', FEnterer.Link));{2}
oList.add(TFHIRProperty.create(self, 'author', 'Resource(Practitioner)', FAuthor.Link));{2}
oList.add(TFHIRProperty.create(self, 'receiver', 'Resource(Practitioner|Organization)', FReceiver.Link));{2}
oList.add(TFHIRProperty.create(self, 'responsible', 'Resource(Practitioner|Organization)', FResponsible.Link));{2}
oList.add(TFHIRProperty.create(self, 'reason', 'CodeableConcept', FReason.Link));{2}
oList.add(TFHIRProperty.create(self, 'data', 'Resource(Any)', FDataList.Link)){3};
end;
procedure TFhirMessageHeader.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierObject := propValue as TFhirId{5a}
else if (propName = 'timestamp') then TimestampObject := propValue as TFhirInstant{5a}
else if (propName = 'event') then Event := propValue as TFhirCoding{4b}
else if (propName = 'response') then Response := propValue as TFhirMessageHeaderResponse{4b}
else if (propName = 'source') then Source := propValue as TFhirMessageHeaderSource{4b}
else if (propName = 'destination') then DestinationList.add(propValue as TFhirMessageHeaderDestination){2}
else if (propName = 'enterer') then Enterer := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'author') then Author := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'receiver') then Receiver := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'responsible') then Responsible := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'reason') then Reason := propValue as TFhirCodeableConcept{4b}
else if (propName = 'data') then DataList.add(propValue as TFhirResourceReference{Resource}){2}
else inherited;
end;
function TFhirMessageHeader.FhirType : string;
begin
result := 'MessageHeader';
end;
function TFhirMessageHeader.Link : TFhirMessageHeader;
begin
result := TFhirMessageHeader(inherited Link);
end;
function TFhirMessageHeader.Clone : TFhirMessageHeader;
begin
result := TFhirMessageHeader(inherited Clone);
end;
{ TFhirMessageHeader }
Procedure TFhirMessageHeader.SetIdentifier(value : TFhirId);
begin
FIdentifier.free;
FIdentifier := value;
end;
Function TFhirMessageHeader.GetIdentifierST : String;
begin
if FIdentifier = nil then
result := ''
else
result := FIdentifier.value;
end;
Procedure TFhirMessageHeader.SetIdentifierST(value : String);
begin
if value <> '' then
begin
if FIdentifier = nil then
FIdentifier := TFhirId.create;
FIdentifier.value := value
end
else if FIdentifier <> nil then
FIdentifier.value := '';
end;
Procedure TFhirMessageHeader.SetTimestamp(value : TFhirInstant);
begin
FTimestamp.free;
FTimestamp := value;
end;
Function TFhirMessageHeader.GetTimestampST : TDateTimeEx;
begin
if FTimestamp = nil then
result := nil
else
result := FTimestamp.value;
end;
Procedure TFhirMessageHeader.SetTimestampST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FTimestamp = nil then
FTimestamp := TFhirInstant.create;
FTimestamp.value := value
end
else if FTimestamp <> nil then
FTimestamp.value := nil;
end;
Procedure TFhirMessageHeader.SetEvent(value : TFhirCoding);
begin
FEvent.free;
FEvent := value;
end;
Procedure TFhirMessageHeader.SetResponse(value : TFhirMessageHeaderResponse);
begin
FResponse.free;
FResponse := value;
end;
Procedure TFhirMessageHeader.SetSource(value : TFhirMessageHeaderSource);
begin
FSource.free;
FSource := value;
end;
Procedure TFhirMessageHeader.SetEnterer(value : TFhirResourceReference{TFhirPractitioner});
begin
FEnterer.free;
FEnterer := value;
end;
Procedure TFhirMessageHeader.SetAuthor(value : TFhirResourceReference{TFhirPractitioner});
begin
FAuthor.free;
FAuthor := value;
end;
Procedure TFhirMessageHeader.SetReceiver(value : TFhirResourceReference{Resource});
begin
FReceiver.free;
FReceiver := value;
end;
Procedure TFhirMessageHeader.SetResponsible(value : TFhirResourceReference{Resource});
begin
FResponsible.free;
FResponsible := value;
end;
Procedure TFhirMessageHeader.SetReason(value : TFhirCodeableConcept);
begin
FReason.free;
FReason := value;
end;
{ TFhirObservation }
constructor TFhirObservation.Create;
begin
inherited;
FPerformerList := TFhirResourceReferenceList{Resource}.Create;
FReferenceRangeList := TFhirObservationReferenceRangeList.Create;
FRelatedList := TFhirObservationRelatedList.Create;
end;
destructor TFhirObservation.Destroy;
begin
FName.free;
FValue.free;
FInterpretation.free;
FComments.free;
FApplies.free;
FIssued.free;
FStatus.free;
FReliability.free;
FBodySite.free;
FMethod.free;
FIdentifier.free;
FSubject.free;
FSpecimen.free;
FPerformerList.Free;
FReferenceRangeList.Free;
FRelatedList.Free;
inherited;
end;
function TFhirObservation.GetResourceType : TFhirResourceType;
begin
result := frtObservation;
end;
function TFhirObservation.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirObservation.Assign(oSource : TAdvObject);
begin
inherited;
name := TFhirObservation(oSource).name.Clone;
value := TFhirObservation(oSource).value.Clone;
interpretation := TFhirObservation(oSource).interpretation.Clone;
commentsObject := TFhirObservation(oSource).commentsObject.Clone;
applies := TFhirObservation(oSource).applies.Clone;
issuedObject := TFhirObservation(oSource).issuedObject.Clone;
FStatus := TFhirObservation(oSource).FStatus.Link;
FReliability := TFhirObservation(oSource).FReliability.Link;
bodySite := TFhirObservation(oSource).bodySite.Clone;
method := TFhirObservation(oSource).method.Clone;
identifier := TFhirObservation(oSource).identifier.Clone;
subject := TFhirObservation(oSource).subject.Clone;
specimen := TFhirObservation(oSource).specimen.Clone;
FPerformerList.Assign(TFhirObservation(oSource).FPerformerList);
FReferenceRangeList.Assign(TFhirObservation(oSource).FReferenceRangeList);
FRelatedList.Assign(TFhirObservation(oSource).FRelatedList);
end;
procedure TFhirObservation.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'value[x]') Then
list.add(FValue.Link);
if (child_name = 'interpretation') Then
list.add(FInterpretation.Link);
if (child_name = 'comments') Then
list.add(FComments.Link);
if (child_name = 'applies[x]') Then
list.add(FApplies.Link);
if (child_name = 'issued') Then
list.add(FIssued.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'reliability') Then
list.add(FReliability.Link);
if (child_name = 'bodySite') Then
list.add(FBodySite.Link);
if (child_name = 'method') Then
list.add(FMethod.Link);
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'specimen') Then
list.add(FSpecimen.Link);
if (child_name = 'performer') Then
list.addAll(FPerformerList);
if (child_name = 'referenceRange') Then
list.addAll(FReferenceRangeList);
if (child_name = 'related') Then
list.addAll(FRelatedList);
end;
procedure TFhirObservation.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'name', 'CodeableConcept', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'value[x]', 'Quantity|CodeableConcept|Attachment|Ratio|Period|SampledData|string', FValue.Link));{2}
oList.add(TFHIRProperty.create(self, 'interpretation', 'CodeableConcept', FInterpretation.Link));{2}
oList.add(TFHIRProperty.create(self, 'comments', 'string', FComments.Link));{2}
oList.add(TFHIRProperty.create(self, 'applies[x]', 'dateTime|Period', FApplies.Link));{2}
oList.add(TFHIRProperty.create(self, 'issued', 'instant', FIssued.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'reliability', 'code', FReliability.Link));{1}
oList.add(TFHIRProperty.create(self, 'bodySite', 'CodeableConcept', FBodySite.Link));{2}
oList.add(TFHIRProperty.create(self, 'method', 'CodeableConcept', FMethod.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Group|Device|Location)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'specimen', 'Resource(Specimen)', FSpecimen.Link));{2}
oList.add(TFHIRProperty.create(self, 'performer', 'Resource(Practitioner|Device|Organization)', FPerformerList.Link)){3};
oList.add(TFHIRProperty.create(self, 'referenceRange', '', FReferenceRangeList.Link)){3};
oList.add(TFHIRProperty.create(self, 'related', '', FRelatedList.Link)){3};
end;
procedure TFhirObservation.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'name') then Name := propValue as TFhirCodeableConcept{4b}
else if (propName.startsWith('value')) then Value := propValue as TFhirType{4}
else if (propName = 'interpretation') then Interpretation := propValue as TFhirCodeableConcept{4b}
else if (propName = 'comments') then CommentsObject := propValue as TFhirString{5a}
else if (propName.startsWith('applies')) then Applies := propValue as TFhirType{4}
else if (propName = 'issued') then IssuedObject := propValue as TFhirInstant{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'reliability') then ReliabilityObject := propValue as TFHIREnum
else if (propName = 'bodySite') then BodySite := propValue as TFhirCodeableConcept{4b}
else if (propName = 'method') then Method := propValue as TFhirCodeableConcept{4b}
else if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'specimen') then Specimen := propValue as TFhirResourceReference{TFhirSpecimen}{4b}
else if (propName = 'performer') then PerformerList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'referenceRange') then ReferenceRangeList.add(propValue as TFhirObservationReferenceRange){2}
else if (propName = 'related') then RelatedList.add(propValue as TFhirObservationRelated){2}
else inherited;
end;
function TFhirObservation.FhirType : string;
begin
result := 'Observation';
end;
function TFhirObservation.Link : TFhirObservation;
begin
result := TFhirObservation(inherited Link);
end;
function TFhirObservation.Clone : TFhirObservation;
begin
result := TFhirObservation(inherited Clone);
end;
{ TFhirObservation }
Procedure TFhirObservation.SetName(value : TFhirCodeableConcept);
begin
FName.free;
FName := value;
end;
Procedure TFhirObservation.SetValue(value : TFhirType);
begin
FValue.free;
FValue := value;
end;
Procedure TFhirObservation.SetInterpretation(value : TFhirCodeableConcept);
begin
FInterpretation.free;
FInterpretation := value;
end;
Procedure TFhirObservation.SetComments(value : TFhirString);
begin
FComments.free;
FComments := value;
end;
Function TFhirObservation.GetCommentsST : String;
begin
if FComments = nil then
result := ''
else
result := FComments.value;
end;
Procedure TFhirObservation.SetCommentsST(value : String);
begin
if value <> '' then
begin
if FComments = nil then
FComments := TFhirString.create;
FComments.value := value
end
else if FComments <> nil then
FComments.value := '';
end;
Procedure TFhirObservation.SetApplies(value : TFhirType);
begin
FApplies.free;
FApplies := value;
end;
Procedure TFhirObservation.SetIssued(value : TFhirInstant);
begin
FIssued.free;
FIssued := value;
end;
Function TFhirObservation.GetIssuedST : TDateTimeEx;
begin
if FIssued = nil then
result := nil
else
result := FIssued.value;
end;
Procedure TFhirObservation.SetIssuedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FIssued = nil then
FIssued := TFhirInstant.create;
FIssued.value := value
end
else if FIssued <> nil then
FIssued.value := nil;
end;
Procedure TFhirObservation.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirObservation.GetStatusST : TFhirObservationStatus;
begin
if FStatus = nil then
result := TFhirObservationStatus(0)
else
result := TFhirObservationStatus(StringArrayIndexOfSensitive(CODES_TFhirObservationStatus, FStatus.value));
end;
Procedure TFhirObservation.SetStatusST(value : TFhirObservationStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirObservationStatus[value]);
end;
Procedure TFhirObservation.SetReliability(value : TFhirEnum);
begin
FReliability.free;
FReliability := value;
end;
Function TFhirObservation.GetReliabilityST : TFhirObservationReliability;
begin
if FReliability = nil then
result := TFhirObservationReliability(0)
else
result := TFhirObservationReliability(StringArrayIndexOfSensitive(CODES_TFhirObservationReliability, FReliability.value));
end;
Procedure TFhirObservation.SetReliabilityST(value : TFhirObservationReliability);
begin
if ord(value) = 0 then
ReliabilityObject := nil
else
ReliabilityObject := TFhirEnum.create(CODES_TFhirObservationReliability[value]);
end;
Procedure TFhirObservation.SetBodySite(value : TFhirCodeableConcept);
begin
FBodySite.free;
FBodySite := value;
end;
Procedure TFhirObservation.SetMethod(value : TFhirCodeableConcept);
begin
FMethod.free;
FMethod := value;
end;
Procedure TFhirObservation.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirObservation.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirObservation.SetSpecimen(value : TFhirResourceReference{TFhirSpecimen});
begin
FSpecimen.free;
FSpecimen := value;
end;
{ TFhirOperationOutcome }
constructor TFhirOperationOutcome.Create;
begin
inherited;
FIssueList := TFhirOperationOutcomeIssueList.Create;
end;
destructor TFhirOperationOutcome.Destroy;
begin
FIssueList.Free;
inherited;
end;
function TFhirOperationOutcome.GetResourceType : TFhirResourceType;
begin
result := frtOperationOutcome;
end;
function TFhirOperationOutcome.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirOperationOutcome.Assign(oSource : TAdvObject);
begin
inherited;
FIssueList.Assign(TFhirOperationOutcome(oSource).FIssueList);
end;
procedure TFhirOperationOutcome.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'issue') Then
list.addAll(FIssueList);
end;
procedure TFhirOperationOutcome.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'issue', '', FIssueList.Link)){3};
end;
procedure TFhirOperationOutcome.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'issue') then IssueList.add(propValue as TFhirOperationOutcomeIssue){2}
else inherited;
end;
function TFhirOperationOutcome.FhirType : string;
begin
result := 'OperationOutcome';
end;
function TFhirOperationOutcome.Link : TFhirOperationOutcome;
begin
result := TFhirOperationOutcome(inherited Link);
end;
function TFhirOperationOutcome.Clone : TFhirOperationOutcome;
begin
result := TFhirOperationOutcome(inherited Clone);
end;
{ TFhirOperationOutcome }
{ TFhirOrder }
constructor TFhirOrder.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FDetailList := TFhirResourceReferenceList{Resource}.Create;
end;
destructor TFhirOrder.Destroy;
begin
FIdentifierList.Free;
FDate.free;
FSubject.free;
FSource.free;
FTarget.free;
FReason.free;
FAuthority.free;
FWhen.free;
FDetailList.Free;
inherited;
end;
function TFhirOrder.GetResourceType : TFhirResourceType;
begin
result := frtOrder;
end;
function TFhirOrder.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirOrder.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirOrder(oSource).FIdentifierList);
dateObject := TFhirOrder(oSource).dateObject.Clone;
subject := TFhirOrder(oSource).subject.Clone;
source := TFhirOrder(oSource).source.Clone;
target := TFhirOrder(oSource).target.Clone;
reason := TFhirOrder(oSource).reason.Clone;
authority := TFhirOrder(oSource).authority.Clone;
when := TFhirOrder(oSource).when.Clone;
FDetailList.Assign(TFhirOrder(oSource).FDetailList);
end;
procedure TFhirOrder.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'target') Then
list.add(FTarget.Link);
if (child_name = 'reason[x]') Then
list.add(FReason.Link);
if (child_name = 'authority') Then
list.add(FAuthority.Link);
if (child_name = 'when') Then
list.add(FWhen.Link);
if (child_name = 'detail') Then
list.addAll(FDetailList);
end;
procedure TFhirOrder.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', 'Resource(Practitioner)', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'target', 'Resource(Organization|Device|Practitioner)', FTarget.Link));{2}
oList.add(TFHIRProperty.create(self, 'reason[x]', 'CodeableConcept|Resource(Any)', FReason.Link));{2}
oList.add(TFHIRProperty.create(self, 'authority', 'Resource(Any)', FAuthority.Link));{2}
oList.add(TFHIRProperty.create(self, 'when', '', FWhen.Link));{2}
oList.add(TFHIRProperty.create(self, 'detail', 'Resource(Any)', FDetailList.Link)){3};
end;
procedure TFhirOrder.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'source') then Source := propValue as TFhirResourceReference{TFhirPractitioner}{4b}
else if (propName = 'target') then Target := propValue as TFhirResourceReference{Resource}{4b}
else if (propName.startsWith('reason')) then Reason := propValue as TFhirType{4}
else if (propName = 'authority') then Authority := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'when') then When := propValue as TFhirOrderWhen{4b}
else if (propName = 'detail') then DetailList.add(propValue as TFhirResourceReference{Resource}){2}
else inherited;
end;
function TFhirOrder.FhirType : string;
begin
result := 'Order';
end;
function TFhirOrder.Link : TFhirOrder;
begin
result := TFhirOrder(inherited Link);
end;
function TFhirOrder.Clone : TFhirOrder;
begin
result := TFhirOrder(inherited Clone);
end;
{ TFhirOrder }
Procedure TFhirOrder.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirOrder.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirOrder.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirOrder.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirOrder.SetSource(value : TFhirResourceReference{TFhirPractitioner});
begin
FSource.free;
FSource := value;
end;
Procedure TFhirOrder.SetTarget(value : TFhirResourceReference{Resource});
begin
FTarget.free;
FTarget := value;
end;
Procedure TFhirOrder.SetReason(value : TFhirType);
begin
FReason.free;
FReason := value;
end;
Procedure TFhirOrder.SetAuthority(value : TFhirResourceReference{Resource});
begin
FAuthority.free;
FAuthority := value;
end;
Procedure TFhirOrder.SetWhen(value : TFhirOrderWhen);
begin
FWhen.free;
FWhen := value;
end;
{ TFhirOrderResponse }
constructor TFhirOrderResponse.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FFulfillmentList := TFhirResourceReferenceList{Resource}.Create;
end;
destructor TFhirOrderResponse.Destroy;
begin
FIdentifierList.Free;
FRequest.free;
FDate.free;
FWho.free;
FAuthority.free;
FCode.free;
FDescription.free;
FFulfillmentList.Free;
inherited;
end;
function TFhirOrderResponse.GetResourceType : TFhirResourceType;
begin
result := frtOrderResponse;
end;
function TFhirOrderResponse.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirOrderResponse.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirOrderResponse(oSource).FIdentifierList);
request := TFhirOrderResponse(oSource).request.Clone;
dateObject := TFhirOrderResponse(oSource).dateObject.Clone;
who := TFhirOrderResponse(oSource).who.Clone;
authority := TFhirOrderResponse(oSource).authority.Clone;
FCode := TFhirOrderResponse(oSource).FCode.Link;
descriptionObject := TFhirOrderResponse(oSource).descriptionObject.Clone;
FFulfillmentList.Assign(TFhirOrderResponse(oSource).FFulfillmentList);
end;
procedure TFhirOrderResponse.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'request') Then
list.add(FRequest.Link);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'who') Then
list.add(FWho.Link);
if (child_name = 'authority[x]') Then
list.add(FAuthority.Link);
if (child_name = 'code') Then
list.add(FCode.Link);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'fulfillment') Then
list.addAll(FFulfillmentList);
end;
procedure TFhirOrderResponse.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'request', 'Resource(Order)', FRequest.Link));{2}
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'who', 'Resource(Practitioner|Organization|Device)', FWho.Link));{2}
oList.add(TFHIRProperty.create(self, 'authority[x]', 'CodeableConcept|Resource(Any)', FAuthority.Link));{2}
oList.add(TFHIRProperty.create(self, 'code', 'code', FCode.Link));{1}
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'fulfillment', 'Resource(Any)', FFulfillmentList.Link)){3};
end;
procedure TFhirOrderResponse.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'request') then Request := propValue as TFhirResourceReference{TFhirOrder}{4b}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'who') then Who := propValue as TFhirResourceReference{Resource}{4b}
else if (propName.startsWith('authority')) then Authority := propValue as TFhirType{4}
else if (propName = 'code') then CodeObject := propValue as TFHIREnum
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'fulfillment') then FulfillmentList.add(propValue as TFhirResourceReference{Resource}){2}
else inherited;
end;
function TFhirOrderResponse.FhirType : string;
begin
result := 'OrderResponse';
end;
function TFhirOrderResponse.Link : TFhirOrderResponse;
begin
result := TFhirOrderResponse(inherited Link);
end;
function TFhirOrderResponse.Clone : TFhirOrderResponse;
begin
result := TFhirOrderResponse(inherited Clone);
end;
{ TFhirOrderResponse }
Procedure TFhirOrderResponse.SetRequest(value : TFhirResourceReference{TFhirOrder});
begin
FRequest.free;
FRequest := value;
end;
Procedure TFhirOrderResponse.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirOrderResponse.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirOrderResponse.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirOrderResponse.SetWho(value : TFhirResourceReference{Resource});
begin
FWho.free;
FWho := value;
end;
Procedure TFhirOrderResponse.SetAuthority(value : TFhirType);
begin
FAuthority.free;
FAuthority := value;
end;
Procedure TFhirOrderResponse.SetCode(value : TFhirEnum);
begin
FCode.free;
FCode := value;
end;
Function TFhirOrderResponse.GetCodeST : TFhirOrderOutcomeCode;
begin
if FCode = nil then
result := TFhirOrderOutcomeCode(0)
else
result := TFhirOrderOutcomeCode(StringArrayIndexOfSensitive(CODES_TFhirOrderOutcomeCode, FCode.value));
end;
Procedure TFhirOrderResponse.SetCodeST(value : TFhirOrderOutcomeCode);
begin
if ord(value) = 0 then
CodeObject := nil
else
CodeObject := TFhirEnum.create(CODES_TFhirOrderOutcomeCode[value]);
end;
Procedure TFhirOrderResponse.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirOrderResponse.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirOrderResponse.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
{ TFhirOrganization }
constructor TFhirOrganization.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FTelecomList := TFhirContactList.Create;
FAddressList := TFhirAddressList.Create;
FContactList := TFhirOrganizationContactList.Create;
FLocationList := TFhirResourceReferenceList{TFhirLocation}.Create;
end;
destructor TFhirOrganization.Destroy;
begin
FIdentifierList.Free;
FName.free;
FType_.free;
FTelecomList.Free;
FAddressList.Free;
FPartOf.free;
FContactList.Free;
FLocationList.Free;
FActive.free;
inherited;
end;
function TFhirOrganization.GetResourceType : TFhirResourceType;
begin
result := frtOrganization;
end;
function TFhirOrganization.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirOrganization.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirOrganization(oSource).FIdentifierList);
nameObject := TFhirOrganization(oSource).nameObject.Clone;
type_ := TFhirOrganization(oSource).type_.Clone;
FTelecomList.Assign(TFhirOrganization(oSource).FTelecomList);
FAddressList.Assign(TFhirOrganization(oSource).FAddressList);
partOf := TFhirOrganization(oSource).partOf.Clone;
FContactList.Assign(TFhirOrganization(oSource).FContactList);
FLocationList.Assign(TFhirOrganization(oSource).FLocationList);
activeObject := TFhirOrganization(oSource).activeObject.Clone;
end;
procedure TFhirOrganization.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'address') Then
list.addAll(FAddressList);
if (child_name = 'partOf') Then
list.add(FPartOf.Link);
if (child_name = 'contact') Then
list.addAll(FContactList);
if (child_name = 'location') Then
list.addAll(FLocationList);
if (child_name = 'active') Then
list.add(FActive.Link);
end;
procedure TFhirOrganization.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'address', 'Address', FAddressList.Link)){3};
oList.add(TFHIRProperty.create(self, 'partOf', 'Resource(Organization)', FPartOf.Link));{2}
oList.add(TFHIRProperty.create(self, 'contact', '', FContactList.Link)){3};
oList.add(TFHIRProperty.create(self, 'location', 'Resource(Location)', FLocationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'active', 'boolean', FActive.Link));{2}
end;
procedure TFhirOrganization.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'address') then AddressList.add(propValue as TFhirAddress){2}
else if (propName = 'partOf') then PartOf := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'contact') then ContactList.add(propValue as TFhirOrganizationContact){2}
else if (propName = 'location') then LocationList.add(propValue as TFhirResourceReference{TFhirLocation}){2}
else if (propName = 'active') then ActiveObject := propValue as TFhirBoolean{5a}
else inherited;
end;
function TFhirOrganization.FhirType : string;
begin
result := 'Organization';
end;
function TFhirOrganization.Link : TFhirOrganization;
begin
result := TFhirOrganization(inherited Link);
end;
function TFhirOrganization.Clone : TFhirOrganization;
begin
result := TFhirOrganization(inherited Clone);
end;
{ TFhirOrganization }
Procedure TFhirOrganization.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirOrganization.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirOrganization.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirOrganization.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirOrganization.SetPartOf(value : TFhirResourceReference{TFhirOrganization});
begin
FPartOf.free;
FPartOf := value;
end;
Procedure TFhirOrganization.SetActive(value : TFhirBoolean);
begin
FActive.free;
FActive := value;
end;
Function TFhirOrganization.GetActiveST : Boolean;
begin
if FActive = nil then
result := false
else
result := FActive.value;
end;
Procedure TFhirOrganization.SetActiveST(value : Boolean);
begin
if FActive = nil then
FActive := TFhirBoolean.create;
FActive.value := value
end;
{ TFhirOther }
constructor TFhirOther.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
end;
destructor TFhirOther.Destroy;
begin
FIdentifierList.Free;
FCode.free;
FSubject.free;
FAuthor.free;
FCreated.free;
inherited;
end;
function TFhirOther.GetResourceType : TFhirResourceType;
begin
result := frtOther;
end;
function TFhirOther.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirOther.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirOther(oSource).FIdentifierList);
code := TFhirOther(oSource).code.Clone;
subject := TFhirOther(oSource).subject.Clone;
author := TFhirOther(oSource).author.Clone;
createdObject := TFhirOther(oSource).createdObject.Clone;
end;
procedure TFhirOther.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'code') Then
list.add(FCode.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'author') Then
list.add(FAuthor.Link);
if (child_name = 'created') Then
list.add(FCreated.Link);
end;
procedure TFhirOther.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'code', 'CodeableConcept', FCode.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Any)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'author', 'Resource(Practitioner|Patient|RelatedPerson)', FAuthor.Link));{2}
oList.add(TFHIRProperty.create(self, 'created', 'date', FCreated.Link));{2}
end;
procedure TFhirOther.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'code') then Code := propValue as TFhirCodeableConcept{4b}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'author') then Author := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'created') then CreatedObject := propValue as TFhirDate{5a}
else inherited;
end;
function TFhirOther.FhirType : string;
begin
result := 'Other';
end;
function TFhirOther.Link : TFhirOther;
begin
result := TFhirOther(inherited Link);
end;
function TFhirOther.Clone : TFhirOther;
begin
result := TFhirOther(inherited Clone);
end;
{ TFhirOther }
Procedure TFhirOther.SetCode(value : TFhirCodeableConcept);
begin
FCode.free;
FCode := value;
end;
Procedure TFhirOther.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirOther.SetAuthor(value : TFhirResourceReference{Resource});
begin
FAuthor.free;
FAuthor := value;
end;
Procedure TFhirOther.SetCreated(value : TFhirDate);
begin
FCreated.free;
FCreated := value;
end;
Function TFhirOther.GetCreatedST : TDateTimeEx;
begin
if FCreated = nil then
result := nil
else
result := FCreated.value;
end;
Procedure TFhirOther.SetCreatedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FCreated = nil then
FCreated := TFhirDate.create;
FCreated.value := value
end
else if FCreated <> nil then
FCreated.value := nil;
end;
{ TFhirPatient }
constructor TFhirPatient.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FNameList := TFhirHumanNameList.Create;
FTelecomList := TFhirContactList.Create;
FAddressList := TFhirAddressList.Create;
FPhotoList := TFhirAttachmentList.Create;
FContactList := TFhirPatientContactList.Create;
FCommunicationList := TFhirCodeableConceptList.Create;
FCareProviderList := TFhirResourceReferenceList{Resource}.Create;
FLink_List := TFhirPatientLinkList.Create;
end;
destructor TFhirPatient.Destroy;
begin
FIdentifierList.Free;
FNameList.Free;
FTelecomList.Free;
FGender.free;
FBirthDate.free;
FDeceased.free;
FAddressList.Free;
FMaritalStatus.free;
FMultipleBirth.free;
FPhotoList.Free;
FContactList.Free;
FAnimal.free;
FCommunicationList.Free;
FCareProviderList.Free;
FManagingOrganization.free;
FLink_List.Free;
FActive.free;
inherited;
end;
function TFhirPatient.GetResourceType : TFhirResourceType;
begin
result := frtPatient;
end;
function TFhirPatient.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirPatient.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirPatient(oSource).FIdentifierList);
FNameList.Assign(TFhirPatient(oSource).FNameList);
FTelecomList.Assign(TFhirPatient(oSource).FTelecomList);
gender := TFhirPatient(oSource).gender.Clone;
birthDateObject := TFhirPatient(oSource).birthDateObject.Clone;
deceased := TFhirPatient(oSource).deceased.Clone;
FAddressList.Assign(TFhirPatient(oSource).FAddressList);
maritalStatus := TFhirPatient(oSource).maritalStatus.Clone;
multipleBirth := TFhirPatient(oSource).multipleBirth.Clone;
FPhotoList.Assign(TFhirPatient(oSource).FPhotoList);
FContactList.Assign(TFhirPatient(oSource).FContactList);
animal := TFhirPatient(oSource).animal.Clone;
FCommunicationList.Assign(TFhirPatient(oSource).FCommunicationList);
FCareProviderList.Assign(TFhirPatient(oSource).FCareProviderList);
managingOrganization := TFhirPatient(oSource).managingOrganization.Clone;
FLink_List.Assign(TFhirPatient(oSource).FLink_List);
activeObject := TFhirPatient(oSource).activeObject.Clone;
end;
procedure TFhirPatient.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'name') Then
list.addAll(FNameList);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'gender') Then
list.add(FGender.Link);
if (child_name = 'birthDate') Then
list.add(FBirthDate.Link);
if (child_name = 'deceased[x]') Then
list.add(FDeceased.Link);
if (child_name = 'address') Then
list.addAll(FAddressList);
if (child_name = 'maritalStatus') Then
list.add(FMaritalStatus.Link);
if (child_name = 'multipleBirth[x]') Then
list.add(FMultipleBirth.Link);
if (child_name = 'photo') Then
list.addAll(FPhotoList);
if (child_name = 'contact') Then
list.addAll(FContactList);
if (child_name = 'animal') Then
list.add(FAnimal.Link);
if (child_name = 'communication') Then
list.addAll(FCommunicationList);
if (child_name = 'careProvider') Then
list.addAll(FCareProviderList);
if (child_name = 'managingOrganization') Then
list.add(FManagingOrganization.Link);
if (child_name = 'link') Then
list.addAll(FLink_List);
if (child_name = 'active') Then
list.add(FActive.Link);
end;
procedure TFhirPatient.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'name', 'HumanName', FNameList.Link)){3};
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'gender', 'CodeableConcept', FGender.Link));{2}
oList.add(TFHIRProperty.create(self, 'birthDate', 'dateTime', FBirthDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'deceased[x]', 'boolean|dateTime', FDeceased.Link));{2}
oList.add(TFHIRProperty.create(self, 'address', 'Address', FAddressList.Link)){3};
oList.add(TFHIRProperty.create(self, 'maritalStatus', 'CodeableConcept', FMaritalStatus.Link));{2}
oList.add(TFHIRProperty.create(self, 'multipleBirth[x]', 'boolean|integer', FMultipleBirth.Link));{2}
oList.add(TFHIRProperty.create(self, 'photo', 'Attachment', FPhotoList.Link)){3};
oList.add(TFHIRProperty.create(self, 'contact', '', FContactList.Link)){3};
oList.add(TFHIRProperty.create(self, 'animal', '', FAnimal.Link));{2}
oList.add(TFHIRProperty.create(self, 'communication', 'CodeableConcept', FCommunicationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'careProvider', 'Resource(Organization|Practitioner)', FCareProviderList.Link)){3};
oList.add(TFHIRProperty.create(self, 'managingOrganization', 'Resource(Organization)', FManagingOrganization.Link));{2}
oList.add(TFHIRProperty.create(self, 'link', '', FLink_List.Link)){3};
oList.add(TFHIRProperty.create(self, 'active', 'boolean', FActive.Link));{2}
end;
procedure TFhirPatient.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'name') then NameList.add(propValue as TFhirHumanName){2}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'gender') then Gender := propValue as TFhirCodeableConcept{4b}
else if (propName = 'birthDate') then BirthDateObject := propValue as TFhirDateTime{5a}
else if (propName.startsWith('deceased')) then Deceased := propValue as TFhirType{4}
else if (propName = 'address') then AddressList.add(propValue as TFhirAddress){2}
else if (propName = 'maritalStatus') then MaritalStatus := propValue as TFhirCodeableConcept{4b}
else if (propName.startsWith('multipleBirth')) then MultipleBirth := propValue as TFhirType{4}
else if (propName = 'photo') then PhotoList.add(propValue as TFhirAttachment){2}
else if (propName = 'contact') then ContactList.add(propValue as TFhirPatientContact){2}
else if (propName = 'animal') then Animal := propValue as TFhirPatientAnimal{4b}
else if (propName = 'communication') then CommunicationList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'careProvider') then CareProviderList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'managingOrganization') then ManagingOrganization := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'link') then Link_List.add(propValue as TFhirPatientLink){2}
else if (propName = 'active') then ActiveObject := propValue as TFhirBoolean{5a}
else inherited;
end;
function TFhirPatient.FhirType : string;
begin
result := 'Patient';
end;
function TFhirPatient.Link : TFhirPatient;
begin
result := TFhirPatient(inherited Link);
end;
function TFhirPatient.Clone : TFhirPatient;
begin
result := TFhirPatient(inherited Clone);
end;
{ TFhirPatient }
Procedure TFhirPatient.SetGender(value : TFhirCodeableConcept);
begin
FGender.free;
FGender := value;
end;
Procedure TFhirPatient.SetBirthDate(value : TFhirDateTime);
begin
FBirthDate.free;
FBirthDate := value;
end;
Function TFhirPatient.GetBirthDateST : TDateTimeEx;
begin
if FBirthDate = nil then
result := nil
else
result := FBirthDate.value;
end;
Procedure TFhirPatient.SetBirthDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FBirthDate = nil then
FBirthDate := TFhirDateTime.create;
FBirthDate.value := value
end
else if FBirthDate <> nil then
FBirthDate.value := nil;
end;
Procedure TFhirPatient.SetDeceased(value : TFhirType);
begin
FDeceased.free;
FDeceased := value;
end;
Procedure TFhirPatient.SetMaritalStatus(value : TFhirCodeableConcept);
begin
FMaritalStatus.free;
FMaritalStatus := value;
end;
Procedure TFhirPatient.SetMultipleBirth(value : TFhirType);
begin
FMultipleBirth.free;
FMultipleBirth := value;
end;
Procedure TFhirPatient.SetAnimal(value : TFhirPatientAnimal);
begin
FAnimal.free;
FAnimal := value;
end;
Procedure TFhirPatient.SetManagingOrganization(value : TFhirResourceReference{TFhirOrganization});
begin
FManagingOrganization.free;
FManagingOrganization := value;
end;
Procedure TFhirPatient.SetActive(value : TFhirBoolean);
begin
FActive.free;
FActive := value;
end;
Function TFhirPatient.GetActiveST : Boolean;
begin
if FActive = nil then
result := false
else
result := FActive.value;
end;
Procedure TFhirPatient.SetActiveST(value : Boolean);
begin
if FActive = nil then
FActive := TFhirBoolean.create;
FActive.value := value
end;
{ TFhirPractitioner }
constructor TFhirPractitioner.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FTelecomList := TFhirContactList.Create;
FPhotoList := TFhirAttachmentList.Create;
FRoleList := TFhirCodeableConceptList.Create;
FSpecialtyList := TFhirCodeableConceptList.Create;
FLocationList := TFhirResourceReferenceList{TFhirLocation}.Create;
FQualificationList := TFhirPractitionerQualificationList.Create;
FCommunicationList := TFhirCodeableConceptList.Create;
end;
destructor TFhirPractitioner.Destroy;
begin
FIdentifierList.Free;
FName.free;
FTelecomList.Free;
FAddress.free;
FGender.free;
FBirthDate.free;
FPhotoList.Free;
FOrganization.free;
FRoleList.Free;
FSpecialtyList.Free;
FPeriod.free;
FLocationList.Free;
FQualificationList.Free;
FCommunicationList.Free;
inherited;
end;
function TFhirPractitioner.GetResourceType : TFhirResourceType;
begin
result := frtPractitioner;
end;
function TFhirPractitioner.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirPractitioner.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirPractitioner(oSource).FIdentifierList);
name := TFhirPractitioner(oSource).name.Clone;
FTelecomList.Assign(TFhirPractitioner(oSource).FTelecomList);
address := TFhirPractitioner(oSource).address.Clone;
gender := TFhirPractitioner(oSource).gender.Clone;
birthDateObject := TFhirPractitioner(oSource).birthDateObject.Clone;
FPhotoList.Assign(TFhirPractitioner(oSource).FPhotoList);
organization := TFhirPractitioner(oSource).organization.Clone;
FRoleList.Assign(TFhirPractitioner(oSource).FRoleList);
FSpecialtyList.Assign(TFhirPractitioner(oSource).FSpecialtyList);
period := TFhirPractitioner(oSource).period.Clone;
FLocationList.Assign(TFhirPractitioner(oSource).FLocationList);
FQualificationList.Assign(TFhirPractitioner(oSource).FQualificationList);
FCommunicationList.Assign(TFhirPractitioner(oSource).FCommunicationList);
end;
procedure TFhirPractitioner.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'address') Then
list.add(FAddress.Link);
if (child_name = 'gender') Then
list.add(FGender.Link);
if (child_name = 'birthDate') Then
list.add(FBirthDate.Link);
if (child_name = 'photo') Then
list.addAll(FPhotoList);
if (child_name = 'organization') Then
list.add(FOrganization.Link);
if (child_name = 'role') Then
list.addAll(FRoleList);
if (child_name = 'specialty') Then
list.addAll(FSpecialtyList);
if (child_name = 'period') Then
list.add(FPeriod.Link);
if (child_name = 'location') Then
list.addAll(FLocationList);
if (child_name = 'qualification') Then
list.addAll(FQualificationList);
if (child_name = 'communication') Then
list.addAll(FCommunicationList);
end;
procedure TFhirPractitioner.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'name', 'HumanName', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'address', 'Address', FAddress.Link));{2}
oList.add(TFHIRProperty.create(self, 'gender', 'CodeableConcept', FGender.Link));{2}
oList.add(TFHIRProperty.create(self, 'birthDate', 'dateTime', FBirthDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'photo', 'Attachment', FPhotoList.Link)){3};
oList.add(TFHIRProperty.create(self, 'organization', 'Resource(Organization)', FOrganization.Link));{2}
oList.add(TFHIRProperty.create(self, 'role', 'CodeableConcept', FRoleList.Link)){3};
oList.add(TFHIRProperty.create(self, 'specialty', 'CodeableConcept', FSpecialtyList.Link)){3};
oList.add(TFHIRProperty.create(self, 'period', 'Period', FPeriod.Link));{2}
oList.add(TFHIRProperty.create(self, 'location', 'Resource(Location)', FLocationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'qualification', '', FQualificationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'communication', 'CodeableConcept', FCommunicationList.Link)){3};
end;
procedure TFhirPractitioner.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'name') then Name := propValue as TFhirHumanName{4b}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'address') then Address := propValue as TFhirAddress{4b}
else if (propName = 'gender') then Gender := propValue as TFhirCodeableConcept{4b}
else if (propName = 'birthDate') then BirthDateObject := propValue as TFhirDateTime{5a}
else if (propName = 'photo') then PhotoList.add(propValue as TFhirAttachment){2}
else if (propName = 'organization') then Organization := propValue as TFhirResourceReference{TFhirOrganization}{4b}
else if (propName = 'role') then RoleList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'specialty') then SpecialtyList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'period') then Period := propValue as TFhirPeriod{4b}
else if (propName = 'location') then LocationList.add(propValue as TFhirResourceReference{TFhirLocation}){2}
else if (propName = 'qualification') then QualificationList.add(propValue as TFhirPractitionerQualification){2}
else if (propName = 'communication') then CommunicationList.add(propValue as TFhirCodeableConcept){2}
else inherited;
end;
function TFhirPractitioner.FhirType : string;
begin
result := 'Practitioner';
end;
function TFhirPractitioner.Link : TFhirPractitioner;
begin
result := TFhirPractitioner(inherited Link);
end;
function TFhirPractitioner.Clone : TFhirPractitioner;
begin
result := TFhirPractitioner(inherited Clone);
end;
{ TFhirPractitioner }
Procedure TFhirPractitioner.SetName(value : TFhirHumanName);
begin
FName.free;
FName := value;
end;
Procedure TFhirPractitioner.SetAddress(value : TFhirAddress);
begin
FAddress.free;
FAddress := value;
end;
Procedure TFhirPractitioner.SetGender(value : TFhirCodeableConcept);
begin
FGender.free;
FGender := value;
end;
Procedure TFhirPractitioner.SetBirthDate(value : TFhirDateTime);
begin
FBirthDate.free;
FBirthDate := value;
end;
Function TFhirPractitioner.GetBirthDateST : TDateTimeEx;
begin
if FBirthDate = nil then
result := nil
else
result := FBirthDate.value;
end;
Procedure TFhirPractitioner.SetBirthDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FBirthDate = nil then
FBirthDate := TFhirDateTime.create;
FBirthDate.value := value
end
else if FBirthDate <> nil then
FBirthDate.value := nil;
end;
Procedure TFhirPractitioner.SetOrganization(value : TFhirResourceReference{TFhirOrganization});
begin
FOrganization.free;
FOrganization := value;
end;
Procedure TFhirPractitioner.SetPeriod(value : TFhirPeriod);
begin
FPeriod.free;
FPeriod := value;
end;
{ TFhirProcedure }
constructor TFhirProcedure.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FBodySiteList := TFhirCodeableConceptList.Create;
FIndicationList := TFhirCodeableConceptList.Create;
FPerformerList := TFhirProcedurePerformerList.Create;
FReportList := TFhirResourceReferenceList{TFhirDiagnosticReport}.Create;
FComplicationList := TFhirCodeableConceptList.Create;
FRelatedItemList := TFhirProcedureRelatedItemList.Create;
end;
destructor TFhirProcedure.Destroy;
begin
FIdentifierList.Free;
FSubject.free;
FType_.free;
FBodySiteList.Free;
FIndicationList.Free;
FPerformerList.Free;
FDate.free;
FEncounter.free;
FOutcome.free;
FReportList.Free;
FComplicationList.Free;
FFollowUp.free;
FRelatedItemList.Free;
FNotes.free;
inherited;
end;
function TFhirProcedure.GetResourceType : TFhirResourceType;
begin
result := frtProcedure;
end;
function TFhirProcedure.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirProcedure.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirProcedure(oSource).FIdentifierList);
subject := TFhirProcedure(oSource).subject.Clone;
type_ := TFhirProcedure(oSource).type_.Clone;
FBodySiteList.Assign(TFhirProcedure(oSource).FBodySiteList);
FIndicationList.Assign(TFhirProcedure(oSource).FIndicationList);
FPerformerList.Assign(TFhirProcedure(oSource).FPerformerList);
date := TFhirProcedure(oSource).date.Clone;
encounter := TFhirProcedure(oSource).encounter.Clone;
outcomeObject := TFhirProcedure(oSource).outcomeObject.Clone;
FReportList.Assign(TFhirProcedure(oSource).FReportList);
FComplicationList.Assign(TFhirProcedure(oSource).FComplicationList);
followUpObject := TFhirProcedure(oSource).followUpObject.Clone;
FRelatedItemList.Assign(TFhirProcedure(oSource).FRelatedItemList);
notesObject := TFhirProcedure(oSource).notesObject.Clone;
end;
procedure TFhirProcedure.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'bodySite') Then
list.addAll(FBodySiteList);
if (child_name = 'indication') Then
list.addAll(FIndicationList);
if (child_name = 'performer') Then
list.addAll(FPerformerList);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'encounter') Then
list.add(FEncounter.Link);
if (child_name = 'outcome') Then
list.add(FOutcome.Link);
if (child_name = 'report') Then
list.addAll(FReportList);
if (child_name = 'complication') Then
list.addAll(FComplicationList);
if (child_name = 'followUp') Then
list.add(FFollowUp.Link);
if (child_name = 'relatedItem') Then
list.addAll(FRelatedItemList);
if (child_name = 'notes') Then
list.add(FNotes.Link);
end;
procedure TFhirProcedure.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'bodySite', 'CodeableConcept', FBodySiteList.Link)){3};
oList.add(TFHIRProperty.create(self, 'indication', 'CodeableConcept', FIndicationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'performer', '', FPerformerList.Link)){3};
oList.add(TFHIRProperty.create(self, 'date', 'Period', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'encounter', 'Resource(Encounter)', FEncounter.Link));{2}
oList.add(TFHIRProperty.create(self, 'outcome', 'string', FOutcome.Link));{2}
oList.add(TFHIRProperty.create(self, 'report', 'Resource(DiagnosticReport)', FReportList.Link)){3};
oList.add(TFHIRProperty.create(self, 'complication', 'CodeableConcept', FComplicationList.Link)){3};
oList.add(TFHIRProperty.create(self, 'followUp', 'string', FFollowUp.Link));{2}
oList.add(TFHIRProperty.create(self, 'relatedItem', '', FRelatedItemList.Link)){3};
oList.add(TFHIRProperty.create(self, 'notes', 'string', FNotes.Link));{2}
end;
procedure TFhirProcedure.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'bodySite') then BodySiteList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'indication') then IndicationList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'performer') then PerformerList.add(propValue as TFhirProcedurePerformer){2}
else if (propName = 'date') then Date := propValue as TFhirPeriod{4b}
else if (propName = 'encounter') then Encounter := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else if (propName = 'outcome') then OutcomeObject := propValue as TFhirString{5a}
else if (propName = 'report') then ReportList.add(propValue as TFhirResourceReference{TFhirDiagnosticReport}){2}
else if (propName = 'complication') then ComplicationList.add(propValue as TFhirCodeableConcept){2}
else if (propName = 'followUp') then FollowUpObject := propValue as TFhirString{5a}
else if (propName = 'relatedItem') then RelatedItemList.add(propValue as TFhirProcedureRelatedItem){2}
else if (propName = 'notes') then NotesObject := propValue as TFhirString{5a}
else inherited;
end;
function TFhirProcedure.FhirType : string;
begin
result := 'Procedure';
end;
function TFhirProcedure.Link : TFhirProcedure;
begin
result := TFhirProcedure(inherited Link);
end;
function TFhirProcedure.Clone : TFhirProcedure;
begin
result := TFhirProcedure(inherited Clone);
end;
{ TFhirProcedure }
Procedure TFhirProcedure.SetSubject(value : TFhirResourceReference{TFhirPatient});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirProcedure.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirProcedure.SetDate(value : TFhirPeriod);
begin
FDate.free;
FDate := value;
end;
Procedure TFhirProcedure.SetEncounter(value : TFhirResourceReference{TFhirEncounter});
begin
FEncounter.free;
FEncounter := value;
end;
Procedure TFhirProcedure.SetOutcome(value : TFhirString);
begin
FOutcome.free;
FOutcome := value;
end;
Function TFhirProcedure.GetOutcomeST : String;
begin
if FOutcome = nil then
result := ''
else
result := FOutcome.value;
end;
Procedure TFhirProcedure.SetOutcomeST(value : String);
begin
if value <> '' then
begin
if FOutcome = nil then
FOutcome := TFhirString.create;
FOutcome.value := value
end
else if FOutcome <> nil then
FOutcome.value := '';
end;
Procedure TFhirProcedure.SetFollowUp(value : TFhirString);
begin
FFollowUp.free;
FFollowUp := value;
end;
Function TFhirProcedure.GetFollowUpST : String;
begin
if FFollowUp = nil then
result := ''
else
result := FFollowUp.value;
end;
Procedure TFhirProcedure.SetFollowUpST(value : String);
begin
if value <> '' then
begin
if FFollowUp = nil then
FFollowUp := TFhirString.create;
FFollowUp.value := value
end
else if FFollowUp <> nil then
FFollowUp.value := '';
end;
Procedure TFhirProcedure.SetNotes(value : TFhirString);
begin
FNotes.free;
FNotes := value;
end;
Function TFhirProcedure.GetNotesST : String;
begin
if FNotes = nil then
result := ''
else
result := FNotes.value;
end;
Procedure TFhirProcedure.SetNotesST(value : String);
begin
if value <> '' then
begin
if FNotes = nil then
FNotes := TFhirString.create;
FNotes.value := value
end
else if FNotes <> nil then
FNotes.value := '';
end;
{ TFhirProfile }
constructor TFhirProfile.Create;
begin
inherited;
FTelecomList := TFhirContactList.Create;
FCodeList := TFhirCodingList.Create;
FMappingList := TFhirProfileMappingList.Create;
FStructureList := TFhirProfileStructureList.Create;
FExtensionDefnList := TFhirProfileExtensionDefnList.Create;
FQueryList := TFhirProfileQueryList.Create;
end;
destructor TFhirProfile.Destroy;
begin
FIdentifier.free;
FVersion.free;
FName.free;
FPublisher.free;
FTelecomList.Free;
FDescription.free;
FCodeList.Free;
FStatus.free;
FExperimental.free;
FDate.free;
FRequirements.free;
FFhirVersion.free;
FMappingList.Free;
FStructureList.Free;
FExtensionDefnList.Free;
FQueryList.Free;
inherited;
end;
function TFhirProfile.GetResourceType : TFhirResourceType;
begin
result := frtProfile;
end;
function TFhirProfile.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirProfile.Assign(oSource : TAdvObject);
begin
inherited;
identifierObject := TFhirProfile(oSource).identifierObject.Clone;
versionObject := TFhirProfile(oSource).versionObject.Clone;
nameObject := TFhirProfile(oSource).nameObject.Clone;
publisherObject := TFhirProfile(oSource).publisherObject.Clone;
FTelecomList.Assign(TFhirProfile(oSource).FTelecomList);
descriptionObject := TFhirProfile(oSource).descriptionObject.Clone;
FCodeList.Assign(TFhirProfile(oSource).FCodeList);
FStatus := TFhirProfile(oSource).FStatus.Link;
experimentalObject := TFhirProfile(oSource).experimentalObject.Clone;
dateObject := TFhirProfile(oSource).dateObject.Clone;
requirementsObject := TFhirProfile(oSource).requirementsObject.Clone;
fhirVersionObject := TFhirProfile(oSource).fhirVersionObject.Clone;
FMappingList.Assign(TFhirProfile(oSource).FMappingList);
FStructureList.Assign(TFhirProfile(oSource).FStructureList);
FExtensionDefnList.Assign(TFhirProfile(oSource).FExtensionDefnList);
FQueryList.Assign(TFhirProfile(oSource).FQueryList);
end;
procedure TFhirProfile.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'version') Then
list.add(FVersion.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'publisher') Then
list.add(FPublisher.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'code') Then
list.addAll(FCodeList);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'experimental') Then
list.add(FExperimental.Link);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'requirements') Then
list.add(FRequirements.Link);
if (child_name = 'fhirVersion') Then
list.add(FFhirVersion.Link);
if (child_name = 'mapping') Then
list.addAll(FMappingList);
if (child_name = 'structure') Then
list.addAll(FStructureList);
if (child_name = 'extensionDefn') Then
list.addAll(FExtensionDefnList);
if (child_name = 'query') Then
list.addAll(FQueryList);
end;
procedure TFhirProfile.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'string', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'version', 'string', FVersion.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'publisher', 'string', FPublisher.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'code', 'Coding', FCodeList.Link)){3};
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'experimental', 'boolean', FExperimental.Link));{2}
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'requirements', 'string', FRequirements.Link));{2}
oList.add(TFHIRProperty.create(self, 'fhirVersion', 'id', FFhirVersion.Link));{2}
oList.add(TFHIRProperty.create(self, 'mapping', '', FMappingList.Link)){3};
oList.add(TFHIRProperty.create(self, 'structure', '', FStructureList.Link)){3};
oList.add(TFHIRProperty.create(self, 'extensionDefn', '', FExtensionDefnList.Link)){3};
oList.add(TFHIRProperty.create(self, 'query', '', FQueryList.Link)){3};
end;
procedure TFhirProfile.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierObject := propValue as TFhirString{5a}
else if (propName = 'version') then VersionObject := propValue as TFhirString{5a}
else if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'publisher') then PublisherObject := propValue as TFhirString{5a}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'code') then CodeList.add(propValue as TFhirCoding){2}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'experimental') then ExperimentalObject := propValue as TFhirBoolean{5a}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'requirements') then RequirementsObject := propValue as TFhirString{5a}
else if (propName = 'fhirVersion') then FhirVersionObject := propValue as TFhirId{5a}
else if (propName = 'mapping') then MappingList.add(propValue as TFhirProfileMapping){2}
else if (propName = 'structure') then StructureList.add(propValue as TFhirProfileStructure){2}
else if (propName = 'extensionDefn') then ExtensionDefnList.add(propValue as TFhirProfileExtensionDefn){2}
else if (propName = 'query') then QueryList.add(propValue as TFhirProfileQuery){2}
else inherited;
end;
function TFhirProfile.FhirType : string;
begin
result := 'Profile';
end;
function TFhirProfile.Link : TFhirProfile;
begin
result := TFhirProfile(inherited Link);
end;
function TFhirProfile.Clone : TFhirProfile;
begin
result := TFhirProfile(inherited Clone);
end;
{ TFhirProfile }
Procedure TFhirProfile.SetIdentifier(value : TFhirString);
begin
FIdentifier.free;
FIdentifier := value;
end;
Function TFhirProfile.GetIdentifierST : String;
begin
if FIdentifier = nil then
result := ''
else
result := FIdentifier.value;
end;
Procedure TFhirProfile.SetIdentifierST(value : String);
begin
if value <> '' then
begin
if FIdentifier = nil then
FIdentifier := TFhirString.create;
FIdentifier.value := value
end
else if FIdentifier <> nil then
FIdentifier.value := '';
end;
Procedure TFhirProfile.SetVersion(value : TFhirString);
begin
FVersion.free;
FVersion := value;
end;
Function TFhirProfile.GetVersionST : String;
begin
if FVersion = nil then
result := ''
else
result := FVersion.value;
end;
Procedure TFhirProfile.SetVersionST(value : String);
begin
if value <> '' then
begin
if FVersion = nil then
FVersion := TFhirString.create;
FVersion.value := value
end
else if FVersion <> nil then
FVersion.value := '';
end;
Procedure TFhirProfile.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirProfile.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirProfile.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirProfile.SetPublisher(value : TFhirString);
begin
FPublisher.free;
FPublisher := value;
end;
Function TFhirProfile.GetPublisherST : String;
begin
if FPublisher = nil then
result := ''
else
result := FPublisher.value;
end;
Procedure TFhirProfile.SetPublisherST(value : String);
begin
if value <> '' then
begin
if FPublisher = nil then
FPublisher := TFhirString.create;
FPublisher.value := value
end
else if FPublisher <> nil then
FPublisher.value := '';
end;
Procedure TFhirProfile.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirProfile.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirProfile.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirProfile.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirProfile.GetStatusST : TFhirResourceProfileStatus;
begin
if FStatus = nil then
result := TFhirResourceProfileStatus(0)
else
result := TFhirResourceProfileStatus(StringArrayIndexOfSensitive(CODES_TFhirResourceProfileStatus, FStatus.value));
end;
Procedure TFhirProfile.SetStatusST(value : TFhirResourceProfileStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirResourceProfileStatus[value]);
end;
Procedure TFhirProfile.SetExperimental(value : TFhirBoolean);
begin
FExperimental.free;
FExperimental := value;
end;
Function TFhirProfile.GetExperimentalST : Boolean;
begin
if FExperimental = nil then
result := false
else
result := FExperimental.value;
end;
Procedure TFhirProfile.SetExperimentalST(value : Boolean);
begin
if FExperimental = nil then
FExperimental := TFhirBoolean.create;
FExperimental.value := value
end;
Procedure TFhirProfile.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirProfile.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirProfile.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirProfile.SetRequirements(value : TFhirString);
begin
FRequirements.free;
FRequirements := value;
end;
Function TFhirProfile.GetRequirementsST : String;
begin
if FRequirements = nil then
result := ''
else
result := FRequirements.value;
end;
Procedure TFhirProfile.SetRequirementsST(value : String);
begin
if value <> '' then
begin
if FRequirements = nil then
FRequirements := TFhirString.create;
FRequirements.value := value
end
else if FRequirements <> nil then
FRequirements.value := '';
end;
Procedure TFhirProfile.SetFhirVersion(value : TFhirId);
begin
FFhirVersion.free;
FFhirVersion := value;
end;
Function TFhirProfile.GetFhirVersionST : String;
begin
if FFhirVersion = nil then
result := ''
else
result := FFhirVersion.value;
end;
Procedure TFhirProfile.SetFhirVersionST(value : String);
begin
if value <> '' then
begin
if FFhirVersion = nil then
FFhirVersion := TFhirId.create;
FFhirVersion.value := value
end
else if FFhirVersion <> nil then
FFhirVersion.value := '';
end;
{ TFhirProvenance }
constructor TFhirProvenance.Create;
begin
inherited;
FTargetList := TFhirResourceReferenceList{Resource}.Create;
FPolicyList := TFhirUriList.Create;
FAgentList := TFhirProvenanceAgentList.Create;
FEntityList := TFhirProvenanceEntityList.Create;
end;
destructor TFhirProvenance.Destroy;
begin
FTargetList.Free;
FPeriod.free;
FRecorded.free;
FReason.free;
FLocation.free;
FPolicyList.Free;
FAgentList.Free;
FEntityList.Free;
FIntegritySignature.free;
inherited;
end;
function TFhirProvenance.GetResourceType : TFhirResourceType;
begin
result := frtProvenance;
end;
function TFhirProvenance.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirProvenance.Assign(oSource : TAdvObject);
begin
inherited;
FTargetList.Assign(TFhirProvenance(oSource).FTargetList);
period := TFhirProvenance(oSource).period.Clone;
recordedObject := TFhirProvenance(oSource).recordedObject.Clone;
reason := TFhirProvenance(oSource).reason.Clone;
location := TFhirProvenance(oSource).location.Clone;
FPolicyList.Assign(TFhirProvenance(oSource).FPolicyList);
FAgentList.Assign(TFhirProvenance(oSource).FAgentList);
FEntityList.Assign(TFhirProvenance(oSource).FEntityList);
integritySignatureObject := TFhirProvenance(oSource).integritySignatureObject.Clone;
end;
procedure TFhirProvenance.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'target') Then
list.addAll(FTargetList);
if (child_name = 'period') Then
list.add(FPeriod.Link);
if (child_name = 'recorded') Then
list.add(FRecorded.Link);
if (child_name = 'reason') Then
list.add(FReason.Link);
if (child_name = 'location') Then
list.add(FLocation.Link);
if (child_name = 'policy') Then
list.addAll(FPolicyList);
if (child_name = 'agent') Then
list.addAll(FAgentList);
if (child_name = 'entity') Then
list.addAll(FEntityList);
if (child_name = 'integritySignature') Then
list.add(FIntegritySignature.Link);
end;
procedure TFhirProvenance.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'target', 'Resource(Any)', FTargetList.Link)){3};
oList.add(TFHIRProperty.create(self, 'period', 'Period', FPeriod.Link));{2}
oList.add(TFHIRProperty.create(self, 'recorded', 'instant', FRecorded.Link));{2}
oList.add(TFHIRProperty.create(self, 'reason', 'CodeableConcept', FReason.Link));{2}
oList.add(TFHIRProperty.create(self, 'location', 'Resource(Location)', FLocation.Link));{2}
oList.add(TFHIRProperty.create(self, 'policy', 'uri', FPolicyList.Link)){3};
oList.add(TFHIRProperty.create(self, 'agent', '', FAgentList.Link)){3};
oList.add(TFHIRProperty.create(self, 'entity', '', FEntityList.Link)){3};
oList.add(TFHIRProperty.create(self, 'integritySignature', 'string', FIntegritySignature.Link));{2}
end;
procedure TFhirProvenance.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'target') then TargetList.add(propValue as TFhirResourceReference{Resource}){2}
else if (propName = 'period') then Period := propValue as TFhirPeriod{4b}
else if (propName = 'recorded') then RecordedObject := propValue as TFhirInstant{5a}
else if (propName = 'reason') then Reason := propValue as TFhirCodeableConcept{4b}
else if (propName = 'location') then Location := propValue as TFhirResourceReference{TFhirLocation}{4b}
else if (propName = 'policy') then PolicyList.add(propValue as TFhirUri){2}
else if (propName = 'agent') then AgentList.add(propValue as TFhirProvenanceAgent){2}
else if (propName = 'entity') then EntityList.add(propValue as TFhirProvenanceEntity){2}
else if (propName = 'integritySignature') then IntegritySignatureObject := propValue as TFhirString{5a}
else inherited;
end;
function TFhirProvenance.FhirType : string;
begin
result := 'Provenance';
end;
function TFhirProvenance.Link : TFhirProvenance;
begin
result := TFhirProvenance(inherited Link);
end;
function TFhirProvenance.Clone : TFhirProvenance;
begin
result := TFhirProvenance(inherited Clone);
end;
{ TFhirProvenance }
Procedure TFhirProvenance.SetPeriod(value : TFhirPeriod);
begin
FPeriod.free;
FPeriod := value;
end;
Procedure TFhirProvenance.SetRecorded(value : TFhirInstant);
begin
FRecorded.free;
FRecorded := value;
end;
Function TFhirProvenance.GetRecordedST : TDateTimeEx;
begin
if FRecorded = nil then
result := nil
else
result := FRecorded.value;
end;
Procedure TFhirProvenance.SetRecordedST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FRecorded = nil then
FRecorded := TFhirInstant.create;
FRecorded.value := value
end
else if FRecorded <> nil then
FRecorded.value := nil;
end;
Procedure TFhirProvenance.SetReason(value : TFhirCodeableConcept);
begin
FReason.free;
FReason := value;
end;
Procedure TFhirProvenance.SetLocation(value : TFhirResourceReference{TFhirLocation});
begin
FLocation.free;
FLocation := value;
end;
Procedure TFhirProvenance.SetIntegritySignature(value : TFhirString);
begin
FIntegritySignature.free;
FIntegritySignature := value;
end;
Function TFhirProvenance.GetIntegritySignatureST : String;
begin
if FIntegritySignature = nil then
result := ''
else
result := FIntegritySignature.value;
end;
Procedure TFhirProvenance.SetIntegritySignatureST(value : String);
begin
if value <> '' then
begin
if FIntegritySignature = nil then
FIntegritySignature := TFhirString.create;
FIntegritySignature.value := value
end
else if FIntegritySignature <> nil then
FIntegritySignature.value := '';
end;
{ TFhirQuery }
constructor TFhirQuery.Create;
begin
inherited;
FParameterList := TFhirExtensionList.Create;
end;
destructor TFhirQuery.Destroy;
begin
FIdentifier.free;
FParameterList.Free;
FResponse.free;
inherited;
end;
function TFhirQuery.GetResourceType : TFhirResourceType;
begin
result := frtQuery;
end;
function TFhirQuery.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirQuery.Assign(oSource : TAdvObject);
begin
inherited;
identifierObject := TFhirQuery(oSource).identifierObject.Clone;
FParameterList.Assign(TFhirQuery(oSource).FParameterList);
response := TFhirQuery(oSource).response.Clone;
end;
procedure TFhirQuery.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'parameter') Then
list.addAll(FParameterList);
if (child_name = 'response') Then
list.add(FResponse.Link);
end;
procedure TFhirQuery.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'uri', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'parameter', 'Extension', FParameterList.Link)){3};
oList.add(TFHIRProperty.create(self, 'response', '', FResponse.Link));{2}
end;
procedure TFhirQuery.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierObject := propValue as TFhirUri{5a}
else if (propName = 'parameter') then ParameterList.add(propValue as TFhirExtension){2}
else if (propName = 'response') then Response := propValue as TFhirQueryResponse{4b}
else inherited;
end;
function TFhirQuery.FhirType : string;
begin
result := 'Query';
end;
function TFhirQuery.Link : TFhirQuery;
begin
result := TFhirQuery(inherited Link);
end;
function TFhirQuery.Clone : TFhirQuery;
begin
result := TFhirQuery(inherited Clone);
end;
{ TFhirQuery }
Procedure TFhirQuery.SetIdentifier(value : TFhirUri);
begin
FIdentifier.free;
FIdentifier := value;
end;
Function TFhirQuery.GetIdentifierST : String;
begin
if FIdentifier = nil then
result := ''
else
result := FIdentifier.value;
end;
Procedure TFhirQuery.SetIdentifierST(value : String);
begin
if value <> '' then
begin
if FIdentifier = nil then
FIdentifier := TFhirUri.create;
FIdentifier.value := value
end
else if FIdentifier <> nil then
FIdentifier.value := '';
end;
Procedure TFhirQuery.SetResponse(value : TFhirQueryResponse);
begin
FResponse.free;
FResponse := value;
end;
{ TFhirQuestionnaire }
constructor TFhirQuestionnaire.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
end;
destructor TFhirQuestionnaire.Destroy;
begin
FStatus.free;
FAuthored.free;
FSubject.free;
FAuthor.free;
FSource.free;
FName.free;
FIdentifierList.Free;
FEncounter.free;
FGroup.free;
inherited;
end;
function TFhirQuestionnaire.GetResourceType : TFhirResourceType;
begin
result := frtQuestionnaire;
end;
function TFhirQuestionnaire.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirQuestionnaire.Assign(oSource : TAdvObject);
begin
inherited;
FStatus := TFhirQuestionnaire(oSource).FStatus.Link;
authoredObject := TFhirQuestionnaire(oSource).authoredObject.Clone;
subject := TFhirQuestionnaire(oSource).subject.Clone;
author := TFhirQuestionnaire(oSource).author.Clone;
source := TFhirQuestionnaire(oSource).source.Clone;
name := TFhirQuestionnaire(oSource).name.Clone;
FIdentifierList.Assign(TFhirQuestionnaire(oSource).FIdentifierList);
encounter := TFhirQuestionnaire(oSource).encounter.Clone;
group := TFhirQuestionnaire(oSource).group.Clone;
end;
procedure TFhirQuestionnaire.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'authored') Then
list.add(FAuthored.Link);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'author') Then
list.add(FAuthor.Link);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'encounter') Then
list.add(FEncounter.Link);
if (child_name = 'group') Then
list.add(FGroup.Link);
end;
procedure TFhirQuestionnaire.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'authored', 'dateTime', FAuthored.Link));{2}
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|RelatedPerson)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'author', 'Resource(Practitioner|Patient|RelatedPerson)', FAuthor.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', 'Resource(Patient|Practitioner|RelatedPerson)', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'CodeableConcept', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'encounter', 'Resource(Encounter)', FEncounter.Link));{2}
oList.add(TFHIRProperty.create(self, 'group', '', FGroup.Link));{2}
end;
procedure TFhirQuestionnaire.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'authored') then AuthoredObject := propValue as TFhirDateTime{5a}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'author') then Author := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'source') then Source := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'name') then Name := propValue as TFhirCodeableConcept{4b}
else if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'encounter') then Encounter := propValue as TFhirResourceReference{TFhirEncounter}{4b}
else if (propName = 'group') then Group := propValue as TFhirQuestionnaireGroup{4b}
else inherited;
end;
function TFhirQuestionnaire.FhirType : string;
begin
result := 'Questionnaire';
end;
function TFhirQuestionnaire.Link : TFhirQuestionnaire;
begin
result := TFhirQuestionnaire(inherited Link);
end;
function TFhirQuestionnaire.Clone : TFhirQuestionnaire;
begin
result := TFhirQuestionnaire(inherited Clone);
end;
{ TFhirQuestionnaire }
Procedure TFhirQuestionnaire.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirQuestionnaire.GetStatusST : TFhirQuestionnaireStatus;
begin
if FStatus = nil then
result := TFhirQuestionnaireStatus(0)
else
result := TFhirQuestionnaireStatus(StringArrayIndexOfSensitive(CODES_TFhirQuestionnaireStatus, FStatus.value));
end;
Procedure TFhirQuestionnaire.SetStatusST(value : TFhirQuestionnaireStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirQuestionnaireStatus[value]);
end;
Procedure TFhirQuestionnaire.SetAuthored(value : TFhirDateTime);
begin
FAuthored.free;
FAuthored := value;
end;
Function TFhirQuestionnaire.GetAuthoredST : TDateTimeEx;
begin
if FAuthored = nil then
result := nil
else
result := FAuthored.value;
end;
Procedure TFhirQuestionnaire.SetAuthoredST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FAuthored = nil then
FAuthored := TFhirDateTime.create;
FAuthored.value := value
end
else if FAuthored <> nil then
FAuthored.value := nil;
end;
Procedure TFhirQuestionnaire.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirQuestionnaire.SetAuthor(value : TFhirResourceReference{Resource});
begin
FAuthor.free;
FAuthor := value;
end;
Procedure TFhirQuestionnaire.SetSource(value : TFhirResourceReference{Resource});
begin
FSource.free;
FSource := value;
end;
Procedure TFhirQuestionnaire.SetName(value : TFhirCodeableConcept);
begin
FName.free;
FName := value;
end;
Procedure TFhirQuestionnaire.SetEncounter(value : TFhirResourceReference{TFhirEncounter});
begin
FEncounter.free;
FEncounter := value;
end;
Procedure TFhirQuestionnaire.SetGroup(value : TFhirQuestionnaireGroup);
begin
FGroup.free;
FGroup := value;
end;
{ TFhirRelatedPerson }
constructor TFhirRelatedPerson.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FTelecomList := TFhirContactList.Create;
FPhotoList := TFhirAttachmentList.Create;
end;
destructor TFhirRelatedPerson.Destroy;
begin
FIdentifierList.Free;
FPatient.free;
FRelationship.free;
FName.free;
FTelecomList.Free;
FGender.free;
FAddress.free;
FPhotoList.Free;
inherited;
end;
function TFhirRelatedPerson.GetResourceType : TFhirResourceType;
begin
result := frtRelatedPerson;
end;
function TFhirRelatedPerson.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirRelatedPerson.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirRelatedPerson(oSource).FIdentifierList);
patient := TFhirRelatedPerson(oSource).patient.Clone;
relationship := TFhirRelatedPerson(oSource).relationship.Clone;
name := TFhirRelatedPerson(oSource).name.Clone;
FTelecomList.Assign(TFhirRelatedPerson(oSource).FTelecomList);
gender := TFhirRelatedPerson(oSource).gender.Clone;
address := TFhirRelatedPerson(oSource).address.Clone;
FPhotoList.Assign(TFhirRelatedPerson(oSource).FPhotoList);
end;
procedure TFhirRelatedPerson.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'relationship') Then
list.add(FRelationship.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'gender') Then
list.add(FGender.Link);
if (child_name = 'address') Then
list.add(FAddress.Link);
if (child_name = 'photo') Then
list.addAll(FPhotoList);
end;
procedure TFhirRelatedPerson.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'relationship', 'CodeableConcept', FRelationship.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'HumanName', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'gender', 'CodeableConcept', FGender.Link));{2}
oList.add(TFHIRProperty.create(self, 'address', 'Address', FAddress.Link));{2}
oList.add(TFHIRProperty.create(self, 'photo', 'Attachment', FPhotoList.Link)){3};
end;
procedure TFhirRelatedPerson.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'relationship') then Relationship := propValue as TFhirCodeableConcept{4b}
else if (propName = 'name') then Name := propValue as TFhirHumanName{4b}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'gender') then Gender := propValue as TFhirCodeableConcept{4b}
else if (propName = 'address') then Address := propValue as TFhirAddress{4b}
else if (propName = 'photo') then PhotoList.add(propValue as TFhirAttachment){2}
else inherited;
end;
function TFhirRelatedPerson.FhirType : string;
begin
result := 'RelatedPerson';
end;
function TFhirRelatedPerson.Link : TFhirRelatedPerson;
begin
result := TFhirRelatedPerson(inherited Link);
end;
function TFhirRelatedPerson.Clone : TFhirRelatedPerson;
begin
result := TFhirRelatedPerson(inherited Clone);
end;
{ TFhirRelatedPerson }
Procedure TFhirRelatedPerson.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
Procedure TFhirRelatedPerson.SetRelationship(value : TFhirCodeableConcept);
begin
FRelationship.free;
FRelationship := value;
end;
Procedure TFhirRelatedPerson.SetName(value : TFhirHumanName);
begin
FName.free;
FName := value;
end;
Procedure TFhirRelatedPerson.SetGender(value : TFhirCodeableConcept);
begin
FGender.free;
FGender := value;
end;
Procedure TFhirRelatedPerson.SetAddress(value : TFhirAddress);
begin
FAddress.free;
FAddress := value;
end;
{ TFhirSecurityEvent }
constructor TFhirSecurityEvent.Create;
begin
inherited;
FParticipantList := TFhirSecurityEventParticipantList.Create;
FObject_List := TFhirSecurityEventObjectList.Create;
end;
destructor TFhirSecurityEvent.Destroy;
begin
FEvent.free;
FParticipantList.Free;
FSource.free;
FObject_List.Free;
inherited;
end;
function TFhirSecurityEvent.GetResourceType : TFhirResourceType;
begin
result := frtSecurityEvent;
end;
function TFhirSecurityEvent.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirSecurityEvent.Assign(oSource : TAdvObject);
begin
inherited;
event := TFhirSecurityEvent(oSource).event.Clone;
FParticipantList.Assign(TFhirSecurityEvent(oSource).FParticipantList);
source := TFhirSecurityEvent(oSource).source.Clone;
FObject_List.Assign(TFhirSecurityEvent(oSource).FObject_List);
end;
procedure TFhirSecurityEvent.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'event') Then
list.add(FEvent.Link);
if (child_name = 'participant') Then
list.addAll(FParticipantList);
if (child_name = 'source') Then
list.add(FSource.Link);
if (child_name = 'object') Then
list.addAll(FObject_List);
end;
procedure TFhirSecurityEvent.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'event', '', FEvent.Link));{2}
oList.add(TFHIRProperty.create(self, 'participant', '', FParticipantList.Link)){3};
oList.add(TFHIRProperty.create(self, 'source', '', FSource.Link));{2}
oList.add(TFHIRProperty.create(self, 'object', '', FObject_List.Link)){3};
end;
procedure TFhirSecurityEvent.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'event') then Event := propValue as TFhirSecurityEventEvent{4b}
else if (propName = 'participant') then ParticipantList.add(propValue as TFhirSecurityEventParticipant){2}
else if (propName = 'source') then Source := propValue as TFhirSecurityEventSource{4b}
else if (propName = 'object') then Object_List.add(propValue as TFhirSecurityEventObject){2}
else inherited;
end;
function TFhirSecurityEvent.FhirType : string;
begin
result := 'SecurityEvent';
end;
function TFhirSecurityEvent.Link : TFhirSecurityEvent;
begin
result := TFhirSecurityEvent(inherited Link);
end;
function TFhirSecurityEvent.Clone : TFhirSecurityEvent;
begin
result := TFhirSecurityEvent(inherited Clone);
end;
{ TFhirSecurityEvent }
Procedure TFhirSecurityEvent.SetEvent(value : TFhirSecurityEventEvent);
begin
FEvent.free;
FEvent := value;
end;
Procedure TFhirSecurityEvent.SetSource(value : TFhirSecurityEventSource);
begin
FSource.free;
FSource := value;
end;
{ TFhirSpecimen }
constructor TFhirSpecimen.Create;
begin
inherited;
FIdentifierList := TFhirIdentifierList.Create;
FSourceList := TFhirSpecimenSourceList.Create;
FTreatmentList := TFhirSpecimenTreatmentList.Create;
FContainerList := TFhirSpecimenContainerList.Create;
end;
destructor TFhirSpecimen.Destroy;
begin
FIdentifierList.Free;
FType_.free;
FSourceList.Free;
FSubject.free;
FAccessionIdentifier.free;
FReceivedTime.free;
FCollection.free;
FTreatmentList.Free;
FContainerList.Free;
inherited;
end;
function TFhirSpecimen.GetResourceType : TFhirResourceType;
begin
result := frtSpecimen;
end;
function TFhirSpecimen.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirSpecimen.Assign(oSource : TAdvObject);
begin
inherited;
FIdentifierList.Assign(TFhirSpecimen(oSource).FIdentifierList);
type_ := TFhirSpecimen(oSource).type_.Clone;
FSourceList.Assign(TFhirSpecimen(oSource).FSourceList);
subject := TFhirSpecimen(oSource).subject.Clone;
accessionIdentifier := TFhirSpecimen(oSource).accessionIdentifier.Clone;
receivedTimeObject := TFhirSpecimen(oSource).receivedTimeObject.Clone;
collection := TFhirSpecimen(oSource).collection.Clone;
FTreatmentList.Assign(TFhirSpecimen(oSource).FTreatmentList);
FContainerList.Assign(TFhirSpecimen(oSource).FContainerList);
end;
procedure TFhirSpecimen.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.addAll(FIdentifierList);
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'source') Then
list.addAll(FSourceList);
if (child_name = 'subject') Then
list.add(FSubject.Link);
if (child_name = 'accessionIdentifier') Then
list.add(FAccessionIdentifier.Link);
if (child_name = 'receivedTime') Then
list.add(FReceivedTime.Link);
if (child_name = 'collection') Then
list.add(FCollection.Link);
if (child_name = 'treatment') Then
list.addAll(FTreatmentList);
if (child_name = 'container') Then
list.addAll(FContainerList);
end;
procedure TFhirSpecimen.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifierList.Link)){3};
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'source', '', FSourceList.Link)){3};
oList.add(TFHIRProperty.create(self, 'subject', 'Resource(Patient|Group|Device|Substance)', FSubject.Link));{2}
oList.add(TFHIRProperty.create(self, 'accessionIdentifier', 'Identifier', FAccessionIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'receivedTime', 'dateTime', FReceivedTime.Link));{2}
oList.add(TFHIRProperty.create(self, 'collection', '', FCollection.Link));{2}
oList.add(TFHIRProperty.create(self, 'treatment', '', FTreatmentList.Link)){3};
oList.add(TFHIRProperty.create(self, 'container', '', FContainerList.Link)){3};
end;
procedure TFhirSpecimen.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierList.add(propValue as TFhirIdentifier){2}
else if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'source') then SourceList.add(propValue as TFhirSpecimenSource){2}
else if (propName = 'subject') then Subject := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'accessionIdentifier') then AccessionIdentifier := propValue as TFhirIdentifier{4b}
else if (propName = 'receivedTime') then ReceivedTimeObject := propValue as TFhirDateTime{5a}
else if (propName = 'collection') then Collection := propValue as TFhirSpecimenCollection{4b}
else if (propName = 'treatment') then TreatmentList.add(propValue as TFhirSpecimenTreatment){2}
else if (propName = 'container') then ContainerList.add(propValue as TFhirSpecimenContainer){2}
else inherited;
end;
function TFhirSpecimen.FhirType : string;
begin
result := 'Specimen';
end;
function TFhirSpecimen.Link : TFhirSpecimen;
begin
result := TFhirSpecimen(inherited Link);
end;
function TFhirSpecimen.Clone : TFhirSpecimen;
begin
result := TFhirSpecimen(inherited Clone);
end;
{ TFhirSpecimen }
Procedure TFhirSpecimen.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirSpecimen.SetSubject(value : TFhirResourceReference{Resource});
begin
FSubject.free;
FSubject := value;
end;
Procedure TFhirSpecimen.SetAccessionIdentifier(value : TFhirIdentifier);
begin
FAccessionIdentifier.free;
FAccessionIdentifier := value;
end;
Procedure TFhirSpecimen.SetReceivedTime(value : TFhirDateTime);
begin
FReceivedTime.free;
FReceivedTime := value;
end;
Function TFhirSpecimen.GetReceivedTimeST : TDateTimeEx;
begin
if FReceivedTime = nil then
result := nil
else
result := FReceivedTime.value;
end;
Procedure TFhirSpecimen.SetReceivedTimeST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FReceivedTime = nil then
FReceivedTime := TFhirDateTime.create;
FReceivedTime.value := value
end
else if FReceivedTime <> nil then
FReceivedTime.value := nil;
end;
Procedure TFhirSpecimen.SetCollection(value : TFhirSpecimenCollection);
begin
FCollection.free;
FCollection := value;
end;
{ TFhirSubstance }
constructor TFhirSubstance.Create;
begin
inherited;
FIngredientList := TFhirSubstanceIngredientList.Create;
end;
destructor TFhirSubstance.Destroy;
begin
FType_.free;
FDescription.free;
FInstance.free;
FIngredientList.Free;
inherited;
end;
function TFhirSubstance.GetResourceType : TFhirResourceType;
begin
result := frtSubstance;
end;
function TFhirSubstance.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirSubstance.Assign(oSource : TAdvObject);
begin
inherited;
type_ := TFhirSubstance(oSource).type_.Clone;
descriptionObject := TFhirSubstance(oSource).descriptionObject.Clone;
instance := TFhirSubstance(oSource).instance.Clone;
FIngredientList.Assign(TFhirSubstance(oSource).FIngredientList);
end;
procedure TFhirSubstance.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'type') Then
list.add(FType_.Link);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'instance') Then
list.add(FInstance.Link);
if (child_name = 'ingredient') Then
list.addAll(FIngredientList);
end;
procedure TFhirSubstance.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'type', 'CodeableConcept', FType_.Link));{2}
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'instance', '', FInstance.Link));{2}
oList.add(TFHIRProperty.create(self, 'ingredient', '', FIngredientList.Link)){3};
end;
procedure TFhirSubstance.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'type') then Type_ := propValue as TFhirCodeableConcept{4b}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'instance') then Instance := propValue as TFhirSubstanceInstance{4b}
else if (propName = 'ingredient') then IngredientList.add(propValue as TFhirSubstanceIngredient){2}
else inherited;
end;
function TFhirSubstance.FhirType : string;
begin
result := 'Substance';
end;
function TFhirSubstance.Link : TFhirSubstance;
begin
result := TFhirSubstance(inherited Link);
end;
function TFhirSubstance.Clone : TFhirSubstance;
begin
result := TFhirSubstance(inherited Clone);
end;
{ TFhirSubstance }
Procedure TFhirSubstance.SetType_(value : TFhirCodeableConcept);
begin
FType_.free;
FType_ := value;
end;
Procedure TFhirSubstance.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirSubstance.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirSubstance.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirSubstance.SetInstance(value : TFhirSubstanceInstance);
begin
FInstance.free;
FInstance := value;
end;
{ TFhirSupply }
constructor TFhirSupply.Create;
begin
inherited;
FDispenseList := TFhirSupplyDispenseList.Create;
end;
destructor TFhirSupply.Destroy;
begin
FKind.free;
FIdentifier.free;
FStatus.free;
FOrderedItem.free;
FPatient.free;
FDispenseList.Free;
inherited;
end;
function TFhirSupply.GetResourceType : TFhirResourceType;
begin
result := frtSupply;
end;
function TFhirSupply.GetHasASummary : Boolean;
begin
result := false;
end;
procedure TFhirSupply.Assign(oSource : TAdvObject);
begin
inherited;
kind := TFhirSupply(oSource).kind.Clone;
identifier := TFhirSupply(oSource).identifier.Clone;
FStatus := TFhirSupply(oSource).FStatus.Link;
orderedItem := TFhirSupply(oSource).orderedItem.Clone;
patient := TFhirSupply(oSource).patient.Clone;
FDispenseList.Assign(TFhirSupply(oSource).FDispenseList);
end;
procedure TFhirSupply.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'kind') Then
list.add(FKind.Link);
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'orderedItem') Then
list.add(FOrderedItem.Link);
if (child_name = 'patient') Then
list.add(FPatient.Link);
if (child_name = 'dispense') Then
list.addAll(FDispenseList);
end;
procedure TFhirSupply.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'kind', 'CodeableConcept', FKind.Link));{2}
oList.add(TFHIRProperty.create(self, 'identifier', 'Identifier', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'orderedItem', 'Resource(Medication|Substance|Device)', FOrderedItem.Link));{2}
oList.add(TFHIRProperty.create(self, 'patient', 'Resource(Patient)', FPatient.Link));{2}
oList.add(TFHIRProperty.create(self, 'dispense', '', FDispenseList.Link)){3};
end;
procedure TFhirSupply.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'kind') then Kind := propValue as TFhirCodeableConcept{4b}
else if (propName = 'identifier') then Identifier := propValue as TFhirIdentifier{4b}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'orderedItem') then OrderedItem := propValue as TFhirResourceReference{Resource}{4b}
else if (propName = 'patient') then Patient := propValue as TFhirResourceReference{TFhirPatient}{4b}
else if (propName = 'dispense') then DispenseList.add(propValue as TFhirSupplyDispense){2}
else inherited;
end;
function TFhirSupply.FhirType : string;
begin
result := 'Supply';
end;
function TFhirSupply.Link : TFhirSupply;
begin
result := TFhirSupply(inherited Link);
end;
function TFhirSupply.Clone : TFhirSupply;
begin
result := TFhirSupply(inherited Clone);
end;
{ TFhirSupply }
Procedure TFhirSupply.SetKind(value : TFhirCodeableConcept);
begin
FKind.free;
FKind := value;
end;
Procedure TFhirSupply.SetIdentifier(value : TFhirIdentifier);
begin
FIdentifier.free;
FIdentifier := value;
end;
Procedure TFhirSupply.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirSupply.GetStatusST : TFhirValuesetSupplyStatus;
begin
if FStatus = nil then
result := TFhirValuesetSupplyStatus(0)
else
result := TFhirValuesetSupplyStatus(StringArrayIndexOfSensitive(CODES_TFhirValuesetSupplyStatus, FStatus.value));
end;
Procedure TFhirSupply.SetStatusST(value : TFhirValuesetSupplyStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirValuesetSupplyStatus[value]);
end;
Procedure TFhirSupply.SetOrderedItem(value : TFhirResourceReference{Resource});
begin
FOrderedItem.free;
FOrderedItem := value;
end;
Procedure TFhirSupply.SetPatient(value : TFhirResourceReference{TFhirPatient});
begin
FPatient.free;
FPatient := value;
end;
{ TFhirValueSet }
constructor TFhirValueSet.Create;
begin
inherited;
FTelecomList := TFhirContactList.Create;
end;
destructor TFhirValueSet.Destroy;
begin
FIdentifier.free;
FVersion.free;
FName.free;
FPublisher.free;
FTelecomList.Free;
FDescription.free;
FCopyright.free;
FStatus.free;
FExperimental.free;
FExtensible.free;
FDate.free;
FDefine.free;
FCompose.free;
FExpansion.free;
inherited;
end;
function TFhirValueSet.GetResourceType : TFhirResourceType;
begin
result := frtValueSet;
end;
function TFhirValueSet.GetHasASummary : Boolean;
begin
result := true;
end;
procedure TFhirValueSet.Assign(oSource : TAdvObject);
begin
inherited;
identifierObject := TFhirValueSet(oSource).identifierObject.Clone;
versionObject := TFhirValueSet(oSource).versionObject.Clone;
nameObject := TFhirValueSet(oSource).nameObject.Clone;
publisherObject := TFhirValueSet(oSource).publisherObject.Clone;
FTelecomList.Assign(TFhirValueSet(oSource).FTelecomList);
descriptionObject := TFhirValueSet(oSource).descriptionObject.Clone;
copyrightObject := TFhirValueSet(oSource).copyrightObject.Clone;
FStatus := TFhirValueSet(oSource).FStatus.Link;
experimentalObject := TFhirValueSet(oSource).experimentalObject.Clone;
extensibleObject := TFhirValueSet(oSource).extensibleObject.Clone;
dateObject := TFhirValueSet(oSource).dateObject.Clone;
define := TFhirValueSet(oSource).define.Clone;
compose := TFhirValueSet(oSource).compose.Clone;
expansion := TFhirValueSet(oSource).expansion.Clone;
end;
procedure TFhirValueSet.GetChildrenByName(child_name : string; list : TFHIRObjectList);
begin
inherited;
if (child_name = 'identifier') Then
list.add(FIdentifier.Link);
if (child_name = 'version') Then
list.add(FVersion.Link);
if (child_name = 'name') Then
list.add(FName.Link);
if (child_name = 'publisher') Then
list.add(FPublisher.Link);
if (child_name = 'telecom') Then
list.addAll(FTelecomList);
if (child_name = 'description') Then
list.add(FDescription.Link);
if (child_name = 'copyright') Then
list.add(FCopyright.Link);
if (child_name = 'status') Then
list.add(FStatus.Link);
if (child_name = 'experimental') Then
list.add(FExperimental.Link);
if (child_name = 'extensible') Then
list.add(FExtensible.Link);
if (child_name = 'date') Then
list.add(FDate.Link);
if (child_name = 'define') Then
list.add(FDefine.Link);
if (child_name = 'compose') Then
list.add(FCompose.Link);
if (child_name = 'expansion') Then
list.add(FExpansion.Link);
end;
procedure TFhirValueSet.ListProperties(oList: TFHIRPropertyList; bInheritedProperties: Boolean);
begin
inherited;
oList.add(TFHIRProperty.create(self, 'identifier', 'string', FIdentifier.Link));{2}
oList.add(TFHIRProperty.create(self, 'version', 'string', FVersion.Link));{2}
oList.add(TFHIRProperty.create(self, 'name', 'string', FName.Link));{2}
oList.add(TFHIRProperty.create(self, 'publisher', 'string', FPublisher.Link));{2}
oList.add(TFHIRProperty.create(self, 'telecom', 'Contact', FTelecomList.Link)){3};
oList.add(TFHIRProperty.create(self, 'description', 'string', FDescription.Link));{2}
oList.add(TFHIRProperty.create(self, 'copyright', 'string', FCopyright.Link));{2}
oList.add(TFHIRProperty.create(self, 'status', 'code', FStatus.Link));{1}
oList.add(TFHIRProperty.create(self, 'experimental', 'boolean', FExperimental.Link));{2}
oList.add(TFHIRProperty.create(self, 'extensible', 'boolean', FExtensible.Link));{2}
oList.add(TFHIRProperty.create(self, 'date', 'dateTime', FDate.Link));{2}
oList.add(TFHIRProperty.create(self, 'define', '', FDefine.Link));{2}
oList.add(TFHIRProperty.create(self, 'compose', '', FCompose.Link));{2}
oList.add(TFHIRProperty.create(self, 'expansion', '', FExpansion.Link));{2}
end;
procedure TFhirValueSet.setProperty(propName : string; propValue: TFHIRObject);
begin
if (propName = 'identifier') then IdentifierObject := propValue as TFhirString{5a}
else if (propName = 'version') then VersionObject := propValue as TFhirString{5a}
else if (propName = 'name') then NameObject := propValue as TFhirString{5a}
else if (propName = 'publisher') then PublisherObject := propValue as TFhirString{5a}
else if (propName = 'telecom') then TelecomList.add(propValue as TFhirContact){2}
else if (propName = 'description') then DescriptionObject := propValue as TFhirString{5a}
else if (propName = 'copyright') then CopyrightObject := propValue as TFhirString{5a}
else if (propName = 'status') then StatusObject := propValue as TFHIREnum
else if (propName = 'experimental') then ExperimentalObject := propValue as TFhirBoolean{5a}
else if (propName = 'extensible') then ExtensibleObject := propValue as TFhirBoolean{5a}
else if (propName = 'date') then DateObject := propValue as TFhirDateTime{5a}
else if (propName = 'define') then Define := propValue as TFhirValueSetDefine{4b}
else if (propName = 'compose') then Compose := propValue as TFhirValueSetCompose{4b}
else if (propName = 'expansion') then Expansion := propValue as TFhirValueSetExpansion{4b}
else inherited;
end;
function TFhirValueSet.FhirType : string;
begin
result := 'ValueSet';
end;
function TFhirValueSet.Link : TFhirValueSet;
begin
result := TFhirValueSet(inherited Link);
end;
function TFhirValueSet.Clone : TFhirValueSet;
begin
result := TFhirValueSet(inherited Clone);
end;
{ TFhirValueSet }
Procedure TFhirValueSet.SetIdentifier(value : TFhirString);
begin
FIdentifier.free;
FIdentifier := value;
end;
Function TFhirValueSet.GetIdentifierST : String;
begin
if FIdentifier = nil then
result := ''
else
result := FIdentifier.value;
end;
Procedure TFhirValueSet.SetIdentifierST(value : String);
begin
if value <> '' then
begin
if FIdentifier = nil then
FIdentifier := TFhirString.create;
FIdentifier.value := value
end
else if FIdentifier <> nil then
FIdentifier.value := '';
end;
Procedure TFhirValueSet.SetVersion(value : TFhirString);
begin
FVersion.free;
FVersion := value;
end;
Function TFhirValueSet.GetVersionST : String;
begin
if FVersion = nil then
result := ''
else
result := FVersion.value;
end;
Procedure TFhirValueSet.SetVersionST(value : String);
begin
if value <> '' then
begin
if FVersion = nil then
FVersion := TFhirString.create;
FVersion.value := value
end
else if FVersion <> nil then
FVersion.value := '';
end;
Procedure TFhirValueSet.SetName(value : TFhirString);
begin
FName.free;
FName := value;
end;
Function TFhirValueSet.GetNameST : String;
begin
if FName = nil then
result := ''
else
result := FName.value;
end;
Procedure TFhirValueSet.SetNameST(value : String);
begin
if value <> '' then
begin
if FName = nil then
FName := TFhirString.create;
FName.value := value
end
else if FName <> nil then
FName.value := '';
end;
Procedure TFhirValueSet.SetPublisher(value : TFhirString);
begin
FPublisher.free;
FPublisher := value;
end;
Function TFhirValueSet.GetPublisherST : String;
begin
if FPublisher = nil then
result := ''
else
result := FPublisher.value;
end;
Procedure TFhirValueSet.SetPublisherST(value : String);
begin
if value <> '' then
begin
if FPublisher = nil then
FPublisher := TFhirString.create;
FPublisher.value := value
end
else if FPublisher <> nil then
FPublisher.value := '';
end;
Procedure TFhirValueSet.SetDescription(value : TFhirString);
begin
FDescription.free;
FDescription := value;
end;
Function TFhirValueSet.GetDescriptionST : String;
begin
if FDescription = nil then
result := ''
else
result := FDescription.value;
end;
Procedure TFhirValueSet.SetDescriptionST(value : String);
begin
if value <> '' then
begin
if FDescription = nil then
FDescription := TFhirString.create;
FDescription.value := value
end
else if FDescription <> nil then
FDescription.value := '';
end;
Procedure TFhirValueSet.SetCopyright(value : TFhirString);
begin
FCopyright.free;
FCopyright := value;
end;
Function TFhirValueSet.GetCopyrightST : String;
begin
if FCopyright = nil then
result := ''
else
result := FCopyright.value;
end;
Procedure TFhirValueSet.SetCopyrightST(value : String);
begin
if value <> '' then
begin
if FCopyright = nil then
FCopyright := TFhirString.create;
FCopyright.value := value
end
else if FCopyright <> nil then
FCopyright.value := '';
end;
Procedure TFhirValueSet.SetStatus(value : TFhirEnum);
begin
FStatus.free;
FStatus := value;
end;
Function TFhirValueSet.GetStatusST : TFhirValuesetStatus;
begin
if FStatus = nil then
result := TFhirValuesetStatus(0)
else
result := TFhirValuesetStatus(StringArrayIndexOfSensitive(CODES_TFhirValuesetStatus, FStatus.value));
end;
Procedure TFhirValueSet.SetStatusST(value : TFhirValuesetStatus);
begin
if ord(value) = 0 then
StatusObject := nil
else
StatusObject := TFhirEnum.create(CODES_TFhirValuesetStatus[value]);
end;
Procedure TFhirValueSet.SetExperimental(value : TFhirBoolean);
begin
FExperimental.free;
FExperimental := value;
end;
Function TFhirValueSet.GetExperimentalST : Boolean;
begin
if FExperimental = nil then
result := false
else
result := FExperimental.value;
end;
Procedure TFhirValueSet.SetExperimentalST(value : Boolean);
begin
if FExperimental = nil then
FExperimental := TFhirBoolean.create;
FExperimental.value := value
end;
Procedure TFhirValueSet.SetExtensible(value : TFhirBoolean);
begin
FExtensible.free;
FExtensible := value;
end;
Function TFhirValueSet.GetExtensibleST : Boolean;
begin
if FExtensible = nil then
result := false
else
result := FExtensible.value;
end;
Procedure TFhirValueSet.SetExtensibleST(value : Boolean);
begin
if FExtensible = nil then
FExtensible := TFhirBoolean.create;
FExtensible.value := value
end;
Procedure TFhirValueSet.SetDate(value : TFhirDateTime);
begin
FDate.free;
FDate := value;
end;
Function TFhirValueSet.GetDateST : TDateTimeEx;
begin
if FDate = nil then
result := nil
else
result := FDate.value;
end;
Procedure TFhirValueSet.SetDateST(value : TDateTimeEx);
begin
if value <> nil then
begin
if FDate = nil then
FDate := TFhirDateTime.create;
FDate.value := value
end
else if FDate <> nil then
FDate.value := nil;
end;
Procedure TFhirValueSet.SetDefine(value : TFhirValueSetDefine);
begin
FDefine.free;
FDefine := value;
end;
Procedure TFhirValueSet.SetCompose(value : TFhirValueSetCompose);
begin
FCompose.free;
FCompose := value;
end;
Procedure TFhirValueSet.SetExpansion(value : TFhirValueSetExpansion);
begin
FExpansion.free;
FExpansion := value;
end;
function TFhirResourceFactory.newEnum : TFhirEnum;
begin
result := TFhirEnum.create;
end;
function TFhirResourceFactory.makeEnum(value : String) : TFhirEnum;
begin
result := TFhirEnum.create;
result.value := value;
end;
function TFhirResourceFactory.newInteger : TFhirInteger;
begin
result := TFhirInteger.create;
end;
function TFhirResourceFactory.makeInteger(value : String) : TFhirInteger;
begin
result := TFhirInteger.create;
result.value := value;
end;
function TFhirResourceFactory.newDateTime : TFhirDateTime;
begin
result := TFhirDateTime.create;
end;
function TFhirResourceFactory.makeDateTime(value : TDateTimeEx) : TFhirDateTime;
begin
result := TFhirDateTime.create;
result.value := value;
end;
function TFhirResourceFactory.newDate : TFhirDate;
begin
result := TFhirDate.create;
end;
function TFhirResourceFactory.makeDate(value : TDateTimeEx) : TFhirDate;
begin
result := TFhirDate.create;
result.value := value;
end;
function TFhirResourceFactory.newDecimal : TFhirDecimal;
begin
result := TFhirDecimal.create;
end;
function TFhirResourceFactory.makeDecimal(value : String) : TFhirDecimal;
begin
result := TFhirDecimal.create;
result.value := value;
end;
function TFhirResourceFactory.newUri : TFhirUri;
begin
result := TFhirUri.create;
end;
function TFhirResourceFactory.makeUri(value : String) : TFhirUri;
begin
result := TFhirUri.create;
result.value := value;
end;
function TFhirResourceFactory.newBase64Binary : TFhirBase64Binary;
begin
result := TFhirBase64Binary.create;
end;
function TFhirResourceFactory.makeBase64Binary(value : String) : TFhirBase64Binary;
begin
result := TFhirBase64Binary.create;
result.value := value;
end;
function TFhirResourceFactory.newString : TFhirString;
begin
result := TFhirString.create;
end;
function TFhirResourceFactory.makeString(value : String) : TFhirString;
begin
result := TFhirString.create;
result.value := value;
end;
function TFhirResourceFactory.newBoolean : TFhirBoolean;
begin
result := TFhirBoolean.create;
end;
function TFhirResourceFactory.makeBoolean(value : Boolean) : TFhirBoolean;
begin
result := TFhirBoolean.create;
result.value := value;
end;
function TFhirResourceFactory.newInstant : TFhirInstant;
begin
result := TFhirInstant.create;
end;
function TFhirResourceFactory.makeInstant(value : TDateTimeEx) : TFhirInstant;
begin
result := TFhirInstant.create;
result.value := value;
end;
function TFhirResourceFactory.newCode : TFhirCode;
begin
result := TFhirCode.create;
end;
function TFhirResourceFactory.makeCode(value : String) : TFhirCode;
begin
result := TFhirCode.create;
result.value := value;
end;
function TFhirResourceFactory.newId : TFhirId;
begin
result := TFhirId.create;
end;
function TFhirResourceFactory.makeId(value : String) : TFhirId;
begin
result := TFhirId.create;
result.value := value;
end;
function TFhirResourceFactory.newOid : TFhirOid;
begin
result := TFhirOid.create;
end;
function TFhirResourceFactory.makeOid(value : String) : TFhirOid;
begin
result := TFhirOid.create;
result.value := value;
end;
function TFhirResourceFactory.newUuid : TFhirUuid;
begin
result := TFhirUuid.create;
end;
function TFhirResourceFactory.makeUuid(value : String) : TFhirUuid;
begin
result := TFhirUuid.create;
result.value := value;
end;
function TFhirResourceFactory.newExtension : TFhirExtension;
begin
result := TFhirExtension.create;
end;
function TFhirResourceFactory.newNarrative : TFhirNarrative;
begin
result := TFhirNarrative.create;
end;
function TFhirResourceFactory.newPeriod : TFhirPeriod;
begin
result := TFhirPeriod.create;
end;
function TFhirResourceFactory.newCoding : TFhirCoding;
begin
result := TFhirCoding.create;
end;
function TFhirResourceFactory.newRange : TFhirRange;
begin
result := TFhirRange.create;
end;
function TFhirResourceFactory.newQuantity : TFhirQuantity;
begin
result := TFhirQuantity.create;
end;
function TFhirResourceFactory.newAttachment : TFhirAttachment;
begin
result := TFhirAttachment.create;
end;
function TFhirResourceFactory.newRatio : TFhirRatio;
begin
result := TFhirRatio.create;
end;
function TFhirResourceFactory.newSampledData : TFhirSampledData;
begin
result := TFhirSampledData.create;
end;
function TFhirResourceFactory.newResourceReference : TFhirResourceReference;
begin
result := TFhirResourceReference.create;
end;
function TFhirResourceFactory.newCodeableConcept : TFhirCodeableConcept;
begin
result := TFhirCodeableConcept.create;
end;
function TFhirResourceFactory.newIdentifier : TFhirIdentifier;
begin
result := TFhirIdentifier.create;
end;
function TFhirResourceFactory.newScheduleRepeat : TFhirScheduleRepeat;
begin
result := TFhirScheduleRepeat.create;
end;
function TFhirResourceFactory.newSchedule : TFhirSchedule;
begin
result := TFhirSchedule.create;
end;
function TFhirResourceFactory.newContact : TFhirContact;
begin
result := TFhirContact.create;
end;
function TFhirResourceFactory.newAddress : TFhirAddress;
begin
result := TFhirAddress.create;
end;
function TFhirResourceFactory.newHumanName : TFhirHumanName;
begin
result := TFhirHumanName.create;
end;
function TFhirResourceFactory.newAdverseReactionSymptom : TFhirAdverseReactionSymptom;
begin
result := TFhirAdverseReactionSymptom.create;
end;
function TFhirResourceFactory.newAdverseReactionExposure : TFhirAdverseReactionExposure;
begin
result := TFhirAdverseReactionExposure.create;
end;
function TFhirResourceFactory.newAdverseReaction : TFhirAdverseReaction;
begin
result := TFhirAdverseReaction.create;
end;
function TFhirResourceFactory.newAlert : TFhirAlert;
begin
result := TFhirAlert.create;
end;
function TFhirResourceFactory.newAllergyIntolerance : TFhirAllergyIntolerance;
begin
result := TFhirAllergyIntolerance.create;
end;
function TFhirResourceFactory.newCarePlanParticipant : TFhirCarePlanParticipant;
begin
result := TFhirCarePlanParticipant.create;
end;
function TFhirResourceFactory.newCarePlanGoal : TFhirCarePlanGoal;
begin
result := TFhirCarePlanGoal.create;
end;
function TFhirResourceFactory.newCarePlanActivity : TFhirCarePlanActivity;
begin
result := TFhirCarePlanActivity.create;
end;
function TFhirResourceFactory.newCarePlanActivitySimple : TFhirCarePlanActivitySimple;
begin
result := TFhirCarePlanActivitySimple.create;
end;
function TFhirResourceFactory.newCarePlan : TFhirCarePlan;
begin
result := TFhirCarePlan.create;
end;
function TFhirResourceFactory.newCompositionAttester : TFhirCompositionAttester;
begin
result := TFhirCompositionAttester.create;
end;
function TFhirResourceFactory.newCompositionEvent : TFhirCompositionEvent;
begin
result := TFhirCompositionEvent.create;
end;
function TFhirResourceFactory.newCompositionSection : TFhirCompositionSection;
begin
result := TFhirCompositionSection.create;
end;
function TFhirResourceFactory.newComposition : TFhirComposition;
begin
result := TFhirComposition.create;
end;
function TFhirResourceFactory.newConceptMapConcept : TFhirConceptMapConcept;
begin
result := TFhirConceptMapConcept.create;
end;
function TFhirResourceFactory.newConceptMapConceptDependsOn : TFhirConceptMapConceptDependsOn;
begin
result := TFhirConceptMapConceptDependsOn.create;
end;
function TFhirResourceFactory.newConceptMapConceptMap : TFhirConceptMapConceptMap;
begin
result := TFhirConceptMapConceptMap.create;
end;
function TFhirResourceFactory.newConceptMap : TFhirConceptMap;
begin
result := TFhirConceptMap.create;
end;
function TFhirResourceFactory.newConditionStage : TFhirConditionStage;
begin
result := TFhirConditionStage.create;
end;
function TFhirResourceFactory.newConditionEvidence : TFhirConditionEvidence;
begin
result := TFhirConditionEvidence.create;
end;
function TFhirResourceFactory.newConditionLocation : TFhirConditionLocation;
begin
result := TFhirConditionLocation.create;
end;
function TFhirResourceFactory.newConditionRelatedItem : TFhirConditionRelatedItem;
begin
result := TFhirConditionRelatedItem.create;
end;
function TFhirResourceFactory.newCondition : TFhirCondition;
begin
result := TFhirCondition.create;
end;
function TFhirResourceFactory.newConformanceSoftware : TFhirConformanceSoftware;
begin
result := TFhirConformanceSoftware.create;
end;
function TFhirResourceFactory.newConformanceImplementation : TFhirConformanceImplementation;
begin
result := TFhirConformanceImplementation.create;
end;
function TFhirResourceFactory.newConformanceRest : TFhirConformanceRest;
begin
result := TFhirConformanceRest.create;
end;
function TFhirResourceFactory.newConformanceRestSecurity : TFhirConformanceRestSecurity;
begin
result := TFhirConformanceRestSecurity.create;
end;
function TFhirResourceFactory.newConformanceRestSecurityCertificate : TFhirConformanceRestSecurityCertificate;
begin
result := TFhirConformanceRestSecurityCertificate.create;
end;
function TFhirResourceFactory.newConformanceRestResource : TFhirConformanceRestResource;
begin
result := TFhirConformanceRestResource.create;
end;
function TFhirResourceFactory.newConformanceRestResourceOperation : TFhirConformanceRestResourceOperation;
begin
result := TFhirConformanceRestResourceOperation.create;
end;
function TFhirResourceFactory.newConformanceRestResourceSearchParam : TFhirConformanceRestResourceSearchParam;
begin
result := TFhirConformanceRestResourceSearchParam.create;
end;
function TFhirResourceFactory.newConformanceRestOperation : TFhirConformanceRestOperation;
begin
result := TFhirConformanceRestOperation.create;
end;
function TFhirResourceFactory.newConformanceRestQuery : TFhirConformanceRestQuery;
begin
result := TFhirConformanceRestQuery.create;
end;
function TFhirResourceFactory.newConformanceMessaging : TFhirConformanceMessaging;
begin
result := TFhirConformanceMessaging.create;
end;
function TFhirResourceFactory.newConformanceMessagingEvent : TFhirConformanceMessagingEvent;
begin
result := TFhirConformanceMessagingEvent.create;
end;
function TFhirResourceFactory.newConformanceDocument : TFhirConformanceDocument;
begin
result := TFhirConformanceDocument.create;
end;
function TFhirResourceFactory.newConformance : TFhirConformance;
begin
result := TFhirConformance.create;
end;
function TFhirResourceFactory.newDevice : TFhirDevice;
begin
result := TFhirDevice.create;
end;
function TFhirResourceFactory.newDeviceObservationReportVirtualDevice : TFhirDeviceObservationReportVirtualDevice;
begin
result := TFhirDeviceObservationReportVirtualDevice.create;
end;
function TFhirResourceFactory.newDeviceObservationReportVirtualDeviceChannel : TFhirDeviceObservationReportVirtualDeviceChannel;
begin
result := TFhirDeviceObservationReportVirtualDeviceChannel.create;
end;
function TFhirResourceFactory.newDeviceObservationReportVirtualDeviceChannelMetric : TFhirDeviceObservationReportVirtualDeviceChannelMetric;
begin
result := TFhirDeviceObservationReportVirtualDeviceChannelMetric.create;
end;
function TFhirResourceFactory.newDeviceObservationReport : TFhirDeviceObservationReport;
begin
result := TFhirDeviceObservationReport.create;
end;
function TFhirResourceFactory.newDiagnosticOrderEvent : TFhirDiagnosticOrderEvent;
begin
result := TFhirDiagnosticOrderEvent.create;
end;
function TFhirResourceFactory.newDiagnosticOrderItem : TFhirDiagnosticOrderItem;
begin
result := TFhirDiagnosticOrderItem.create;
end;
function TFhirResourceFactory.newDiagnosticOrder : TFhirDiagnosticOrder;
begin
result := TFhirDiagnosticOrder.create;
end;
function TFhirResourceFactory.newDiagnosticReportImage : TFhirDiagnosticReportImage;
begin
result := TFhirDiagnosticReportImage.create;
end;
function TFhirResourceFactory.newDiagnosticReport : TFhirDiagnosticReport;
begin
result := TFhirDiagnosticReport.create;
end;
function TFhirResourceFactory.newDocumentManifest : TFhirDocumentManifest;
begin
result := TFhirDocumentManifest.create;
end;
function TFhirResourceFactory.newDocumentReferenceRelatesTo : TFhirDocumentReferenceRelatesTo;
begin
result := TFhirDocumentReferenceRelatesTo.create;
end;
function TFhirResourceFactory.newDocumentReferenceService : TFhirDocumentReferenceService;
begin
result := TFhirDocumentReferenceService.create;
end;
function TFhirResourceFactory.newDocumentReferenceServiceParameter : TFhirDocumentReferenceServiceParameter;
begin
result := TFhirDocumentReferenceServiceParameter.create;
end;
function TFhirResourceFactory.newDocumentReferenceContext : TFhirDocumentReferenceContext;
begin
result := TFhirDocumentReferenceContext.create;
end;
function TFhirResourceFactory.newDocumentReference : TFhirDocumentReference;
begin
result := TFhirDocumentReference.create;
end;
function TFhirResourceFactory.newEncounterParticipant : TFhirEncounterParticipant;
begin
result := TFhirEncounterParticipant.create;
end;
function TFhirResourceFactory.newEncounterHospitalization : TFhirEncounterHospitalization;
begin
result := TFhirEncounterHospitalization.create;
end;
function TFhirResourceFactory.newEncounterHospitalizationAccomodation : TFhirEncounterHospitalizationAccomodation;
begin
result := TFhirEncounterHospitalizationAccomodation.create;
end;
function TFhirResourceFactory.newEncounterLocation : TFhirEncounterLocation;
begin
result := TFhirEncounterLocation.create;
end;
function TFhirResourceFactory.newEncounter : TFhirEncounter;
begin
result := TFhirEncounter.create;
end;
function TFhirResourceFactory.newFamilyHistoryRelation : TFhirFamilyHistoryRelation;
begin
result := TFhirFamilyHistoryRelation.create;
end;
function TFhirResourceFactory.newFamilyHistoryRelationCondition : TFhirFamilyHistoryRelationCondition;
begin
result := TFhirFamilyHistoryRelationCondition.create;
end;
function TFhirResourceFactory.newFamilyHistory : TFhirFamilyHistory;
begin
result := TFhirFamilyHistory.create;
end;
function TFhirResourceFactory.newGroupCharacteristic : TFhirGroupCharacteristic;
begin
result := TFhirGroupCharacteristic.create;
end;
function TFhirResourceFactory.newGroup : TFhirGroup;
begin
result := TFhirGroup.create;
end;
function TFhirResourceFactory.newImagingStudySeries : TFhirImagingStudySeries;
begin
result := TFhirImagingStudySeries.create;
end;
function TFhirResourceFactory.newImagingStudySeriesInstance : TFhirImagingStudySeriesInstance;
begin
result := TFhirImagingStudySeriesInstance.create;
end;
function TFhirResourceFactory.newImagingStudy : TFhirImagingStudy;
begin
result := TFhirImagingStudy.create;
end;
function TFhirResourceFactory.newImmunizationExplanation : TFhirImmunizationExplanation;
begin
result := TFhirImmunizationExplanation.create;
end;
function TFhirResourceFactory.newImmunizationReaction : TFhirImmunizationReaction;
begin
result := TFhirImmunizationReaction.create;
end;
function TFhirResourceFactory.newImmunizationVaccinationProtocol : TFhirImmunizationVaccinationProtocol;
begin
result := TFhirImmunizationVaccinationProtocol.create;
end;
function TFhirResourceFactory.newImmunization : TFhirImmunization;
begin
result := TFhirImmunization.create;
end;
function TFhirResourceFactory.newImmunizationRecommendationRecommendation : TFhirImmunizationRecommendationRecommendation;
begin
result := TFhirImmunizationRecommendationRecommendation.create;
end;
function TFhirResourceFactory.newImmunizationRecommendationRecommendationDateCriterion : TFhirImmunizationRecommendationRecommendationDateCriterion;
begin
result := TFhirImmunizationRecommendationRecommendationDateCriterion.create;
end;
function TFhirResourceFactory.newImmunizationRecommendationRecommendationProtocol : TFhirImmunizationRecommendationRecommendationProtocol;
begin
result := TFhirImmunizationRecommendationRecommendationProtocol.create;
end;
function TFhirResourceFactory.newImmunizationRecommendation : TFhirImmunizationRecommendation;
begin
result := TFhirImmunizationRecommendation.create;
end;
function TFhirResourceFactory.newListEntry : TFhirListEntry;
begin
result := TFhirListEntry.create;
end;
function TFhirResourceFactory.newList : TFhirList;
begin
result := TFhirList.create;
end;
function TFhirResourceFactory.newLocationPosition : TFhirLocationPosition;
begin
result := TFhirLocationPosition.create;
end;
function TFhirResourceFactory.newLocation : TFhirLocation;
begin
result := TFhirLocation.create;
end;
function TFhirResourceFactory.newMedia : TFhirMedia;
begin
result := TFhirMedia.create;
end;
function TFhirResourceFactory.newMedicationProduct : TFhirMedicationProduct;
begin
result := TFhirMedicationProduct.create;
end;
function TFhirResourceFactory.newMedicationProductIngredient : TFhirMedicationProductIngredient;
begin
result := TFhirMedicationProductIngredient.create;
end;
function TFhirResourceFactory.newMedicationPackage : TFhirMedicationPackage;
begin
result := TFhirMedicationPackage.create;
end;
function TFhirResourceFactory.newMedicationPackageContent : TFhirMedicationPackageContent;
begin
result := TFhirMedicationPackageContent.create;
end;
function TFhirResourceFactory.newMedication : TFhirMedication;
begin
result := TFhirMedication.create;
end;
function TFhirResourceFactory.newMedicationAdministrationDosage : TFhirMedicationAdministrationDosage;
begin
result := TFhirMedicationAdministrationDosage.create;
end;
function TFhirResourceFactory.newMedicationAdministration : TFhirMedicationAdministration;
begin
result := TFhirMedicationAdministration.create;
end;
function TFhirResourceFactory.newMedicationDispenseDispense : TFhirMedicationDispenseDispense;
begin
result := TFhirMedicationDispenseDispense.create;
end;
function TFhirResourceFactory.newMedicationDispenseDispenseDosage : TFhirMedicationDispenseDispenseDosage;
begin
result := TFhirMedicationDispenseDispenseDosage.create;
end;
function TFhirResourceFactory.newMedicationDispenseSubstitution : TFhirMedicationDispenseSubstitution;
begin
result := TFhirMedicationDispenseSubstitution.create;
end;
function TFhirResourceFactory.newMedicationDispense : TFhirMedicationDispense;
begin
result := TFhirMedicationDispense.create;
end;
function TFhirResourceFactory.newMedicationPrescriptionDosageInstruction : TFhirMedicationPrescriptionDosageInstruction;
begin
result := TFhirMedicationPrescriptionDosageInstruction.create;
end;
function TFhirResourceFactory.newMedicationPrescriptionDispense : TFhirMedicationPrescriptionDispense;
begin
result := TFhirMedicationPrescriptionDispense.create;
end;
function TFhirResourceFactory.newMedicationPrescriptionSubstitution : TFhirMedicationPrescriptionSubstitution;
begin
result := TFhirMedicationPrescriptionSubstitution.create;
end;
function TFhirResourceFactory.newMedicationPrescription : TFhirMedicationPrescription;
begin
result := TFhirMedicationPrescription.create;
end;
function TFhirResourceFactory.newMedicationStatementDosage : TFhirMedicationStatementDosage;
begin
result := TFhirMedicationStatementDosage.create;
end;
function TFhirResourceFactory.newMedicationStatement : TFhirMedicationStatement;
begin
result := TFhirMedicationStatement.create;
end;
function TFhirResourceFactory.newMessageHeaderResponse : TFhirMessageHeaderResponse;
begin
result := TFhirMessageHeaderResponse.create;
end;
function TFhirResourceFactory.newMessageHeaderSource : TFhirMessageHeaderSource;
begin
result := TFhirMessageHeaderSource.create;
end;
function TFhirResourceFactory.newMessageHeaderDestination : TFhirMessageHeaderDestination;
begin
result := TFhirMessageHeaderDestination.create;
end;
function TFhirResourceFactory.newMessageHeader : TFhirMessageHeader;
begin
result := TFhirMessageHeader.create;
end;
function TFhirResourceFactory.newObservationReferenceRange : TFhirObservationReferenceRange;
begin
result := TFhirObservationReferenceRange.create;
end;
function TFhirResourceFactory.newObservationRelated : TFhirObservationRelated;
begin
result := TFhirObservationRelated.create;
end;
function TFhirResourceFactory.newObservation : TFhirObservation;
begin
result := TFhirObservation.create;
end;
function TFhirResourceFactory.newOperationOutcomeIssue : TFhirOperationOutcomeIssue;
begin
result := TFhirOperationOutcomeIssue.create;
end;
function TFhirResourceFactory.newOperationOutcome : TFhirOperationOutcome;
begin
result := TFhirOperationOutcome.create;
end;
function TFhirResourceFactory.newOrderWhen : TFhirOrderWhen;
begin
result := TFhirOrderWhen.create;
end;
function TFhirResourceFactory.newOrder : TFhirOrder;
begin
result := TFhirOrder.create;
end;
function TFhirResourceFactory.newOrderResponse : TFhirOrderResponse;
begin
result := TFhirOrderResponse.create;
end;
function TFhirResourceFactory.newOrganizationContact : TFhirOrganizationContact;
begin
result := TFhirOrganizationContact.create;
end;
function TFhirResourceFactory.newOrganization : TFhirOrganization;
begin
result := TFhirOrganization.create;
end;
function TFhirResourceFactory.newOther : TFhirOther;
begin
result := TFhirOther.create;
end;
function TFhirResourceFactory.newPatientContact : TFhirPatientContact;
begin
result := TFhirPatientContact.create;
end;
function TFhirResourceFactory.newPatientAnimal : TFhirPatientAnimal;
begin
result := TFhirPatientAnimal.create;
end;
function TFhirResourceFactory.newPatientLink : TFhirPatientLink;
begin
result := TFhirPatientLink.create;
end;
function TFhirResourceFactory.newPatient : TFhirPatient;
begin
result := TFhirPatient.create;
end;
function TFhirResourceFactory.newPractitionerQualification : TFhirPractitionerQualification;
begin
result := TFhirPractitionerQualification.create;
end;
function TFhirResourceFactory.newPractitioner : TFhirPractitioner;
begin
result := TFhirPractitioner.create;
end;
function TFhirResourceFactory.newProcedurePerformer : TFhirProcedurePerformer;
begin
result := TFhirProcedurePerformer.create;
end;
function TFhirResourceFactory.newProcedureRelatedItem : TFhirProcedureRelatedItem;
begin
result := TFhirProcedureRelatedItem.create;
end;
function TFhirResourceFactory.newProcedure : TFhirProcedure;
begin
result := TFhirProcedure.create;
end;
function TFhirResourceFactory.newProfileMapping : TFhirProfileMapping;
begin
result := TFhirProfileMapping.create;
end;
function TFhirResourceFactory.newProfileStructure : TFhirProfileStructure;
begin
result := TFhirProfileStructure.create;
end;
function TFhirResourceFactory.newProfileStructureElement : TFhirProfileStructureElement;
begin
result := TFhirProfileStructureElement.create;
end;
function TFhirResourceFactory.newProfileStructureElementSlicing : TFhirProfileStructureElementSlicing;
begin
result := TFhirProfileStructureElementSlicing.create;
end;
function TFhirResourceFactory.newProfileStructureElementDefinition : TFhirProfileStructureElementDefinition;
begin
result := TFhirProfileStructureElementDefinition.create;
end;
function TFhirResourceFactory.newProfileStructureElementDefinitionType : TFhirProfileStructureElementDefinitionType;
begin
result := TFhirProfileStructureElementDefinitionType.create;
end;
function TFhirResourceFactory.newProfileStructureElementDefinitionConstraint : TFhirProfileStructureElementDefinitionConstraint;
begin
result := TFhirProfileStructureElementDefinitionConstraint.create;
end;
function TFhirResourceFactory.newProfileStructureElementDefinitionBinding : TFhirProfileStructureElementDefinitionBinding;
begin
result := TFhirProfileStructureElementDefinitionBinding.create;
end;
function TFhirResourceFactory.newProfileStructureElementDefinitionMapping : TFhirProfileStructureElementDefinitionMapping;
begin
result := TFhirProfileStructureElementDefinitionMapping.create;
end;
function TFhirResourceFactory.newProfileStructureSearchParam : TFhirProfileStructureSearchParam;
begin
result := TFhirProfileStructureSearchParam.create;
end;
function TFhirResourceFactory.newProfileExtensionDefn : TFhirProfileExtensionDefn;
begin
result := TFhirProfileExtensionDefn.create;
end;
function TFhirResourceFactory.newProfileQuery : TFhirProfileQuery;
begin
result := TFhirProfileQuery.create;
end;
function TFhirResourceFactory.newProfile : TFhirProfile;
begin
result := TFhirProfile.create;
end;
function TFhirResourceFactory.newProvenanceAgent : TFhirProvenanceAgent;
begin
result := TFhirProvenanceAgent.create;
end;
function TFhirResourceFactory.newProvenanceEntity : TFhirProvenanceEntity;
begin
result := TFhirProvenanceEntity.create;
end;
function TFhirResourceFactory.newProvenance : TFhirProvenance;
begin
result := TFhirProvenance.create;
end;
function TFhirResourceFactory.newQueryResponse : TFhirQueryResponse;
begin
result := TFhirQueryResponse.create;
end;
function TFhirResourceFactory.newQuery : TFhirQuery;
begin
result := TFhirQuery.create;
end;
function TFhirResourceFactory.newQuestionnaireGroup : TFhirQuestionnaireGroup;
begin
result := TFhirQuestionnaireGroup.create;
end;
function TFhirResourceFactory.newQuestionnaireGroupQuestion : TFhirQuestionnaireGroupQuestion;
begin
result := TFhirQuestionnaireGroupQuestion.create;
end;
function TFhirResourceFactory.newQuestionnaire : TFhirQuestionnaire;
begin
result := TFhirQuestionnaire.create;
end;
function TFhirResourceFactory.newRelatedPerson : TFhirRelatedPerson;
begin
result := TFhirRelatedPerson.create;
end;
function TFhirResourceFactory.newSecurityEventEvent : TFhirSecurityEventEvent;
begin
result := TFhirSecurityEventEvent.create;
end;
function TFhirResourceFactory.newSecurityEventParticipant : TFhirSecurityEventParticipant;
begin
result := TFhirSecurityEventParticipant.create;
end;
function TFhirResourceFactory.newSecurityEventParticipantNetwork : TFhirSecurityEventParticipantNetwork;
begin
result := TFhirSecurityEventParticipantNetwork.create;
end;
function TFhirResourceFactory.newSecurityEventSource : TFhirSecurityEventSource;
begin
result := TFhirSecurityEventSource.create;
end;
function TFhirResourceFactory.newSecurityEventObject : TFhirSecurityEventObject;
begin
result := TFhirSecurityEventObject.create;
end;
function TFhirResourceFactory.newSecurityEventObjectDetail : TFhirSecurityEventObjectDetail;
begin
result := TFhirSecurityEventObjectDetail.create;
end;
function TFhirResourceFactory.newSecurityEvent : TFhirSecurityEvent;
begin
result := TFhirSecurityEvent.create;
end;
function TFhirResourceFactory.newSpecimenSource : TFhirSpecimenSource;
begin
result := TFhirSpecimenSource.create;
end;
function TFhirResourceFactory.newSpecimenCollection : TFhirSpecimenCollection;
begin
result := TFhirSpecimenCollection.create;
end;
function TFhirResourceFactory.newSpecimenTreatment : TFhirSpecimenTreatment;
begin
result := TFhirSpecimenTreatment.create;
end;
function TFhirResourceFactory.newSpecimenContainer : TFhirSpecimenContainer;
begin
result := TFhirSpecimenContainer.create;
end;
function TFhirResourceFactory.newSpecimen : TFhirSpecimen;
begin
result := TFhirSpecimen.create;
end;
function TFhirResourceFactory.newSubstanceInstance : TFhirSubstanceInstance;
begin
result := TFhirSubstanceInstance.create;
end;
function TFhirResourceFactory.newSubstanceIngredient : TFhirSubstanceIngredient;
begin
result := TFhirSubstanceIngredient.create;
end;
function TFhirResourceFactory.newSubstance : TFhirSubstance;
begin
result := TFhirSubstance.create;
end;
function TFhirResourceFactory.newSupplyDispense : TFhirSupplyDispense;
begin
result := TFhirSupplyDispense.create;
end;
function TFhirResourceFactory.newSupply : TFhirSupply;
begin
result := TFhirSupply.create;
end;
function TFhirResourceFactory.newValueSetDefine : TFhirValueSetDefine;
begin
result := TFhirValueSetDefine.create;
end;
function TFhirResourceFactory.newValueSetDefineConcept : TFhirValueSetDefineConcept;
begin
result := TFhirValueSetDefineConcept.create;
end;
function TFhirResourceFactory.newValueSetCompose : TFhirValueSetCompose;
begin
result := TFhirValueSetCompose.create;
end;
function TFhirResourceFactory.newValueSetComposeInclude : TFhirValueSetComposeInclude;
begin
result := TFhirValueSetComposeInclude.create;
end;
function TFhirResourceFactory.newValueSetComposeIncludeFilter : TFhirValueSetComposeIncludeFilter;
begin
result := TFhirValueSetComposeIncludeFilter.create;
end;
function TFhirResourceFactory.newValueSetExpansion : TFhirValueSetExpansion;
begin
result := TFhirValueSetExpansion.create;
end;
function TFhirResourceFactory.newValueSetExpansionContains : TFhirValueSetExpansionContains;
begin
result := TFhirValueSetExpansionContains.create;
end;
function TFhirResourceFactory.newValueSet : TFhirValueSet;
begin
result := TFhirValueSet.create;
end;
function TFHIRResourceFactory.makeByName(const name : String) : TFHIRElement;
begin
if name = 'Enum' then
result := newEnum()
else if name = 'Integer' then
result := newInteger()
else if name = 'DateTime' then
result := newDateTime()
else if name = 'Date' then
result := newDate()
else if name = 'Decimal' then
result := newDecimal()
else if name = 'Uri' then
result := newUri()
else if name = 'Base64Binary' then
result := newBase64Binary()
else if name = 'String' then
result := newString()
else if name = 'Boolean' then
result := newBoolean()
else if name = 'Instant' then
result := newInstant()
else if name = 'Code' then
result := newCode()
else if name = 'Id' then
result := newId()
else if name = 'Oid' then
result := newOid()
else if name = 'Uuid' then
result := newUuid()
else if name = 'Extension' then
result := newExtension()
else if name = 'Narrative' then
result := newNarrative()
else if name = 'Period' then
result := newPeriod()
else if name = 'Coding' then
result := newCoding()
else if name = 'Range' then
result := newRange()
else if name = 'Quantity' then
result := newQuantity()
else if name = 'Attachment' then
result := newAttachment()
else if name = 'Ratio' then
result := newRatio()
else if name = 'SampledData' then
result := newSampledData()
else if name = 'ResourceReference' then
result := newResourceReference()
else if name = 'CodeableConcept' then
result := newCodeableConcept()
else if name = 'Identifier' then
result := newIdentifier()
else if name = 'Schedule.repeat' then
result := newScheduleRepeat()
else if name = 'Schedule' then
result := newSchedule()
else if name = 'Contact' then
result := newContact()
else if name = 'Address' then
result := newAddress()
else if name = 'HumanName' then
result := newHumanName()
else if name = 'AdverseReaction.symptom' then
result := newAdverseReactionSymptom()
else if name = 'AdverseReaction.exposure' then
result := newAdverseReactionExposure()
else if name = 'AdverseReaction' then
result := newAdverseReaction()
else if name = 'Alert' then
result := newAlert()
else if name = 'AllergyIntolerance' then
result := newAllergyIntolerance()
else if name = 'CarePlan.participant' then
result := newCarePlanParticipant()
else if name = 'CarePlan.goal' then
result := newCarePlanGoal()
else if name = 'CarePlan.activity' then
result := newCarePlanActivity()
else if name = 'CarePlan.activity.simple' then
result := newCarePlanActivitySimple()
else if name = 'CarePlan' then
result := newCarePlan()
else if name = 'Composition.attester' then
result := newCompositionAttester()
else if name = 'Composition.event' then
result := newCompositionEvent()
else if name = 'Composition.section' then
result := newCompositionSection()
else if name = 'Composition' then
result := newComposition()
else if name = 'ConceptMap.concept' then
result := newConceptMapConcept()
else if name = 'ConceptMap.concept.dependsOn' then
result := newConceptMapConceptDependsOn()
else if name = 'ConceptMap.concept.map' then
result := newConceptMapConceptMap()
else if name = 'ConceptMap' then
result := newConceptMap()
else if name = 'Condition.stage' then
result := newConditionStage()
else if name = 'Condition.evidence' then
result := newConditionEvidence()
else if name = 'Condition.location' then
result := newConditionLocation()
else if name = 'Condition.relatedItem' then
result := newConditionRelatedItem()
else if name = 'Condition' then
result := newCondition()
else if name = 'Conformance.software' then
result := newConformanceSoftware()
else if name = 'Conformance.implementation' then
result := newConformanceImplementation()
else if name = 'Conformance.rest' then
result := newConformanceRest()
else if name = 'Conformance.rest.security' then
result := newConformanceRestSecurity()
else if name = 'Conformance.rest.security.certificate' then
result := newConformanceRestSecurityCertificate()
else if name = 'Conformance.rest.resource' then
result := newConformanceRestResource()
else if name = 'Conformance.rest.resource.operation' then
result := newConformanceRestResourceOperation()
else if name = 'Conformance.rest.resource.searchParam' then
result := newConformanceRestResourceSearchParam()
else if name = 'Conformance.rest.operation' then
result := newConformanceRestOperation()
else if name = 'Conformance.rest.query' then
result := newConformanceRestQuery()
else if name = 'Conformance.messaging' then
result := newConformanceMessaging()
else if name = 'Conformance.messaging.event' then
result := newConformanceMessagingEvent()
else if name = 'Conformance.document' then
result := newConformanceDocument()
else if name = 'Conformance' then
result := newConformance()
else if name = 'Device' then
result := newDevice()
else if name = 'DeviceObservationReport.virtualDevice' then
result := newDeviceObservationReportVirtualDevice()
else if name = 'DeviceObservationReport.virtualDevice.channel' then
result := newDeviceObservationReportVirtualDeviceChannel()
else if name = 'DeviceObservationReport.virtualDevice.channel.metric' then
result := newDeviceObservationReportVirtualDeviceChannelMetric()
else if name = 'DeviceObservationReport' then
result := newDeviceObservationReport()
else if name = 'DiagnosticOrder.event' then
result := newDiagnosticOrderEvent()
else if name = 'DiagnosticOrder.item' then
result := newDiagnosticOrderItem()
else if name = 'DiagnosticOrder' then
result := newDiagnosticOrder()
else if name = 'DiagnosticReport.image' then
result := newDiagnosticReportImage()
else if name = 'DiagnosticReport' then
result := newDiagnosticReport()
else if name = 'DocumentManifest' then
result := newDocumentManifest()
else if name = 'DocumentReference.relatesTo' then
result := newDocumentReferenceRelatesTo()
else if name = 'DocumentReference.service' then
result := newDocumentReferenceService()
else if name = 'DocumentReference.service.parameter' then
result := newDocumentReferenceServiceParameter()
else if name = 'DocumentReference.context' then
result := newDocumentReferenceContext()
else if name = 'DocumentReference' then
result := newDocumentReference()
else if name = 'Encounter.participant' then
result := newEncounterParticipant()
else if name = 'Encounter.hospitalization' then
result := newEncounterHospitalization()
else if name = 'Encounter.hospitalization.accomodation' then
result := newEncounterHospitalizationAccomodation()
else if name = 'Encounter.location' then
result := newEncounterLocation()
else if name = 'Encounter' then
result := newEncounter()
else if name = 'FamilyHistory.relation' then
result := newFamilyHistoryRelation()
else if name = 'FamilyHistory.relation.condition' then
result := newFamilyHistoryRelationCondition()
else if name = 'FamilyHistory' then
result := newFamilyHistory()
else if name = 'Group.characteristic' then
result := newGroupCharacteristic()
else if name = 'Group' then
result := newGroup()
else if name = 'ImagingStudy.series' then
result := newImagingStudySeries()
else if name = 'ImagingStudy.series.instance' then
result := newImagingStudySeriesInstance()
else if name = 'ImagingStudy' then
result := newImagingStudy()
else if name = 'Immunization.explanation' then
result := newImmunizationExplanation()
else if name = 'Immunization.reaction' then
result := newImmunizationReaction()
else if name = 'Immunization.vaccinationProtocol' then
result := newImmunizationVaccinationProtocol()
else if name = 'Immunization' then
result := newImmunization()
else if name = 'ImmunizationRecommendation.recommendation' then
result := newImmunizationRecommendationRecommendation()
else if name = 'ImmunizationRecommendation.recommendation.dateCriterion' then
result := newImmunizationRecommendationRecommendationDateCriterion()
else if name = 'ImmunizationRecommendation.recommendation.protocol' then
result := newImmunizationRecommendationRecommendationProtocol()
else if name = 'ImmunizationRecommendation' then
result := newImmunizationRecommendation()
else if name = 'List.entry' then
result := newListEntry()
else if name = 'List' then
result := newList()
else if name = 'Location.position' then
result := newLocationPosition()
else if name = 'Location' then
result := newLocation()
else if name = 'Media' then
result := newMedia()
else if name = 'Medication.product' then
result := newMedicationProduct()
else if name = 'Medication.product.ingredient' then
result := newMedicationProductIngredient()
else if name = 'Medication.package' then
result := newMedicationPackage()
else if name = 'Medication.package.content' then
result := newMedicationPackageContent()
else if name = 'Medication' then
result := newMedication()
else if name = 'MedicationAdministration.dosage' then
result := newMedicationAdministrationDosage()
else if name = 'MedicationAdministration' then
result := newMedicationAdministration()
else if name = 'MedicationDispense.dispense' then
result := newMedicationDispenseDispense()
else if name = 'MedicationDispense.dispense.dosage' then
result := newMedicationDispenseDispenseDosage()
else if name = 'MedicationDispense.substitution' then
result := newMedicationDispenseSubstitution()
else if name = 'MedicationDispense' then
result := newMedicationDispense()
else if name = 'MedicationPrescription.dosageInstruction' then
result := newMedicationPrescriptionDosageInstruction()
else if name = 'MedicationPrescription.dispense' then
result := newMedicationPrescriptionDispense()
else if name = 'MedicationPrescription.substitution' then
result := newMedicationPrescriptionSubstitution()
else if name = 'MedicationPrescription' then
result := newMedicationPrescription()
else if name = 'MedicationStatement.dosage' then
result := newMedicationStatementDosage()
else if name = 'MedicationStatement' then
result := newMedicationStatement()
else if name = 'MessageHeader.response' then
result := newMessageHeaderResponse()
else if name = 'MessageHeader.source' then
result := newMessageHeaderSource()
else if name = 'MessageHeader.destination' then
result := newMessageHeaderDestination()
else if name = 'MessageHeader' then
result := newMessageHeader()
else if name = 'Observation.referenceRange' then
result := newObservationReferenceRange()
else if name = 'Observation.related' then
result := newObservationRelated()
else if name = 'Observation' then
result := newObservation()
else if name = 'OperationOutcome.issue' then
result := newOperationOutcomeIssue()
else if name = 'OperationOutcome' then
result := newOperationOutcome()
else if name = 'Order.when' then
result := newOrderWhen()
else if name = 'Order' then
result := newOrder()
else if name = 'OrderResponse' then
result := newOrderResponse()
else if name = 'Organization.contact' then
result := newOrganizationContact()
else if name = 'Organization' then
result := newOrganization()
else if name = 'Other' then
result := newOther()
else if name = 'Patient.contact' then
result := newPatientContact()
else if name = 'Patient.animal' then
result := newPatientAnimal()
else if name = 'Patient.link' then
result := newPatientLink()
else if name = 'Patient' then
result := newPatient()
else if name = 'Practitioner.qualification' then
result := newPractitionerQualification()
else if name = 'Practitioner' then
result := newPractitioner()
else if name = 'Procedure.performer' then
result := newProcedurePerformer()
else if name = 'Procedure.relatedItem' then
result := newProcedureRelatedItem()
else if name = 'Procedure' then
result := newProcedure()
else if name = 'Profile.mapping' then
result := newProfileMapping()
else if name = 'Profile.structure' then
result := newProfileStructure()
else if name = 'Profile.structure.element' then
result := newProfileStructureElement()
else if name = 'Profile.structure.element.slicing' then
result := newProfileStructureElementSlicing()
else if name = 'Profile.structure.element.definition' then
result := newProfileStructureElementDefinition()
else if name = 'Profile.structure.element.definition.type' then
result := newProfileStructureElementDefinitionType()
else if name = 'Profile.structure.element.definition.constraint' then
result := newProfileStructureElementDefinitionConstraint()
else if name = 'Profile.structure.element.definition.binding' then
result := newProfileStructureElementDefinitionBinding()
else if name = 'Profile.structure.element.definition.mapping' then
result := newProfileStructureElementDefinitionMapping()
else if name = 'Profile.structure.searchParam' then
result := newProfileStructureSearchParam()
else if name = 'Profile.extensionDefn' then
result := newProfileExtensionDefn()
else if name = 'Profile.query' then
result := newProfileQuery()
else if name = 'Profile' then
result := newProfile()
else if name = 'Provenance.agent' then
result := newProvenanceAgent()
else if name = 'Provenance.entity' then
result := newProvenanceEntity()
else if name = 'Provenance' then
result := newProvenance()
else if name = 'Query.response' then
result := newQueryResponse()
else if name = 'Query' then
result := newQuery()
else if name = 'Questionnaire.group' then
result := newQuestionnaireGroup()
else if name = 'Questionnaire.group.question' then
result := newQuestionnaireGroupQuestion()
else if name = 'Questionnaire' then
result := newQuestionnaire()
else if name = 'RelatedPerson' then
result := newRelatedPerson()
else if name = 'SecurityEvent.event' then
result := newSecurityEventEvent()
else if name = 'SecurityEvent.participant' then
result := newSecurityEventParticipant()
else if name = 'SecurityEvent.participant.network' then
result := newSecurityEventParticipantNetwork()
else if name = 'SecurityEvent.source' then
result := newSecurityEventSource()
else if name = 'SecurityEvent.object' then
result := newSecurityEventObject()
else if name = 'SecurityEvent.object.detail' then
result := newSecurityEventObjectDetail()
else if name = 'SecurityEvent' then
result := newSecurityEvent()
else if name = 'Specimen.source' then
result := newSpecimenSource()
else if name = 'Specimen.collection' then
result := newSpecimenCollection()
else if name = 'Specimen.treatment' then
result := newSpecimenTreatment()
else if name = 'Specimen.container' then
result := newSpecimenContainer()
else if name = 'Specimen' then
result := newSpecimen()
else if name = 'Substance.instance' then
result := newSubstanceInstance()
else if name = 'Substance.ingredient' then
result := newSubstanceIngredient()
else if name = 'Substance' then
result := newSubstance()
else if name = 'Supply.dispense' then
result := newSupplyDispense()
else if name = 'Supply' then
result := newSupply()
else if name = 'ValueSet.define' then
result := newValueSetDefine()
else if name = 'ValueSet.define.concept' then
result := newValueSetDefineConcept()
else if name = 'ValueSet.compose' then
result := newValueSetCompose()
else if name = 'ValueSet.compose.include' then
result := newValueSetComposeInclude()
else if name = 'ValueSet.compose.include.filter' then
result := newValueSetComposeIncludeFilter()
else if name = 'ValueSet.expansion' then
result := newValueSetExpansion()
else if name = 'ValueSet.expansion.contains' then
result := newValueSetExpansionContains()
else if name = 'ValueSet' then
result := newValueSet()
else
result := nil;
end;
end.
|
// NAME: TUMAKOV KIRILL ALEKSANDROVICH, 203
// ASGN: N2
unit NumberDialog;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm2 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
BitBtn1: TBitBtn;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
function RequestNumber(Caption, Request:string; DefaultValue:Integer):Integer;
function RequestFloat(Caption, Request:string; DefaultValue:Single):Single;
implementation
{$R *.dfm}
function RequestNumber(Caption, Request:string; DefaultValue:Integer):Integer;
begin;
Form2.Label1.Caption:=Request;
Form2.Edit1.Text:='';
Form2.Caption:=Caption;
Form2.ShowModal;
try
Result:=StrToInt(Form2.Edit1.Text);
except
on E:Exception do
Result:=DefaultValue;
end;
end;
function RequestFloat(Caption, Request:string; DefaultValue:Single):Single;
var s:String;
begin;
Form2.Label1.Caption:=Request;
Form2.Edit1.Text:='';
Form2.Caption:=Caption;
Form2.ShowModal;
try
s:=Form2.Edit1.Text;
while pos('.',s)<>0 do s[pos('.',s)]:=',';
Result:=StrToFloat(s);
except
on E:Exception do
Result:=DefaultValue;
end;
end;
end.
|
unit uWashDetail;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, DBCtrls, Mask, Grids, DBGrids, FMTBcd, DB,
DBClient, Provider, SqlExpr, Buttons, DBGridEhGrouping, ToolCtrlsEh,
DBGridEhToolCtrls, DynVarsEh, EhLibVCL, GridsEh, DBAxisGridsEh, DBGridEh,
DBCGrids, ExtCtrls, uNewOrganization, uNewDriver;
type
TfrmWashDetail = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
pkWashDate: TDateTimePicker;
pkWashTimeBegin: TDateTimePicker;
pkWashTimeEnd: TDateTimePicker;
GroupBox2: TGroupBox;
Label4: TLabel;
Label5: TLabel;
GroupBox3: TGroupBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
GroupBox5: TGroupBox;
Label13: TLabel;
Label14: TLabel;
txtHoleCnt: TDBEdit;
GroupBox6: TGroupBox;
Label15: TLabel;
txtWashSum: TDBText;
qWash: TSQLQuery;
prvWash: TDataSetProvider;
cdsWash: TClientDataSet;
dsWash: TDataSource;
btnSave: TBitBtn;
btnCancel: TBitBtn;
btAddNewOrg: TSpeedButton;
btAddNewDr: TSpeedButton;
txtOrgName: TDBLookupComboBox;
cboDrSName: TDBLookupComboBox;
cboDrFName: TDBLookupComboBox;
cboDrTName: TDBLookupComboBox;
cdoOrgTel: TDBLookupComboBox;
cboDrTel: TDBLookupComboBox;
GroupBox4: TGroupBox;
Label11: TLabel;
cdsWashW_ID: TIntegerField;
cdsWashOP_ID: TIntegerField;
cdsWashWS_ID: TIntegerField;
cdsWashORG_ID: TIntegerField;
cdsWashC_ID: TIntegerField;
cdsWashD_ID: TIntegerField;
cdsWashT_ID: TIntegerField;
cdsWashW_SUMM: TFloatField;
cdsWashW_TIME_BEGIN: TSQLTimeStampField;
cdsWashW_TIME_END: TSQLTimeStampField;
cdsWashW_DATE: TSQLTimeStampField;
cboCarNum: TDBLookupComboBox;
btAddCar: TSpeedButton;
cboTankN: TDBLookupComboBox;
txtOrgType: TDBEdit;
prvWasDetail: TDataSetProvider;
cdsWashDetail: TClientDataSet;
dsWashDetail: TDataSource;
qWashDetail: TSQLQuery;
cdsWashDetailWD_ID: TIntegerField;
cdsWashDetailW_ID: TIntegerField;
cdsWashDetailWD_HOLE_ST: TIntegerField;
cdsWashDetailLQ_ID: TIntegerField;
cdsWashDetailWD_PRICE: TFloatField;
cdsWashDetailHOLE_NO: TIntegerField;
cdsWashDetailLQ_NAME: TStringField;
grHolesInfo: TDBGrid;
imgEditHole: TImage;
cdsWashORGT_ID: TIntegerField;
cdsWashORGT_NAME: TStringField;
cdsWashT_HOLE_CNT: TIntegerField;
procedure cdsWashORG_IDChange(Sender: TField);
procedure cdsWashD_IDChange(Sender: TField);
procedure btnSaveClick(Sender: TObject);
procedure grHolesInfoDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure grHolesInfoCellClick(Column: TColumn);
procedure btAddCarClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btAddNewOrgClick(Sender: TObject);
procedure btAddNewDrClick(Sender: TObject);
private
{ Private declarations }
op_id:integer;
frmNewOrg: TfrmNewOrg;
frmNewDriver: TfrmNewDriver;
procedure AddHoles(holes_cnt: integer);
public
{ Public declarations }
procedure Edit(w_id: integer);
procedure Add(op_id: integer);
end;
implementation
uses uData, uGlobals, SqlTimSt, uTest;
{$R *.dfm}
{ TfrmWashDetail }
procedure TfrmWashDetail.Add(op_id:integer);
begin
self.op_id := op_id;
pkWashDate.Date := Date;
pkWashTimeBegin.Time := Time;
pkWashTimeEnd.Time := Time;
cdsWash.Close;
cdsWash.Params.ParamByName('w_id').AsInteger := -1;
cdsWash.Open;
cdsWash.Insert;
cdsWashW_ID.AsInteger := data.getGeneratorValue('GEN_WASH_ID', true);
cdsWashOP_ID.AsInteger := op_id;
cdsWashWS_ID.AsInteger := W_BEGIN;
cdsWashDetail.Close;
cdsWashDetail.Params.ParamByName('w_id').AsInteger := -1;
cdsWashDetail.Open;
ShowModal;
end;
procedure TfrmWashDetail.AddHoles(holes_cnt: integer);
var i:integer;
begin
for i := 0 to holes_cnt - 1 do
begin
cdsWashDetail.Insert;
cdsWashDetailWD_ID.AsInteger := data.getGeneratorValue('GEN_WASH_DETAIL_ID', true);
cdsWashDetailW_ID.AsInteger := cdsWashW_ID.AsInteger;
cdsWashDetailWD_HOLE_ST.AsInteger := 2;
cdsWashDetailHOLE_NO.AsInteger := i + 1;
cdsWashDetailLQ_ID.AsInteger := 0;
end;
end;
procedure TfrmWashDetail.btAddCarClick(Sender: TObject);
begin
if not Assigned(frmTest) then frmTest := TfrmTest.Create(self);
frmTest.cdsNewItem.Open;
frmTest.cdsNewItem.Insert;
frmTest.ShowModal;
freeAndNil(frmTest);
end;
procedure TfrmWashDetail.btAddNewDrClick(Sender: TObject);
begin
if cdsWashORG_ID.IsNull then
begin
messageBox(handle, 'Установите сначала организацию', 'Ошибка', MB_OK or MB_ICONERROR);
exit;
end;
if not Assigned(frmNewDriver) then frmNewDriver := TfrmNewDriver.Create(self);
if frmNewDriver.Add(cdsWashORG_ID.AsInteger) = mrOk then
begin
cdsWashD_ID.AsInteger := frmNewDriver.cdsNewDriverD_ID.AsInteger;
cdsWashC_ID.AsInteger := frmNewDriver.cdsNewCarC_ID.AsInteger;
cdsWashT_ID.AsInteger := frmNewDriver.cdsNewTankT_ID.AsInteger;
if not cdsWashT_ID.IsNull then AddHoles(frmNewDriver.cdsNewTankT_HOLE_CNT.AsInteger);
end;
end;
procedure TfrmWashDetail.btAddNewOrgClick(Sender: TObject);
begin
if not Assigned(frmNewOrg) then frmNewOrg := TfrmNewOrg.Create(self);
if frmNewOrg.Add(cdsWashOP_ID.AsInteger) = mrOK then
cdsWashORG_ID.AsInteger := frmNewOrg.cdsNewOrgORG_ID.AsInteger;
end;
procedure TfrmWashDetail.btnSaveClick(Sender: TObject);
begin
cdsWashW_DATE.AsSQLTimeStamp := DateTimeToSQLTimeStamp(pkWashDate.Date);
cdsWashW_TIME_BEGIN.AsSQLTimeStamp := DateTimeToSQLTimeStamp(pkWashTimeBegin.Date);
cdsWashW_TIME_END.AsSQLTimeStamp := DateTimeToSQLTimeStamp(pkWashTimeEnd.Date);
cdsWash.CheckBrowseMode;
cdsWash.ApplyUpdates(0);
cdsWashDetail.CheckBrowseMode;
cdsWashDetail.ApplyUpdates(0);
ModalResult := mrOK;
end;
procedure TfrmWashDetail.cdsWashD_IDChange(Sender: TField);
begin
data.filterDictionary(data.cdsCar, 'D_ID=' + Sender.AsString);
cdsWashC_ID.Clear;
end;
procedure TfrmWashDetail.cdsWashORG_IDChange(Sender: TField);
begin
data.filterDictionary(data.cdsDriver, 'ORG_ID=' + Sender.AsString);
cdsWashD_ID.OnChange := nil;
cdsWashD_ID.Clear;
cdsWashD_ID.OnChange := cdsWashD_IDChange;
cdsWashC_ID.Clear;
cdsWashT_ID.Clear;
txtHoleCnt.Text := '';
cdsWashDetail.EmptyDataSet;
end;
procedure TfrmWashDetail.Edit(w_id: integer);
begin
cdsWash.Close;
cdsWash.Params.ParamByName('w_id').AsInteger := w_id;
cdsWash.Open;
cdsWash.Edit;
cdsWashDetail.Close;
cdsWashDetail.Params.ParamByName('w_id').AsInteger := w_id;
cdsWashDetail.Open;
pkWashDate.Date := cdsWashW_DATE.AsDateTime;
pkWashTimeBegin.Time := TTime(cdsWashW_TIME_BEGIN.AsDateTime);
pkWashTimeEnd.Time := TTime(cdsWashW_TIME_END.AsDateTime);
data.filterDictionary(data.cdsDriver, 'ORG_ID=' + cdsWashORG_ID.AsString);
data.filterDictionary(data.cdsCar, 'D_ID=' + cdsWashD_ID.AsString);
ShowModal;
end;
procedure TfrmWashDetail.FormDestroy(Sender: TObject);
begin
freeAndNil(frmNewOrg);
freeAndNil(frmNewDriver);
end;
procedure TfrmWashDetail.grHolesInfoCellClick(Column: TColumn);
begin
if Column.FieldName = '' then
begin
showMessage('Edit Rec ' + cdsWashDetailHOLE_NO.AsString)
end
end;
procedure TfrmWashDetail.grHolesInfoDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Column.FieldName = '' then
begin
grHolesInfo.Canvas.FillRect(rect);
grHolesInfo.Canvas.Draw(rect.Left, rect.Top, imgEditHole.Picture.Bitmap);
end
end;
end.
|
unit PascalCoin.RPC.API.Base;
interface
Uses
System.JSON,
System.Generics.Collections,
PascalCoin.RPC.Interfaces;
Type
TPascalCoinAPIBase = Class(TInterfacedObject, IPascalCoinBaseAPI)
Private
Protected
FClient: IPascalCoinRPCClient;
FLastError: String;
// FTools: IPascalCoinTools;
Function PublicKeyParam(Const AKey: String; Const AKeyStyle: TKeyStyle): TParamPair;
Function GetNodeURI: String;
Procedure SetNodeURI(Const Value: String);
Function GetLastError: String;
Function GetJSONResult: TJSONValue;
Function GetJSONResultStr: String;
Function ResultAsObj: TJSONObject;
Function ResultAsArray: TJSONArray;
Constructor Create(AClient: IPascalCoinRPCClient);
End;
implementation
Uses PascalCoin.Utils;
{ TPascalCoinAPIBase }
constructor TPascalCoinAPIBase.Create(AClient: IPascalCoinRPCClient);
begin
inherited Create;
FClient := AClient;
end;
function TPascalCoinAPIBase.GetJSONResult: TJSONValue;
begin
result := FClient.ResponseObject.GetValue('result');
end;
function TPascalCoinAPIBase.GetJSONResultStr: String;
begin
result := FClient.ResponseStr;
end;
function TPascalCoinAPIBase.GetLastError: String;
begin
result := FLastError;
end;
function TPascalCoinAPIBase.GetNodeURI: String;
begin
result := FClient.NodeURI;
end;
function TPascalCoinAPIBase.PublicKeyParam(const AKey: String; const AKeyStyle: TKeyStyle): TParamPair;
Const
_KeyType: Array [Boolean] Of String = ('b58_pubkey', 'enc_pubkey');
Begin
Case AKeyStyle Of
ksUnkown:
result := TParamPair.Create(_KeyType[TPascalCoinUtils.IsHexaString(AKey)], AKey);
ksEncKey:
result := TParamPair.Create('enc_pubkey', AKey);
ksB58Key:
result := TParamPair.Create('b58_pubkey', AKey);
End;
end;
function TPascalCoinAPIBase.ResultAsArray: TJSONArray;
begin
Result := GetJSONResult as TJSONArray;
end;
function TPascalCoinAPIBase.ResultAsObj: TJSONObject;
begin
Result := GetJSONResult as TJSONObject;
end;
procedure TPascalCoinAPIBase.SetNodeURI(const Value: String);
begin
FClient.NodeURI := Value;
end;
end.
|
Unit PascalCoin.Utils;
Interface
uses PascalCoin.RPC.Interfaces;
Type
TPascalCoinUtils = Class
Private
Public
Class Function IsHexaString(Const Value: String): Boolean; Static;
Class Function AccountNumberCheckSum(Const Value: Cardinal): Integer; Static;
Class Function AccountNumberWithCheckSum(Const Value: Cardinal): String; Static;
Class Function ValidAccountNumber(Const Value: String): Boolean; Static;
Class Function AccountNumber(Const Value: String): Cardinal; Static;
class procedure SplitAccount(Const Value: String; Out AccountNumber: Cardinal;
Out CheckSum: Integer); static;
Class Function ValidateAccountName(Const Value: String): Boolean; Static;
Class Function BlocksToRecovery(Const LatestBlock, LastActiveBlock: Integer): Integer; static;
Class Function DaysToRecovery(Const LatestBlock, LastActiveBlock: Integer): Double; static;
Class Function KeyStyle(const AKey: String): TKeyStyle; static;
Class Function UnixToLocalDate(Const Value: Integer): TDateTime; Static;
Class Function StrToHex(Const Value: String): String; Static;
End;
Implementation
Uses
System.SysUtils,
System.DateUtils,
clpConverters,
clpEncoders,
PascalCoin.RPC.Consts;
{ TPascalCoinTools }
class function TPascalCoinUtils.AccountNumber(const Value: String): Cardinal;
var lCheckSum: Integer;
begin
SplitAccount(Value, Result, lCheckSum);
end;
Class Function TPascalCoinUtils.AccountNumberCheckSum(Const Value: Cardinal): Integer;
Var
lVal: Int64;
Begin
lVal := Value;
result := ((lVal * 101) MOD 89) + 10;
End;
class function TPascalCoinUtils.AccountNumberWithCheckSum(const Value: Cardinal): String;
begin
Result := Value.ToString + '-' + AccountNumberCheckSum(Value).ToString;
end;
class function TPascalCoinUtils.BlocksToRecovery(const LatestBlock, LastActiveBlock: Integer): Integer;
begin
Result := (LastActiveBlock + RECOVERY_WAIT_BLOCKS) - LatestBlock;
end;
class function TPascalCoinUtils.DaysToRecovery(const LatestBlock, LastActiveBlock: Integer): Double;
begin
Result := BlocksToRecovery(LatestBlock, LastActiveBlock) / BLOCKS_PER_DAY;
end;
Class Function TPascalCoinUtils.IsHexaString(Const Value: String): Boolean;
Var
i: Integer;
Begin
if Value.Length mod 2 > 0 then
Exit(False);
result := true;
For i := Low(Value) To High(Value) Do
If (NOT CharInSet(Value[i], PASCALCOIN_HEXA))Then
Begin
Exit(false);
End;
End;
class function TPascalCoinUtils.KeyStyle(const AKey: String): TKeyStyle;
begin
if IsHexaString(AKey) then
Result := TKeyStyle.ksEncKey
else //if B58Key(AKey)
Result := TKeyStyle.ksB58Key;
// else
// Result := TKeyStyle.ksUnkown
end;
Class Procedure TPascalCoinUtils.SplitAccount(Const Value: String; Out AccountNumber: Cardinal;
Out CheckSum: Integer);
Var
lVal: TArray<String>;
Begin
If Value.IndexOf('-') > 0 Then
Begin
lVal := Value.Trim.Split(['-']);
AccountNumber := lVal[0].ToInt64;
CheckSum := lVal[1].ToInteger;
End
Else
Begin
AccountNumber := Value.ToInt64;
CheckSum := -1;
End;
End;
Class Function TPascalCoinUtils.StrToHex(Const Value: String): String;
Begin
result := THex.Encode(TConverters.ConvertStringToBytes(Value, TEncoding.ANSI));
End;
Class Function TPascalCoinUtils.UnixToLocalDate(Const Value: Integer): TDateTime;
Begin
Result := TTimeZone.Local.ToLocalTime(UnixToDateTime(Value));
End;
Class Function TPascalCoinUtils.ValidAccountNumber(Const Value: String): Boolean;
Var
lVal: TArray<String>;
lChk: Integer;
lAcct: Int64;
Begin
result := false;
lVal := Value.Trim.Split(['-']);
If length(lVal) = 1 Then
Begin
If TryStrToInt64(lVal[0], lAcct) Then
result := true;
End
Else
Begin
If TryStrToInt64(lVal[0], lAcct) Then
Begin
lChk := AccountNumberCheckSum(lVal[0].Trim.ToInt64);
result := lChk = lVal[1].Trim.ToInteger;
End;
End;
End;
Class Function TPascalCoinUtils.ValidateAccountName(Const Value: String): Boolean;
Var
i: Integer;
Begin
result := true;
If Value = '' Then
exit;
If Not CharInSet(Value.Chars[0], PASCALCOIN_ENCODING_START) Then
exit(false);
If Value.length < 3 Then
exit(false);
If Value.length > 64 Then
exit(false);
For i := 0 To Value.length - 1 Do
Begin
If Not CharInSet(Value.Chars[i], PASCALCOIN_ENCODING) Then
exit(false);
End;
End;
End.
|
(*
Example of usage
Ini1: TIni;
Ini1.FileName:='d:\path\foo.ini';
ini1.enabled:=true;
ini1.find('section','item','default');
result:=ini1.AsString;
ini1.enabled:=false;
*)
unit Ini;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, IniFiles;
type
EIniConversion = class(Exception);
TIni = class(TComponent)
private
{ Private declarations }
fIniFile: TIniFile;
fFileName: string;
fSection: string;
fKey: string;
fValue: string;
fEnabled: Boolean;
fYes : TStringList;
fNo : TStringList;
fOnCreateFailure: TNotifyEvent;
fConvertedFalse : string;
fConvertedTrue : string;
protected
{ Protected declarations }
procedure SetBoolean(aValue: Boolean);Virtual;
procedure SetInteger(aValue: LongInt);Virtual;
procedure SetString(aValue: string);Virtual;
procedure SetKey(aValue: string);Virtual;
procedure SetEnabled(aValue: Boolean);Virtual;
procedure SetDateTime(aValue: TDateTime);Virtual;
function GetBoolean: Boolean;Virtual;
function GetInteger: LongInt;Virtual;
function GetString: string;Virtual;
function GetDateTime: TDateTime;Virtual;
procedure SetFilename(aFileName: string);Virtual;
function FindIniFile(Ini: string):string;Virtual;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Free;
procedure Load;
procedure Post;
function Find(aSection, aKey, aDefault: string): String;
procedure Store(aSection, aKey, aValue: string);
{------------------------ Public properties ----------------------------}
{---
--- ONLY AVAILABLE AT RUN TIME
---
}
property AsBoolean : Boolean
read GetBoolean
write SetBoolean;
property AsInteger : LongInt
read GetInteger
write SetInteger;
property AsDateTime : TDateTime
read GetDateTime
write SetDateTime;
property AsString : string
read GetString
write SetString;
published
{ Published declarations }
property Name;
property Tag;
property Section : string
read fSection
write fSection;
property Key : string
read fKey
write SetKey;
property Enabled : Boolean
read fEnabled
write SetEnabled;
property FileName : string
read fFilename
write SetFilename;
property TokensTrue : TStringList
read fYes
write fYes;
property TokensFalse : TStringList
read fNo
write fNo;
property ConvertedFalse : string
read fConvertedFalse
write fConvertedFalse;
property ConvertedTrue : string
read fConvertedTrue
write fConvertedTrue;
{ Events }
property OnCreateFailure: TNotifyEvent
read fOnCreateFailure
write fOnCreateFailure;
end;
{ Behaves like TIni, but does NOT reference the
win.ini file. A blank file name will force the
object to be disabled.
}
TIniNoWin = class(TIni)
protected
procedure SetFileName( aFileName : string); override;
public
property AsBoolean;
property AsInteger;
property AsDateTime;
property AsString;
published
property Name;
property Tag;
property Section;
property Key;
property Enabled;
property FileName;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('System', [TIni,TIniNoWin]);
end;
destructor TIni.Destroy;
begin
if Assigned(fYes) then
fYes.Free;
if Assigned(fNo) then
fNo.Free;
//if Assigned(fIniFile) then
//fIniFile.Free;
inherited Destroy;
end;
constructor Tini.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fEnabled := False;
if fFileName = '' then
begin
FileName:='WIN.INI';
end
else
begin
FileName:=fFileName;
end;
fConvertedFalse := 'False';
fConvertedTrue := 'True';
if not Assigned(fYes) then
begin
fYes := TStringList.Create;
fYes.Clear;
fYes.Add('True');
fYes.Add('true');
fYes.Add('Yes');
fYes.Add('yes');
fYes.Add('1');
fYes.Add('Y');
fYes.Add('y');
end;
if not Assigned(fNo) then
begin
fNo := TStringList.Create;
fNo.Clear;
fNo.Add('False');
fNo.Add('false');
fNo.Add('No');
fNo.Add('no');
fNo.Add('0');
fNo.Add('N');
fNo.Add('n');
end;
end;
function TIni.Find(aSection, aKey, aDefault: string): String;
begin
Section := aSection;
Key := aKey;
AsString := aDefault;
Load;
result:=fValue;
end;
procedure TIni.Store(aSection, aKey, aValue: string);
begin
Section := aSection;
Key := aKey;
AsString := aValue;
Post;
end;
procedure TIni.Free;
begin
if Enabled then
begin
Post;
fIniFile.Free;
end;
//fYes.Free;
//fNo.Free;
inherited free;
end;
procedure TIni.SetBoolean(aValue: Boolean);
begin
case aValue of
True: fValue := fConvertedTrue;
False: fValue := fConvertedFalse;
end;
end;
procedure TIni.SetInteger(aValue: LongInt);
begin
fValue := IntToStr(aValue)
end;
procedure TIni.SetString(aValue: string);
begin
fValue := aValue;
end;
function TIni.GetBoolean: Boolean;
var
Index : Word;
begin
for Index := 0 to fYes.Count - 1 do
begin
if fYes.Strings[Index] = fValue then
begin
Result := True;
Exit;
end;
end;
for Index := 0 to fNo.Count - 1 do
begin
if fNo.Strings[Index] = fValue then
begin
Result := False;
Exit;
end
end;
// Raise EIniConversion.Create('Can not convert ''' + fValue + ''' to boolean');
Result := False;
end;
function TIni.GetInteger: LongInt;
begin
Result := StrToInt(fValue)
end;
function TIni.GetString: string;
begin
Result := fValue
end;
procedure TIni.SetFileName(aFilename: string);
begin
if fEnabled then
begin
ShowMessage('You can not change the file name of'+chr(13)+chr(10)
+'an INI component while it is active');
exit;
end;
if aFileName = '' then aFileName := 'WIN.INI';
{ Expand the file with its path info }
fFileName:=FindIniFile(aFileName);
if length(fFileName)=0 then
begin
if Assigned(fOnCreateFailure) then fOnCreateFailure(self);
end;
fIniFile.Free;
fIniFile := TIniFile.Create(fFileName);
end;
procedure TIni.Post;
begin
if fEnabled and (fKey <> '') then
try
fIniFile.WriteString(fSection, fKey, fValue);
except
end;
end;
function TIni.GetDateTime: TDateTime;
begin
Result := StrToDateTime(fValue)
end;
procedure TIni.SetDateTime(aValue: TDateTime);
begin
fValue := DateTimeToStr(aValue);
end;
procedure TIni.Load;
begin
if fKey = '' then exit;
if fSection = '' then exit;
if fFileName = '' then exit;
if fEnabled then
fValue := fIniFile.ReadString(fSection, fKey, fValue)
end;
procedure TIni.SetKey(aValue: string);
begin
fKey := aValue;
end;
procedure TIni.SetEnabled(aValue: Boolean);
begin
if aValue = fEnabled then exit;
if fEnabled = True then { disable the ini file }
begin
fIniFile.Free;
fEnabled := False;
end
else
begin
if fFileName = '' then fFileName := 'WIN.INI';
fFileName:=FindIniFile(fFileName);
fEnabled := True; { Enable the ini file }
fIniFile := TIniFile.Create(fFileName);
end
end;
{ *************************************************************** }
function TIni.FindIniFile(Ini: string):string;
var
WinDirP, SysDirP: array [0..255] of char;
WinDir, SysDir: string;
Size: Integer;
CurPath: String;
begin
Size:= 254;
{ First we should see if the INI file already has an explicit path
prepended to it. If so then we should just assign the return to
the input and exit }
if not (pos('\', ini)=0) then
begin
Result:=Ini;
exit;
end
else
Result:='';
CurPath:=ExtractFilePath(Application.ExeName);
if NOT FileExists(CurPath + Ini) then
begin
GetWindowsDirectory(WinDirP, Size);
WinDir:=string(WinDirP);
if NOT FileExists(WinDir + '\'+ Ini) then
begin
GetSystemDirectory(SysDirP, Size);
SysDir:=string(SysDirP);
if NOT FileExists(SysDir + '\' + Ini) then
begin
Result:='';
end
else
begin { Found it in the Windows System directory }
result:= SysDir + '\' + ini;
end;
end
else
begin { Found it in the Windows Root }
result:= WinDir + '\' + ini;
end;
end
else
begin { Found it in the CurPath }
result:= CurPath + ini;
end;
end;
{================================================================
This alters the behaviour of TIni so that it does not use
win.ini. Instead, it will disable the TIni instance if the
file name is zero length
================================================================ }
procedure TIniNoWin.SetFileName(aFilename: string);
begin
if aFileName = '' then begin
SetEnabled( False );
Exit;
end;
if fEnabled then begin
ShowMessage('You can not change the file name of'+chr(13)+chr(10)
+'an INI component while it is active');
exit;
end;
fFileName := aFileName;
fIniFile.Free;
fIniFile := TIniFile.Create(fFileName);
end;
end.
|
unit UServer;
interface
uses
Windows,
SysUtils,
WinSock,
eiTypes,
eiHelpers,
eiExceptions,
eiConstants,
UServerTypes,
ULogger,
UListenUdpThread,
UResponseUdpThread,
UListenTcpThread,
UResponseTcpThread,
UPacketHandlers,
UDevices;
type
TServer = class(TInterfacedObject, IServer)
private
FChargenTcpListener: TListenTcpThread;
FChargenUdpListener: TListenUdpThread;
FCommandTcpListener: TListenTcpThread;
FCommandUdpListener: TListenUdpThread;
FDaytimeTcpListener: TListenTcpThread;
FDaytimeUdpListener: TListenUdpThread;
FEasyIpDevice: IDevice;
FEasyIpListener: TListenUdpThread;
FEchoTcpListener: TListenTcpThread;
FEchoUdpListener: TListenUdpThread;
FLogger: ILogger;
FSearchListener: TListenUdpThread;
constructor Create; overload;
procedure OnChargenTcpRequest(Sender: TObject; request: RequestStruct);
procedure OnChargenUdpRequest(Sender: TObject; request: RequestStruct);
procedure OnCommandTcpRequest(Sender: TObject; request: RequestStruct);
procedure OnCommandUdpRequest(Sender: TObject; request: RequestStruct);
procedure OnDaytimeTcpRequest(Sender: TObject; request: RequestStruct);
procedure OnDaytimeUdpRequest(Sender: TObject; request: RequestStruct);
procedure OnEasyIpRequest(Sender: TObject; request: RequestStruct);
procedure OnEchoTcpRequest(Sender: TObject; request: RequestStruct);
procedure OnEchoUdpRequest(Sender: TObject; request: RequestStruct);
procedure OnSearchRequest(Sender: TObject; request: RequestStruct);
public
constructor Create(logger: ILogger); overload;
destructor Destroy; override;
procedure Start;
procedure Stop;
end;
implementation
constructor TServer.Create;
begin
end;
constructor TServer.Create(logger: ILogger);
const
ECHO_PORT = 7;
CHARGEN_PORT = 19;
DAYTIME_PORT = 13;
SEARCH_PORT = 990;
COMMAND_PORT = 991;
begin
inherited Create();
FLogger := logger;
FLogger.Log('Starting server...', '%s');
FEasyIpDevice := TEasyIpDevice.Create(FLogger);
FChargenTcpListener := TListenTcpThread.Create(FLogger, CHARGEN_PORT);
FChargenTcpListener.OnReceive := OnChargenTcpRequest;
FChargenUdpListener := TListenUdpThread.Create(FLogger, CHARGEN_PORT);
FChargenUdpListener.OnReceive := OnChargenUdpRequest;
FCommandTcpListener := TListenTcpThread.Create(FLogger, COMMAND_PORT);
FCommandTcpListener.OnReceive := OnCommandTcpRequest;
FCommandUdpListener := TListenUdpThread.Create(FLogger, COMMAND_PORT);
FCommandUdpListener.OnReceive := OnCommandUdpRequest;
FDaytimeTcpListener := TListenTcpThread.Create(FLogger, DAYTIME_PORT);
FDaytimeTcpListener.OnReceive := OnDaytimeTcpRequest;
FDaytimeUdpListener := TListenUdpThread.Create(FLogger, DAYTIME_PORT);
FDaytimeUdpListener.OnReceive := OnDaytimeUdpRequest;
FEasyIpListener := TListenUdpThread.Create(FLogger, EASYIP_PORT);
FEasyIpListener.OnReceive := OnEasyIpRequest;
FEchoTcpListener := TListenTcpThread.Create(FLogger, ECHO_PORT);
FEchoTcpListener.OnReceive := OnEchoTcpRequest;
FEchoUdpListener := TListenUdpThread.Create(FLogger, ECHO_PORT);
FEchoUdpListener.OnReceive := OnEchoUdpRequest;
FSearchListener := TListenUdpThread.Create(FLogger, SEARCH_PORT);
FSearchListener.OnReceive := OnSearchRequest;
end;
destructor TServer.Destroy;
begin
FLogger.Log('Stopping server...');
Stop();
inherited;
end;
procedure TServer.OnChargenTcpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnChargenTcpRequest occured');
request.Handler := TChargenHandler.Create(FLogger);
with TResponseTcpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnChargenUdpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnChargenUdpRequest occured');
request.Handler := TChargenHandler.Create(FLogger);
with TResponseUdpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnCommandTcpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnCommandTcpRequest occured');
request.Handler := TCommandHandler.Create(FLogger);
with TResponseTcpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnCommandUdpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnCommandUdpRequest occured');
request.Handler := TCommandHandler.Create(FLogger);
with TResponseUdpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnDaytimeTcpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnDaytimeTcpRequest occured');
request.Handler := TDaytimeHandler.Create(FLogger);
with TResponseTcpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnDaytimeUdpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnDaytimeUdpRequest occured');
request.Handler := TDaytimeHandler.Create(FLogger);
with TResponseUdpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnEasyIpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnEasyIpRequest occured');
request.Handler := TEasyIpHandler.Create(FLogger, FEasyIpDevice);
with TResponseUdpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnEchoTcpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnEchoTcpRequest occured');
request.Handler := TEchoHandler.Create(FLogger);
with TResponseTcpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnEchoUdpRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnEchoUdpRequest occured');
request.Handler := TEchoHandler.Create(FLogger);
with TResponseUdpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.OnSearchRequest(Sender: TObject; request: RequestStruct);
begin
FLogger.Log('OnSearchRequest occured');
request.Handler := TSearchHandler.Create(FLogger);
with TResponseUdpThread.Create(FLogger, request) do
Resume;
end;
procedure TServer.Start;
begin
FChargenTcpListener.Resume();
FChargenUdpListener.Resume();
FCommandTcpListener.Resume();
FCommandUdpListener.Resume();
FDaytimeTcpListener.Resume();
FDaytimeUdpListener.Resume();
FEasyIpListener.Resume();
FEchoTcpListener.Resume();
FEchoUdpListener.Resume();
FSearchListener.Resume();
FLogger.Log('Server is started.', '%s');
end;
procedure TServer.Stop;
begin
FChargenTcpListener.Cancel();
FChargenUdpListener.Cancel();
FCommandTcpListener.Cancel();
FCommandUdpListener.Cancel();
FDaytimeTcpListener.Cancel();
FDaytimeUdpListener.Cancel();
FEasyIpListener.Cancel();
FEchoTcpListener.Cancel();
FEchoUdpListener.Cancel();
FSearchListener.Cancel();
end;
end.
|
unit ServerUnit;
{$I mormot.defines.inc}
interface
uses
Classes,
SysUtils,
mormot.core.base,
mormot.core.interfaces,
mormot.rest.http.server,
mormot.rest.memserver,
mormot.soa.core,
mormot.core.os,
SharedInterface;
type
{ TChatService }
TChatService = class(TInterfacedObject,IChatService)
protected
fConnected: array of IChatCallback;
public
procedure Join(const pseudo: string; const callback: IChatCallback);
procedure BlaBla(const pseudo,msg: string);
procedure CallbackReleased(const callback: IInvokable; const interfaceName: RawUTF8);
end;
{ TServer }
TServer = class
public
procedure Run;
end;
implementation
{ TServer }
procedure TServer.Run;
var
HttpServer: TRestHttpServer;
Server: TRestServerFullMemory;
AChatService: IChatService;
begin
Server := TRestServerFullMemory.CreateWithOwnModel([]);
try
Server.ServiceDefine(TChatService,[IChatService],sicShared).
SetOptions([],[optExecLockedPerInterface]). // thread-safe fConnected[]
ByPassAuthentication := true;
HttpServer := TRestHttpServer.Create('8888',[Server],'+',useBidirSocket);
try
HttpServer.WebSocketsEnable(Server,PROJECTEST_TRANSMISSION_KEY).
Settings.SetFullLog; // full verbose logs for this demo
TextColor(ccLightGreen);
writeln('WebSockets Chat Server running on localhost:8888'#13#10);
TextColor(ccWhite);
writeln('Please compile and run Client.exe'#13#10);
TextColor(ccLightGray);
writeln('Press [Enter] to quit'#13#10);
TextColor(ccCyan);
readln;
finally
HttpServer.Free;
end;
finally
Server.Free;
end;
end;
{ TChatService }
procedure TChatService.Join(const pseudo: string; const callback: IChatCallback);
begin
InterfaceArrayAdd(fConnected,callback);
end;
procedure TChatService.BlaBla(const pseudo, msg: string);
var i: integer;
begin
for i := high(fConnected) downto 0 do // downwards for InterfaceArrayDelete()
try
fConnected[i].NotifyBlaBla(pseudo, msg);
except
InterfaceArrayDelete(fConnected,i); // unsubscribe the callback on failure
end;
end;
procedure TChatService.CallbackReleased(const callback: IInvokable; const interfaceName: RawUTF8);
begin
if interfaceName='IChatCallback' then
InterfaceArrayDelete(fConnected,callback);
end;
end.
|
unit fCanteiro;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, fBasicoCrud, cxGraphics, cxControls,
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack,
dxSkinscxPCPainter, dxBarBuiltInMenu, cxContainer, cxEdit, Vcl.ComCtrls,
dxCore, cxDateUtils, cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage,
cxNavigator, Data.DB, cxDBData, cxButtonEdit, cxLocalization, System.Actions,
Vcl.ActnList, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxGridCustomView, cxGrid, cxGroupBox,
cxRadioGroup, Vcl.StdCtrls, cxDropDownEdit, cxImageComboBox, cxTextEdit,
cxMaskEdit, cxCalendar, Vcl.ExtCtrls, cxPC, dmuViveiro, cxDBEdit,
System.TypInfo, uControleAcesso, dmuPrincipal, uTypes, Vcl.ExtDlgs;
type
TCanteiro = class(TModelo)
private
FNome: String;
procedure SetNome(const Value: String);
public
property Nome: String read FNome write SetNome;
end;
TfrmCanteiro = class(TfrmBasicoCrud)
viewRegistrosID: TcxGridDBColumn;
viewRegistrosNOME: TcxGridDBColumn;
Label3: TLabel;
EditNome: TcxDBTextEdit;
procedure FormCreate(Sender: TObject);
private
dmViveiro: TdmViveiro;
protected
function fprGetPermissao: String; override;
procedure pprValidarDados; override;
{ Private declarations }
public
{ Public declarations }
end;
var
frmCanteiro: TfrmCanteiro;
implementation
{$R *.dfm}
procedure TfrmCanteiro.FormCreate(Sender: TObject);
begin
dmViveiro := TdmViveiro.Create(Self);
dmViveiro.Name := '';
inherited;
PesquisaPadrao := Ord(tppTodos);
end;
function TfrmCanteiro.fprGetPermissao: String;
begin
Result := GetEnumName(TypeInfo(TPermissaoViveiro), Ord(vivCanteiro));
end;
procedure TfrmCanteiro.pprValidarDados;
begin
inherited;
if not dmPrincipal.FuncoesViveiro.fpuValidarNomeCanteiro(dmViveiro.cdsMatrizID.AsInteger, dmViveiro.cdsMatrizNOME.AsString) then
raise Exception.Create('JŠ existe um canteiro com este nome. Por favor, informe outro nome.');
end;
{ TCanteiro }
procedure TCanteiro.SetNome(const Value: String);
begin
FNome := Value;
end;
end.
|
unit uMemIniFileEx;
interface
uses
Classes, IniFiles, SysUtils;
type
TMemIniFileEx = class (TMemIniFile)
private
FReadFormatSettings: TFormatSettings;
FWriteFormatSettings: TFormatSettings;
public
constructor Create(const FileName: string);
constructor CreateFromStream(aStream: TStream);
constructor CreateFromText(aText: string);
function ReadFloat(const Section, Name: string; Default: Double): Double; override;
procedure WriteFloat(const Section, Name: string; Value: Double); override;
procedure AddStrings(aStrings: TStrings);
end;
implementation
{ TMemIniFileEx }
procedure TMemIniFileEx.AddStrings(aStrings: TStrings);
var
s: TStrings;
begin
s := TStringList.Create;
try
GetStrings(s);
s.AddStrings(aStrings);
SetStrings(s);
finally
s.Free;
end;
end;
constructor TMemIniFileEx.Create(const FileName: string);
begin
inherited Create(FileName);
//GetLocaleFormatSettings(0,
FReadFormatSettings := FormatSettings;
FReadFormatSettings.DecimalSeparator := '.';
FReadFormatSettings.DateSeparator := '.';
FReadFormatSettings.TimeSeparator := ':';
FWriteFormatSettings := FReadFormatSettings;
{
GetLocaleFormatSettings(0, FWriteFormatSettings);
FWriteFormatSettings.DecimalSeparator := FReadFormatSettings.DecimalSeparator;
FReadFormatSettings.DateSeparator := FReadFormatSettings.DateSeparator;
FReadFormatSettings.TimeSeparator := FReadFormatSettings.TimeSeparator;
}
end;
constructor TMemIniFileEx.CreateFromStream(aStream: TStream);
var
List: TStringList;
begin
Create('');
List := TStringList.Create;
try
List.LoadFromStream(aStream);
SetStrings(List);
finally
List.Free;
end;
end;
constructor TMemIniFileEx.CreateFromText(aText: string);
var
List: TStringList;
begin
Create('');
List := TStringList.Create;
try
List.Text := aText;
SetStrings(List);
finally
List.Free;
end;
end;
function TMemIniFileEx.ReadFloat(const Section, Name: string;
Default: Double): Double;
var
FloatStr: string;
begin
FloatStr := ReadString(Section, Name, '');
Result := Default;
if FloatStr <> '' then
try
Result := StrToFloat(FloatStr, FReadFormatSettings);
except
on EConvertError do
begin
try
// меняем разделитель целой и дробной части на другой
if FReadFormatSettings.DecimalSeparator = '.' then
FReadFormatSettings.DecimalSeparator := ','
else
FReadFormatSettings.DecimalSeparator := '.';
// и повторяем попытку
Result := StrToFloat(FloatStr, FReadFormatSettings);
except
on EConvertError do
// Ignore EConvertError exceptions
else
raise;
end;
end
else
raise;
end;
end;
procedure TMemIniFileEx.WriteFloat(const Section, Name: string; Value: Double);
begin
// используем свои параметры для преобразования числа в строку
WriteString(Section, Name, FloatToStr(Value, FWriteFormatSettings));
end;
end.
|
unit tTManualTecnico;
interface
uses
classes, uTLatexExporter, dialogs, contnrs, Winapi.Windows, ShellApi,
System.SysUtils,
Utilidades;
type
TVentana = class(TObject)
private
FNombre: string;
FDescripcion: string;
FParte, FDescripcionParte: TStringList;
procedure setDescripcion(const Value: string);
procedure setNombre(const Value: string);
public
constructor create;
destructor destroy; override;
procedure agregarParte(nombre, descripcion: string);
published
property nombre: string read FNombre write setNombre;
property descripcion: string read FDescripcion write setDescripcion;
end;
TDescripcionVentanas = class(TObject)
private
FVentanas: TObjectList;
public
constructor create;
destructor destroy; override;
published
end;
TCodigoDescripcion = record
Ruta, descripcion: string;
end;
TCarpetaCodigo = class(TObject)
private
SLRutasCodigo: TStringList;
SLDescripcionCodigo: TStringList;
FNombre: string;
FDescripcion: string;
function getCount: integer;
procedure setDescripcion(const Value: string);
public
constructor create(nombre: string);
destructor destroy; override;
procedure agregarCodigo(Ruta, descripcion: string);
function obtenerCodigo(id: integer): TCodigoDescripcion;
published
property nombre: string read FNombre;
property Count: integer read getCount;
property descripcion: string read FDescripcion write setDescripcion;
end;
TCarpetasCodigos = class(TObject)
private
FCarpetas: TObjectList;
FCount: integer;
FCarpetaTemp: integer;
FRutaActual: string;
function getCount: integer;
procedure setRutaActual(const Value: string);
procedure _agregarCodigo(Ruta, descripcion: string; carpeta: integer);
public
constructor create;
destructor destroy; override;
function agregarCarpeta(nombre, descripcion: string): integer;
function obtenerCarpeta(id: integer): TCarpetaCodigo;
procedure agregarCodigo(nombre, descripcion: string);
published
property Count: integer read getCount;
property RutaActual: string read FRutaActual write setRutaActual;
end;
TPasoInstalacion = record
Titulo, descripcion, Imagen: string;
end;
TLinkDescargaManual = record
Usuario: string;
Tecnico: string;
Codigo: string;
end;
TManualTecnico = class(TObject)
private
LEManTec: TLatexExporter;
LEManCod: TLatexExporter;
LEManUse: TLatexExporter;
SLAutores: TStringList;
SLIntroduccion: TStringList;
SLSoftwareSimilares: TStringList;
SLDescripcion: TStringList;
SLRequisitosInstalacion: TStringList;
SLImagenes: TStringList;
SLHerramientasDesarrollo: TStringList;
SLInstalacion: TStringList;
SLBibliografia: TStringList;
FrutaExportar: string;
FIp, FRuta: string;
FTitulo: string;
FSubtitulo: string;
FAutoresCorto: string;
FVersion: string;
FUniversidad: string;
FFecha: string;
FCiudad: string;
FPrograma: string;
FFacultad: string;
FGrupo: string;
FObjetivo: string;
FEsAplicacionEscritorio: boolean;
FnombreManualTecnico: string;
FHandle: HWND;
FnombreManualCodigo: string;
FnombreManualUsuario: string;
FCarpetasCodigo: TCarpetasCodigos;
procedure setrutaExportar(const Value: string);
procedure setTitulo(const Value: string);
procedure setSubtitulo(const Value: string);
procedure setAutoresCorto(const Value: string);
procedure setCiudad(const Value: string);
procedure setFacultad(const Value: string);
procedure setFecha(const Value: string);
procedure setGrupo(const Value: string);
procedure setPrograma(const Value: string);
procedure setUniversidad(const Value: string);
procedure setVersion(const Value: string);
procedure setObjetivo(const Value: string);
procedure setEsAplicacionEscritorio(const Value: boolean);
procedure setnombreManual(const Value: string);
procedure setHandle(const Value: HWND);
procedure setnombreManualCodigo(const Value: string);
procedure setnombreManualUsuario(const Value: string);
procedure setCarpetasCodigo(const Value: TCarpetasCodigos);
public
constructor create;
destructor destroy;
procedure exportarManualTecnico;
procedure exportarManualCodigoFuente;
procedure exportarManualUsuario;
procedure exportarArchivoRC;
procedure exportarImagenes;
procedure agregarAutor(ss: string);
procedure agregarIntroduccion(ss: string);
procedure leerIntroduccion(Ruta: string);
procedure agregarDescripcion(ss: string);
procedure leerDescripcion(Ruta: string);
procedure agregarHerramientasDesarrollo(ss: string);
procedure leerHerramientasDesarrollo(Ruta: string);
procedure agregarRequisitoSistema(ss: string);
procedure leerRequisitosSistema(Ruta: string);
procedure agregarPasoInstalacion(ss: string);
procedure leerPasosInstalacion(Ruta: string);
procedure agregarBibliografia(ss: string);
procedure leerBibliografia(Ruta: string);
procedure agregarImagen(nombre: string);
procedure agregarSoftwareSimilar(nombre: string);
procedure datosDescarga(ip, Ruta: string);
function rutaDescargaHttp: TLinkDescargaManual;
published
property Handle: HWND read FHandle write setHandle;
property rutaExportar: string read FrutaExportar write setrutaExportar;
property nombreManualTecnico: string read FnombreManualTecnico
write setnombreManual;
property nombreManualUsuario: string read FnombreManualUsuario
write setnombreManualUsuario;
property nombreManualCodigo: string read FnombreManualCodigo
write setnombreManualCodigo;
property Titulo: string read FTitulo write setTitulo;
property Subtitulo: string read FSubtitulo write setSubtitulo;
property AutoresCorto: string read FAutoresCorto write setAutoresCorto;
property Universidad: string read FUniversidad write setUniversidad;
property Facultad: string read FFacultad write setFacultad;
property Programa: string read FPrograma write setPrograma;
property Grupo: string read FGrupo write setGrupo;
property Ciudad: string read FCiudad write setCiudad;
property Fecha: string read FFecha write setFecha;
property Version: string read FVersion write setVersion;
property Objetivo: string read FObjetivo write setObjetivo;
property EsAplicacionEscritorio: boolean read FEsAplicacionEscritorio
write setEsAplicacionEscritorio;
property CarpetasCodigo: TCarpetasCodigos read FCarpetasCodigo
write setCarpetasCodigo;
end;
implementation
{ TManualTecnico }
{$R Win32/Debug/Recursos/Latex.RES}
procedure TManualTecnico.agregarAutor(ss: string);
begin
SLAutores.Add(ss);
end;
procedure TManualTecnico.agregarBibliografia(ss: string);
begin
end;
procedure TManualTecnico.agregarDescripcion(ss: string);
begin
SLDescripcion.Add(ss);
end;
procedure TManualTecnico.agregarHerramientasDesarrollo(ss: string);
begin
end;
procedure TManualTecnico.agregarImagen(nombre: string);
begin
SLImagenes.Add(nombre);
end;
procedure TManualTecnico.agregarIntroduccion(ss: string);
begin
SLIntroduccion.Add(ss);
end;
procedure TManualTecnico.agregarPasoInstalacion(ss: string);
begin
SLInstalacion.Add(ss);
end;
procedure TManualTecnico.agregarRequisitoSistema(ss: string);
begin
SLRequisitosInstalacion.Add(ss);
end;
procedure TManualTecnico.agregarSoftwareSimilar(nombre: string);
begin
SLSoftwareSimilares.Add(nombre);
end;
constructor TManualTecnico.create;
begin
SLAutores := TStringList.create;
SLIntroduccion := TStringList.create;
SLDescripcion := TStringList.create;
SLSoftwareSimilares := TStringList.create;
SLRequisitosInstalacion := TStringList.create;
SLImagenes := TStringList.create;
SLHerramientasDesarrollo := TStringList.create;
SLInstalacion := TStringList.create;
SLBibliografia := TStringList.create;
FCarpetasCodigo := TCarpetasCodigos.create;
LEManTec := TLatexExporter.create;
LEManCod := TLatexExporter.create;
LEManUse := TLatexExporter.create;
end;
procedure TManualTecnico.datosDescarga(ip, Ruta: string);
begin
FIp := ip;
FRuta := Ruta;
end;
destructor TManualTecnico.destroy;
begin
end;
procedure TManualTecnico.exportarArchivoRC;
var
Ruta: string;
archivo, batFile, pasFile: TStringList;
nombre, nombreUC, nombreCarpeta: string;
i: integer;
j: integer;
begin
Ruta := ExtractFilePath(ParamStr(0)) + '\Recursos';
if not DirectoryExists(Ruta) then
CreateDir(Ruta);
archivo := TStringList.create;
batFile := TStringList.create;
pasFile := TStringList.create;
for i := 1 to SLImagenes.Count do
begin
nombre := SLImagenes[i - 1];
nombreUC := UpperCase(StringReplace(nombre, '.', '_', [rfReplaceAll]));
archivo.Add(nombreUC + ' RCDATA "' + nombre + '"');
pasFile.Add('Recursos := TResourceStream.create(HInstance, ' + #39 +
nombreUC + #39 + ', RT_RCDATA);');
pasFile.Add('Recursos.SaveToFile(directorio + ' + #39 + '\Imagenes\' +
nombre + #39 + ');');
pasFile.Add('Recursos.Free;');
pasFile.Add('');
end;
{ Exportar el archivo en la ruta }
archivo.SaveToFile(Ruta + '\Imagenes.rc');
batFile.Add('@echo off');
batFile.Add('title Creando Recursos RecursosSAE.RES');
batFile.Add('cd ' + Ruta);
batFile.Add('echo Paquete de recursos creado. Presione ENTER para salir.');
batFile.Add('brc32 -r -v Imagenes.rc');
batFile.Add('exit');
batFile.SaveToFile(Ruta + '\CompilarRecursos.bat');
pasFile.Add(ExtractFilePath(ParamStr(0)));
pasFile.Add(ExtractFilePath(ParamStr(0) + '..\..\..'));
pasFile.SaveToFile(Ruta + '\codigoManua.pas');
{ Ejecutar el bat para generar el Imagenes.RES }
ShellExecute(Handle, 'open', pchar(Ruta + '\CompilarRecursos.bat'), nil, nil,
SW_NORMAL);
end;
procedure TManualTecnico.exportarImagenes;
var
Recursos: TResourceStream;
i: integer;
j: integer;
Ruta: string;
nombreUC, nombre: string;
nCarpeta: TCarpetaCodigo;
begin
{ Determinar si la carpeta de Imágenes Existe }
Ruta := FrutaExportar + '\Imagenes';
if not DirectoryExists(Ruta) then
CreateDir(Ruta);
for i := 1 to SLImagenes.Count do
begin
nombre := SLImagenes[i - 1];
nombreUC := UpperCase(StringReplace(nombre, '.', '_', [rfReplaceAll]));
Recursos := TResourceStream.create(HInstance, nombreUC, RT_RCDATA);
Recursos.SaveToFile(FrutaExportar + '\Imagenes\' + nombre);
Recursos.Free;
end;
end;
procedure TManualTecnico.exportarManualCodigoFuente;
var
i, j, ld: integer;
LCodigo: TStringList;
nombre, descripcion, Ruta: string;
CarpetaCodigo: TCarpetaCodigo;
Encoding: TEncoding;
begin
LEManCod.documentClass('12pt,landscape,twoside,spanish', 'Plantilla');
LEManCod.usePackage('fontenc', 'T1');
LEManCod.usePackage('inputenc', 'latin9');
LEManCod.usePackage('inputenc', 'letterpaper');
LEManCod.usePackage('babel');
LEManCod.usePackage('array');
LEManCod.usePackage('longtable');
LEManCod.usePackage('pifont');
LEManCod.usePackage('float');
LEManCod.usePackage('textcomp');
LEManCod.usePackage('url');
LEManCod.usePackage('graphicx');
LEManCod.usePackage('Plantilla');
LEManCod.usePackage('fancyhdr');
LEManCod.usePackage('hyperref', 'unicode=true,pdfusetitle,bookmarks=true,' +
'bookmarksnumbered=false,bookmarksopen=false,breaklinks=false,' +
'pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false');
LEManCod.pagestyle('fancy');
LEManCod.setcounter('secnumdepth', '3');
LEManCod.setcounter('tocdepth', '1');
LEManCod.geometry('3cm', '3cm', '3cm', '3cm', '1cm', '1cm', '1cm');
LEManCod.agregarLinea('\addto\shorthandsspanish{\spanishdeactivate{~<>.}}');
LEManCod.makeatletter;
LEManCod.agregarLinea('\providecommand{\tabularnewline}{\\}');
LEManCod.agregarLinea('\AtBeginDocument{');
LEManCod.agregarLinea(' \def\labelitemi{\ding{111}}');
LEManCod.agregarLinea(' \def\labelitemii{\ding{109}}');
LEManCod.agregarLinea(' \def\labelitemiii{\ding{237}}');
LEManCod.agregarLinea(' \def\labelitemiv{\(\bullet\)}');
LEManCod.agregarLinea('}');
LEManCod.makeatother;
LEManCod.defineLenguajeHTML;
LEManCod.defineLenguajePascal;
LEManCod.defineLenguajeTypeScript;
LEManCod.defineLenguajeCss;
LEManCod.agregarLinea('');
LEManCod.beginEnviroment('document');
LEManCod.agregarLinea('');
{ Datos de la Aplicación $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManCod.Titulo(FTitulo);
LEManCod.Subtitulo(FSubtitulo);
LEManCod.agregarLinea('\Autores{%');
LEManCod.agregarLinea('\begin{tabular}{c}');
for i := 1 to SLAutores.Count do
begin
LEManCod.agregarLinea(SLAutores[i - 1] + '\tabularnewline');
end;
LEManCod.agregarLinea('\end{tabular}}');
LEManCod.agregarLinea('\AutoresCorto{' + FAutoresCorto + '}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\Institucion{' + FUniversidad + '}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\Facultad{' + FFacultad + '}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\Programa{' + FPrograma + '}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\Grupo{' + FGrupo + '}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\Ciudad{' + FCiudad + '}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\Fecha{' + FFecha + '}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\TipoCapitulo{Proyecto}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('.');
LEManCod.agregarLinea('');
{ Generar la portada principal $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManCod.agregarLinea
('\PortadaInicial{\includegraphics[width=6cm]{Imagenes/man_Logo}}{' +
FTitulo + '}{Versión ' + FVersion + '}{Código Fuente}{}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\GenerarPortada{}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\DerechosAutor{}{}');
LEManCod.agregarLinea('');
LEManCod.agregarLinea('\tableofcontents{}');
LEManCod.agregarLinea('');
{ Agregar la Introducción $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManCod.agregarLinea('\chapter*{Introducción}');
LEManCod.agregarLinea('');
for i := 1 to SLIntroduccion.Count do
begin
LEManCod.agregarLinea(SLIntroduccion[i - 1] + ' \\');
end;
for i := 1 to FCarpetasCodigo.Count do
begin
CarpetaCodigo := FCarpetasCodigo.obtenerCarpeta(i - 1);
nombre := CarpetaCodigo.nombre;
descripcion := CarpetaCodigo.descripcion;
LEManCod.chapter(nombre);
LEManCod.agregarLinea(descripcion);
for j := 1 to CarpetaCodigo.Count do
begin
try
LCodigo := TStringList.create;
Ruta := CarpetaCodigo.obtenerCodigo(j - 1).Ruta;
descripcion := CarpetaCodigo.obtenerCodigo(j - 1).descripcion;
Encoding := TUTF8Encoding.create;
LCodigo.LoadFromFile(Ruta, Encoding);
ld := LastDelimiter('\', Ruta);
nombre := Copy(Ruta, ld + 1, length(Ruta) - ld);
nombre := StringReplace(nombre, '_', '\_', [rfReplaceAll]);
LEManCod.section(nombre);
LEManCod.agregarLinea(descripcion);
LEManCod.agregarCodigo(LCodigo, nombre);
LCodigo.Free;
except
on E: Exception do
begin
LEManCod.guardarCopia;
end;
end;
end;
end;
LEManCod.endEnviroment('document');
LEManCod.exportarCompilar(FrutaExportar + '\' + FnombreManualCodigo);
end;
procedure TManualTecnico.exportarManualTecnico;
var
i: integer;
begin
LEManTec.documentClass('12pt,twoside,spanish', 'Plantilla');
LEManTec.usePackage('fontenc', 'T1');
LEManTec.usePackage('inputenc', 'latin9');
LEManTec.usePackage('inputenc', 'letterpaper');
LEManTec.usePackage('babel');
LEManTec.usePackage('array');
LEManTec.usePackage('longtable');
LEManTec.usePackage('pifont');
LEManTec.usePackage('float');
LEManTec.usePackage('textcomp');
LEManTec.usePackage('url');
LEManTec.usePackage('graphicx');
LEManTec.usePackage('Plantilla');
LEManTec.usePackage('fancyhdr');
LEManTec.usePackage('hyperref', 'unicode=true,pdfusetitle,bookmarks=true,' +
'bookmarksnumbered=false,bookmarksopen=false,breaklinks=false,' +
'pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false');
LEManTec.pagestyle('fancy');
LEManTec.setcounter('secnumdepth', '3');
LEManTec.setcounter('tocdepth', '1');
LEManTec.geometry('5cm', '3cm', '3cm', '3cm', '1cm', '1cm', '1cm');
LEManTec.agregarLinea('\addto\shorthandsspanish{\spanishdeactivate{~<>.}}');
LEManTec.makeatletter;
LEManTec.agregarLinea('\providecommand{\tabularnewline}{\\}');
LEManTec.agregarLinea('\AtBeginDocument{');
LEManTec.agregarLinea(' \def\labelitemi{\ding{111}}');
LEManTec.agregarLinea(' \def\labelitemii{\ding{109}}');
LEManTec.agregarLinea(' \def\labelitemiii{\ding{237}}');
LEManTec.agregarLinea(' \def\labelitemiv{\(\bullet\)}');
LEManTec.agregarLinea('}');
LEManTec.makeatother;
LEManTec.agregarLinea('');
LEManTec.beginEnviroment('document');
LEManTec.agregarLinea('');
{ Datos de la Aplicación $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.Titulo(FTitulo);
LEManTec.Subtitulo(FSubtitulo);
LEManTec.agregarLinea('\Autores{%');
LEManTec.agregarLinea('\begin{tabular}{c}');
for i := 1 to SLAutores.Count do
begin
LEManTec.agregarLinea(SLAutores[i - 1] + '\tabularnewline');
end;
LEManTec.agregarLinea('\end{tabular}}');
LEManTec.agregarLinea('\AutoresCorto{' + FAutoresCorto + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Institucion{' + FUniversidad + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Facultad{' + FFacultad + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Programa{' + FPrograma + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Grupo{' + FGrupo + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Ciudad{' + FCiudad + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Fecha{' + FFecha + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\TipoCapitulo{Sección}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('.');
LEManTec.agregarLinea('');
{ Generar la portada principal $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea
('\PortadaInicial{\includegraphics[width=6cm]{Imagenes/man_Logo}}{' +
FTitulo + '}{Versión ' + FVersion + '}{Manual Técnico}{}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\GenerarPortada{}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\DerechosAutor{}{}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\tableofcontents{}');
LEManTec.agregarLinea('');
{ Agregar la Introducción $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea('\chapter*{Introducción}');
LEManTec.agregarLinea('');
for i := 1 to SLIntroduccion.Count do
begin
LEManTec.agregarLinea(SLIntroduccion[i - 1] + ' \\');
end;
{ Descripción de la aplicación $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea('\chapter{' + FTitulo + '}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Descripcion{');
LEManTec.agregarLinea('\noindent\begin{minipage}[t]{1\columnwidth}');
LEManTec.agregarLinea('En esta sección se explicará:');
LEManTec.agregarLinea('\begin{itemize}');
LEManTec.agregarLinea('\item Cómo instalar el software \NombreSoftware{' +
FTitulo + '}');
LEManTec.agregarLinea('\item Cuáles son los requisitos del sistema');
LEManTec.agregarLinea('\item La preparación para la instalación ');
LEManTec.agregarLinea('\item Las opciones de instalación');
LEManTec.agregarLinea('\item Herramientas para el diseño y desarrollo');
LEManTec.agregarLinea('\end{itemize}');
LEManTec.agregarLinea
('\end{minipage}}{\includegraphics[width=3cm]{Imagenes/man_Logo}}{}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea
('A continuación se hace una descripción técnica del software:');
LEManTec.agregarLinea('');
{ Descripción Técnica del Software $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea('\begin{itemize}');
LEManTec.agregarLinea('\item \textbf{Nombre:} ' + FTitulo);
LEManTec.agregarLinea('\item \textbf{Objetivo:} ' + FObjetivo);
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\item \textbf{Requisitos de Instalación:} ');
LEManTec.agregarLinea('\begin{itemize}');
for i := 1 to SLRequisitosInstalacion.Count do
begin
LEManTec.agregarLinea('\item ' + SLRequisitosInstalacion[i - 1]);
end;
LEManTec.agregarLinea('\end{itemize}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\item \textbf{Versión:} ' + FVersion);
LEManTec.agregarLinea('\item \textbf{Software Similares:}');
{ Software Similares $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea('\begin{itemize}');
for i := 1 to SLSoftwareSimilares.Count do
begin
LEManTec.agregarLinea(SLSoftwareSimilares[i - 1]);
end;
LEManTec.agregarLinea('\end{itemize}');
LEManTec.agregarLinea('\end{itemize}');
{ Descripción de la Aplicación $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\section{Descripción}');
for i := 1 to SLDescripcion.Count do
begin
LEManTec.agregarLinea(SLDescripcion[i - 1] + ' \\');
end;
{ Instalación de la Aplicación $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea
('\chapter{Instalación de la Aplicación y Herramientas de Desarrollo}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\Descripcion{');
LEManTec.agregarLinea('En esta sección se explicará:');
LEManTec.agregarLinea('\begin{itemize}');
LEManTec.agregarLinea('\item Cómo instalar el software \NombreSoftware{' +
FTitulo + '}');
LEManTec.agregarLinea('\item Cuáles son los requisitos del sistema');
LEManTec.agregarLinea('\item La preparación para la instalación ');
LEManTec.agregarLinea('\item Las opciones de instalación');
LEManTec.agregarLinea('\item Herramientas para el diseño y desarrollo');
LEManTec.agregarLinea('\end{itemize}}' +
'{\includegraphics[width=3cm]{Imagenes/inst_Instalacion}}{}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\section{Instalación del Software}');
LEManTec.agregarLinea
('A continuación encontrará los requisitos del sistema para la instalación,'
+ ' guia para instalar la aplicación y opciones de instalación.');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\section{Requisitos del Sistema}');
LEManTec.agregarLinea
('En el siguiente listado se muestran los requisitos mínimos del sistema.' +
' Para asegurar el buen funcionamiento del software se recomienda un' +
' sistema que sobrepase estos requisitos mínimos.');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\begin{itemize}');
for i := 1 to SLRequisitosInstalacion.Count do
begin
LEManTec.agregarLinea('\item ' + SLRequisitosInstalacion[i - 1]);
end;
LEManTec.agregarLinea('\end{itemize}');
{ Herramientas de Desarrollo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\section{Herramientas para el Desarrollo}');
LEManTec.agregarLinea('');
for i := 1 to SLHerramientasDesarrollo.Count do
begin
LEManTec.agregarLinea(SLHerramientasDesarrollo[i - 1]);
end;
{ Instalación de la Aplicación $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManTec.agregarLinea('');
LEManTec.agregarLinea('\section{Instalación de la Aplicación}');
LEManTec.agregarLinea('');
LEManTec.agregarLinea
('Para instalar el software se deben seguir los siguientes pasos:');
LEManTec.agregarLinea('');
LEManTec.agregarLinea('');
for i := 1 to SLInstalacion.Count do
begin
LEManTec.agregarLinea(SLInstalacion[i - 1]);
end;
LEManTec.agregarLinea('');
{ Exportar la Bibliografia }
LEManTec.agregarLinea('\begin{thebibliography}{1}');
for i := 1 to SLBibliografia.Count do
begin
LEManTec.agregarLinea(SLBibliografia[i - 1]);
end;
LEManTec.agregarLinea('\end{thebibliography}');
LEManTec.agregarLinea('');
LEManTec.endEnviroment('document');
{ Exportar el Manual }
LEManTec.exportarCompilar(FrutaExportar + '\' + FnombreManualTecnico);
end;
procedure TManualTecnico.exportarManualUsuario;
var
i: integer;
begin
LEManUse.documentClass('12pt,twoside,spanish', 'Plantilla');
LEManUse.usePackage('fontenc', 'T1');
LEManUse.usePackage('inputenc', 'latin9');
LEManUse.usePackage('inputenc', 'letterpaper');
LEManUse.usePackage('babel');
LEManUse.usePackage('array');
LEManUse.usePackage('longtable');
LEManUse.usePackage('pifont');
LEManUse.usePackage('float');
LEManUse.usePackage('textcomp');
LEManUse.usePackage('url');
LEManUse.usePackage('graphicx');
LEManUse.usePackage('Plantilla');
LEManUse.usePackage('fancyhdr');
LEManUse.usePackage('hyperref', 'unicode=true,pdfusetitle,bookmarks=true,' +
'bookmarksnumbered=false,bookmarksopen=false,breaklinks=false,' +
'pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false');
LEManUse.pagestyle('fancy');
LEManUse.setcounter('secnumdepth', '3');
LEManUse.setcounter('tocdepth', '1');
LEManUse.geometry('3cm', '3cm', '3cm', '3cm', '1cm', '1cm', '1cm');
LEManUse.agregarLinea('\addto\shorthandsspanish{\spanishdeactivate{~<>.}}');
LEManUse.makeatletter;
LEManUse.agregarLinea('\providecommand{\tabularnewline}{\\}');
LEManUse.agregarLinea('\AtBeginDocument{');
LEManUse.agregarLinea(' \def\labelitemi{\ding{111}}');
LEManUse.agregarLinea(' \def\labelitemii{\ding{109}}');
LEManUse.agregarLinea(' \def\labelitemiii{\ding{237}}');
LEManUse.agregarLinea(' \def\labelitemiv{\(\bullet\)}');
LEManUse.agregarLinea('}');
LEManUse.makeatother;
LEManUse.agregarLinea('');
LEManUse.beginEnviroment('document');
LEManUse.agregarLinea('');
{ Datos de la Aplicación $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManUse.Titulo(FTitulo);
LEManUse.Subtitulo(FSubtitulo);
LEManUse.agregarLinea('\Autores{%');
LEManUse.agregarLinea('\begin{tabular}{c}');
for i := 1 to SLAutores.Count do
begin
LEManUse.agregarLinea(SLAutores[i - 1] + '\tabularnewline');
end;
LEManUse.agregarLinea('\end{tabular}}');
LEManUse.agregarLinea('\AutoresCorto{' + FAutoresCorto + '}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\Institucion{' + FUniversidad + '}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\Facultad{' + FFacultad + '}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\Programa{' + FPrograma + '}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\Grupo{' + FGrupo + '}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\Ciudad{' + FCiudad + '}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\Fecha{' + FFecha + '}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\TipoCapitulo{Sección}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('.');
LEManUse.agregarLinea('');
{ Generar la portada principal $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManUse.agregarLinea
('\PortadaInicial{\includegraphics[width=6cm]{Imagenes/man_Logo}}{' +
FTitulo + '}{Versión ' + FVersion + '}{Manual Técnico}{}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\GenerarPortada{}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\DerechosAutor{}{}');
LEManUse.agregarLinea('');
LEManUse.agregarLinea('\tableofcontents{}');
LEManUse.agregarLinea('');
{ Agregar la Introducción $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ }
LEManUse.agregarLinea('\chapter*{Introducción}');
LEManUse.agregarLinea('');
for i := 1 to SLIntroduccion.Count do
begin
LEManUse.agregarLinea(SLIntroduccion[i - 1] + ' \\');
end;
LEManUse.endEnviroment('document');
{ Exportar el Manual }
LEManUse.exportarCompilar(FrutaExportar + '\' + FnombreManualUsuario);
end;
procedure TManualTecnico.leerBibliografia(Ruta: string);
var
LSBibligrafia: TStringList;
begin
LSBibligrafia := TStringList.create;
LSBibligrafia.LoadFromFile(Ruta);
SLBibliografia.AddStrings(LSBibligrafia);
end;
procedure TManualTecnico.leerDescripcion(Ruta: string);
var
LSDescripcion: TStringList;
Encoding: TEncoding;
begin
Encoding := TUTF8Encoding.create;
LSDescripcion := TStringList.create;
// LSDescripcion.DefaultEncoding := Encoding;
LSDescripcion.LoadFromFile(Ruta);
SLDescripcion.AddStrings(LSDescripcion);
end;
procedure TManualTecnico.leerHerramientasDesarrollo(Ruta: string);
var
LSHerramientas: TStringList;
local: string;
Encoding: TEncoding;
begin
Encoding := TUTF8Encoding.create;
local := ExtractFilePath(ParamStr(0)) + '\';
LSHerramientas := TStringList.create;
// LSHerramientas.DefaultEncoding := Encoding;
LSHerramientas.LoadFromFile(local + Ruta);
SLHerramientasDesarrollo.AddStrings(LSHerramientas);
end;
procedure TManualTecnico.leerIntroduccion(Ruta: string);
var
LSIntroduccion: TStringList;
Encoding: TEncoding;
begin
Encoding := TUTF8Encoding.create;
LSIntroduccion := TStringList.create;
// LSIntroduccion.DefaultEncoding := Encoding;
LSIntroduccion.LoadFromFile(Ruta);
SLIntroduccion.AddStrings(LSIntroduccion);
end;
procedure TManualTecnico.leerPasosInstalacion(Ruta: string);
var
LSPasosInstalacion: TStringList;
local: string;
Encoding: TEncoding;
begin
Encoding := TUTF8Encoding.create;
local := ExtractFilePath(ParamStr(0)) + '\';
LSPasosInstalacion := TStringList.create;
// LSPasosInstalacion.DefaultEncoding := Encoding;
LSPasosInstalacion.LoadFromFile(local + Ruta);
SLInstalacion.AddStrings(LSPasosInstalacion);
end;
procedure TManualTecnico.leerRequisitosSistema(Ruta: string);
var
LSRequisitos: TStringList;
Encoding: TEncoding;
begin
Encoding := TUTF8Encoding.create;
LSRequisitos := TStringList.create;
// LSRequisitos.DefaultEncoding := Encoding;
LSRequisitos.LoadFromFile(Ruta);
SLRequisitosInstalacion.AddStrings(LSRequisitos);
end;
function TManualTecnico.rutaDescargaHttp: TLinkDescargaManual;
begin
Result.Tecnico := 'http://' + FIp + FRuta + FnombreManualTecnico + '.pdf';
Result.Usuario := 'http://' + FIp + FRuta + FnombreManualUsuario + '.pdf';
Result.Codigo := 'http://' + FIp + FRuta + FnombreManualCodigo + '.pdf';
end;
procedure TManualTecnico.setAutoresCorto(const Value: string);
begin
FAutoresCorto := Value;
end;
procedure TManualTecnico.setCarpetasCodigo(const Value: TCarpetasCodigos);
begin
FCarpetasCodigo := Value;
end;
procedure TManualTecnico.setCiudad(const Value: string);
begin
FCiudad := Value;
end;
procedure TManualTecnico.setEsAplicacionEscritorio(const Value: boolean);
begin
FEsAplicacionEscritorio := Value;
end;
procedure TManualTecnico.setFacultad(const Value: string);
begin
FFacultad := Value;
end;
procedure TManualTecnico.setFecha(const Value: string);
begin
FFecha := Value;
end;
procedure TManualTecnico.setGrupo(const Value: string);
begin
FGrupo := Value;
end;
procedure TManualTecnico.setHandle(const Value: HWND);
begin
FHandle := Value;
end;
procedure TManualTecnico.setnombreManual(const Value: string);
begin
FnombreManualTecnico := Value;
end;
procedure TManualTecnico.setnombreManualCodigo(const Value: string);
begin
FnombreManualCodigo := Value;
end;
procedure TManualTecnico.setnombreManualUsuario(const Value: string);
begin
FnombreManualUsuario := Value;
end;
procedure TManualTecnico.setObjetivo(const Value: string);
begin
FObjetivo := Value;
end;
procedure TManualTecnico.setPrograma(const Value: string);
begin
FPrograma := Value;
end;
procedure TManualTecnico.setrutaExportar(const Value: string);
begin
FrutaExportar := Value;
end;
procedure TManualTecnico.setSubtitulo(const Value: string);
begin
FSubtitulo := Value;
end;
procedure TManualTecnico.setTitulo(const Value: string);
begin
FTitulo := Value;
end;
procedure TManualTecnico.setUniversidad(const Value: string);
begin
FUniversidad := Value;
end;
procedure TManualTecnico.setVersion(const Value: string);
begin
FVersion := Value;
end;
{ TVentana }
procedure TVentana.agregarParte(nombre, descripcion: string);
begin
FParte.Add(nombre);
FDescripcionParte.Add(descripcion);
end;
constructor TVentana.create;
begin
FParte := TStringList.create;
FDescripcionParte := TStringList.create;
end;
destructor TVentana.destroy;
begin
inherited;
end;
procedure TVentana.setDescripcion(const Value: string);
begin
FDescripcion := Value;
end;
procedure TVentana.setNombre(const Value: string);
begin
FNombre := Value;
end;
{ TDescripcionVentanas }
constructor TDescripcionVentanas.create;
begin
end;
destructor TDescripcionVentanas.destroy;
begin
inherited destroy;
end;
{ TCarpetaImagenes }
procedure TCarpetaCodigo.agregarCodigo(Ruta, descripcion: string);
begin
SLRutasCodigo.Add(Ruta);
SLDescripcionCodigo.Add(descripcion);
end;
constructor TCarpetaCodigo.create(nombre: string);
begin
SLRutasCodigo := TStringList.create;
SLDescripcionCodigo := TStringList.create;
FNombre := nombre;
end;
destructor TCarpetaCodigo.destroy;
begin
SLRutasCodigo.Free;
inherited destroy;
end;
function TCarpetaCodigo.getCount: integer;
begin
Result := SLRutasCodigo.Count;
end;
function TCarpetaCodigo.obtenerCodigo(id: integer): TCodigoDescripcion;
begin
Result.Ruta := SLRutasCodigo[id];
Result.descripcion := SLDescripcionCodigo[id];
end;
procedure TCarpetaCodigo.setDescripcion(const Value: string);
begin
FDescripcion := Value;
end;
{ TCarpetasImagenes }
function TCarpetasCodigos.agregarCarpeta(nombre, descripcion: string): integer;
begin
FCarpetaTemp := FCarpetas.Add(TCarpetaCodigo.create(nombre));
obtenerCarpeta(FCarpetaTemp).descripcion := descripcion;
Result := FCarpetaTemp;
end;
procedure TCarpetasCodigos._agregarCodigo(Ruta, descripcion: string;
carpeta: integer);
begin
(FCarpetas.Items[carpeta] as TCarpetaCodigo).agregarCodigo(Ruta, descripcion);
end;
procedure TCarpetasCodigos.agregarCodigo(nombre, descripcion: string);
begin
_agregarCodigo(FRutaActual + nombre, descripcion, FCarpetaTemp);
end;
constructor TCarpetasCodigos.create;
begin
FCarpetas := TObjectList.create;
end;
destructor TCarpetasCodigos.destroy;
begin
FCarpetas.Free;
inherited destroy;
end;
function TCarpetasCodigos.getCount: integer;
begin
Result := FCarpetas.Count;
end;
function TCarpetasCodigos.obtenerCarpeta(id: integer): TCarpetaCodigo;
begin
Result := (FCarpetas.Items[id] as TCarpetaCodigo);
end;
procedure TCarpetasCodigos.setRutaActual(const Value: string);
begin
FRutaActual := Value;
end;
end.
|
{ ------------------------------------
功能说明:工厂
创建日期:2010/03/29
作者:WZW
版权:WZW
------------------------------------- }
unit SysFactory;
interface
uses
Classes,
SysUtils,
FactoryIntf,
SvcInfoIntf;
type
// 工厂基类
TBaseFactory = class(TFactory, ISvcInfoEx)
private
protected
FIntfName: string;
{ ISvcInfoEx }
procedure GetSvcInfo(Intf: ISvcInfoGetter); virtual; abstract;
public
constructor Create(const IntfName: string); // virtual;
destructor Destroy; override;
{ Inherited }
function Supports(const IntfName: string): Boolean; override;
procedure EnumKeys(Intf: IEnumKey); override;
end;
// 接口工厂
TIntfFactory = class(TBaseFactory)
private
Flag: Integer;
FSvcInfoRec: TSvcInfoRec;
FIntfCreatorFunc: TIntfCreatorFunc;
procedure InnerGetSvcInfo(Intf: IInterface; SvcInfoGetter: ISvcInfoGetter);
protected
procedure GetSvcInfo(Intf: ISvcInfoGetter); override;
function GetObj(out Obj: TObject; out AutoFree: Boolean): Boolean; override;
public
constructor Create(const IID: TGUID; IntfCreatorFunc: TIntfCreatorFunc);
overload;
constructor Create(const IntfName: string; IntfCreatorFunc: TIntfCreatorFunc);
overload;
destructor Destroy; override;
function GetIntf(const IID: TGUID; out Obj): HResult; override;
procedure ReleaseIntf; override;
end;
// 单例工厂
TSingletonFactory = class(TBaseFactory)
private
FIntfCreatorFunc: TIntfCreatorFunc;
FIntfRelease: Boolean;
protected
FInstance: TObject;
FIntfRef: IInterface;
procedure GetSvcInfo(Intf: ISvcInfoGetter); override;
function GetObj(out Obj: TObject; out AutoFree: Boolean): Boolean; override;
public
constructor Create(const IID: TGUID; IntfCreatorFunc: TIntfCreatorFunc;
IntfRelease: Boolean = False); overload;
constructor Create(const IntfName: string; IntfCreatorFunc: TIntfCreatorFunc;
IntfRelease: Boolean = False); overload;
destructor Destroy; override;
function GetIntf(const IID: TGUID; out Obj): HResult; override;
procedure ReleaseIntf; override;
end;
// 实例工厂
TObjFactory = class(TSingletonFactory)
private
FOwnsObj: Boolean;
protected
public
constructor Create(const IID: TGUID; Instance: TObject; OwnsObj: Boolean =
False; IntfRelease: Boolean = False); overload;
constructor Create(const IntfName: string; Instance: TObject; OwnsObj:
Boolean = False; IntfRelease: Boolean = False); overload;
destructor Destroy; override;
//function GetIntf(const IID: TGUID; out Obj): HResult; override;
procedure ReleaseIntf; override;
end;
implementation
uses
SysFactoryMgr,
SysMsg;
{ TBaseFactory }
constructor TBaseFactory.Create(const IntfName: string);
begin
if FactoryManager.Exists(IntfName) then
raise Exception.CreateFmt(Err_IntfExists, [IntfName]);
FIntfName := IntfName;
FactoryManager.RegisterFactory(Self);
end;
destructor TBaseFactory.Destroy;
begin
FactoryManager.UnRegisterFactory(Self);
inherited;
end;
procedure TBaseFactory.EnumKeys(Intf: IEnumKey);
begin
if Assigned(Intf) then
Intf.EnumKey(self.FIntfName);
end;
function TBaseFactory.Supports(const IntfName: string): Boolean;
begin
Result := self.FIntfName = IntfName;
end;
{ TIntfFactory }
constructor TIntfFactory.Create(const IntfName: string; IntfCreatorFunc:
TIntfCreatorFunc);
begin
if not Assigned(IntfCreatorFunc) then
raise Exception.CreateFmt(Err_IntfCreatorFuncIsNil, [IntfName]);
Flag := 0;
Self.FIntfCreatorFunc := IntfCreatorFunc;
inherited Create(IntfName);
end;
constructor TIntfFactory.Create(const IID: TGUID; IntfCreatorFunc:
TIntfCreatorFunc);
begin
self.Create(GUIDToString(IID), IntfCreatorFunc);
end;
function TIntfFactory.GetIntf(const IID: TGUID; out Obj): HResult;
var
tmpObj: TObject;
tmpIntf: IInterface;
begin
Result := E_NOINTERFACE;
if Assigned(Self.FIntfCreatorFunc) then
begin
tmpObj := Self.FIntfCreatorFunc(FParam);
if tmpObj <> nil then
begin
if tmpObj.GetInterface(IID, tmpIntf) then
begin
Result := S_OK;
IInterface(Obj) := tmpIntf;
if Flag = 0 then
begin
if tmpObj.GetInterface(IInterface, tmpIntf) then
InnerGetSvcInfo(tmpIntf, nil);
end;
end
else
tmpObj.Free;
end;
end;
end;
function TIntfFactory.GetObj(out Obj: TObject; out AutoFree: Boolean): Boolean;
begin
AutoFree := True;
Obj := Self.FIntfCreatorFunc(Self.FParam);
Result := Obj <> nil;
end;
destructor TIntfFactory.Destroy;
begin
inherited;
end;
procedure TIntfFactory.GetSvcInfo(Intf: ISvcInfoGetter);
var
Obj: TObject;
tmpIntf: IInterface;
begin
if (Flag = 0) or (Flag = 2) then
begin
Obj := Self.FIntfCreatorFunc(self.FParam);
if Obj <> nil then
begin
if Obj.GetInterface(IInterface, tmpIntf) then
begin
InnerGetSvcInfo(tmpIntf, Intf);
tmpIntf := nil;
end;
end;
end;
Intf.SvcInfo(FSvcInfoRec);
end;
procedure TIntfFactory.InnerGetSvcInfo(Intf: IInterface; SvcInfoGetter:
ISvcInfoGetter);
var
SvcInfoIntf: ISvcInfo;
SvcInfoIntfEx: ISvcInfoEx;
begin
if Intf = nil then
exit;
FSvcInfoRec.GUID := self.FIntfName;
if Intf.QueryInterface(ISvcInfo, SvcInfoIntf) = S_OK then
begin
Self.Flag := 1;
with FSvcInfoRec do
begin
// GUID :=GUIDToString(self.FIntfGUID);
ModuleName := SvcInfoIntf.GetModuleName;
Title := SvcInfoIntf.GetTitle;
Version := SvcInfoIntf.GetVersion;
Comments := SvcInfoIntf.GetComments;
end;
SvcInfoIntf := nil;
end
else if Intf.QueryInterface(ISvcInfoEx, SvcInfoIntfEx) = S_OK then
begin
Flag := 2;
if SvcInfoGetter <> nil then
SvcInfoIntfEx.GetSvcInfo(SvcInfoGetter);
SvcInfoIntfEx := nil;
end;
end;
procedure TIntfFactory.ReleaseIntf;
begin
inherited;
end;
{ TSingletonFactory }
constructor TSingletonFactory.Create(const IntfName: string; IntfCreatorFunc:
TIntfCreatorFunc; IntfRelease: Boolean);
begin
FInstance := nil;
FIntfRef := nil;
FIntfRelease := IntfRelease;
FIntfCreatorFunc := IntfCreatorFunc;
inherited Create(IntfName);
end;
constructor TSingletonFactory.Create(const IID: TGUID; IntfCreatorFunc:
TIntfCreatorFunc; IntfRelease: Boolean);
begin
self.Create(GUIDToString(IID), IntfCreatorFunc, IntfRelease);
end;
function TSingletonFactory.GetIntf(const IID: TGUID; out Obj): HResult;
begin
Result := E_NOINTERFACE;
if FIntfRef = nil then
begin
if (FInstance = nil) and Assigned(FIntfCreatorFunc) then
FInstance := FIntfCreatorFunc(Self.FParam);
if FInstance <> nil then
begin
if FInstance.GetInterface(IID, FIntfRef) then
begin
Result := S_OK;
IInterface(Obj) := FIntfRef;
end
else
raise Exception.CreateFmt(Err_IntfNotSupport, [GUIDToString(IID)]);
end;
end
else
begin
Result := FIntfRef.QueryInterface(IID, Obj);
end;
end;
destructor TSingletonFactory.Destroy;
begin
inherited;
end;
function TSingletonFactory.GetObj(out Obj: TObject; out AutoFree: Boolean):
Boolean;
begin
Obj := Self.FInstance;
AutoFree := False;
Result := True;
end;
procedure TSingletonFactory.GetSvcInfo(Intf: ISvcInfoGetter);
var
SvcInfoIntf: ISvcInfo;
SvcInfoIntfEx: ISvcInfoEx;
SvcInfoRec: TSvcInfoRec;
begin
if FInstance = nil then
begin
FInstance := FIntfCreatorFunc(self.FParam);
if FInstance = nil then
exit;
FInstance.GetInterface(IInterface, FIntfRef);
end;
if FInstance.GetInterface(ISvcInfo, SvcInfoIntf) then
begin
with SvcInfoRec do
begin
GUID := Self.FIntfName;
ModuleName := SvcInfoIntf.GetModuleName;
Title := SvcInfoIntf.GetTitle;
Version := SvcInfoIntf.GetVersion;
Comments := SvcInfoIntf.GetComments;
end;
Intf.SvcInfo(SvcInfoRec);
end
else if FInstance.GetInterface(ISvcInfoEx, SvcInfoIntfEx) then
SvcInfoIntfEx.GetSvcInfo(Intf)
else
begin
with SvcInfoRec do
begin
GUID := Self.FIntfName;
ModuleName := '';
Title := '';
Version := '';
Comments := '';
end;
Intf.SvcInfo(SvcInfoRec);
end;
end;
procedure TSingletonFactory.ReleaseIntf;
begin
if FInstance = nil then
exit;
if (FInstance is TInterfacedObject) or FIntfRelease then
FIntfRef := nil
else
begin
FInstance.Free;
FIntfRef := nil;
end;
FInstance := nil;
end;
{ TObjFactory }
constructor TObjFactory.Create(const IntfName: string; Instance: TObject;
OwnsObj, IntfRelease: Boolean);
begin
if Instance = nil then
raise Exception.CreateFmt(Err_InstanceIsNil, [IntfName]);
inherited Create(IntfName, nil, IntfRelease); //往上后FIntfRef会被赋为nil
FOwnsObj := OwnsObj or IntfRelease or (Instance is TInterfacedObject);
FInstance := Instance;
end;
constructor TObjFactory.Create(const IID: TGUID; Instance: TObject; OwnsObj:
Boolean; IntfRelease: Boolean);
var
IIDStr: string;
tmpIntf: IInterface;
begin
IIDStr := GUIDToString(IID);
if not Instance.GetInterface(IID, tmpIntf) then
raise Exception.CreateFmt(Err_ObjNotImpIntf, [Instance.ClassName, IIDStr]);
Self.Create(IIDStr, Instance, OwnsObj, IntfRelease);
FIntfRef := tmpIntf;
end;
destructor TObjFactory.Destroy;
begin
inherited;
end;
procedure TObjFactory.ReleaseIntf;
begin
if FOwnsObj then
inherited;
end;
end.
|
{
ORM Brasil é um ORM simples e descomplicado para quem utiliza Delphi
Copyright (c) 2016, Isaque Pinheiro
All rights reserved.
GNU Lesser General Public License
Versão 3, 29 de junho de 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
A todos é permitido copiar e distribuir cópias deste documento de
licença, mas mudá-lo não é permitido.
Esta versão da GNU Lesser General Public License incorpora
os termos e condições da versão 3 da GNU General Public License
Licença, complementado pelas permissões adicionais listadas no
arquivo LICENSE na pasta principal.
}
{ @abstract(ORMBr Framework.)
@created(20 Jul 2016)
@author(Isaque Pinheiro <isaquepsp@gmail.com>)
@author(Skype : ispinheiro)
ORM Brasil é um ORM simples e descomplicado para quem utiliza Delphi.
}
unit ormbr.session.dataset;
interface
uses
DB,
Rtti,
TypInfo,
Classes,
Variants,
SysUtils,
Generics.Collections,
/// orm
ormbr.objects.manager,
ormbr.objects.manager.abstract,
ormbr.session.abstract,
ormbr.dataset.base.adapter,
dbcbr.mapping.classes,
dbebr.factory.interfaces;
type
// M - Sessão DataSet
TSessionDataSet<M: class, constructor> = class(TSessionAbstract<M>)
private
FOwner: TDataSetBaseAdapter<M>;
procedure PopularDataSet(const ADBResultSet: IDBResultSet);
protected
FConnection: IDBConnection;
public
constructor Create(const AOwner: TDataSetBaseAdapter<M>;
const AConnection: IDBConnection; const APageSize: Integer = -1); overload;
destructor Destroy; override;
procedure OpenID(const AID: Variant); override;
procedure OpenSQL(const ASQL: string); override;
procedure OpenWhere(const AWhere: string; const AOrderBy: string = ''); override;
procedure NextPacket; override;
procedure RefreshRecord(const AColumns: TParams); override;
procedure NextPacketList(const AObjectList: TObjectList<M>); overload; override;
function NextPacketList: TObjectList<M>; overload; override;
function NextPacketList(const APageSize, APageNext: Integer): TObjectList<M>; overload; override;
function NextPacketList(const AWhere, AOrderBy: String; const APageSize, APageNext: Integer): TObjectList<M>; overload; override;
function SelectAssociation(const AObject: TObject): String; override;
end;
implementation
uses
ormbr.bind;
{ TSessionDataSet<M> }
constructor TSessionDataSet<M>.Create(const AOwner: TDataSetBaseAdapter<M>;
const AConnection: IDBConnection; const APageSize: Integer);
begin
inherited Create(APageSize);
FOwner := AOwner;
FConnection := AConnection;
FManager := TObjectManager<M>.Create(Self, AConnection, APageSize);
end;
destructor TSessionDataSet<M>.Destroy;
begin
FManager.Free;
inherited;
end;
function TSessionDataSet<M>.SelectAssociation(const AObject: TObject): String;
begin
inherited;
Result := FManager.SelectInternalAssociation(AObject);
end;
procedure TSessionDataSet<M>.OpenID(const AID: Variant);
var
LDBResultSet: IDBResultSet;
begin
inherited;
LDBResultSet := FManager.SelectInternalID(AID);
// Popula o DataSet em memória com os registros retornardos no comando SQL
PopularDataSet(LDBResultSet);
end;
procedure TSessionDataSet<M>.OpenSQL(const ASQL: string);
var
LDBResultSet: IDBResultSet;
begin
inherited;
if ASQL = '' then
LDBResultSet := FManager.SelectInternalAll
else
LDBResultSet := FManager.SelectInternal(ASQL);
// Popula o DataSet em memória com os registros retornardos no comando SQL
PopularDataSet(LDBResultSet);
end;
procedure TSessionDataSet<M>.OpenWhere(const AWhere: string;
const AOrderBy: string);
begin
inherited;
OpenSQL(FManager.SelectInternalWhere(AWhere, AOrderBy));
end;
procedure TSessionDataSet<M>.RefreshRecord(const AColumns: TParams);
var
LDBResultSet: IDBResultSet;
LWhere: String;
LFor: Integer;
begin
inherited;
LWhere := '';
for LFor := 0 to AColumns.Count -1 do
begin
LWhere := LWhere + AColumns[LFor].Name + '=' + AColumns[LFor].AsString;
if LFor < AColumns.Count -1 then
LWhere := LWhere + ' AND ';
end;
LDBResultSet := FManager.SelectInternal(FManager.SelectInternalWhere(LWhere, ''));
// Atualiza dados no DataSet
while LDBResultSet.NotEof do
begin
FOwner.FOrmDataSet.Edit;
TBind.Instance
.SetFieldToField(LDBResultSet, FOwner.FOrmDataSet);
FOwner.FOrmDataSet.Post;
end;
end;
procedure TSessionDataSet<M>.NextPacket;
var
LDBResultSet: IDBResultSet;
begin
inherited;
LDBResultSet := FManager.NextPacket;
if LDBResultSet.RecordCount > 0 then
/// <summary>
/// Popula o DataSet em memória com os registros retornardos no comando SQL
/// </summary>
PopularDataSet(LDBResultSet)
else
FFetchingRecords := True;
end;
procedure TSessionDataSet<M>.NextPacketList(const AObjectList: TObjectList<M>);
begin
inherited;
if FFetchingRecords then
Exit;
FPageNext := FPageNext + FPageSize;
if FFindWhereUsed then
FManager.NextPacketList(AObjectList, FWhere, FOrderBy, FPageSize, FPageNext)
else
FManager.NextPacketList(AObjectList, FPageSize, FPageNext);
/// <summary>
/// if AObjectList <> nil then
/// if AObjectList.RecordCount = 0 then
/// FFetchingRecords := True;
/// Esse código para definir a tag FFetchingRecords, está sendo feito no
/// método NextPacketList() dentro do FManager.
/// </summary>
end;
function TSessionDataSet<M>.NextPacketList: TObjectList<M>;
begin
inherited;
Result := nil;
if FFetchingRecords then
Exit;
FPageNext := FPageNext + FPageSize;
if FFindWhereUsed then
Result := FManager.NextPacketList(FWhere, FOrderBy, FPageSize, FPageNext)
else
Result := FManager.NextPacketList(FPageSize, FPageNext);
if Result = nil then
Exit;
if Result.Count > 0 then
Exit;
FFetchingRecords := True;
end;
function TSessionDataSet<M>.NextPacketList(const APageSize,
APageNext: Integer): TObjectList<M>;
begin
inherited;
Result := nil;
if FFetchingRecords then
Exit;
Result := FManager.NextPacketList(APageSize, APageNext);
if Result = nil then
Exit;
if Result.Count > 0 then
Exit;
FFetchingRecords := True;
end;
function TSessionDataSet<M>.NextPacketList(const AWhere, AOrderBy: String;
const APageSize, APageNext: Integer): TObjectList<M>;
begin
inherited;
Result := nil;
if FFetchingRecords then
Exit;
Result := FManager.NextPacketList(AWhere, AOrderBy, APageSize, APageNext);
if Result = nil then
Exit;
if Result.Count > 0 then
Exit;
FFetchingRecords := True;
end;
procedure TSessionDataSet<M>.PopularDataSet(const ADBResultSet: IDBResultSet);
begin
// FOrmDataSet.Locate(KeyFiels, KeyValues, Options);
// { TODO -oISAQUE : Procurar forma de verificar se o registro não já está em memória
// pela chave primaria }
while ADBResultSet.NotEof do
begin
FOwner.FOrmDataSet.Append;
TBind.Instance
.SetFieldToField(ADBResultSet, FOwner.FOrmDataSet);
FOwner.FOrmDataSet.Fields[0].AsInteger := -1;
FOwner.FOrmDataSet.Post;
end;
ADBResultSet.Close;
end;
end.
|
unit MyUtils;
interface
uses
RegularExpressions;
type
TUtils = class
public
class function ExtractLetters(Text: string): string;
class function ExtractNumbers(Text: string): string;
end;
implementation
class function TUtils.ExtractLetters(Text: string): string;
begin
Result := TRegEx.Replace(Text, '[\W\d]', '');
end;
class function TUtils.ExtractNumbers(Text: string): string;
begin
Result := TRegEx.Replace(Text, '\D', '');
end;
end.
|
{*******************************************************************************
* *
* PentireFMX *
* *
* https://github.com/gmurt/PentireFMX *
* *
* Copyright 2020 Graham Murt *
* *
* email: graham@kernow-software.co.uk *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License forthe specific language governing permissions and *
* limitations under the License. *
* *
*******************************************************************************}
unit ksPinCode;
interface
uses {$IFDEF MSWINDOWS} Windows, {$ENDIF} Classes, FMX.StdCtrls, FMX.Graphics, FMX.Objects, ksProgressIndicator,
System.UITypes, System.UIConsts, FMX.Types, FMX.Controls, System.Types;
type
TksPinCodeSubmitEvent = procedure(Sender: TObject; ACode: string) of object;
[ComponentPlatformsAttribute(pidAllPlatforms)]
TksPinCode = class(TControl)
private
FIndicator: TksProgressIndicator;
FTintColor: TAlphaColor;
FLogo: TBitmap;
FKeyRects: array[1..12] of TRectF;
FCode: string;
FPrompt: string;
FOnSubmit: TksPinCodeSubmitEvent;
FPinLength: integer;
procedure SetTintColor(const Value: TAlphaColor);
procedure SetLogo(const Value: TBitmap);
function ButtonIndexFromPos(x, y: single): integer;
procedure DoKeyPressed(AKey: string);
procedure DoDeletePressed;
procedure DoSubmit;
procedure SetPrompt(const Value: string);
procedure SetPinLength(const Value: integer);
protected
procedure Paint; override;
protected
procedure Resize; override;
procedure Loaded; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Single); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Reset;
published
property Align;
property Logo: TBitmap read FLogo write SetLogo;
property Margins;
property Padding;
property Position;
property Width;
property TintColor: TAlphaColor read FTintColor write SetTintColor default $FF336A97;
property Size;
property Height;
property PinLength: integer read FPinLength write SetPinLength default 4;
property Prompt: string read FPrompt write SetPrompt;
property Visible;
property OnSubmit: TksPinCodeSubmitEvent read FOnSubmit write FOnSubmit;
end;
procedure Register;
implementation
uses Math, System.TypInfo, SysUtils, System.Threading,
Fmx.Forms, ksCommon;
procedure Register;
begin
RegisterComponents('Pentire FMX', [TksPinCode]);
end;
{ TksSpeedButton }
procedure TksPinCode.Reset;
begin
FCode := '';
FIndicator.Steps.CurrentStep := 0;
Repaint;
end;
constructor TksPinCode.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FIndicator := TksProgressIndicator.Create(Self);
FIndicator.Stored := False;
FTintColor := $FF336A97;
FIndicator.ActiveColor := FTintColor;
FIndicator.OutlineColor := FTintColor;
FIndicator.InactiveColor := claWhite;
FIndicator.Steps.Size := 28;
FIndicator.Steps.CurrentStep := 0;
FIndicator.KeepHighlighted := True;
FLogo := TBitmap.Create;
Size.Width := 320;
Size.Height := 480;
AddObject(FIndicator);
FCode := '';
FPrompt := 'Enter PIN';
FPinLength := 4;
FIndicator.Steps.MaxSteps := FPinLength;
end;
destructor TksPinCode.Destroy;
begin
FIndicator.DisposeOf;
FreeAndNil(FLogo);
inherited;
end;
procedure TksPinCode.DoDeletePressed;
begin
if Length(FCode) > 0 then
FCode := Copy(FCode, 1, Length(FCode)-1);
FIndicator.Steps.CurrentStep := Length(FCode);
//DoVibrate;
Repaint;
end;
procedure TksPinCode.DoKeyPressed(AKey: string);
begin
if Length(FCode) < 4 then
begin
FCode := FCode + AKey;
FIndicator.Steps.CurrentStep := Length(FCode);
//DoVibrate;
{$IFDEF MSWINDOWS}
OutputDebugString(PChar('Key Index Pressed: '+AKey));
{$ENDIF}
end;
//Sleep(1000);
//FIndicator.Visible := True;
Repaint;
if Length(Fcode) = 4 then
begin
Application.ProcessMessages;
Sleep(200);
DoSubmit;
end;
end;
procedure TksPinCode.DoSubmit;
begin
{$IFDEF MSWINDOWS}
OutputDebugString(PChar('Code entered: '+FCode));
{$ENDIF}
if Assigned(FOnSubmit) then
FOnSubmit(Self, FCode);
end;
function TksPinCode.ButtonIndexFromPos(x, y: single): integer;
var
ICount: integer;
begin
Result := -1;
for ICount := 1 to 12 do
begin
if PtInRect(FKeyRects[ICount], PointF(x, y)) then
begin
Result := ICount-1;
Exit;
end;
end;
end;
procedure TksPinCode.Loaded;
begin
inherited;
Resize;
end;
procedure TksPinCode.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Single);
var
AIndex: integer;
begin
inherited;
AIndex := ButtonIndexFromPos(x, y);
if AIndex > -1 then
begin
case AIndex of
0..8: DoKeyPressed(IntToStr(AIndex+1));
10: DoKeyPressed('0');
11: DoDeletePressed;
end;
end;
end;
procedure TksPinCode.Paint;
var
rectKeypad: TRectF;
rectText: TRectF;
rectLogo: TRectF;
ABtnWidth, ABtnHeight: single;
ICount: integer;
x,y: single;
ABtnText: string;
begin
inherited;
if Locked then
Exit;
Canvas.Fill.Color := claWhite;
Canvas.FillRect(ClipRect, 0, 0, AllCorners, 1);
if (csDesigning in ComponentState) then
begin
DrawDesignBorder(claDimgray, claDimgray);
end;
rectKeypad := ClipRect;
rectKeypad.Top := (rectKeypad.Height / 10) * 6;
Canvas.Fill.Color := FTintColor;
Canvas.Fill.Kind := TBrushKind.Solid;
Canvas.FillRect(rectKeypad, 0, 0, AllCorners, 1);
rectText := RectF(0, 0, Width, ((Height / 10) * 6) - 110);
rectLogo := RectF((Width/2)-32, (rectText.Bottom/2)-32, (Width/2)+32, (rectText.Bottom/2)+32);
begin
if (csDesigning in ComponentState) then
begin
Canvas.Stroke.Dash := TStrokeDash.Dash;
Canvas.Stroke.Thickness := GetScreenScale;
Canvas.Stroke.Kind := TBrushKind.Solid;
Canvas.DrawRect(rectLogo, 0, 0, AllCorners, 1);
end;
if FLogo <> nil then
Canvas.DrawBitmap(FLogo, RectF(0, 0, FLogo.Width, FLogo.Height), rectLogo, 1);
end;
Canvas.Font.Size := 20;
Canvas.FillText(rectText, FPrompt, False, 1, [], TTextAlign.Center, TTextAlign.Trailing);
ABtnWidth := rectKeypad.Width /3;
ABtnHeight := rectKeypad.Height / 4;
Canvas.Fill.Color := claWhite;
x := 0;
y := rectKeypad.Top;
for ICount := 1 to 12 do
begin
case ICount of
1..9: ABtnText := InTtoStr(ICount);
10: ABtnText := '';
11: ABtnText := '0';
12: ABtnText := 'DEL';
end;
FKeyRects[ICount] := RectF(x, y, x+ABtnWidth, y+ABtnHeight);
Canvas.FillText(FKeyRects[ICount], ABtnText, False, 1, [], TTextAlign.Center, TTextAlign.Center);
x := x + ABtnWidth;
if ICount mod 3 = 0 then
begin
y := y + ABtnHeight;
x := 0;
end;
end;
end;
procedure TksPinCode.Resize;
begin
inherited;
FIndicator.Position.X := 0;
FIndicator.Size.Width := Width;
FIndicator.Position.Y := ((Height / 10) * 6) - 100;
end;
procedure TksPinCode.SetLogo(const Value: TBitmap);
begin
FLogo := Value;
Repaint;
end;
procedure TksPinCode.SetPinLength(const Value: integer);
begin
FPinLength := Value;
FIndicator.Steps.MaxSteps := Value;
Repaint;
end;
procedure TksPinCode.SetPrompt(const Value: string);
begin
if FPrompt <> Value then
begin
FPrompt := Value;
Repaint;
end;
end;
procedure TksPinCode.SetTintColor(const Value: TAlphaColor);
begin
FTintColor := Value;
Repaint;
end;
end.
|
{
ID: ndchiph1
PROG: nuggets
LANG: PASCAL
}
uses math;
const
inputfile = 'nuggets.in';
outputfile = 'nuggets.out';
LM = 67000;
//type
var
fi,fo: text;
n: longint;
f: array[0..LM] of boolean;
procedure openfile;
begin
assign(fi,inputfile); reset(fi);
assign(fo,outputfile); rewrite(fo);
end;
procedure closefile;
begin
close(fi);
close(fo);
end;
procedure input;
begin
readln(fi,n);
end;
procedure process;
var
i,j,num: longint;
begin
f[0]:= true;
for i:= 1 to n do
begin
readln(fi,num);
for j:= num to LM do
if f[j-num] then f[j]:= true;
end;
f[0]:= false;
for i:= 66500 downto 0 do
if not f[i] then
if (i < 66000) then
begin
writeln(fo,i);
exit;
end
else
begin
writeln(fo,0);
exit;
end;
end;
procedure output;
begin
end;
BEGIN
openfile;
input;
process;
output;
closefile;
END.
|
unit itcmm;
{ =================================================================
Instrutech ITC-16/18 Interface Library V1.0
(c) John Dempster, University of Strathclyde, All Rights Reserved
=================================================================
28/2/02
15/3/02
19/3/02 ... Completed, first released version
1/8/02 ... ITC-16 now only has +/- 10.24V A/D voltage range
Changes to various structures to match updated ITCMM.DLL
21/8/02 ...
6/12/02 ... Latest revision of ITCMM.DLL
11/2/04 ... ITCMM_MemoryToDACAndDigitalOut can now wait for ext. trigger
itcmm.dll now specifically loaded from program folder
12/11/04 .. Two DAC output channels now supported
04/04/07 ... Collection of last point in single sweep now assured
19/12/11 ... D/A fifo now filled by ITCMM_GetADCSamples allowing
record buffer to be increased to MaxADCSamples div 2 (4194304)
27/8/12 ... ITCMM_WriteDACsAndDigitalPort and ITCMM_ReadADC now disabled when ADCActive = TRUE
06.11.13 .. A/D input channels can now be mapped to different physical inputs
}
interface
uses WinTypes,Dialogs, SysUtils, WinProcs,mmsystem, math, UITypes ;
procedure ITCMM_InitialiseBoard ;
procedure ITCMM_LoadLibrary ;
function ITCMM_GetDLLAddress(
Handle : Integer ;
const ProcName : string ) : Pointer ;
procedure ITCMM_ConfigureHardware(
EmptyFlagIn : Integer ) ;
function ITCMM_ADCToMemory(
var HostADCBuf : Array of SmallInt ;
nChannels : Integer ;
nSamples : Integer ;
var dt : Double ;
ADCVoltageRange : Single ;
TriggerMode : Integer ;
ExternalTriggerActiveHigh : Boolean ;
CircularBuffer : Boolean ;
ADCChannelInputMap : Array of Integer
) : Boolean ;
function ITCMM_StopADC : Boolean ;
procedure ITCMM_GetADCSamples (
OutBuf : Pointer ;
var OutBufPointer : Integer
) ;
procedure ITCMM_CheckSamplingInterval(
var SamplingInterval : Double ;
var Ticks : Cardinal
) ;
function ITCMM_MemoryToDACAndDigitalOut(
var DACValues : Array of SmallInt ;
NumDACChannels : Integer ;
nPoints : Integer ;
var DigValues : Array of SmallInt ;
DigitalInUse : Boolean ;
WaitForExternalTrigger : Boolean
) : Boolean ;
function ITCMM_GetDACUpdateInterval : double ;
function ITCMM_StopDAC : Boolean ;
procedure ITCMM_WriteDACsAndDigitalPort(
var DACVolts : array of Single ;
nChannels : Integer ;
DigValue : Integer
) ;
function ITCMM_GetLabInterfaceInfo(
var Model : string ; { Laboratory interface model name/number }
var ADCMinSamplingInterval : Double ; { Smallest sampling interval }
var ADCMaxSamplingInterval : Double ; { Largest sampling interval }
var ADCMinValue : Integer ; { Negative limit of binary ADC values }
var ADCMaxValue : Integer ; { Positive limit of binary ADC values }
var ADCVoltageRanges : Array of single ; { A/D voltage range option list }
var NumADCVoltageRanges : Integer ; { No. of options in above list }
var ADCBufferLimit : Integer ; { Max. no. samples in A/D buffer }
var DACMaxVolts : Single ; { Positive limit of bipolar D/A voltage range }
var DACMinUpdateInterval : Double {Min. D/A update interval }
) : Boolean ;
function ITCMM_GetMaxDACVolts : single ;
function ITCMM_ReadADC( Channel : Integer ) : SmallInt ;
procedure ITCMM_GetChannelOffsets(
var Offsets : Array of Integer ;
NumChannels : Integer
) ;
procedure ITCMM_CloseLaboratoryInterface ;
function TrimChar( Input : Array of ANSIChar ) : string ;
function MinInt( const Buf : array of LongInt ) : LongInt ;
function MaxInt( const Buf : array of LongInt ) : LongInt ;
Procedure ITCMM_CheckError( Err : Cardinal ; ErrSource : String ) ;
implementation
uses SESLabIO ;
const
FIFOMaxPoints = 16128 ;
MAX_DEVICE_TYPE_NUMBER = 4 ;
ITC16_ID = 0 ;
ITC16_MAX_DEVICE_NUMBER= 16 ;
ITC18_ID = 1 ;
ITC18_MAX_DEVICE_NUMBER = 16 ;
ITC1600_ID = 2 ;
ITC1600_MAX_DEVICE_NUMBER = 16 ;
ITC00_ID = 3 ;
ITC00_MAX_DEVICE_NUMBER = 16 ;
ITC_MAX_DEVICE_NUMBER = 16 ;
NORMAL_MODE = 0 ;
SMART_MODE = 1 ;
D2H = $00 ; //Input
H2D = $01 ; //Output
DIGITAL_INPUT = $02 ; //Digital Input
DIGITAL_OUTPUT = $03 ; //Digital Output
AUX_INPUT = $04 ; //Aux Input
AUX_OUTPUT = $05 ; //Aux Output
//STUB -> check the correct number
NUMBER_OF_D2H_CHANNELS = 32 ; //ITC1600: 8+F+S0+S1+4(AUX) == 15 * 2 = 30
NUMBER_OF_H2D_CHANNELS = 15 ; //ITC1600: 4+F+S0+S1 == 7 * 2 = 14 + 1-Host-Aux
//STUB -> Move this object to the Registry
ITC18_SOFTWARE_SEQUENCE_SIZE = 4096 ;
//STUB ->Verify
ITC16_SOFTWARE_SEQUENCE_SIZE = 1024 ;
ITC18_NUMBEROFCHANNELS = 16 ; //4 + 8 + 2 + 1 + 1
ITC18_NUMBEROFOUTPUTS = 7 ; //4 + 2 + 1
ITC18_NUMBEROFINPUTS = 9 ; //8 + 1
ITC18_NUMBEROFADCINPUTS = 8 ;
ITC18_NUMBEROFDACOUTPUTS = 4 ;
ITC18_NUMBEROFDIGINPUTS = 1 ;
ITC18_NUMBEROFDIGOUTPUTS = 2 ;
ITC18_NUMBEROFAUXINPUTS = 0 ;
ITC18_NUMBEROFAUXOUTPUTS = 1 ;
ITC18_DA_CH_MASK = $3 ; //4 DA Channels
ITC18_DO0_CH = $4 ; //DO0
ITC18_DO1_CH = $5 ; //DO1
ITC18_AUX_CH = $6 ; //AUX
ITC16_NUMBEROFCHANNELS = 14 ; //4 + 8 + 1 + 1
ITC16_NUMBEROFOUTPUTS = 5 ; //4 + 1
ITC16_NUMBEROFINPUTS = 9 ; //8 + 1
ITC16_DO_CH = 4 ;
ITC16_NUMBEROFADCINPUTS = 8 ;
ITC16_NUMBEROFDACOUTPUTS = 4 ;
ITC16_NUMBEROFDIGINPUTS = 1 ;
ITC16_NUMBEROFDIGOUTPUTS = 1 ;
ITC16_NUMBEROFAUXINPUTS = 0 ;
ITC16_NUMBEROFAUXOUTPUTS = 0 ;
//STUB: Check the numbers
ITC1600_NUMBEROFCHANNELS = 47 ; //15 + 32
ITC1600_NUMBEROFINPUTS = 32 ; //(8 AD + 1 Temp + 4 Aux + 3 Dig) * 2
ITC1600_NUMBEROFOUTPUTS = 15 ; //(4 + 3) * 2 + 1
ITC1600_NUMBEROFADCINPUTS = 16 ; //8+8
ITC1600_NUMBEROFDACOUTPUTS = 8 ; //4+4
ITC1600_NUMBEROFDIGINPUTS = 6 ; //F+S+S * 2
ITC1600_NUMBEROFDIGOUTPUTS = 6 ; //F+S+S * 2
ITC1600_NUMBEROFAUXINPUTS = 8 ; //4+4
ITC1600_NUMBEROFAUXOUTPUTS = 1 ; //On Host
ITC1600_NUMBEROFTEMPINPUTS = 2 ; //1+1
ITC1600_NUMBEROFINPUTGROUPS = 8 ; //
ITC1600_NUMBEROFOUTPUTGROUPS = 5 ; //(DAC, SD) + (DAC, SD) + FD + FD + HOST
//***************************************************************************
//ITC1600 CHANNELS
//DACs
ITC1600_DA0 = 0 ; //RACK0
ITC1600_DA1 = 1 ;
ITC1600_DA2 = 2 ;
ITC1600_DA3 = 3 ;
ITC1600_DA4 = 4 ; //RACK1
ITC1600_DA5 = 5 ;
ITC1600_DA6 = 6 ;
ITC1600_DA7 = 7;
//Digital outputs
ITC1600_DOF0 = 8 ; //RACK0
ITC1600_DOS00 = 9 ;
ITC1600_DOS01 = 10 ;
ITC1600_DOF1 = 11 ; //RACK1
ITC1600_DOS10 = 12 ;
ITC1600_DOS11 = 13 ;
ITC1600_HOST = 14 ;
//ADCs
ITC1600_AD0 = 0 ; //RACK0
ITC1600_AD1 = 1 ;
ITC1600_AD2 = 2 ;
ITC1600_AD3 = 3 ;
ITC1600_AD4 = 4 ;
ITC1600_AD5 = 5 ;
ITC1600_AD6 = 6 ;
ITC1600_AD7 = 7 ;
ITC1600_AD8 = 8 ; //RACK1
ITC1600_AD9 = 9 ;
ITC1600_AD10 = 10 ;
ITC1600_AD11 = 11 ;
ITC1600_AD12 = 12 ;
ITC1600_AD13 = 13 ;
ITC1600_AD14 = 14 ;
ITC1600_AD15 = 15 ;
//Slow ADCs
ITC1600_SAD0 = 16 ; //RACK0
ITC1600_SAD1 = 17 ;
ITC1600_SAD2 = 18 ;
ITC1600_SAD3 = 19 ;
ITC1600_SAD4 = 20 ; //RACK1
ITC1600_SAD5 = 21 ;
ITC1600_SAD6 = 22 ;
ITC1600_SAD7 = 23 ;
//Temperature
ITC1600_TEM0 = 24 ; //RACK0
ITC1600_TEM1 = 25 ; //RACK1
//Digital inputs
ITC1600_DIF0 = 26 ; //RACK0
ITC1600_DIS00 = 27 ;
ITC1600_DIS01 = 28 ;
ITC1600_DIF1 = 29 ; //RACK1
ITC1600_DIS10 = 31 ;
ITC1600_DIS11 = 32 ;
ITC18_STANDARD_FUNCTION = 0 ;
ITC18_PHASESHIFT_FUNCTION = 1 ;
ITC18_DYNAMICCLAMP_FUNCTION = 2 ;
ITC18_SPECIAL_FUNCTION = 3 ;
ITC1600_STANDARD_FUNCTION = 0 ;
//***************************************************************************
//Overflow/Underrun Codes
ITC_READ_OVERFLOW_H = $01 ;
ITC_WRITE_UNDERRUN_H = $02 ;
ITC_READ_OVERFLOW_S = $10 ;
ITC_WRITE_UNDERRUN_S = $20 ;
ITC_STOP_CH_ON_OVERFLOW = $0001 ; //Stop One Channel
ITC_STOP_CH_ON_UNDERRUN = $0002 ;
ITC_STOP_CH_ON_COUNT = $1000 ;
ITC_STOP_PR_ON_COUNT = $2000 ;
ITC_STOP_DR_ON_OVERFLOW = $0100 ; //Stop One Direction
ITC_STOP_DR_ON_UNDERRUN = $0200 ;
ITC_STOP_ALL_ON_OVERFLOW = $1000 ; //Stop System (Hardware STOP)
ITC_STOP_ALL_ON_UNDERRUN = $2000 ;
//***************************************************************************
//Software Keys MSB
PaulKey = $5053 ;
HekaKey = $4845 ;
UicKey = $5543 ;
InstruKey = $4954 ;
AlexKey = $4142 ;
EcellKey = $4142 ;
SampleKey = $5470 ;
TestKey = $4444 ;
TestSuiteKey = $5453 ;
ITC_EMPTY = 0 ;
ITC_RESERVE = $80000000 ;
ITC_INIT_FLAG = $00008000 ;
ITC_FUNCTION_MASK = $00000FFF ;
RUN_STATE = $10 ;
ERROR_STATE = $80000000 ;
DEAD_STATE = $00 ;
EMPTY_INPUT = $01 ;
EMPTY_OUTPUT = $02 ;
USE_FREQUENCY = $0 ;
USE_TIME = $1 ;
USE_TICKS = $2 ;
NO_SCALE = $0 ;
MS_SCALE = $4 ;
US_SCALE = $8 ;
NS_SCALE = $C ;
READ_TOTALTIME = $01 ;
READ_RUNTIME = $02 ;
READ_ERRORS = $04 ;
READ_RUNNINGMODE = $08 ;
READ_OVERFLOW = $10 ;
READ_CLIPPING = $20 ;
RESET_FIFO_COMMAND = $10000 ;
PRELOAD_FIFO_COMMAND = $20000 ;
LAST_FIFO_COMMAND = $40000 ;
FLUSH_FIFO_COMMAND = $80000 ;
// ITC-16 FIFO sequence codes
// --------------------------
ITC16_INPUT_AD0 = $7 ;
ITC16_INPUT_AD1 = $6 ;
ITC16_INPUT_AD2 = $5 ;
ITC16_INPUT_AD3 = $4 ;
ITC16_INPUT_AD4 = $3 ;
ITC16_INPUT_AD5 = $2 ;
ITC16_INPUT_AD6 = $1 ;
ITC16_INPUT_AD7 = $0 ;
ITC16_INPUT_DIGITAL =$20 ;
ITC16_INPUT_UPDATE = $0 ;
ITC16_OUTPUT_DA0 = $18 ;
ITC16_OUTPUT_DA1 = $10 ;
ITC16_OUTPUT_DA2 = $08 ;
ITC16_OUTPUT_DA3 = $0 ;
ITC16_OUTPUT_DIGITAL = $40 ;
ITC16_OUTPUT_UPDATE = $0 ;
// ITC-18 FIFO sequence codes
// --------------------------
ITC18_INPUT_AD0 = $0000 ;
ITC18_INPUT_AD1 = $0080 ;
ITC18_INPUT_AD2 = $0100 ;
ITC18_INPUT_AD3 = $0180 ;
ITC18_INPUT_AD4 = $0200 ;
ITC18_INPUT_AD5 = $0280 ;
ITC18_INPUT_AD6 = $0300 ;
ITC18_INPUT_AD7 = $0380 ;
ITC18_INPUT_UPDATE = $4000 ;
ITC18_OUTPUT_DA0 = $0000 ;
ITC18_OUTPUT_DA1 = $0800 ;
ITC18_OUTPUT_DA2 = $1000 ;
ITC18_OUTPUT_DA3 = $1800 ;
ITC18_OUTPUT_DIGITAL0 = $2000 ;
ITC18_OUTPUT_DIGITAL1 = $2800 ;
ITC18_OUTPUT_UPDATE = $8000 ;
// Error flags
ACQ_SUCCESS = 0 ;
Error_DeviceIsNotSupported = $0001000 ; //1000 0000 0000 0001 0000 0000 0000
Error_UserVersionID = $80001000 ;
Error_KernelVersionID = $81001000 ;
Error_DSPVersionID = $82001000;
Error_TimerIsRunning = $8CD01000 ;
Error_TimerIsDead = $8CD11000 ;
Error_TimerIsWeak = $8CD21000 ;
Error_MemoryAllocation = $80401000 ;
Error_MemoryFree = $80411000 ;
Error_MemoryError = $80421000 ;
Error_MemoryExist = $80431000 ;
Warning_AcqIsRunning = $80601000 ;
Error_TIMEOUT = $80301000 ;
Error_OpenRegistry = $8D101000 ;
Error_WriteRegistry = $8DC01000 ;
Error_ReadRegistry = $8DB01000 ;
Error_ParamRegistry = $8D701000 ;
Error_CloseRegistry = $8D201000 ;
Error_Open = $80101000 ;
Error_Close = $80201000 ;
Error_DeviceIsBusy = $82601000 ;
Error_AreadyOpen = $80111000 ;
Error_NotOpen = $80121000 ;
Error_NotInitialized = $80D01000 ;
Error_Parameter = $80701000 ;
Error_ParameterSize = $80A01000 ;
Error_Config = $89001000 ;
Error_InputMode = $80611000 ;
Error_OutputMode = $80621000 ;
Error_Direction = $80631000 ;
Error_ChannelNumber = $80641000 ;
Error_SamplingRate = $80651000 ;
Error_StartOffset = $80661000 ;
Error_Software = $8FF01000 ;
type
//Specification for Hardware Configuration
THWFunction = packed record
Mode : Cardinal ; //Mode: 0 - Internal Clock; 1 - Intrabox Clock; 2 External Clock
U2F_File :Pointer ; //U2F File name -> may be NULL
SizeOfSpecificFunction : Cardinal ; //Sizeof SpecificFunction
SpecificFunction : Pointer ; //Specific for each device
end ;
TITC1600_Special_HWFunction = packed record
Func : Cardinal ; //HWFunction
DSPType : Cardinal ; //LCA for Interface side
HOSTType : Cardinal ; //LCA for Interface side
RACKType : Cardinal ; //LCA for Interface side
end ;
TITC18_Special_HWFunction = packed record
Func : Cardinal ; //HWFunction
InterfaceData : Pointer ; //LCA for Interface side
IsolatedData : Pointer ; //LCA for Isolated side
Reserved : Cardinal ; // Added for new ITCMLL
end ;
TITCChannelInfo = packed record
ModeNumberOfPoints : Cardinal ;
ChannelType : Cardinal ;
ChannelNumber : Cardinal ;
Reserved0 : Cardinal ; //0 - does not care; Use High speed if possible
ErrorMode : Cardinal ; //See ITC_STOP_XX..XX definition for Error Modes
ErrorState : Cardinal ;
FIFOPointer : Pointer ;
FIFONumberOfPoints : Cardinal ; //In Points
ModeOfOperation : Cardinal ;
SizeOfModeParameters : Cardinal ;
ModeParameters : Pointer ;
SamplingIntervalFlag : Cardinal ; //See flags above
SamplingRate : Double ; //See flags above
StartOffset : Double ; //Seconds
Gain : Double ; //Times
Offset : Double ; //Volts
ExternalDecimation : Cardinal ;
Reserved1 : Cardinal ;
Reserved2 : Cardinal ;
Reserved3 : Cardinal ;
end ;
TITCStatus = packed record
CommandStatus : Cardinal ;
RunningMode : Cardinal ;
Overflow : Cardinal ;
Clipping : Cardinal ;
State : Cardinal ;
Reserved0 : Cardinal ;
Reserved1 : Cardinal ;
Reserved2 : Cardinal ;
TotalSeconds : Double ;
RunSeconds : Double ;
end ;
// Specification for Acquisition Configuration record
TITCPublicConfig = packed record
DigitalInputMode : Cardinal ; //Bit 0: Latch Enable, Bit 1: Invert. For ITC1600; See AES doc.
ExternalTriggerMode : Cardinal ; //Bit 0: Transition, Bit 1: Invert
ExternalTrigger : Cardinal ; //Enable
EnableExternalClock : Cardinal ; //Enable
DACShiftValue : Cardinal ; //For ITC18 Only. Needs special LCA
InputRange : Cardinal ; //AD0.. AD7
TriggerOutPosition : Cardinal ;
OutputEnable : Integer ;
SequenceLength : Cardinal ; //In/Out for ITC16/18; Out for ITC1600
Sequence : Pointer ; //In/Out for ITC16/18; Out for ITC1600
SequenceLengthIn : Cardinal ; //For ITC1600 only
SequenceIn : Pointer ; //For ITC1600 only
ResetFIFOFlag : Cardinal ; //Reset FIFO Pointers / Total Number of points in NORMALMODE
ControlLight : Cardinal ;
SamplingInterval : Double ; //In Seconds. Note: may be calculated from channel setting
end ;
TITCChannelData = packed record
ChannelType : Cardinal ; //Channel Type + Command
ChannelNumber : Cardinal ; //Channel Number
Value : Integer ; //Number of points OR Data Value
DataPointer : Pointer ; //Data
end ;
TITCSingleScanData = packed record
ChannelType : Cardinal ; //Channel Type
ChannelNumber : Cardinal ; //Channel Number
IntegrationPeriod : Double ;
DecimateMode : Cardinal ;
end ;
TVersionInfo = packed record
Major : Integer ;
Minor : Integer ;
Description : Array[0..79] of ANSIchar ;
Date : Array[0..79] of ANSIchar ;
end ;
TGlobalDeviceInfo = packed record
DeviceType : Cardinal ;
DeviceNumber : Cardinal ;
PrimaryFIFOSize : Cardinal ; //In Points
SecondaryFIFOSize : Cardinal ; //In Points
LoadedFunction : Cardinal ;
SoftKey : Cardinal ;
Mode : Cardinal ;
MasterSerialNumber : Cardinal ;
SecondarySerialNumber : Cardinal ;
HostSerialNumber : Cardinal ;
NumberOfDACs : Cardinal ;
NumberOfADCs : Cardinal ;
NumberOfDOs : Cardinal ;
NumberOfDIs : Cardinal ;
NumberOfAUXOs : Cardinal ;
NumberOfAUXIs : Cardinal ;
Reserved0 : Cardinal ;
Reserved1 : Cardinal ;
Reserved2 : Cardinal ;
Reserved3 : Cardinal ;
end ;
TITCStartInfo = packed record
ExternalTrigger : Integer ; //-1 - do not change
OutputEnable : Integer ; //-1 - do not change
StopOnOverflow : Integer ; //-1 - do not change
StopOnUnderrun : Integer ; //-1 - do not change
RunningOption : Integer ;
ResetFIFOs : Cardinal ;
Reserved2 : Cardinal ;
Reserved3 : Cardinal ;
StartTime : Double ;
StopTime : Double ;
end ;
TITCLimited = packed record
ChannelType : Cardinal ;
ChannelNumber : Cardinal ;
SamplingIntervalFlag : Cardinal ; //See flags above
SamplingRate : Double ; //See flags above
TimeIntervalFlag : Cardinal ; //See flags above
Time : Double ; //See flags above
DecimationMode : Cardinal ;
Data : Pointer ;
end ;
// *** DLL libray function templates ***
TITC_Devices = Function (
DeviceType : Cardinal ;
Var DeviceNumber : Cardinal ) : Cardinal ; cdecl ;
TITC_GetDeviceHandle = Function(
DeviceType : Cardinal ;
DeviceNumber : Cardinal ;
Var DeviceHandle : Integer ) : Cardinal ; cdecl ;
TITC_GetDeviceType = Function(
DeviceHandle : Integer ;
Var DeviceType : Cardinal ;
Var DeviceNumber : Cardinal ) : Cardinal ; cdecl ;
TITC_OpenDevice = Function (
DeviceType : Cardinal ;
DeviceNumber : Cardinal ;
Mode : Cardinal ;
Var DeviceHandle : Integer ) : Cardinal ; cdecl ;
TITC_CloseDevice = Function(
DeviceHandle : Integer ) : Cardinal ; cdecl ;
TITC_InitDevice = Function(
DeviceHandle : Integer ;
sHWFunction : pointer ) : Cardinal ; cdecl ;
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//M
//M STATIC INFORMATION FUNCTIONs
//M
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
TITC_GetDeviceInfo = Function(
DeviceHandle : Integer ;
Var DeviceInfo : TGlobalDeviceInfo ) : Cardinal ; cdecl ;
TITC_GetVersions = Function(
DeviceHandle : Integer ;
Var ThisDriverVersion : TVersionInfo ;
Var KernelLevelDriverVersion : TVersionInfo ;
Var HardwareVersion: TVersionInfo ) : Cardinal ; cdecl ;
TITC_GetSerialNumbers = Function(
DeviceHandle : Integer ;
Var HostSerialNumber : Integer ;
Var MasterBoxSerialNumber : Integer ;
Var SlaveBoxSerialNumber : Integer ) : Cardinal ; cdecl ;
TITC_GetStatusText = Function(
DeviceHandle : Integer ;
Status : Integer ;
Text : PANSIChar ;
MaxCharacters : Cardinal ) : Cardinal ; cdecl ;
TITC_SetSoftKey = Function(
DeviceHandle : Integer ;
SoftKey : Cardinal ) : Cardinal ; cdecl ;
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//M
//M DYNAMIC INFORMATION FUNCTIONs
//M
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
TITC_GetState = Function(
DeviceHandle : Integer ;
Var sParam : TITCStatus ) : Cardinal ; cdecl ;
TITC_SetState = Function(
DeviceHandle : Integer ;
Var sParam : TITCStatus ): Cardinal ; cdecl ;
TITC_GetFIFOInformation = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var ChannelData : Array of TITCChannelData ) : Cardinal ; cdecl ;
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//M
//M CONFIGURATION FUNCTIONs
//M
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
TITC_ResetChannels = Function(
DeviceHandle : Integer ) : Cardinal ; cdecl ;
TITC_SetChannels = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Channels : Array of TITCChannelInfo ) : Cardinal ; cdecl ;
TITC_UpdateChannels = Function(
DeviceHandle : Integer ) : Cardinal ; cdecl ;
TITC_GetChannels = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Channels : Array of TITCChannelInfo ): Cardinal ; cdecl ;
TITC_ConfigDevice = Function(
DeviceHandle : Integer ;
Var ITCConfig : TITCPublicConfig ): Cardinal ; cdecl ;
TITC_Start = Function(
DeviceHandle : Integer ;
Var StartInfo : TITCStartInfo ) : Cardinal ; cdecl ;
TITC_Stop = Function(
DeviceHandle : Integer ;
Var StartInfo : TITCStartInfo ) : Cardinal ; cdecl ;
TITC_UpdateNow = Function(
DeviceHandle : Integer ;
Var StartInfo : TITCStartInfo ) : Cardinal ; cdecl ;
TITC_SingleScan = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Data : Array of TITCSingleScanData ) : Cardinal ; cdecl ;
TITC_AsyncIO = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Data : Array of TITCChannelData ) : Cardinal ; cdecl ;
//***************************************************************************
TITC_GetDataAvailable = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Data : Array of TITCChannelData ) : Cardinal ; cdecl ;
TITC_UpdateFIFOPosition = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Data : Array of TITCChannelData ) : Cardinal ; cdecl ;
TITC_ReadWriteFIFO = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Data : Array of TITCChannelData ) : Cardinal ; cdecl ;
TITC_UpdateFIFOInformation = Function(
DeviceHandle : Integer ;
NumberOfChannels : Cardinal ;
Var Data : Array of TITCChannelData ) : Cardinal ; cdecl ;
var
ITC_Devices : TITC_Devices ;
ITC_GetDeviceHandle : TITC_GetDeviceHandle ;
ITC_GetDeviceType : TITC_GetDeviceType ;
ITC_OpenDevice : TITC_OpenDevice ;
ITC_CloseDevice : TITC_CloseDevice ;
ITC_InitDevice : TITC_InitDevice ;
ITC_GetDeviceInfo : TITC_GetDeviceInfo ;
ITC_GetVersions : TITC_GetVersions ;
ITC_GetSerialNumbers : TITC_GetSerialNumbers ;
ITC_GetStatusText : TITC_GetStatusText ;
ITC_SetSoftKey : TITC_SetSoftKey ;
ITC_GetState : TITC_GetState ;
ITC_SetState : TITC_SetState ;
ITC_GetFIFOInformation : TITC_GetFIFOInformation ;
ITC_ResetChannels : TITC_ResetChannels ;
ITC_SetChannels : TITC_SetChannels ;
ITC_UpdateChannels : TITC_UpdateChannels ;
ITC_GetChannels : TITC_GetChannels ;
ITC_ConfigDevice : TITC_ConfigDevice ;
ITC_Start : TITC_Start ;
ITC_Stop : TITC_Stop ;
ITC_UpdateNow : TITC_UpdateNow ;
ITC_SingleScan : TITC_SingleScan ;
ITC_AsyncIO : TITC_AsyncIO ;
ITC_GetDataAvailable : TITC_GetDataAvailable ;
ITC_UpdateFIFOPosition : TITC_UpdateFIFOPosition ;
ITC_ReadWriteFIFO : TITC_ReadWriteFIFO ;
//ITC_UpdateFIFOInformation : TITC_UpdateFIFOInformation ;
LibraryHnd : THandle ; // ITCMM DLL library file handle
Device : Integer ; // ITCMM device handle
DeviceType : Cardinal ; // ITC interface type (ITC16/ITC18)
LibraryLoaded : boolean ; // Libraries loaded flag
DeviceInitialised : Boolean ; // Indicates devices has been successfully initialised
DeviceInfo : TGlobalDeviceInfo ; // ITC device hardware information
FADCVoltageRangeMax : Single ; // Upper limit of A/D input voltage range
FADCMinValue : Integer ; // Max. A/D integer value
FADCMaxValue : Integer ; // Min. A/D integer value
FADCSamplingInterval : Double ; // A/D sampling interval in current use (s)
FADCMinSamplingInterval : Single ; // Minimum valid A/D sampling interval (s)
FADCMaxSamplingInterval : Single ; // Maximum valid A/D sampling interval (s)
FADCBufferLimit : Integer ; // Number of samples in A/D input buffer
CyclicADCBuffer : Boolean ; // Circular (non-stop) A/D sampling mode
EmptyFlag : SmallInt ; // Value of A/D buffer empty flag
FNumADCSamples : Integer ; // No. of A/D samples per channel to acquire
FNumADCChannels : Integer ; // No. of A/D channels to acquired
FNumSamplesRequired : Integer ; // Total no. of A/D samples to acquired
OutPointer : Integer ; // Pointer to last A/D sample transferred
// (used by ITCMM_GetADC+Samples)
OutPointerSkipCount : Integer ; // No. of points to ignore when FIFO read starts
FDACVoltageRangeMax : Single ; // Upper limit of D/A voltage range
FDACMinValue : Integer ; // Max. D/A integer value
FDACMaxValue : Integer ; // Min. D/A integer value
FNumDACPoints : Integer ;
FNumDACChannels : Integer ; // No. of D/A channels in use
FDACPointer : Integer ; // No. output points written to FIFO
FDACMinUpdateInterval : Single ;
DACFIFO : PSmallIntArray ; // FIFO output storage buffer
DACPointer : Integer ; // FIFO DAC write pointer
ADCFIFO : PSmallIntArray ; // FIFO input storage buffer
// FIFO sequencer codes in use
INPUT_AD0 : Integer ;
INPUT_AD1 : Integer ;
INPUT_AD2 : Integer ;
INPUT_AD3 : Integer ;
INPUT_AD4 : Integer ;
INPUT_AD5 : Integer ;
INPUT_AD6 : Integer ;
INPUT_AD7 : Integer ;
INPUT_UPDATE : Integer ;
OUTPUT_DA0 : Integer ;
OUTPUT_DA1 : Integer ;
OUTPUT_DA2 : Integer ;
OUTPUT_DA3 : Integer ;
OUTPUT_DIGITAL : Integer ;
OUTPUT_UPDATE : Integer ;
Sequence : Array[0..16] of Cardinal ; // FIFO input/output control sequence
Config : TITCPublicConfig ; // ITC interface configuration data
ADCActive : Boolean ; // Indicates A/D conversion in progress
function ITCMM_GetLabInterfaceInfo(
var Model : string ; { Laboratory interface model name/number }
var ADCMinSamplingInterval : Double ; { Smallest sampling interval }
var ADCMaxSamplingInterval : Double ; { Largest sampling interval }
var ADCMinValue : Integer ; { Negative limit of binary ADC values }
var ADCMaxValue : Integer ; { Positive limit of binary ADC values }
var ADCVoltageRanges : Array of single ; { A/D voltage range option list }
var NumADCVoltageRanges : Integer ; { No. of options in above list }
var ADCBufferLimit : Integer ; { Max. no. samples in A/D buffer }
var DACMaxVolts : Single ; { Positive limit of bipolar D/A voltage range }
var DACMinUpdateInterval : Double {Min. D/A update interval }
) : Boolean ;
{ --------------------------------------------
Get information about the interface hardware
-------------------------------------------- }
begin
if not DeviceInitialised then ITCMM_InitialiseBoard ;
{ Get type of Digidata 1320 }
if DeviceInitialised then begin
{ Get device model and serial number }
if DeviceType = ITC16_ID then
Model := format( ' ITC-16 Detected : s/n %d',[DeviceInfo.MasterSerialNumber] )
else if DeviceType = ITC18_ID then
Model := format( ' ITC-18 Detected : s/n %d',[DeviceInfo.MasterSerialNumber] )
else Model := 'Unknown' ;
// Define available A/D voltage range options
ADCVoltageRanges[0] := 10.24 ;
ADCVoltageRanges[1] := 5.12 ;
ADCVoltageRanges[2] := 2.048 ;
ADCVoltageRanges[3] := 1.024 ;
FADCVoltageRangeMax := ADCVoltageRanges[0] ;
// ITC-16 does not have programmable A/D gain
if DeviceType = ITC18_ID then NumADCVoltageRanges := 4
else NumADCVoltageRanges := 1 ;
// A/D sample value range (16 bits)
ADCMinValue := -32678 ;
ADCMaxValue := -ADCMinValue - 1 ;
FADCMinValue := ADCMinValue ;
FADCMaxValue := ADCMaxValue ;
// Upper limit of bipolar D/A voltage range
DACMaxVolts := 10.25 ;
FDACVoltageRangeMax := 10.25 ;
DACMinUpdateInterval := 2.5E-6 ;
FDACMinUpdateInterval := DACMinUpdateInterval ;
// Min./max. A/D sampling intervals
ADCMinSamplingInterval := 5E-6 ;
ADCMaxSamplingInterval := 0.065 ;
FADCMinSamplingInterval := ADCMinSamplingInterval ;
FADCMaxSamplingInterval := ADCMaxSamplingInterval ;
// FADCBufferLimit := High(TSmallIntArray)+1 ;
FADCBufferLimit := MaxADCSamples div 2 ; //Old value 16128 ;
ADCBufferLimit := FADCBufferLimit ;
end ;
Result := DeviceInitialised ;
end ;
procedure ITCMM_LoadLibrary ;
{ -------------------------------------
Load ITCMM.DLL library into memory
-------------------------------------}
begin
{ Load ITCMM interface DLL library }
LibraryHnd := LoadLibrary(
PChar(ExtractFilePath(ParamStr(0)) + 'itcmm.DLL'));
{ Get addresses of procedures in library }
if LibraryHnd > 0 then begin
@ITC_Devices :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_Devices') ;
@ITC_GetDeviceHandle :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetDeviceHandle') ;
@ITC_GetDeviceType :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetDeviceType') ;
@ITC_OpenDevice :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_OpenDevice') ;
@ITC_CloseDevice :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_CloseDevice') ;
@ITC_InitDevice :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_InitDevice') ;
@ITC_GetDeviceInfo :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetDeviceInfo') ;
@ITC_GetVersions :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetVersions') ;
@ITC_GetSerialNumbers :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetSerialNumbers') ;
@ITC_GetStatusText :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetStatusText') ;
@ITC_SetSoftKey :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_SetSoftKey') ;
@ITC_GetState :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetState') ;
@ITC_SetState :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_SetState') ;
@ITC_GetFIFOInformation :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetFIFOInformation') ;
@ITC_ResetChannels :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_ResetChannels') ;
@ITC_SetChannels :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_SetChannels') ;
@ITC_UpdateChannels :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_UpdateChannels') ;
@ITC_GetChannels :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetChannels') ;
@ITC_ConfigDevice :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_ConfigDevice') ;
@ITC_Start :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_Start') ;
@ITC_Stop :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_Stop') ;
@ITC_UpdateNow :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_UpdateNow') ;
@ITC_SingleScan :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_SingleScan') ;
@ITC_AsyncIO :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_AsyncIO') ;
@ITC_GetDataAvailable :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_GetDataAvailable') ;
@ITC_UpdateFIFOPosition :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_UpdateFIFOPosition') ;
@ITC_ReadWriteFIFO :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_ReadWriteFIFO') ;
//@ITC_UpdateFIFOInformation :=ITCMM_GetDLLAddress(LibraryHnd,'ITC_UpdateFIFOInformation') ;
LibraryLoaded := True ;
end
else begin
MessageDlg( ' Instrutech interface library (ITCMM.DLL) not found', mtWarning, [mbOK], 0 ) ;
LibraryLoaded := False ;
end ;
end ;
function ITCMM_GetDLLAddress(
Handle : Integer ;
const ProcName : string ) : Pointer ;
// -----------------------------------------
// Get address of procedure within ITC16 DLL
// -----------------------------------------
begin
Result := GetProcAddress(Handle,PChar(ProcName)) ;
if Result = Nil then
MessageDlg('ITCMM.DLL- ' + ProcName + ' not found',mtWarning,[mbOK],0) ;
end ;
function ITCMM_GetMaxDACVolts : single ;
{ -----------------------------------------------------------------
Return the maximum positive value of the D/A output voltage range
-----------------------------------------------------------------}
begin
Result := FDACVoltageRangeMax ;
end ;
procedure ITCMM_InitialiseBoard ;
{ -------------------------------------------
Initialise Instrutech interface hardware
-------------------------------------------}
var
Err,Retry : Integer ;
NumDevices : Cardinal ;
Done : Boolean ;
begin
DeviceInitialised := False ;
if not LibraryLoaded then ITCMM_LoadLibrary ;
if LibraryLoaded then begin
// Determine type of ITC interface
Err := ITC_Devices( ITC16_ID, NumDevices ) ;
ITCMM_CheckError( Err, 'ITC_Devices' ) ;
if Err <> ACQ_SUCCESS then exit
else begin
if NumDevices > 0 then begin
// Set up for ITC-16
DeviceType := ITC16_ID ;
// Load ITC-16 FIFO sequencer codes
INPUT_AD0 := ITC16_INPUT_AD0 ;
INPUT_AD1 := ITC16_INPUT_AD1 ;
INPUT_AD2 := ITC16_INPUT_AD2 ;
INPUT_AD3 := ITC16_INPUT_AD3 ;
INPUT_AD4 := ITC16_INPUT_AD4 ;
INPUT_AD5 := ITC16_INPUT_AD5 ;
INPUT_AD6 := ITC16_INPUT_AD6 ;
INPUT_AD7 := ITC16_INPUT_AD7 ;
INPUT_UPDATE := ITC16_INPUT_UPDATE ;
OUTPUT_DA0 := ITC16_OUTPUT_DA0 ;
OUTPUT_DA1 := ITC16_OUTPUT_DA1 ;
OUTPUT_DA2 := ITC16_OUTPUT_DA2 ;
OUTPUT_DA3 := ITC16_OUTPUT_DA3 ;
OUTPUT_DIGITAL := ITC16_OUTPUT_DIGITAL ;
OUTPUT_UPDATE := ITC16_OUTPUT_UPDATE ;
OutPointerSkipCount := -5 ;
end
else begin
ITC_Devices( ITC18_ID, NumDevices ) ;
if NumDevices > 0 then begin
// Set up for ITC-18
DeviceType := ITC18_ID ;
// Load ITC-16 FIFO sequencer codes
INPUT_AD0 := ITC18_INPUT_AD0 ;
INPUT_AD1 := ITC18_INPUT_AD1 ;
INPUT_AD2 := ITC18_INPUT_AD2 ;
INPUT_AD3 := ITC18_INPUT_AD3 ;
INPUT_AD4 := ITC18_INPUT_AD4 ;
INPUT_AD5 := ITC18_INPUT_AD5 ;
INPUT_AD6 := ITC18_INPUT_AD6 ;
INPUT_AD7 := ITC18_INPUT_AD7 ;
INPUT_UPDATE := ITC18_INPUT_UPDATE ;
OUTPUT_DA0 := ITC18_OUTPUT_DA0 ;
OUTPUT_DA1 := ITC18_OUTPUT_DA1 ;
OUTPUT_DA2 := ITC18_OUTPUT_DA2 ;
OUTPUT_DA3 := ITC18_OUTPUT_DA3 ;
OUTPUT_DIGITAL := ITC18_OUTPUT_DIGITAL1 ;
OUTPUT_UPDATE := ITC18_OUTPUT_UPDATE ;
OutPointerSkipCount := -3 ;
end ;
end ;
end ;
// Open device
Done := False ;
Retry := 0 ;
While not Done do begin
Err := ITC_OpenDevice( DeviceType, 0, NORMAL_MODE, Device ) ;
if (Err = ACQ_SUCCESS) or (Retry >= 10) then Done := True ;
Inc(Retry) ;
end ;
ITCMM_CheckError( Err, 'ITC_OpenDevice' ) ;
if Err <> ACQ_SUCCESS then exit ;
// Initialise interface hardware
Err := ITC_InitDevice( Device, Nil ) ;
ITCMM_CheckError( Err, 'ITC_InitDevice' ) ;
// Get device information
Err := ITC_GetDeviceInfo( Device, DeviceInfo ) ;
ITCMM_CheckError( Err, 'ITC_DeviceInfo' ) ;
// Create A/D, D/A and digital O/P buffers
New(ADCFIFO) ;
New(DACFIFO) ;
DeviceInitialised := True ;
end ;
end ;
procedure ITCMM_ConfigureHardware(
EmptyFlagIn : Integer ) ;
{ --------------------------------------------------------------------------
-------------------------------------------------------------------------- }
begin
EmptyFlag := EmptyFlagIn ;
end ;
function ITCMM_ADCToMemory(
var HostADCBuf : Array of SmallInt ; { A/D sample buffer (OUT) }
nChannels : Integer ; { Number of A/D channels (IN) }
nSamples : Integer ; { Number of A/D samples ( per channel) (IN) }
var dt : Double ; { Sampling interval (s) (IN) }
ADCVoltageRange : Single ; { A/D input voltage range (V) (IN) }
TriggerMode : Integer ; { A/D sweep trigger mode (IN) }
ExternalTriggerActiveHigh : Boolean ; // External trigger is active high
CircularBuffer : Boolean ; { Repeated sampling into buffer (IN) }
ADCChannelInputMap : Array of Integer // Physical A/D input channel map
) : Boolean ; { Returns TRUE indicating A/D started }
{ -----------------------------
Start A/D converter sampling
-----------------------------}
var
ch,Gain : Integer ;
Ticks : Cardinal ;
StartInfo : TITCStartInfo ;
ChannelInfo : Array[0..7] of TITCChannelInfo ;
ChannelData : TITCChannelData ;
Err : Cardinal ;
OK : Boolean ;
begin
Result := False ;
if not DeviceInitialised then ITCMM_InitialiseBoard ;
if not DeviceInitialised then Exit ;
// Stop any acquisition in progress
ITCMM_StopADC ;
// Make sure that dt is one of (1,10,20,50,100,...) us
ITCMM_CheckSamplingInterval( dt, Ticks ) ;
// Copy to internal storage
FNumADCSamples := nSamples ;
FNumADCChannels := nChannels ;
FNumSamplesRequired := nChannels*nSamples ;
FADCSamplingInterval := dt ;
CyclicADCBuffer := CircularBuffer ;
// Reset all existing channels
Err := ITC_ResetChannels( Device ) ;
ITCMM_CheckError( Err, 'ITC_ResetChannels' ) ;
// Define new A/D input channels
for ch := 0 to nChannels-1 do begin
ChannelInfo[ch].ModeNumberOfPoints := 0 ;
ChannelInfo[ch].ChannelType := D2H ;
ChannelInfo[ch].ChannelNumber := ch ;
ChannelInfo[ch].ErrorMode := 0 ;
ChannelInfo[ch].ErrorState := 0 ;
ChannelInfo[ch].FIFOPointer := ADCFIFO ;
ChannelInfo[ch].FIFONumberOfPoints := 0 ;
ChannelInfo[ch].ModeOfOperation := 0 ;
ChannelInfo[ch].SizeOfModeParameters := 0 ;
ChannelInfo[ch].ModeParameters := Nil ;
ChannelInfo[ch].SamplingIntervalFlag := USE_TIME or US_SCALE;
ChannelInfo[ch].SamplingRate := (dt*1E6) ;
ChannelInfo[ch].StartOffset := 0.0 ;
ChannelInfo[ch].Gain := 1.0 ;
ChannelInfo[ch].Offset := 0.0 ;
end ;
// Load new channel settings
Err := ITC_SetChannels( Device, nChannels, ChannelInfo ) ;
ITCMM_CheckError( Err, 'ITC_SetChannels' ) ;
// Update interface with new settings
Err := ITC_UpdateChannels( Device ) ;
ITCMM_CheckError( Err, 'ITC_UpdateChannels' ) ;
Config.DigitalInputMode := 0 ;
// Set external trigger polarity
if ExternalTriggerActiveHigh then Config.ExternalTriggerMode := 1
else Config.ExternalTriggerMode := 3 ;
// Set external trigger
if TriggerMode <> tmFreeRun then Config.ExternalTrigger := 1
else Config.ExternalTrigger := 0 ;
Config.EnableExternalClock := 0 ;
Config.DACShiftValue := 0 ;
Config.TriggerOutPosition := 0 ;
Config.OutputEnable := 0 ;
// Set A/D input gain for Ch.0
Gain := Round(FADCVoltageRangeMax/ADCVoltageRange) ;
if Gain = 1 then Config.InputRange := 0
else if Gain = 2 then Config.InputRange := 1
else if Gain = 5 then Config.InputRange := 2
else Config.InputRange := 3 ;
// Replicate gain setting for all other channels in use
for ch := 1 to nChannels-1 do
Config.InputRange := ((Config.InputRange and 3) shl (ch*2))
or Config.InputRange ;
Config.TriggerOutPosition := 0 ;
Config.OutputEnable := 0 ;
// Set up FIFO acquisition sequence for A/D input channels
for ch := 0 to nChannels-1 do begin
if ADCChannelInputMap[ch] = 0 then Sequence[ch] := INPUT_AD0 ;
if ADCChannelInputMap[ch] = 1 then Sequence[ch] := INPUT_AD1 ;
if ADCChannelInputMap[ch] = 2 then Sequence[ch] := INPUT_AD2 ;
if ADCChannelInputMap[ch] = 3 then Sequence[ch] := INPUT_AD3 ;
if ADCChannelInputMap[ch] = 4 then Sequence[ch] := INPUT_AD4 ;
if ADCChannelInputMap[ch] = 5 then Sequence[ch] := INPUT_AD5 ;
if ADCChannelInputMap[ch] = 6 then Sequence[ch] := INPUT_AD6 ;
if ADCChannelInputMap[ch] = 7 then Sequence[ch] := INPUT_AD7 ;
if ch = (nChannels-1) then Sequence[ch] := Sequence[ch] or INPUT_UPDATE ;
end ;
Config.Sequence := @Sequence ;
Config.SequenceLength := nChannels ;
Config.SequenceLengthIn := 0 ;
Config.SequenceIn := Nil ;
Config.ResetFIFOFlag := 1 ;
Config.ControlLight := 0 ;
// Set sampling interval (THIS DOESN'T WORK AT THE MOMENT)
Config.SamplingInterval := (dt) / nChannels ;
Err := ITC_ConfigDevice( Device, Config ) ;
ITCMM_CheckError( Err, 'ITC_ConfigDevice' ) ;
// Clear A/D FIFO
ChannelData.ChannelType := D2H or FLUSH_FIFO_COMMAND ;
ChannelData.ChannelNumber := 0 ;
ChannelData.Value := 0 ;
Err := ITC_ReadWriteFIFO( Device, 1, ChannelData ) ;
ITCMM_CheckError(Err,'ITC_ReadWriteFIFO') ;
// Start A/D sampling
if TriggerMode <> tmWaveGen then begin
// Free Run vs External Trigger of recording seeep
if TriggerMode = tmExtTrigger then StartInfo.ExternalTrigger := 1
else StartInfo.ExternalTrigger := 0 ;
StartInfo.OutputEnable := -1 ;
if CircularBuffer then begin
StartInfo.StopOnOverFlow := 0 ;
StartInfo.StopOnUnderRun := 0 ;
end
else begin
StartInfo.StopOnOverFlow := 1 ;
StartInfo.StopOnUnderRun := 1 ;
end ;
StartInfo.RunningOption:= 0 ;
Err := ITC_Start( Device, StartInfo ) ;
ITCMM_CheckError( Err, 'ITC_START' ) ;
ADCActive := True ;
OK := True ;
end
else OK := True ;
OutPointer := OutPointerSkipCount ;
DACPointer := 0 ; // Clear DAC FIFO update pointer ;
Result := OK ;
end ;
function ITCMM_StopADC : Boolean ; { Returns False indicating A/D stopped }
{ -------------------------------
Reset A/D conversion sub-system
-------------------------------}
var
Status : TITCStatus ;
Dummy : TITCStartInfo ;
Err : Cardinal ;
ChannelData : TITCChannelData ;
begin
Result := False ;
if not DeviceInitialised then ITCMM_InitialiseBoard ;
if not DeviceInitialised then Exit ;
{ Stop ITC interface (both A/D and D/A) }
Status.CommandStatus := READ_RUNNINGMODE ;
Err := ITC_GetState( Device, Status ) ;
ITCMM_CheckError( Err, 'ITC_GetState' ) ;
if Status.RunningMode <> DEAD_STATE then begin
ITC_Stop( Device, Dummy ) ;
ITCMM_CheckError( Err, 'ITC_Stop' ) ;
end ;
// Determine number of samples available in FIFOs
ChannelData.ChannelType := D2H ;
ChannelData.ChannelNumber := 0 ;
ChannelData.Value := 0 ;
Err := ITC_GetDataAvailable( Device, 1, ChannelData ) ;
ITCMM_CheckError(Err,'ITC_GetDataAvailable') ;
//outputdebugString(PChar(format('%d',[ChannelData.Value]))) ;
// Read A/D samples from FIFO
ChannelData.DataPointer := ADCFIFO ;
if ChannelData.Value > 0 then begin
Err := ITC_ReadWriteFIFO( Device, 1, ChannelData ) ;
ITCMM_CheckError(Err,'ITC_ReadWriteFIFO') ;
end ;
ADCActive := False ;
Result := ADCActive ;
end ;
procedure ITCMM_GetADCSamples(
OutBuf : Pointer ; { Pointer to buffer to receive A/D samples [In] }
var OutBufPointer : Integer { Latest sample pointer [OUT]}
) ;
// -----------------------------------------
// Get A/D samples from ITC interface FIFO
// -----------------------------------------
var
i,OutPointerLimit : Integer ;
ChannelData : TITCChannelData ;
Err : Integer ;
begin
if ADCActive then begin
// Determine number of samples available in FIFO
ChannelData.ChannelType := D2H ;
ChannelData.ChannelNumber := 0 ;
ChannelData.Value := 0 ;
ITCMM_CheckError( ITC_GetDataAvailable( Device, 1, ChannelData),
'ITC_GetDataAvailable' ) ;
//outputdebugString(PChar(format('%d',[ChannelData.Value]))) ;
// Read A/D samples from FIFO
ChannelData.DataPointer := ADCFIFO ;
if ChannelData.Value > 1 then begin
// Interleave samples from A/D FIFO buffers into O/P buffer
if not CyclicADCBuffer then begin
OutPointerLimit := FNumSamplesRequired - 1 ;
// Ensure FIFO buffer is not emptied if sweep not completed
if (OutPointer + ChannelData.Value) < OutPointerLimit then begin
ChannelData.Value := ChannelData.Value -1 ;
end ;
// Read data from FIFO
ITCMM_CheckError( ITC_ReadWriteFIFO( Device, 1, ChannelData ),
'ITC_ReadWriteFIFO') ;
for i := 0 to ChannelData.Value-1 do begin
if (OutPointer >= 0) and (OutPointer <= OutPointerLimit) then
PSmallIntArray(OutBuf)^[OutPointer] := ADCFIFO^[i] ;
Inc(OutPointer) ;
end ;
OutBufPointer := Min(OutPointer,OutPointerLimit) ;
end
else begin
// Ensure FIFO buffer is not emptied
ChannelData.Value := ChannelData.Value -1 ;
// Read data from FIFO
ITCMM_CheckError( ITC_ReadWriteFIFO( Device, 1, ChannelData ),
'ITC_ReadWriteFIFO') ;
// Cyclic buffer
for i := 0 to ChannelData.Value-1 do begin
if OutPointer >= 0 then PSmallIntArray(OutBuf)^[OutPointer] := ADCFIFO^[i] ;
Inc(OutPointer) ;
if Outpointer >= FNumSamplesRequired then Outpointer := 0 ;
end ;
OutBufPointer := OutPointer ;
end ;
// Write D/A waveform to FIFO.
if (ChannelData.Value > 0) and (DACPointer > 0) and
(DACPointer < FNumSamplesRequired) then begin
ChannelData.ChannelType := H2D ;
ChannelData.Value := Min(ChannelData.Value,FNumSamplesRequired-DACPointer) ;
ChannelData.DataPointer := Pointer(Cardinal(DACFIFO) + DACPointer*2);
DACPointer := DACPointer + ChannelData.Value ;
Err := ITC_ReadWriteFIFO( Device, 1, ChannelData ) ;
ITCMM_CheckError(Err,'ITC_ReadWriteFIFO') ;
//outputdebugstring(pchar(format('%d %d',[DACPointer,ChannelData.Value])));
end ;
end ;
end ;
end ;
procedure ITCMM_CheckSamplingInterval(
var SamplingInterval : Double ;
var Ticks : Cardinal
) ;
{ ---------------------------------------------------
Convert sampling period from <SamplingInterval> (in s) into
clocks ticks, Returns no. of ticks in "Ticks"
---------------------------------------------------}
const
MaxTicksAllowed = 50000 ; // 50 ms upper limit
SecsToMicrosecs = 1E6 ;
var
TicksRequired,Multiplier,iStep : Cardinal ;
Steps : Array[0..4] of Cardinal ;
begin
// Ensure sampling interval remains within supported limits
if SamplingInterval < FADCMinSamplingInterval then
SamplingInterval := FADCMinSamplingInterval ;
if SamplingInterval > FADCMaxSamplingInterval then
SamplingInterval := FADCMaxSamplingInterval ;
// Set to nearest valid 1,2,4,5,8 increment
Steps[0] := 1 ;
Steps[1] := 2 ;
Steps[2] := 4 ;
Steps[3] := 5 ;
Steps[4] := 8 ;
TicksRequired := Round(SamplingInterval*SecsToMicrosecs) ;
iStep := 0 ;
Multiplier := 1 ;
Ticks := Steps[iStep]*Multiplier ;
while (Ticks < Min(TicksRequired,MaxTicksAllowed)) do begin
Ticks := Steps[iStep]*Multiplier ;
if iStep = High(Steps) then begin
Multiplier := Multiplier*10 ;
iStep := 0 ;
end
else Inc(iStep) ;
end ;
SamplingInterval := Ticks/SecsToMicrosecs ;
end ;
function ITCMM_MemoryToDACAndDigitalOut(
var DACValues : Array of SmallInt ; // D/A output values
NumDACChannels : Integer ; // No. D/A channels
nPoints : Integer ; // No. points per channel
var DigValues : Array of SmallInt ; // Digital port values
DigitalInUse : Boolean ; // Output to digital outs
WaitForExternalTrigger : Boolean // Wait for ext. trigger
) : Boolean ;
{ --------------------------------------------------------------
Send a voltage waveform stored in DACBuf to the D/A converters
30/11/01 DigFill now set to correct final value to prevent
spurious digital O/P changes between records
--------------------------------------------------------------}
var
i,k,ch,Err,iFIFO : Integer ;
StartInfo : TITCStartInfo ;
ChannelData : TITCChannelData ;
DACChannel : Array[0..15] of Cardinal ;
ADCChannel : Array[0..15] of Cardinal ;
NumOutChannels : Integer ; // No. of DAC + Digital output channels
LastFIFOSample : Integer ; // Last sample index in FIFO
InCh, OutCh : Integer ;
iDAC, iDig : Integer ;
Step,Counter : Single ;
begin
Result := False ;
if not DeviceInitialised then ITCMM_InitialiseBoard ;
if not DeviceInitialised then Exit ;
{ Stop any acquisition in progress }
ADCActive := ITCMM_StopADC ;
// Get A/D channel sequence codes
for ch := 0 to FNumADCChannels-1 do ADCChannel[Ch] := Sequence[Ch] ;
// Set up DAC channel O/P sequence codes
for ch := 0 to High(DACChannel) do DACChannel[ch] := OUTPUT_DA0 ;
if NumDACChannels > 1 then DACChannel[1] := OUTPUT_DA1 ;
if NumDACChannels > 2 then DACChannel[2] := OUTPUT_DA2 ;
if NumDACChannels > 3 then DACChannel[3] := OUTPUT_DA3 ;
NumOutChannels := NumDACChannels ;
if DigitalInUse then begin
DACChannel[NumDACChannels] := OUTPUT_DIGITAL ;
NumOutChannels := NumDACChannels + 1 ;
end ;
// Incorporate codes into FIFO control sequence
// (Note. Config and Sequence already contains data entered by ITCMM_ADCToMemory)
if FNumADCChannels < NumOutChannels then begin
// No. of output channels exceed input
// -----------------------------------
// Configure sequence memory
Config.SequenceLength := FNumADCChannels*NumOutChannels ;
InCh := 0 ;
OutCh := 0 ;
for k := 0 to Config.SequenceLength-1 do begin
Sequence[k] := ADCChannel[InCh] or DACChannel[OutCh] ;
// D/A channel update
if OutCh = (NumOutChannels-1) then begin
Sequence[k] := Sequence[k] or OUTPUT_UPDATE ;
OutCh := 0 ;
end
else Inc(OutCh) ;
// A/D channel update
if InCh = (FNumADCChannels-1) then begin
Sequence[k] := Sequence[k] or INPUT_UPDATE ;
InCh := 0 ;
end
else Inc(InCh) ;
end ;
// DAC / Dig buffer step interval
Step := NumOutChannels / FNumADCChannels ;
// Copy D/A values into D/A FIFO buffers
iFIFO := 0 ;
Counter := 0.0 ;
LastFIFOSample := FNumADCChannels*FNumADCSamples - 1 ;
While iFIFO <= LastFIFOSample do begin
// Copy D/A values
iDAC := Min( Trunc(Counter),nPoints-1 ) ;
for ch := 0 to NumDACChannels-1 do if iFIFO <= LastFIFOSample then begin
DACFIFO^[iFIFO] := DACValues[iDAC*NumDACChannels+ch] ;
Inc(iFIFO) ;
end ;
// Copy digital values
if DigitalInUse then begin
iDig := Min( Trunc(Counter),nPoints-1) ;
if iFIFO <= LastFIFOSample then begin
DACFIFO^[iFIFO] := DigValues[iDig] ;
Inc(iFIFO) ;
end ;
end ;
Counter := Counter + Step ;
end ;
end
else begin
// No. of input channels equal or exceed outputs
// ---------------------------------------------
// Configure sequence memory
Config.SequenceLength := FNumADCChannels ;
for ch := 0 to FNumADCChannels-1 do begin
Sequence[ch] := Sequence[ch] or DACChannel[ch] ;
end ;
Sequence[FNumADCChannels-1] := Sequence[FNumADCChannels-1] or OUTPUT_UPDATE ;
// Copy D/A values into D/A FIFO buffers
for i := 0 to FNumADCSamples-1 do begin
iDAC := Min( i, nPoints-1 ) ;
iFIFO := i*FNumADCChannels ;
// Copy D/A values
for ch := 0 to FNumADCChannels-1 do begin
if ch < NumOutChannels then
DACFIFO^[iFIFO+ch] := DACValues[iDAC*NumDACChannels+ch]
else DACFIFO^[iFIFO+ch] := DACValues[iDAC*NumDACChannels] ;
end ;
// Copy digital values
if DigitalInUse then begin
DACFIFO^[iFIFO+NumDACChannels] := DigValues[iDAC] ;
end ;
end ;
end ;
//outputdebugstring(pchar(format('%d',[iFIFO])));
Config.Sequence := @Sequence ;
Config.SequenceLengthIn := 0 ;
Config.SequenceIn := Nil ;
Config.ResetFIFOFlag := 1 ;
Config.ControlLight := 0 ;
Config.SamplingInterval := FADCSamplingInterval ;
Err := ITC_ConfigDevice( Device, Config ) ;
ITCMM_CheckError( Err, 'ITC_ConfigDevice' ) ;
// Write D/A samples to FIFO
ChannelData.ChannelType := H2D or RESET_FIFO_COMMAND or PRELOAD_FIFO_COMMAND {or LAST_FIFO_COMMAND} ;
ChannelData.ChannelNumber := 0 ;
ChannelData.Value := Min(FNumADCSamples*FNumADCChannels,FIFOMaxPoints) ;
ChannelData.DataPointer := DACFIFO ;
Err := ITC_ReadWriteFIFO( Device, 1, ChannelData ) ;
ITCMM_CheckError(Err,'ITC_ReadWriteFIFO') ;
{Save D/A sweep data }
DACPointer := Min(FNumADCSamples*FNumADCChannels,FIFOMaxPoints) ;
FNumDACPoints := nPoints ;
FNumDACChannels := NumDACChannels ;
// Start combined A/D & D/A sweep
if WaitForExternalTrigger then StartInfo.ExternalTrigger := 1
else StartInfo.ExternalTrigger := 0 ;
StartInfo.OutputEnable := 1 ; // Enable D/A output on interface
StartInfo.StopOnOverFlow := 1 ; // Stop FIFO on A/D overflow
StartInfo.StopOnUnderRun := 1 ; // Stop FIFO on D/A underrun
StartInfo.RunningOption := 0 ;
Err := ITC_Start( Device, StartInfo ) ;
ITCMM_CheckError( Err, 'ITC_Start' ) ;
ADCActive := True ;
Result := ADCActive ;
end ;
function ITCMM_GetDACUpdateInterval : double ;
{ -----------------------
Get D/A update interval
-----------------------}
begin
Result := FADCSamplingInterval ;
{ NOTE. DAC update interval is constrained to be the same
as A/D sampling interval (set by ITCMM_ADCtoMemory. }
end ;
function ITCMM_StopDAC : Boolean ;
{ ---------------------------------
Disable D/A conversion sub-system
---------------------------------}
begin
// Note. Since D/A sub-system of ITC boards is strictly linked
// to A/D sub-system, this procedure does nothing
Result := False ;
end ;
procedure ITCMM_WriteDACsAndDigitalPort(
var DACVolts : array of Single ;
nChannels : Integer ;
DigValue : Integer
) ;
{ ----------------------------------------------------
Update D/A outputs with voltages suppled in DACVolts
and TTL digital O/P with bit pattern in DigValue
----------------------------------------------------}
const
MaxDACValue = 32767 ;
MinDACValue = -32768 ;
var
DACScale : single ;
ch,DACValue,NumCh : Integer ;
ChannelData : Array[0..4] of TITCChannelData ;
Err : Integer ;
begin
if not DeviceInitialised then ITCMM_InitialiseBoard ;
if not DeviceInitialised then Exit ;
if ADCActive then Exit ;
// Scale from Volts to binary integer units
DACScale := MaxDACValue/FDACVoltageRangeMax ;
{ Set up D/A channel values }
NumCh := 0 ;
for ch := 0 to nChannels-1 do begin
// Correct for errors in hardware DAC scaling factor
DACValue := Round(DACVolts[ch]*DACScale) ;
// Keep within legitimate limits
if DACValue > MaxDACValue then DACValue := MaxDACValue ;
if DACValue < MinDACValue then DACValue := MinDACValue ;
ChannelData[NumCh].ChannelType := H2D ;
ChannelData[NumCh].ChannelNumber := ch ;
ChannelData[NumCh].Value := DACValue ;
Inc(NumCh) ;
end ;
// Set up digital O/P values
ChannelData[NumCh].ChannelType := DIGITAL_OUTPUT ;
ChannelData[NumCh].ChannelNumber := 0;
ChannelData[NumCh].Value := DigValue ;
Inc(NumCh) ;
Err := ITC_AsyncIO( Device, NumCh, ChannelData ) ;
ITCMM_CheckError( Err, 'ITC_AsyncIO' ) ;
end ;
function ITCMM_ReadADC(
Channel : Integer // A/D channel
) : SmallInt ;
// ---------------------------
// Read Analogue input channel
// ---------------------------
var
ChannelData : TITCChannelData ;
Err : Integer ;
begin
Result := 0 ;
if not DeviceInitialised then ITCMM_InitialiseBoard ;
if not DeviceInitialised then Exit ;
if ADCActive then Exit ;
ChannelData.ChannelType := D2H ;
ChannelData.ChannelNumber := Channel ;
Err := ITC_AsyncIO( Device, 1, ChannelData ) ;
ITCMM_CheckError( Err, 'ITC_AsyncIO' ) ;
Result := ChannelData.Value ;
end ;
procedure ITCMM_GetChannelOffsets(
var Offsets : Array of Integer ;
NumChannels : Integer
) ;
{ --------------------------------------------------------
Returns the order in which analog channels are acquired
and stored in the A/D data buffers
--------------------------------------------------------}
var
ch : Integer ;
begin
for ch := 0 to NumChannels-1 do Offsets[ch] := ch ;
end ;
procedure ITCMM_CloseLaboratoryInterface ;
{ -----------------------------------
Shut down lab. interface operations
----------------------------------- }
begin
if not DeviceInitialised then Exit ;
{ Stop any acquisition in progress }
ITCMM_StopADC ;
{ Close connection with interface }
ITC_CloseDevice( Device ) ;
// Free A/D, D/A and digital O/P buffers
Dispose(ADCFIFO) ;
Dispose(DACFIFO) ;
DeviceInitialised := False ;
ADCActive := False ;
end ;
function TrimChar( Input : Array of ANSIChar ) : string ;
var
i : Integer ;
pInput : PANSIChar ;
begin
pInput := @Input ;
Result := '' ;
for i := 0 to StrLen(pInput)-1 do Result := Result + Input[i] ;
end ;
{ -------------------------------------------
Return the smallest value in the array 'Buf'
-------------------------------------------}
function MinInt(
const Buf : array of LongInt { List of numbers (IN) }
) : LongInt ; { Returns Minimum of Buf }
var
i,Min : LongInt ;
begin
Min := High(Min) ;
for i := 0 to High(Buf) do
if Buf[i] < Min then Min := Buf[i] ;
Result := Min ;
end ;
{ -------------------------------------------
Return the largest value in the array 'Buf'
-------------------------------------------}
function MaxInt(
const Buf : array of LongInt { List of numbers (IN) }
) : LongInt ; { Returns Maximum of Buf }
var
i,Max : LongInt ;
begin
Max := -High(Max) ;
for i := 0 to High(Buf) do
if Buf[i] > Max then Max := Buf[i] ;
Result := Max ;
end ;
Procedure ITCMM_CheckError(
Err : Cardinal ; // Error code
ErrSource : String ) ; // Name of procedure which returned Err
// ----------------------------------------------
// Report type and source of ITC interface error
// ----------------------------------------------
var
ErrName : string ;
begin
if Err <> ACQ_SUCCESS then begin
Case Err of
Error_DeviceIsNotSupported : ErrName := 'DeviceIsNotSupported' ;
Error_UserVersionID : ErrName := 'UserVersionID' ;
Error_KernelVersionID : ErrName := 'KernelVersionID' ;
Error_DSPVersionID : ErrName := 'DSPVersionID' ;
Error_TimerIsRunning : ErrName := 'TimerIsRunning' ;
Error_TimerIsDead : ErrName := 'TimerIsDead' ;
Error_TimerIsWeak : ErrName := 'TimerIsWeak' ;
Error_MemoryAllocation : ErrName := 'MemoryAllocation' ;
Error_MemoryFree : ErrName := 'MemoryFree' ;
Error_MemoryError : ErrName := 'MemoryError' ;
Error_MemoryExist : ErrName := 'MemoryExist' ;
Warning_AcqIsRunning : ErrName := 'AcqIsRunning' ;
Error_TIMEOUT : ErrName := 'TIMEOUT' ;
Error_OpenRegistry : ErrName := 'OpenRegistry' ;
Error_WriteRegistry : ErrName := 'WriteRegistry' ;
Error_ReadRegistry : ErrName := 'ReadRegistry' ;
Error_ParamRegistry : ErrName := 'ParamRegistry' ;
Error_CloseRegistry : ErrName := 'CloseRegistry' ;
Error_Open : ErrName := 'Open' ;
Error_Close : ErrName := 'Close' ;
Error_DeviceIsBusy : ErrName := 'DeviceIsBusy' ;
Error_AreadyOpen : ErrName := 'AreadyOpen' ;
Error_NotOpen : ErrName := 'NotOpen' ;
Error_NotInitialized : ErrName := 'NotInitialized' ;
Error_Parameter : ErrName := 'Parameter' ;
Error_ParameterSize : ErrName := 'ParameterSize' ;
Error_Config : ErrName := 'Config' ;
Error_InputMode : ErrName := 'InputMode' ;
Error_OutputMode : ErrName := 'OutputMode' ;
Error_Direction : ErrName := 'Direction' ;
Error_ChannelNumber : ErrName := 'ChannelNumber' ;
Error_SamplingRate : ErrName := 'SamplingRate' ;
Error_StartOffset : ErrName := 'StartOffset' ;
Error_Software : ErrName := 'Software' ;
else ErrName := 'Unknown' ;
end ;
MessageDlg( 'Error ' + ErrName + ' in ' + ErrSource, mtError, [mbOK], 0) ;
//outputdebugString(PChar('Error ' + ErrName + ' in ' + ErrSource));
end ;
end ;
end.
|
{ *******************************************************************************
Title: T2Ti ERP
Description: Janela de Lançamentos para o módulo Contabilidade
The MIT License
Copyright: Copyright (C) 2016 T2Ti.COM
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
The author may be contacted at:
t2ti.com@gmail.com</p>
@author Albert Eije (t2ti.com@gmail.com)
@version 2.0
******************************************************************************* }
unit UContabilLancamento;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, UTelaCadastro, DB, DBClient, Menus, StdCtrls, ExtCtrls, Buttons, Grids,
DBGrids, JvExDBGrids, JvDBGrid, JvDBUltimGrid, ComCtrls, ContabilLancamentoCabecalhoVO,
ContabilLancamentoCabecalhoController, Tipos, Atributos, Constantes, LabeledCtrls, JvToolEdit,
Mask, JvExMask, JvBaseEdits, Math, StrUtils, ActnList, Generics.Collections,
RibbonSilverStyleActnCtrls, ActnMan, ToolWin, ActnCtrls, Controller;
type
[TFormDescription(TConstantes.MODULO_CONTABILIDADE, 'Lançamento Contábil')]
TFContabilLancamento = class(TFTelaCadastro)
DSContabilLancamentoDetalhe: TDataSource;
CDSContabilLancamentoDetalhe: TClientDataSet;
PanelMestre: TPanel;
EditIdLote: TLabeledCalcEdit;
EditLote: TLabeledEdit;
PageControlItens: TPageControl;
tsItens: TTabSheet;
PanelItens: TPanel;
GridDetalhe: TJvDBUltimGrid;
ComboBoxTipo: TLabeledComboBox;
CDSContabilLancamentoDetalheID: TIntegerField;
CDSContabilLancamentoDetalheID_CONTABIL_CONTA: TIntegerField;
CDSContabilLancamentoDetalheID_CONTABIL_HISTORICO: TIntegerField;
CDSContabilLancamentoDetalheID_CONTABIL_LANCAMENTO_CAB: TIntegerField;
CDSContabilLancamentoDetalheHISTORICO: TStringField;
CDSContabilLancamentoDetalheTIPO: TStringField;
CDSContabilLancamentoDetalheVALOR: TFMTBCDField;
EditDataLancamento: TLabeledDateEdit;
EditDataInclusao: TLabeledDateEdit;
ComboBoxLiberado: TLabeledComboBox;
CDSContabilLancamentoDetalhePERSISTE: TStringField;
CDSContabilLancamentoDetalheCONTABIL_CONTACLASSIFICACAO: TStringField;
EditValor: TLabeledCalcEdit;
procedure FormCreate(Sender: TObject);
procedure CDSContabilLancamentoDetalheAfterEdit(DataSet: TDataSet);
procedure GridDetalheKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure EditIdLoteKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
function VerificarLancamentos: Boolean;
public
{ Public declarations }
procedure GridParaEdits; override;
procedure LimparCampos; override;
procedure ControlaBotoes; override;
procedure ControlaPopupMenu; override;
// Controles CRUD
function DoInserir: Boolean; override;
function DoEditar: Boolean; override;
function DoExcluir: Boolean; override;
function DoSalvar: Boolean; override;
procedure ConfigurarLayoutTela;
end;
var
FContabilLancamento: TFContabilLancamento;
implementation
uses ULookup, Biblioteca, UDataModule, ContabilLancamentoDetalheVO, ContabilLoteVO,
ContabilLoteController, ContabilContaVO, ContabilContaController, ContabilHistoricoVO,
ContabilHistoricoController;
{$R *.dfm}
{$REGION 'Controles Infra'}
procedure TFContabilLancamento.FormCreate(Sender: TObject);
begin
ClasseObjetoGridVO := TContabilLancamentoCabecalhoVO;
ObjetoController := TContabilLancamentoCabecalhoController.Create;
inherited;
end;
procedure TFContabilLancamento.LimparCampos;
begin
inherited;
CDSContabilLancamentoDetalhe.EmptyDataSet;
end;
procedure TFContabilLancamento.ConfigurarLayoutTela;
begin
PanelEdits.Enabled := True;
if StatusTela = stNavegandoEdits then
begin
PanelMestre.Enabled := False;
PanelItens.Enabled := False;
end
else
begin
PanelMestre.Enabled := True;
PanelItens.Enabled := True;
end;
end;
procedure TFContabilLancamento.ControlaBotoes;
begin
inherited;
BotaoImprimir.Visible := False;
end;
procedure TFContabilLancamento.ControlaPopupMenu;
begin
inherited;
MenuImprimir.Visible := False;
end;
{$ENDREGION}
{$REGION 'Controles CRUD'}
function TFContabilLancamento.DoInserir: Boolean;
begin
Result := inherited DoInserir;
ConfigurarLayoutTela;
if Result then
begin
EditIdLote.SetFocus;
end;
end;
function TFContabilLancamento.DoEditar: Boolean;
begin
Result := inherited DoEditar;
ConfigurarLayoutTela;
if Result then
begin
EditIdLote.SetFocus;
end;
end;
function TFContabilLancamento.DoExcluir: Boolean;
begin
if inherited DoExcluir then
begin
try
TController.ExecutarMetodo('ContabilLancamentoCabecalhoController.TContabilLancamentoCabecalhoController', 'Exclui', [IdRegistroSelecionado], 'DELETE', 'Boolean');
Result := TController.RetornoBoolean;
except
Result := False;
end;
end
else
begin
Result := False;
end;
if Result then
TController.ExecutarMetodo('ContabilLancamentoCabecalhoController.TContabilLancamentoCabecalhoController', 'Consulta', [Trim(Filtro), Pagina.ToString, False], 'GET', 'Lista');
end;
function TFContabilLancamento.DoSalvar: Boolean;
var
ContabilLancamentoDetalhe: TContabilLancamentoDetalheVO;
begin
if VerificarLancamentos then
begin
Result := inherited DoSalvar;
if Result then
begin
try
if not Assigned(ObjetoVO) then
ObjetoVO := TContabilLancamentoCabecalhoVO.Create;
TContabilLancamentoCabecalhoVO(ObjetoVO).IdEmpresa := Sessao.Empresa.Id;
TContabilLancamentoCabecalhoVO(ObjetoVO).IdContabilLote := EditIdLote.AsInteger;
TContabilLancamentoCabecalhoVO(ObjetoVO).LoteDescricao := EditLote.Text;
TContabilLancamentoCabecalhoVO(ObjetoVO).DataLancamento := EditDataLancamento.Date;
TContabilLancamentoCabecalhoVO(ObjetoVO).DataInclusao := EditDataInclusao.Date;
TContabilLancamentoCabecalhoVO(ObjetoVO).Liberado := IfThen(ComboBoxLiberado.ItemIndex = 0, 'S', 'N');
TContabilLancamentoCabecalhoVO(ObjetoVO).Valor := EditValor.Value;
TContabilLancamentoCabecalhoVO(ObjetoVO).Tipo := Copy(ComboBoxTipo.Text, 1, 4);
// Detalhes
TContabilLancamentoCabecalhoVO(ObjetoVO).ListaContabilLancamentoDetalheVO := TObjectList<TContabilLancamentoDetalheVO>.Create;
CDSContabilLancamentoDetalhe.DisableControls;
CDSContabilLancamentoDetalhe.First;
while not CDSContabilLancamentoDetalhe.Eof do
begin
if (CDSContabilLancamentoDetalhePERSISTE.AsString = 'S') or (CDSContabilLancamentoDetalheID.AsInteger = 0) then
begin
ContabilLancamentoDetalhe := TContabilLancamentoDetalheVO.Create;
ContabilLancamentoDetalhe.Id := CDSContabilLancamentoDetalheID.AsInteger;
ContabilLancamentoDetalhe.IdContabilLancamentoCab := TContabilLancamentoCabecalhoVO(ObjetoVO).Id;
ContabilLancamentoDetalhe.IdContabilConta := CDSContabilLancamentoDetalheID_CONTABIL_CONTA.AsInteger;
ContabilLancamentoDetalhe.IdContabilHistorico := CDSContabilLancamentoDetalheID_CONTABIL_HISTORICO.AsInteger;
ContabilLancamentoDetalhe.Historico := CDSContabilLancamentoDetalheHISTORICO.AsString;
ContabilLancamentoDetalhe.Tipo := CDSContabilLancamentoDetalheTIPO.AsString;
ContabilLancamentoDetalhe.Valor := CDSContabilLancamentoDetalheVALOR.AsFloat;
TContabilLancamentoCabecalhoVO(ObjetoVO).ListaContabilLancamentoDetalheVO.Add(ContabilLancamentoDetalhe);
end;
CDSContabilLancamentoDetalhe.Next;
end;
CDSContabilLancamentoDetalhe.EnableControls;
if StatusTela = stInserindo then
begin
TController.ExecutarMetodo('ContabilLancamentoCabecalhoController.TContabilLancamentoCabecalhoController', 'Insere', [TContabilLancamentoCabecalhoVO(ObjetoVO)], 'PUT', 'Lista');
end
else if StatusTela = stEditando then
begin
if TContabilLancamentoCabecalhoVO(ObjetoVO).ToJSONString <> StringObjetoOld then
begin
TController.ExecutarMetodo('ContabilLancamentoCabecalhoController.TContabilLancamentoCabecalhoController', 'Altera', [TContabilLancamentoCabecalhoVO(ObjetoVO)], 'POST', 'Boolean');
end
else
Application.MessageBox('Nenhum dado foi alterado.', 'Mensagem do Sistema', MB_OK + MB_ICONINFORMATION);
end;
except
Result := False;
end;
end;
end
else
Exit(False);
end;
{$ENDREGION}
{$REGION 'Controle de Grid'}
procedure TFContabilLancamento.CDSContabilLancamentoDetalheAfterEdit(DataSet: TDataSet);
begin
CDSContabilLancamentoDetalhePERSISTE.AsString := 'S';
end;
procedure TFContabilLancamento.GridDetalheKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_F1 then
begin
try
if GridDetalhe.Columns[GridDetalhe.SelectedIndex].Field.FieldName = 'ID_CONTABIL_CONTA' then
begin
PopulaCamposTransientesLookup(TContabilContaVO, TContabilContaController);
if CDSTransiente.RecordCount > 0 then
begin
CDSContabilLancamentoDetalhe.Edit;
CDSContabilLancamentoDetalheID_CONTABIL_CONTA.AsInteger := CDSTransiente.FieldByName('ID').AsInteger;
CDSContabilLancamentoDetalheCONTABIL_CONTACLASSIFICACAO.AsString := CDSTransiente.FieldByName('CLASSIFICACAO').AsString;
CDSContabilLancamentoDetalheTIPO.AsString := CDSTransiente.FieldByName('NATUREZA').AsString;
CDSContabilLancamentoDetalhe.Post;
end;
end
else if GridDetalhe.Columns[GridDetalhe.SelectedIndex].Field.FieldName = 'HISTORICO' then
begin
PopulaCamposTransientesLookup(TContabilHistoricoVO, TContabilHistoricoController);
if CDSTransiente.RecordCount > 0 then
begin
CDSContabilLancamentoDetalhe.Edit;
CDSContabilLancamentoDetalheID_CONTABIL_HISTORICO.AsInteger := CDSTransiente.FieldByName('ID').AsInteger;
CDSContabilLancamentoDetalheHISTORICO.AsString := CDSTransiente.FieldByName('HISTORICO').AsString;
CDSContabilLancamentoDetalhe.Post;
end;
end;
finally
CDSTransiente.Close;
end;
end;
If Key = VK_RETURN then
EditIdLote.SetFocus;
end;
procedure TFContabilLancamento.GridParaEdits;
begin
inherited;
if not CDSGrid.IsEmpty then
begin
ObjetoVO := TContabilLancamentoCabecalhoVO(TController.BuscarObjeto('ContabilLancamentoCabecalhoController.TContabilLancamentoCabecalhoController', 'ConsultaObjeto', ['ID=' + IdRegistroSelecionado.ToString], 'GET'));
end;
if Assigned(ObjetoVO) then
begin
EditIdLote.AsInteger := TContabilLancamentoCabecalhoVO(ObjetoVO).IdContabilLote;
EditLote.Text := TContabilLancamentoCabecalhoVO(ObjetoVO).LoteDescricao;
EditDataLancamento.Date := TContabilLancamentoCabecalhoVO(ObjetoVO).DataLancamento;
EditDataInclusao.Date := TContabilLancamentoCabecalhoVO(ObjetoVO).DataInclusao;
ComboBoxLiberado.ItemIndex := AnsiIndexStr(TContabilLancamentoCabecalhoVO(ObjetoVO).Liberado, ['S', 'N']);
EditValor.Value := TContabilLancamentoCabecalhoVO(ObjetoVO).Valor;
ComboBoxTipo.ItemIndex := AnsiIndexStr(TContabilLancamentoCabecalhoVO(ObjetoVO).Tipo, ['UDVC', 'UCVD', 'UDUC', 'VDVC']);
// Preenche as grids internas com os dados das Listas que vieram no objeto
TController.TratarRetorno<TContabilLancamentoDetalheVO>(TContabilLancamentoCabecalhoVO(ObjetoVO).ListaContabilLancamentoDetalheVO, True, True, CDSContabilLancamentoDetalhe);
// Limpa as listas para comparar posteriormente se houve inclusões/alterações e subir apenas o necessário para o servidor
TContabilLancamentoCabecalhoVO(ObjetoVO).ListaContabilLancamentoDetalheVO.Clear;
// Serializa o objeto para consultar posteriormente se houve alterações
FormatSettings.DecimalSeparator := '.';
StringObjetoOld := ObjetoVO.ToJSONString;
FormatSettings.DecimalSeparator := ',';
end;
ConfigurarLayoutTela;
end;
{$ENDREGION}
{$REGION 'Campos Transientes'}
procedure TFContabilLancamento.EditIdLoteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
var
Filtro: String;
begin
if Key = VK_F1 then
begin
if EditIdLote.Value <> 0 then
Filtro := 'ID = ' + EditIdLote.Text
else
Filtro := 'ID=0';
try
EditIdLote.Clear;
EditLote.Clear;
if not PopulaCamposTransientes(Filtro, TContabilLoteVO, TContabilLoteController) then
PopulaCamposTransientesLookup(TContabilLoteVO, TContabilLoteController);
if CDSTransiente.RecordCount > 0 then
begin
EditIdLote.Text := CDSTransiente.FieldByName('ID').AsString;
EditLote.Text := CDSTransiente.FieldByName('DESCRICAO').AsString;
end
else
begin
Exit;
EditDataLancamento.SetFocus;
end;
finally
CDSTransiente.Close;
end;
end;
end;
{$ENDREGION}
{$REGION 'Actions'}
function TFContabilLancamento.VerificarLancamentos: Boolean;
var
Creditos, Debitos: Extended;
QuantidadeCreditos, QuantidadeDebitos: Integer;
Mensagem: String;
begin
Creditos := 0;
Debitos := 0;
QuantidadeCreditos := 0;
QuantidadeDebitos := 0;
Result := False;
//
CDSContabilLancamentoDetalhe.DisableControls;
CDSContabilLancamentoDetalhe.First;
while not CDSContabilLancamentoDetalhe.Eof do
begin
if CDSContabilLancamentoDetalheTIPO.AsString = 'C' then
begin
Inc(QuantidadeCreditos);
Creditos := Creditos + CDSContabilLancamentoDetalheVALOR.AsExtended;
end
else if CDSContabilLancamentoDetalheTIPO.AsString = 'D' then
begin
Inc(QuantidadeDebitos);
Debitos := Debitos + CDSContabilLancamentoDetalheVALOR.AsExtended;
end;
CDSContabilLancamentoDetalhe.Next;
end;
CDSContabilLancamentoDetalhe.First;
CDSContabilLancamentoDetalhe.EnableControls;
{ Verifica os totais }
if Creditos <> Debitos then
Mensagem := Mensagem + #13 + 'Total de créditos difere do total de débitos.';
{ Verifica os tipos de lançamento }
// UDVC - Um Débito para Vários Créditos
if ComboBoxTipo.ItemIndex = 0 then
begin
if QuantidadeDebitos > 1 then
Mensagem := Mensagem + #13 + 'UDVC - Mais do que um débito informado.';
if QuantidadeDebitos < 1 then
Mensagem := Mensagem + #13 + 'UDVC - Nenhum débito informado.';
if QuantidadeCreditos < 1 then
Mensagem := Mensagem + #13 + 'UDVC - Nenhum crédito informado.';
if QuantidadeCreditos = 1 then
Mensagem := Mensagem + #13 + 'UDVC - Apenas um crédito informado.';
end;
// UCVD - Um Crédito para Vários Débitos
if ComboBoxTipo.ItemIndex = 1 then
begin
if QuantidadeCreditos > 1 then
Mensagem := Mensagem + #13 + 'UCVD - Mais do que um crédito informado.';
if QuantidadeCreditos < 1 then
Mensagem := Mensagem + #13 + 'UCVD - Nenhum crédito informado.';
if QuantidadeDebitos < 1 then
Mensagem := Mensagem + #13 + 'UCVD - Nenhum débito informado.';
if QuantidadeDebitos = 1 then
Mensagem := Mensagem + #13 + 'UCVD - Apenas um débito informado.';
end;
// UDUC - Um Débito para Um Crédito
if ComboBoxTipo.ItemIndex = 2 then
begin
if QuantidadeCreditos > 1 then
Mensagem := Mensagem + #13 + 'UDUC - Mais do que um crédito informado.';
if QuantidadeDebitos > 1 then
Mensagem := Mensagem + #13 + 'UDUC - Mais do que um crédito informado.';
if QuantidadeCreditos < 1 then
Mensagem := Mensagem + #13 + 'UDUC - Nenhum crédito informado.';
if QuantidadeDebitos < 1 then
Mensagem := Mensagem + #13 + 'UDUC - Nenhum débito informado.';
end;
// VDVC - Vários Débitos para Vários Créditos
if ComboBoxTipo.ItemIndex = 3 then
begin
if QuantidadeCreditos < 1 then
Mensagem := Mensagem + #13 + 'VDVC - Nenhum crédito informado.';
if QuantidadeDebitos < 1 then
Mensagem := Mensagem + #13 + 'VDVC - Nenhum débito informado.';
if QuantidadeCreditos = 1 then
Mensagem := Mensagem + #13 + 'VDVC - Apenas um crédito informado.';
if QuantidadeDebitos = 1 then
Mensagem := Mensagem + #13 + 'VDVC - Apenas um débito informado.';
end;
if Mensagem <> '' then
begin
Application.MessageBox(PChar('Ocorreram erros na validação dos dados informados. Lista de erros abaixo: ' + #13 + Mensagem), 'Erro do sistema', MB_OK + MB_ICONERROR);
Result := False;
end
else
Result := True;
end;
{$ENDREGION}
end.
|
unit GPMatrixTest;
interface
uses
TestFramework,
GDIPOBJ,
GDIPAPI;
type
TGPMatrixTest = class(TTestCase)
private
FMatrix: TGPMatrix;
FTestPoint: array[0..0] of TGPPointF;
procedure CheckArraysEqual(const got, expected: TMatrixArray);
procedure CheckPointsEqual(const got, expected: TGPPointF);
public
procedure SetUp; override;
procedure TearDown; override;
published
procedure TestIdentity;
procedure TestSetElement;
procedure TestScale;
procedure TestTranslate;
procedure TestRotate;
procedure TestTranslateRotate;
procedure TestTranslateRotateScale;
procedure TestRotateAt;
end;
implementation
uses
System.Math;
{ TGDIPlusTest }
procedure TGPMatrixTest.CheckArraysEqual(const got, expected: TMatrixArray);
var
i: Integer;
begin
Check(High(got) = High(expected), 'Arrays sizes not equals!');
for i := Low(got) to High(got) do
Check(SameValue(got[i], expected[i], 0.0001), 'Arrays not equals!');
end;
procedure TGPMatrixTest.CheckPointsEqual(const got, expected: TGPPointF);
begin
Check(SameValue(got.X, expected.X, 0.0001), 'Points X not equals!');
Check(SameValue(got.Y, expected.Y, 0.0001), 'Points Y not equals!');
end;
procedure TGPMatrixTest.SetUp;
begin
inherited;
// identity matrix
FMatrix := TGPMatrix.Create;
FTestPoint[0].X := 1.0;
FTestPoint[0].Y := 0.0;
end;
procedure TGPMatrixTest.TearDown;
begin
inherited;
FMatrix.Free;
end;
procedure TGPMatrixTest.TestIdentity;
var
got: TMatrixArray;
expected: TMatrixArray;
expectedPoint: TGPPointF;
begin
expected[0] := 1; //m11
expected[1] := 0; //m12
expected[2] := 0; //m21
expected[3] := 1; //m22
expected[4] := 0; //dx
expected[5] := 0; //dy
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
expectedPoint := MakePoint(1.0, 0.0);
FMatrix.TransformPoints(PGPPoint(@FTestPoint), 1);
CheckPointsEqual(FTestPoint[0], expectedPoint);
end;
procedure TGPMatrixTest.TestRotate;
var
got: TMatrixArray;
expected: TMatrixArray;
expectedPoint: TGPPointF;
begin
{0.86602540378 0.50000000000
-0.50000000000 0.86602540378
}
expected[0] := 0.86602540378; //m11
expected[1] := 0.5; //m12
expected[2] := -0.5; //m21
expected[3] := 0.86602540378; //m22
expected[4] := 0; //dx
expected[5] := 0; //dy
// counter clockwise?
FMatrix.Rotate(30);
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
expectedPoint := MakePoint(0.86602540378, 0.5);
FMatrix.TransformPoints(PGPPointF(@FTestPoint));
CheckPointsEqual(FTestPoint[0], expectedPoint);
end;
procedure TGPMatrixTest.TestRotateAt;
const
offsetX = 10.0;
offsetY = 20.0;
rotAngle = 30;
var
got,
expected: TMatrixArray;
expectedMatrix: TGPMatrix;
begin
expectedMatrix := TGPMatrix.Create;
// 1st approach
expectedMatrix.Translate(-offsetX, -offsetY, MatrixOrderAppend);
expectedMatrix.Rotate(rotAngle, MatrixOrderAppend);
expectedMatrix.Translate(offsetX, offsetY, MatrixOrderAppend);
// 2nd approach
// 3rd approach
expectedMatrix.GetElements(expected);
expectedMatrix.Free;
FMatrix.RotateAt(rotAngle, MakePoint(offsetX, offsetY));
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
end;
procedure TGPMatrixTest.TestTranslateRotate;
var
got: TMatrixArray;
expected: TMatrixArray;
expectedPoint: TGPPointF;
begin
expected[0] := 0.86602540378; //m11
expected[1] := 0.5; //m12
expected[2] := -0.5; //m21
expected[3] := 0.86602540378; //m22
expected[4] := 10; //dx
expected[5] := 20; //dy
// 1st approach
FMatrix.Translate(10, 20);
FMatrix.Rotate(30);
// 2nd approach
// FMatrix.Rotate(30);
// FMatrix.Translate(10, 20, MatrixOrderAppend);
// 3rd approach
// FMatrix.Rotate(-30);
// FMatrix.Translate(-10, -20);
// FMatrix.Invert;
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
expectedPoint := MakePoint(10.86602540378, 20.5);
{ (x y 1) * (m11 m12 0 = (x' y' 1)
m21 m22 0
dx dy 1)
x' = x * eM11 + y * eM21 + eDX
y' = x * eM12 + y * eM22 + eDY
}
// multiply vector (TestPoint) by matrix (self)
FMatrix.TransformPoints(PGPPointF(@FTestPoint));
CheckPointsEqual(FTestPoint[0], expectedPoint);
end;
procedure TGPMatrixTest.TestTranslateRotateScale;
var
got: TMatrixArray;
expected: TMatrixArray;
expectedPoint: TGPPointF;
begin
expected[0] := 0.86602540378/2; //m11
expected[1] := 0.5/2; //m12
expected[2] := -0.5/2; //m21
expected[3] := 0.86602540378/2; //m22
expected[4] := 10; //dx
expected[5] := 20; //dy
// 1st approach
FMatrix.Translate(10, 20);
FMatrix.Rotate(30);
FMatrix.Scale(0.5, 0.5);
// 2nd approach
// FMatrix.Scale(0.5, 0.5);
// FMatrix.Rotate(30, MatrixOrderAppend);
// FMatrix.Translate(10, 20, MatrixOrderAppend);
// 3rd approach
// FMatrix.Scale(2, 2);
// FMatrix.Rotate(-30);
// FMatrix.Translate(-10, -20);
// FMatrix.Invert;
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
expectedPoint := MakePoint(10.43301, 20.25);
{ (x y 1) * (m11 m12 0 = (x' y' 1)
m21 m22 0
dx dy 1)
x' = x * eM11 + y * eM21 + eDX
y' = x * eM12 + y * eM22 + eDY
}
// multiply vector (TestPoint) by matrix (self)
FMatrix.TransformPoints(PGPPointF(@FTestPoint));
CheckPointsEqual(FTestPoint[0], expectedPoint);
end;
procedure TGPMatrixTest.TestScale;
var
got: TMatrixArray;
expected: TMatrixArray;
expectedPoint: TGPPointF;
begin
expected[0] := 2; //m11
expected[1] := 0; //m12
expected[2] := 0; //m21
expected[3] := 2; //m22
expected[4] := 0; //dx
expected[5] := 0; //dy
FMatrix.Scale(2.0, 2.0);
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
expectedPoint := MakePoint(2.0, 0.0);
FMatrix.TransformPoints(PGPPointF(@FTestPoint));
CheckPointsEqual(FTestPoint[0], expectedPoint);
end;
procedure TGPMatrixTest.TestSetElement;
var
got: TMatrixArray;
expected: TMatrixArray;
begin
expected[0] := 0.9; //m11
expected[1] := 0.5; //m12
expected[2] := -0.5; //m21
expected[3] := 1.1; //m22
expected[4] := 21000; //dx
expected[5] := 1000; //dy
//m11, m12, m21, m22, dx, dy
FMatrix.SetElements(0.9, 0.5, -0.5, 1.1, 21000, 1000);
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
end;
procedure TGPMatrixTest.TestTranslate;
var
got: TMatrixArray;
expected: TMatrixArray;
expectedPoint: TGPPointF;
begin
expected[0] := 1; //m11
expected[1] := 0; //m12
expected[2] := 0; //m21
expected[3] := 1; //m22
expected[4] := 1000; //dx
expected[5] := 2000; //dy
FMatrix.Translate(1000, 2000);
FMatrix.GetElements(got);
CheckArraysEqual(got, expected);
expectedPoint := MakePoint(1001.0, 2000.0);
FMatrix.TransformPoints(PGPPointF(@FTestPoint), 1);
CheckPointsEqual(FTestPoint[0], expectedPoint);
end;
initialization
// Register any test cases with the test runner
RegisterTest(TGPMatrixTest.Suite);
end.
|
unit EditFolderItemUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, User, FileCtrl;
type
TEditFolderItemForm = class(TForm)
nameLabel: TLabel;
locationLabel: TLabel;
nameEdit: TEdit;
locationEdit: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
pLoadedFolderItem: TFolderItem;
public
{ Public declarations }
SaveButtonClicked: Boolean;
procedure LoadFolderItem(const folderItem: TFolderItem);
end;
var
EditFolderItemForm: TEditFolderItemForm;
implementation
{$R *.dfm}
uses Main;
procedure TEditFolderItemForm.Button1Click(Sender: TObject);
begin
SaveButtonClicked := false;
Close();
end;
procedure TEditFolderItemForm.Button2Click(Sender: TObject);
begin
SaveButtonClicked := true;
pLoadedFolderItem.Name := nameEdit.Text;
pLoadedFolderItem.FilePath := locationEdit.Text;
Close();
end;
procedure TEditFolderItemForm.Button3Click(Sender: TObject);
begin
if OpenDialog1.Execute() then begin
locationEdit.Text := OpenDialog1.FileName;
end;
end;
procedure TEditFolderItemForm.FormCreate(Sender: TObject);
begin
Text := TMain.Instance.Loc.GetString('EditFolderItemForm.Title');
nameLabel.Caption := TMain.Instance.Loc.GetString('EditFolderItemForm.NameLabel');
locationLabel.Caption := TMain.Instance.Loc.GetString('EditFolderItemForm.LocationLabel');
end;
procedure TEditFolderItemForm.LoadFolderItem(const folderItem: TFolderItem);
begin
pLoadedFolderItem := folderItem;
nameEdit.Text := folderItem.Name;
locationEdit.Text := folderItem.FilePath;
end;
end.
|
unit F14;
interface
uses typelist, F13;
procedure SaveBuku (lBuku: List_Buku; s: string);
procedure SaveUser (lUser: List_User; s: string);
procedure SavePeminjaman (lPeminjaman: List_Peminjaman; s: string);
procedure SavePengembalian (lPengembalian: List_Pengembalian; s: string);
procedure SaveBuku_Hilang (lBuku_Hilang: List_Buku_Hilang; s: string);
procedure Save(lBuku: List_Buku; lUser: List_User; lPeminjaman: List_Peminjaman; lPengembalian: List_Pengembalian; lBuku_Hilang: List_Buku_Hilang; var filebuku, fileuser, filepeminjaman, filepengembalian, filehilang: string);
procedure SaveExit(var lBuku: List_Buku;var lUser: List_User;var lPeminjaman: List_Peminjaman;var lPengembalian: List_Pengembalian;var lBuku_Hilang: List_Buku_Hilang; var filebuku, fileuser, filepeminjaman, filepengembalian, filehilang: string);
implementation
procedure SaveBuku (lBuku: List_Buku; s: string);
var
UserFile : textfile;
i: integer;
draft,Arr_Judul_Buku , Arr_Author, Arr_Kategori, Str_ID_Buku, Str_Jumlah_Buku, Str_Tahun_Penerbit: array [1..1000] of string;
Arr_ID_Buku, Arr_Jumlah_Buku, Arr_Tahun_Penerbit : array [1..1000] of integer;
begin
Assign(Userfile, s);
Rewrite(Userfile);
for i:=1 to lBuku.Neff do begin
Arr_ID_Buku[i]:= lBuku.listbuku[i].ID_Buku;
Arr_Judul_Buku[i]:= lBuku.listbuku[i].Judul_Buku;
Arr_Author[i]:= lBuku.listbuku[i].Author;
Arr_Jumlah_Buku[i]:= lBuku.listbuku[i].Jumlah_Buku;
Arr_Tahun_Penerbit[i]:= lBuku.listbuku[i].Tahun_Penerbit;
Arr_Kategori[i]:= lBuku.listbuku[i].Kategori;
str(Arr_ID_Buku[i], Str_ID_Buku[i]);
str(Arr_Jumlah_Buku[i], Str_Jumlah_Buku[i]);
str(Arr_Tahun_Penerbit[i], Str_Tahun_Penerbit[i]);
draft[i]:= Str_ID_Buku[i] +','+ Arr_Judul_Buku[i]+',' + Arr_Author[i]+',' +Str_Jumlah_Buku[i] +',' + Str_Tahun_Penerbit[i] +',' + Arr_Kategori[i]+',';
writeln(Userfile, draft[i]);
end;
close(UserFile);
end;
procedure SaveUser (lUser: List_User; s: string);
var
UserFile : textfile;
i: integer;
draft, Arr_Nama, Arr_Alamat, Arr_Username, Arr_Password, Arr_Role: array [1..1000] of string;
begin
Assign(Userfile, s);
Rewrite(Userfile);
for i:=1 to lUser.Neff do begin
Arr_Nama[i]:= lUser.listUser[i].Nama;
Arr_Alamat[i]:= lUser.listUser[i].Alamat;
Arr_Username[i]:= lUser.listUser[i].Username;
Arr_Password[i]:= lUser.listUser[i].Password;
Arr_Role[i]:= lUser.listUser[i].Role;
draft[i]:= Arr_Nama[i]+','+ Arr_Alamat[i]+','+ Arr_Username[i]+','+ Arr_Password[i]+','+ Arr_Role[i]+',';
writeln(Userfile, draft[i]);
end;
close(UserFile);
end;
procedure SavePeminjaman (lPeminjaman: List_Peminjaman; s: string);
var
UserFile : textfile;
i: integer;
draft, Arr_Username, Arr_Status_Pengembalian, Str_ID_Buku: array [1..1000] of string;
Arr_Tanggal_Peminjaman, Arr_Tanggal_Batas_Pengembalian: array [1..1000] of tanggal;
Arr_ID_Buku: array [1..1000] of integer;
begin
Assign(Userfile, s);
Rewrite(Userfile);
for i:=1 to lPeminjaman.Neff do begin
Arr_Username[i]:= lPeminjaman.listPeminjaman[i].Username;
Arr_ID_Buku[i]:= lPeminjaman.listPeminjaman[i].ID_Buku;
Arr_Tanggal_Peminjaman[i]:= lPeminjaman.listPeminjaman[i].Tanggal_Peminjaman;
Arr_Tanggal_Batas_Pengembalian[i]:= lPeminjaman.listPeminjaman[i].Tanggal_Batas_Pengembalian;
Arr_Status_Pengembalian[i]:= lPeminjaman.listPeminjaman[i].Status_Pengembalian;
str(Arr_ID_Buku[i], Str_ID_Buku[i]);
draft[i]:= Arr_Username[i]+','+ Str_ID_Buku[i]+','+ TanggalToString(Arr_Tanggal_Peminjaman[i])+','+ TanggalToString(Arr_Tanggal_Batas_Pengembalian[i])+','+Arr_Status_Pengembalian[i]+',';
writeln(Userfile, draft[i]);
end;
close(UserFile);
end;
procedure SavePengembalian (lPengembalian: List_Pengembalian; s: string);
var
UserFile : textfile;
i: integer;
draft, Arr_Username, Str_ID_Buku: array [1..1000] of string;
Arr_Tanggal_Pengembalian: array [1..1000] of tanggal;
Arr_ID_Buku: array [1..1000] of integer;
begin
Assign(Userfile, s);
Rewrite(Userfile);
for i:=1 to lPengembalian.Neff do begin
Arr_Username[i]:= lPengembalian.listPengembalian[i].Username;
Arr_ID_Buku[i]:= lPengembalian.listPengembalian[i].ID_Buku;
Arr_Tanggal_Pengembalian[i]:= lPengembalian.listPengembalian[i].Tanggal_Pengembalian;
str(Arr_ID_Buku[i], Str_ID_Buku[i]);
draft[i]:= Arr_Username[i]+','+ Str_ID_Buku[i]+','+ TanggalToString(Arr_Tanggal_Pengembalian[i])+',';
writeln(Userfile, draft[i]);
end;
close(UserFile);
end;
procedure SaveBuku_Hilang (lBuku_Hilang: List_Buku_Hilang; s: string);
var
UserFile : textfile;
i: integer;
draft, Arr_Username, Str_ID_Buku_Hilang: array [1..1000] of string;
Arr_Tanggal_Laporan: array [1..1000] of tanggal;
Arr_ID_Buku_Hilang: array [1..1000] of integer;
begin
Assign(Userfile, s);
Rewrite(Userfile);
for i:=1 to lBuku_Hilang.Neff do begin
Arr_Username[i]:= lBuku_Hilang.listBuku_Hilang[i].Username;
Arr_ID_Buku_Hilang[i]:= lBuku_Hilang.listBuku_Hilang[i].ID_Buku_Hilang;
Arr_Tanggal_Laporan[i]:= lBuku_Hilang.listBuku_Hilang[i].Tanggal_Laporan;
str(Arr_ID_Buku_Hilang[i], Str_ID_Buku_Hilang[i]);
draft[i]:= Arr_Username[i]+','+ Str_ID_Buku_Hilang[i]+','+ TanggalToString(Arr_Tanggal_Laporan[i])+',';
writeln(Userfile, draft[i]);
end;
close(UserFile);
end;
procedure Save(lBuku: List_Buku; lUser: List_User; lPeminjaman: List_Peminjaman; lPengembalian: List_Pengembalian; lBuku_Hilang: List_Buku_Hilang; var filebuku, fileuser, filepeminjaman, filepengembalian, filehilang: string);
begin
write('Masukkan nama File Buku: ');
readln(filebuku);
SaveBuku(lBuku, filebuku);
write('Masukkan nama File User: ');
readln(fileuser);
SaveUser(lUser, fileuser);
write('Masukkan nama File Peminjaman: ');
readln(filepeminjaman);
SavePeminjaman(lPeminjaman, filepeminjaman);
write('Masukkan nama File Pengembalian: ');
readln(filepengembalian);
SavePengembalian(lPengembalian, filepengembalian);
write('Masukkan nama File Buku Hilang: ');
readln(filehilang);
SaveBuku_Hilang(lBuku_Hilang, filehilang);
writeln();
writeln('Data berhasil disimpan!');
end;
procedure SaveExit(var lBuku: List_Buku;var lUser: List_User;var lPeminjaman: List_Peminjaman;var lPengembalian: List_Pengembalian;var lBuku_Hilang: List_Buku_Hilang; var filebuku, fileuser, filepeminjaman, filepengembalian, filehilang: string);
begin
SaveBuku(lBuku, filebuku);
SaveUser(lUser, fileuser);
SavePeminjaman(lPeminjaman, filepeminjaman);
SavePengembalian(lPengembalian, filepengembalian);
SaveBuku_Hilang(lBuku_Hilang, filehilang);
end;
end.
|
{ Collection of small utility routines.
}
module picprg_util;
define picprg_closing;
define picprg_erase;
define picprg_reset;
define picprg_nconfig;
define picprg_space_set;
define picprg_space;
define picprg_off;
define picprg_maskit;
define picprg_mask;
define picprg_mask_same;
define picprg_send;
define picprg_recv;
define picprg_vddlev;
define picprg_vddset;
define picprg_sendbuf;
define picprg_progtime;
%include 'picprg2.ins.pas';
{
*******************************************************************************
*
* Function PICPRG_CLOSING (PR, STAT)
*
* Check whether this use of the library is being closed down. If not,
* STAT is reset and the function returns FALSE. If so, STAT will
* indicate the library is being closed and the function will return TRUE.
}
function picprg_closing ( {check for library is being closed}
in out pr: picprg_t; {state for this use of the library}
out stat: sys_err_t) {set to CLOSE if library being closed}
:boolean; {TRUE iff library being closed}
val_param;
begin
if pr.quit
then begin {library is closing down}
sys_stat_set (picprg_subsys_k, picprg_stat_close_k, stat);
picprg_closing := true;
end
else begin {library is not closing down}
sys_error_none (stat);
picprg_closing := false;
end
;
end;
{
*******************************************************************************
*
* Subroutine PICPRG_ERASE (PR, STAT)
*
* Erase all erasable non-volatile memory in the target chip.
}
procedure picprg_erase ( {erase all erasable non-volatile target mem}
in out pr: picprg_t; {state for this use of the library}
out stat: sys_err_t); {completion status}
val_param;
begin
if pr.erase_p = nil then begin {no erase routine installed ?}
sys_stat_set (picprg_subsys_k, picprg_stat_nerase_k, stat);
return;
end;
pr.erase_p^ (addr(pr), stat); {call the specific erase routine}
end;
{
*******************************************************************************
*
* Subroutine PICPRG_RESET (PR, STAT)
*
* Reset the target chip and associated state in this library and the
* remote unit. All settings that are "choices" are reset to defaults.
* The settings that are a function of the specific target chip are
* not altered.
}
procedure picprg_reset ( {reset the target chip and associated state}
in out pr: picprg_t; {state for this use of the library}
out stat: sys_err_t); {completion status}
val_param;
begin
picprg_cmdw_reset (pr, stat); {reset the target chip}
if sys_error(stat) then return;
picprg_cmdw_spprog (pr, stat); {set the address space to program, not data}
if sys_error(stat) then return;
picprg_cmdw_adr (pr, 0, stat); {reset desired address of next transfer}
end;
{
*******************************************************************************
*
* Function PICPRG_NCONFIG (PR, STAT)
*
* Test for the library has been configured (PICPRG_CONFIG called).
* The function returns TRUE with an approriate error status in STAT if
* the library has not been configured. If the library has been configured,
* then the function returns FALSE and STAT is return normal.
}
function picprg_nconfig ( {check for library has been configured}
in out pr: picprg_t; {state for this use of the library}
out stat: sys_err_t) {set to error if library not configured}
:boolean; {TRUE if library not configured}
val_param;
begin
if pr.id_p = nil
then begin {library not configured}
picprg_nconfig := true;
sys_stat_set (picprg_subsys_k, picprg_stat_nconfig_k, stat);
end
else begin {library has been configured}
picprg_nconfig := false;
sys_error_none (stat);
end
;
end;
{
*******************************************************************************
*
* Subroutine PICPRG_SPACE_SET (PR, SPACE, STAT)
*
* High level routine for applications to switch the memory address space.
* Applications are encouraged to call this routine instead of issuing the low
* level SPxxxx commands directly.
}
procedure picprg_space_set ( {select address space for future operations}
in out pr: picprg_t; {state for this use of the library}
in space: picprg_space_k_t; {ID for the new selected target memory space}
out stat: sys_err_t); {completion status}
val_param;
begin
sys_error_none (stat); {init to no error encountered}
case space of {which address space switching to ?}
picprg_space_prog_k: begin {switching to program memory address space}
picprg_cmdw_spprog (pr, stat); {switch remote unit and reconfigure library}
if sys_error(stat) then return;
if pr.id_p <> nil then begin
picprg_progtime (pr, pr.id_p^.tprogp, stat); {set write wait time}
if sys_error(stat) then return;
end;
end;
picprg_space_data_k: begin {switching to data memory address space}
picprg_cmdw_spdata (pr, stat); {switch remote unit and reconfigure library}
if sys_error(stat) then return;
if pr.id_p <> nil then begin
picprg_progtime (pr, pr.id_p^.tprogd, stat); {set write wait time}
if sys_error(stat) then return;
end;
end;
otherwise
sys_stat_set (picprg_subsys_k, picprg_stat_badspace_k, stat);
sys_stat_parm_int (ord(space), stat);
end; {end of memory space cases}
end;
{
*******************************************************************************
*
* Subroutine PICPRG_SPACE (PR, SPACE)
*
* Configure the PICPRG library to the indicated target address space
* setting. This routine does not change the address space. It is called
* to notify the library that the address space was changed.
*
* This routine is called implicitly by the SPPROG and SPDATA low level
* command routines.
}
procedure picprg_space ( {reconfig library to new mem space selection}
in out pr: picprg_t; {state for this use of the library}
in space: picprg_space_k_t); {ID for the new selected target memory space}
val_param;
begin
pr.space := space;
if pr.id_p = nil then return; {not configured yet, nothing more to do ?}
case pr.id_p^.fam of {which PIC family is it in ?}
{
**********
*
* PIC 18 family.
}
picprg_picfam_18f_k, {18F252 and related}
picprg_picfam_18f6680_k: begin {18F6680 and related}
case pr.space of
picprg_space_prog_k: begin {program memory space}
pr.write_p := {install array write routine}
univ_ptr(addr(picprg_write_18));
pr.read_p := {install array read routine}
univ_ptr(addr(picprg_read_gen));
end;
picprg_space_data_k: begin {data memory space}
pr.write_p := {install array write routine}
univ_ptr(addr(picprg_write_18d));
if picprg_read_18fe_k in pr.fwinfo.idread
then begin {firmware can read EEPROM directly}
pr.read_p := univ_ptr(addr(picprg_read_gen))
end
else begin {no firmware EEPROM read, use emulation}
pr.read_p := univ_ptr(addr(picprg_read_18d));
end
;
end;
otherwise
pr.write_p := nil;
pr.read_p := nil;
end; {end of memory space cases}
end; {end of 18Fxx2 18Fxx8 family case}
{
**********
*
* PIC 18F2520 and related.
}
picprg_picfam_18f2520_k: begin
case pr.space of
picprg_space_prog_k: begin {program memory space}
pr.read_p := {install array read routine}
univ_ptr(addr(picprg_read_gen));
end;
picprg_space_data_k: begin {data memory space}
if picprg_read_18fe_k in pr.fwinfo.idread
then begin {firmware can read EEPROM directly}
pr.read_p := univ_ptr(addr(picprg_read_gen))
end
else begin {no firmware EEPROM read, use emulation}
pr.read_p := univ_ptr(addr(picprg_read_18d));
end
;
end;
otherwise
pr.write_p := nil;
pr.read_p := nil;
end; {end of memory space cases}
end; {end of 18Fxx2 18Fxx8 family case}
{
**********
*
* 16 bit PICs: 24, 30, and 33 families.
}
picprg_picfam_24h_k,
picprg_picfam_24f_k,
picprg_picfam_24fj_k,
picprg_picfam_33ep_k,
picprg_picfam_30f_k: begin
pr.write_p := {init to generic array write routine}
univ_ptr(addr(picprg_write_targw));
pr.read_p := {init to generic array read routine}
univ_ptr(addr(picprg_read_gen));
case pr.space of
picprg_space_prog_k: begin {program memory space}
if pr.fwinfo.cmd[56] then begin {W30PGM command implemented ?}
pr.write_p := {install special program memory write routine}
univ_ptr(addr(picprg_write_30pgm));
end;
end; {end of program memory space}
end; {end of PIC 30 memory space cases}
end; {end of PIC 30 family case}
end; {end of PIC family cases}
end;
{
*******************************************************************************
*
* Subroutine PICPRG_OFF (PR, STAT)
*
* Disengage from the target chip or circuit to the extent possible.
}
procedure picprg_off ( {disengage from target to the extent possible}
in out pr: picprg_t; {state for this use of the library}
out stat: sys_err_t); {completion status}
val_param;
begin
picprg_cmdw_highz (pr, stat); {try to set target lines to high impedence}
if {HIGHZ command not supported ?}
sys_stat_match (picprg_subsys_k, picprg_stat_cmdnimp_k, stat)
then begin
picprg_cmdw_off (pr, stat); {use OFF command, is always supported}
end;
end;
{
*******************************************************************************
*
* Function PICPRG_MASKIT (DAT, MASK, ADR)
*
* Return the value in DAT with all unused bits set to 0. MASK is the information
* on which bits are valid, and ADR is the address of this data word.
}
function picprg_maskit ( {apply valid bits mask to data word}
in dat: picprg_dat_t; {data word to mask}
in mask: picprg_maskdat_t; {information about valid bits}
in adr: picprg_adr_t) {target chip address of this data word}
:picprg_dat_t; {returned DAT with all unused bits zero}
val_param;
begin
picprg_maskit := dat & picprg_mask (mask, adr);
end;
{
*******************************************************************************
*
* Function PICPRG_MASK (MASK, ADR)
*
* Return the mask of valid data bits for the address ADR. MASK specifies
* which data bits are valid.
}
function picprg_mask ( {get mask of valid data bits at address}
in mask: picprg_maskdat_t; {information about valid bits}
in adr: picprg_adr_t) {target chip address of this data word}
:picprg_dat_t; {returned mask of valid data bits}
val_param;
begin
if odd(adr)
then begin {data word is at odd address}
picprg_mask := mask.masko;
end
else begin {data word if at even address}
picprg_mask := mask.maske;
end
;
end;
{
*******************************************************************************
*
* Subroutine PICPRG_MASK_SAME (MASK, MASKDAT)
*
* Set the mask information in MASKDAT to be the mask MASK in all cases.
}
procedure picprg_mask_same ( {make mask info with one mask for all cases}
in mask: picprg_dat_t; {the mask to apply in all cases}
out maskdat: picprg_maskdat_t); {returned mask info}
val_param;
begin
maskdat.maske := mask; {set mask for even addresses}
maskdat.masko := mask; {set mask for odd addresses}
end;
{
*******************************************************************************
*
* Subroutine PICPRG_SEND (PR, N, DAT, STAT)
*
* Send the low N bits of DAT to the target chip via the serial interface.
* The LSB of DAT is sent first. N must not exceed 32. The optimum
* commands are used to send the data, depending on how many bits are being
* sent and which commands are implemented in the programmer. Nothing is
* done if N is zero or negative.
}
procedure picprg_send ( {send serial bits to target, use optimum cmd}
in out pr: picprg_t; {state for this use of the library}
in n: sys_int_machine_t; {0-32 number of serial bits to send}
in dat: sys_int_conv32_t; {the data bits to send, LSB first}
out stat: sys_err_t); {completion status}
val_param;
var
nleft: sys_int_machine_t; {number of bits left to send}
nt: sys_int_machine_t; {number of bits to send with current command}
dleft: sys_int_conv32_t; {the data bits left to send}
label
next_bits;
begin
if n <= 0 then begin {no bits to send ?}
sys_error_none (stat);
return;
end;
if n > 32 then begin {invalid number of bits argument ?}
sys_stat_set (picprg_subsys_k, picprg_stat_badnbits_k, stat);
sys_stat_parm_int (0, stat);
sys_stat_parm_int (32, stat);
sys_stat_parm_int (n, stat);
return;
end;
nleft := n; {init number of bits left to send}
nt := 0; {init number of bits sent last time}
dleft := dat; {init the bits left to send}
while nleft > 0 do begin {keep looping until all bits sent}
dleft := rshft(dleft, nt); {position remaining bits into LSB}
if (n > 24) and pr.fwinfo.cmd[53] then begin
nt := nleft; {number of bits to send with this command}
picprg_cmdw_send4 (pr, nt, dleft, stat);
goto next_bits;
end;
if (n > 16) and pr.fwinfo.cmd[52] then begin
nt := min(24, nleft); {number of bits to send with this command}
picprg_cmdw_send3 (pr, nt, dleft, stat);
goto next_bits;
end;
if (n > 8) and pr.fwinfo.cmd[5] then begin
nt := min(16, nleft); {number of bits to send with this command}
picprg_cmdw_send2 (pr, nt, dleft, stat);
goto next_bits;
end;
nt := min(8, nleft); {number of bits to send with this command}
picprg_cmdw_send1 (pr, nt, dleft, stat);
next_bits: {done sending one command, on to next}
if sys_error(stat) then return;
nleft := nleft - nt; {update number of bits left to send}
end; {back to do another command if bits left}
end;
{
*******************************************************************************
*
* Subroutine PICPRG_RECV (PR, N, DAT, STAT)
*
* Receive N bits from the target chip via the serial interface. The bits
* are returned in the least significant end of DAT. The first received bit
* is written to the LSB of DAT. Unused bits in DAT are set to 0.
}
procedure picprg_recv ( {read serial bits from targ, use optimum cmd}
in out pr: picprg_t; {state for this use of the library}
in n: sys_int_machine_t; {0-32 number of bits to read}
out dat: sys_int_conv32_t; {returned bits shifted into LSB, high zero}
out stat: sys_err_t); {completion status}
val_param;
var
nleft: sys_int_machine_t; {number of bits left to receive}
nt: sys_int_machine_t; {number of bits to recv with current command}
d: sys_int_conv32_t; {bits received with current command}
label
next_bits;
begin
dat := 0; {init all received bits to 0}
if n <= 0 then begin {no bits to receive ?}
sys_error_none (stat);
return;
end;
if n > 32 then begin {invalid number of bits argument ?}
sys_stat_set (picprg_subsys_k, picprg_stat_badnbits_k, stat);
sys_stat_parm_int (0, stat);
sys_stat_parm_int (32, stat);
sys_stat_parm_int (n, stat);
return;
end;
nleft := n; {init number of bits left to receive}
while nleft > 0 do begin {keep looping until all bits sent}
if (n > 24) and pr.fwinfo.cmd[55] then begin
nt := nleft; {number of bits to receive with this command}
picprg_cmdw_recv4 (pr, nt, d, stat);
goto next_bits;
end;
if (n > 16) and pr.fwinfo.cmd[54] then begin
nt := min(24, nleft); {number of bits to receive with this command}
picprg_cmdw_recv3 (pr, nt, d, stat);
goto next_bits;
end;
if (n > 8) and pr.fwinfo.cmd[7] then begin
nt := min(16, nleft); {number of bits to receive with this command}
picprg_cmdw_recv2 (pr, nt, d, stat);
goto next_bits;
end;
nt := min(8, nleft); {number of bits to receive with this command}
picprg_cmdw_recv1 (pr, nt, d, stat);
next_bits: {done sending one command, on to next}
if sys_error(stat) then return;
dat := dat ! lshft(d, n - nleft); {merge in new received bits}
nleft := nleft - nt; {update number of bits left to receive}
end; {back to do another command if bits left}
end;
{
*******************************************************************************
*
* Subroutine PICPRG_VDDLEV (PR, VDDID, STAT)
*
* Select the Vdd level to be used on the next reset. On old programmers that
* do not implement the VDD command, Vdd is immediately set to the selected
* level. On newer programmers with the VDD command the current Vdd level is
* not altered, but the new Vdd level will take effect the next time Vdd is
* enabled.
*
* Applications should use this routine instead of issuing low level programmer
* commands.
}
procedure picprg_vddlev ( {set Vdd level for next time enabled}
in out pr: picprg_t; {state for this use of the library}
in vddid: picprg_vdd_k_t; {ID for the new level to set to}
out stat: sys_err_t); {completion status}
val_param;
var
v: real; {new desired voltage}
vout: real; {actual resulting voltage}
begin
case vddid of {set V to the new selected Vdd voltage}
picprg_vdd_low_k: v := pr.vdd.low;
picprg_vdd_norm_k: v := pr.vdd.norm;
picprg_vdd_high_k: v := pr.vdd.high;
otherwise
sys_stat_set (picprg_subsys_k, picprg_stat_badvddid_k, stat);
sys_stat_parm_int (ord(vddid), stat);
return;
end;
picprg_vddset (pr, v, vout, stat);
end;
{
*******************************************************************************
*
* Subroutine PICPRG_VDDSET (PR, VIN, VOUT, STAT)
*
* Set up the target Vdd state so that it will be as close as possible to VIN
* volts after the next reset. Depending on the programmer capabilities, Vdd
* may change to the new level immediately, but it is not guaranteed to
* changed until after the next reset. VOUT is returned the actual Vdd level
* that the programmer will produce.
}
procedure picprg_vddset ( {set Vdd for specified level by next reset}
in out pr: picprg_t; {state for this use of the library}
in vin: real; {desired Vdd level in volts}
out vout: real; {actual Vdd level selected}
out stat: sys_err_t); {completion status}
val_param;
begin
sys_error_none (stat); {init to no error encountered}
if not pr.fwinfo.varvdd then begin {programmer has fixed Vdd ?}
vout := {indicate programmer's fixed Vdd level}
round(10.0 * (pr.fwinfo.vddmin + pr.fwinfo.vddmax) / 2.0) / 10.0;
return;
end;
if pr.fwinfo.cmd[65] then begin {VDD command is available ?}
picprg_cmdw_vdd (pr, vin, stat); {set to desired Vdd}
vout := max(0.0, min(6.0, vin)); {clip to programmer's Vdd range}
return;
end;
picprg_cmdw_vddvals (pr, vin, vin, vin, stat); {set low/norm/high all to selected level}
vout := max(0.0, min(6.0, vin)); {clip to programmer's Vdd range}
end;
{
*******************************************************************************
*
* Subroutine PICPRG_SENDBUF (PR, BUF, N, STAT)
*
* Send N bytes from the buffer BUF to the programmer. This is a low level routine
* that does not interpret the bytes. It does use the proper I/O means to send
* to the particular programmer in use. All data is sent to the programmer via
* this routine in normal operation. Some data may be sent privately during
* initialization.
}
procedure picprg_sendbuf ( {send buffer of bytes to the programmer}
in out pr: picprg_t; {state for this use of the library}
in buf: univ picprg_buf_t; {buffer of bytes to send}
in n: sys_int_adr_t; {number of bytes to send}
out stat: sys_err_t); {completion status}
val_param;
var
i: sys_int_machine_t; {scratch integer and loop counter}
vbuf: string_var80_t; {var string output buffer}
stat2: sys_err_t;
begin
vbuf.max := size_char(vbuf.str); {init local var string}
if picprg_closing (pr, stat) then return; {library is being closed down ?}
if picprg_flag_showout_k in pr.flags then begin {show output bytes on standard output ?}
writeln;
write ('>');
for i := 0 to n-1 do begin
write (' ', buf[i]);
end;
writeln;
sys_flush_stdout; {make sure all output sent to parent program}
end;
case pr.devconn of {what kind of I/O connection is in use ?}
picprg_devconn_sio_k: begin {programmer is connected via serial line}
for i := 1 to n do begin {once for each byte to send}
vbuf.str[i] := chr(buf[i-1]); {copy this char to var string output buffer}
end;
vbuf.len := n; {set number of bytes in var string output buffer}
file_write_sio_rec (vbuf, pr.conn, stat); {send the bytes to the remote unit}
end;
picprg_devconn_usb_k: begin {programner is connected via USB}
picprg_sys_usb_write (pr.conn, buf, n, stat); {send the bytes}
end;
otherwise
sys_stat_set (picprg_subsys_k, picprg_stat_baddevconn_k, stat);
sys_stat_parm_int (ord(pr.devconn), stat);
return;
end;
if picprg_closing (pr, stat2) then begin {library is being closed down ?}
stat := stat2;
return;
end;
end;
{
*******************************************************************************
*
* Subroutine PICPRG_PROGTIME (PR, PROGT, STAT)
*
* Set the programming time in the programmer. PROGT is the programming time
* to set in units of seconds.
*
* This routine sets the normal and fast programming times, as implemented by
* the programmer.
}
procedure picprg_progtime ( {set programming time}
in out pr: picprg_t; {state for this use of the library}
in progt: real; {programming time, seconds}
out stat: sys_err_t); {completion status}
val_param;
var
r: real; {scratch floating point}
ii: sys_int_machine_t; {scratch integer}
begin
picprg_cmdw_tprog (pr, progt, stat); {set time in base ticks}
if sys_error(stat) then return;
if pr.fwinfo.cmd[83] then begin {programmer implements TPROGF command ?}
r := (pr.id_p^.tprogp * pr.fwinfo.ftickf) + 0.999; {number of ticks}
ii := trunc(min(r, 65535.5)); {clip to max possible}
picprg_cmdw_tprogf (pr, ii, stat); {set programming time in fast ticks}
if sys_error(stat) then return;
end;
end;
|
unit luafile;
{$mode delphi}
interface
uses
Classes, SysUtils, DOM, zstream, math, custombase85, fgl, xmlutils;
type TLuafile=class
private
fname: string;
filedata: TMemorystream;
fdonotsave: boolean;
public
constructor create(name: string; stream: TStream);
constructor createFromXML(node: TDOMNode);
procedure saveToXML(node: TDOMNode);
destructor destroy; override;
published
property name: string read fname write fname;
property stream: TMemoryStream read filedata;
property doNotSave: boolean read fdonotsave write fdonotsave;
end;
TLuaFileList = TFPGList<TLuafile>;
implementation
constructor TLuafile.createFromXML(node: TDOMNode);
var s: string;
b: pchar;
m: TMemorystream;
dc: Tdecompressionstream;
maxsize, size: integer;
read: integer;
useascii85: boolean;
a: TDOMNode;
begin
name:=node.NodeName;
filedata:=TMemorystream.create;
s:=node.TextContent;
useascii85:=false;
if node.HasAttributes then
begin
a:=node.Attributes.GetNamedItem('Encoding');
useascii85:=(a<>nil) and (a.TextContent='Ascii85');
a:=node.Attributes.GetNamedItem('Name');
if a<>nil then
name:=a.TextContent;
end;
if useascii85 then
begin
size:=(length(s) div 5)*4+(length(s) mod 5);
maxsize:=max(65536,size);
getmem(b, maxsize);
size:=Base85ToBin(pchar(s), b);
end
else
begin
size:=length(s) div 2;
maxsize:=max(65536,size); //64KB or the required size if that's bigger
getmem(b, maxsize);
HexToBin(pchar(s), b, size);
end;
try
m:=tmemorystream.create;
m.WriteBuffer(b^, size);
m.position:=0;
dc:=Tdecompressionstream.create(m, true);
if useascii85 then //this ce version also added a filesize (This is why I usually don't recommend using svn builds for production work. Of coure, not many people using the svn made use of the file stuff)
begin
size:=dc.ReadDWord;
FreeMemAndNil(b);
getmem(b, size);
read:=dc.read(b^, size);
filedata.WriteBuffer(b^, read);
end
else
begin
//reuse the b buffer
repeat
read:=dc.read(b^, maxsize);
filedata.WriteBuffer(b^, read);
until read=0;
end;
finally
FreeMemAndNil(b);
end;
end;
procedure TLuafile.saveToXML(node: TDOMNode);
var
outputastext: pchar;
doc: TDOMDocument;
m: TMemorystream;
c: Tcompressionstream;
n: TDOMNode;
a: TDOMAttr;
s: string;
xmlname: boolean;
i: integer;
namecount: integer;
begin
if donotsave then exit;
outputastext:=nil;
//compress the file
m:=tmemorystream.create;
c:=Tcompressionstream.create(clmax, m, true);
c.WriteDWord(filedata.size);
c.write(filedata.Memory^, filedata.size);
c.free;
//convert the compressed file to an ascii85 sring
getmem(outputastext, (m.size div 4) * 5 + 5 );
BinToBase85(pchar(m.memory), outputastext, m.size);
doc:=node.OwnerDocument;
n:=Node.AppendChild(doc.CreateElement('File'+node.ChildNodes.Count.ToString));
n.TextContent:=outputastext;
a:=doc.createAttribute('Name');
a.TextContent:=name;
n.Attributes.SetNamedItem(a);
a:=doc.CreateAttribute('Encoding');
a.TextContent:='Ascii85';
n.Attributes.SetNamedItem(a);
FreeMemAndNil(outputastext);
freeandnil(m);
end;
constructor TLuafile.create(name: string; stream: tstream);
begin
self.name:=name;
filedata:=tmemorystream.create;
stream.position:=0;
filedata.LoadFromStream(stream);
filedata.position:=0;
end;
destructor TLuafile.destroy;
begin
if filedata<>nil then
filedata.free;
inherited destroy;
end;
end.
|
unit dmAttributesSet;
interface
uses
System.SysUtils, System.Classes, rtc.dmDoc, MemTableDataEh, Data.DB,
DataDriverEh, MemTableEh, VkVariableBinding, VkVariableBindingDialog;
type
TAttributesSetDm = class(TDocDm)
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
procedure DoWriteVariables(Sender: TObject; AInsert: Boolean);
public
{ Public declarations }
class function GetDm: TDocDm;override;
procedure Open;
end;
var
AttributesSetDm: TAttributesSetDm;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
uses dmmainRtc, uLog, uDocDescription;
{$R *.dfm}
procedure TAttributesSetDm.DataModuleCreate(Sender: TObject);
begin
inherited;
InitClientSqlManager('ATTRIBUTESET');
SqlManager.SelectSQL.Add('SELECT idset, name ');
SqlManager.SelectSQL.Add('FROM attributeset ');
SqlManager.SelectSQL.Add('WHERE idset>=0');
SqlManager.SelectSQL.Add('ORDER BY name');
DocStruDescriptionList.Add('idset','','ID','ID',4,'',4,False,True,nil);
DocStruDescriptionList.Add('name','','Наименование','Наименование',60,'',60,True,False,
TBindingDescription.GetBindingDescription(TEditVkVariableBinding));
DocStruDescriptionList.GetDocStruDescriptionItem('name').bNotEmpty := True;
// OnInitVariables := DoOnInitvariables;
// OnFillKeyFields := DoOnFillKeyFields;
OnWriteVariables := DoWritevariables;
end;
procedure TAttributesSetDm.DoWriteVariables(Sender: TObject; AInsert: Boolean);
begin
if AInsert then
DocVariableList.VarByName('idset').AsInteger := MainRtcDm.Gen_Id('IDATTRIBUTESET');
end;
class function TAttributesSetDm.GetDm: TDocDm;
begin
Result := TAttributesSetDm.Create(MainRtcDm);
end;
procedure TAttributesSetDm.Open;
begin
FRtcQueryDataSet.Close;
FRtcQueryDataSet.SQL.Clear;
FRtcQueryDataSet.SQL.Text := SqlManager.SelectSQL.Text;
FRtcQueryDataSet.Open;
end;
end.
|
{
ID: ndchiph1
PROG: milk3
LANG: PASCAL
}
uses math;
const
MAX = 20;
type
mang = array[1..3] of integer;
var
src: array[1..6] of integer = (1,1,2,2,3,3);
des: array[1..6] of integer = (2,3,1,3,1,2);
fi,fo: text;
m: array[0..MAX,0..MAX] of boolean;
f: array[0..MAX] of boolean;
b: mang;
total: integer;
procedure input;
var i: integer;
begin
for i:= 1 to 3 do read(fi,b[i]);
total:= b[3];
end;
procedure pour(x,y: integer; var a: mang);
begin
if (a[x] < b[y]-a[y]) then begin
a[y]:= a[y] + a[x];
a[x]:= 0;
end else
begin
a[x]:= a[x] - (b[y]-a[y]);
a[y]:= b[y];
end;
end;
procedure dfs(i,j: integer);
var k: integer;
a: array[1..3] of integer;
begin
//
m[i,j]:= true;
for k:=1 to 6 do begin
a[1]:= i; a[2]:= j; a[3]:= total-i-j;
pour(src[k], des[k], a);
if not m[a[1],a[2]] then dfs(a[1], a[2]);
end;
end;
procedure process;
var i,j,t: integer;
first: boolean;
begin
//
fillchar(m,sizeof(m),false);
fillchar(f,sizeof(f),false);
//
dfs(0,0);
//
for i:= 0 to MAX do
if (m[0,i]) then
begin
t:= b[3]-i;
if (t >= 0) then f[t]:= true;
end;
//
first:= true;
for i:= 0 to MAX do
if (f[i]) then begin
if not first then write(fo, ' ');
first:= false;
write(fo,i);
end;
writeln(fo);
end;
begin
assign(fi,'milk3.in'); reset(fi);
assign(fo,'milk3.out'); rewrite(fo);
//
input;
process;
//
close(fi);
close(fo);
end. |
unit PetrolRegionsEditorForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, CommonFrame, CommonParentChildTreeFrame,
PetrolRegion, BaseObjects;
type
TfrmPetrolRegionsEditor = class(TForm)
frmPetrolRegions: TfrmParentChild;
pnlButtons: TPanel;
btnOK: TButton;
btnCancel: TButton;
private
{ Private declarations }
FMainRegion: TNewPetrolRegion;
procedure SetMainRegion(const Value: TNewPetrolRegion);
function GetSelectedObject: TIDObject;
function GetSelectedObjects: TIDObjects;
public
{ Public declarations }
property MainRegion: TNewPetrolRegion read FMainRegion write SetMainRegion;
property SelectedObject: TIDObject read GetSelectedObject;
property SelectedObjects: TIDObjects read GetSelectedObjects;
constructor Create(AOwner: TComponent); override;
end;
var
frmPetrolRegionsEditor: TfrmPetrolRegionsEditor;
implementation
uses Facade, SDFacade;
{$R *.dfm}
{ TfrmPetrolRegionsEditor }
constructor TfrmPetrolRegionsEditor.Create(AOwner: TComponent);
begin
inherited;
MainRegion := TMainFacade.GetInstance.AllNewPetrolRegions.ItemsByID[0] as TNewPetrolRegion;
frmPetrolRegions.MultiSelect := true;
frmPetrolRegions.SelectableLayers := [2];
end;
function TfrmPetrolRegionsEditor.GetSelectedObject: TIDObject;
begin
Result := frmPetrolRegions.SelectedObject;
end;
function TfrmPetrolRegionsEditor.GetSelectedObjects: TIDObjects;
begin
Result := frmPetrolRegions.SelectedObjects;
end;
procedure TfrmPetrolRegionsEditor.SetMainRegion(
const Value: TNewPetrolRegion);
begin
if FMainRegion <> Value then
begin
FMainRegion := Value;
frmPetrolRegions.Root := FMainRegion;
end;
end;
end.
|
{ Program DUMP_PICPRG
*
* Write all the information in the global PICPRG.ENV file to PICPRG.ENV in the
* current directory. The data is sorted by PIC name and written in a
* consistent format. This program is intended for cleaning up the PICPRG.ENV
* file after manual editing.
}
program dump_picprg;
%include 'sys.ins.pas';
%include 'util.ins.pas';
%include 'string.ins.pas';
%include 'file.ins.pas';
%include 'stuff.ins.pas';
%include 'picprg.ins.pas';
type
pics_t = array[1 .. 1] of picprg_idblock_p_t; {array of pointers to PIC descriptors}
pics_p_t = ^pics_t;
var
pr: picprg_t; {PICPRG library state}
pic_p: picprg_idblock_p_t; {info about one PIC}
prev_p: picprg_idblock_p_t; {points to previous PIC in list}
npics: sys_int_machine_t; {number of PICs}
nunique: sys_int_machine_t; {numer of unique PICs found}
org: picprg_org_k_t; {organization ID}
ii, jj, kk: sys_int_machine_t; {scratch integers}
conn: file_conn_t; {connection to the output file}
obuf: {one line output buffer}
%include '(cog)lib/string256.ins.pas';
pics_p: pics_p_t; {points to dynamically allocated array of PIC pointers}
idname_p: picprg_idname_p_t;
idname2_p: picprg_idname_p_t;
adr_p: picprg_adrent_p_t; {pointer to address descriptor}
adr2_p: picprg_adrent_p_t;
pbits: sys_int_machine_t; {bits in widest program memory word}
diffs:
%include '(cog)lib/string80.ins.pas';
tk: {scratch token}
%include '(cog)lib/string32.ins.pas';
hasid: boolean; {PIC has chip ID}
stat: sys_err_t;
label
dupdiff;
{
********************************************************************************
*
* Subroutine WLINE
*
* Write the string in the output buffer OBUF as the next output file line,
* then reset the output buffer to empty.
}
procedure wline;
val_param;
var
stat: sys_err_t;
begin
file_write_text (obuf, conn, stat); {write the line to the output file}
sys_error_abort (stat, '', '', nil, 0);
obuf.len := 0; {reset the output buffer to empty}
end;
{
********************************************************************************
*
* Subroutine WSTR (STR)
*
* Add the string STR to the end of the current output file line.
}
procedure wstr ( {write string to output file line}
in str: univ string_var_arg_t); {the string to write}
val_param;
begin
string_append (obuf, str);
end;
{
********************************************************************************
*
* Subroutine WS (S)
*
* Write the string S to the end of the current output file line.
}
procedure ws ( {write token to output file line}
in s: string); {the token string}
val_param;
var
tk: string_var256_t;
begin
tk.max := size_char(tk.str); {init local var string}
string_vstring (tk, s, size_char(s)); {convert to to var string}
wstr (tk); {write the var string as the next token}
end;
{
********************************************************************************
*
* Subroutine WTK (TK)
*
* Write the string TK as the next token to the current output file line.
}
procedure wtk ( {write token to output file line}
in tk: univ string_var_arg_t); {token to add}
val_param;
begin
string_append_token (obuf, tk);
end;
{
********************************************************************************
*
* Subroutine WTKS (S)
*
* Write the string S as the next output line token.
}
procedure wtks ( {write token to output file line}
in s: string); {the token string}
val_param;
var
tk: string_var256_t;
begin
tk.max := size_char(tk.str); {init local var string}
string_vstring (tk, s, size_char(s)); {convert to to var string}
wtk (tk); {write the var string as the next token}
end;
{
********************************************************************************
*
* Subroutine WINT (I, BASE, ND)
*
* Write the integer value I as the next token to the current output line. The
* value will be written using the number base (radix) BASE. ND is the number
* of digits. Leading zeros will be added as needed to fill the field. ND = 0
* indicates to use only the mininum number of digits necessary with no leading
* zeros.
}
procedure wint ( {write integer to output file line}
in i: sys_int_machine_t; {the integer value}
in base: sys_int_machine_t; {number base (radix)}
in nd: sys_int_machine_t); {fixed number of digits}
val_param;
var
tk: string_var80_t; {scratch token}
tki: string_var80_t; {integer string}
flags: string_fi_t; {string conversion modifier flags}
stat: sys_err_t; {completion status}
begin
tk.max := size_char(tk.str); {init local var string}
tki.max := size_char(tki.str);
if (i = 0) and (nd = 0) then begin {special case of free format zero ?}
tk.str[1] := '0';
tk.len := 1;
wtk (tk);
return;
end;
tk.len := 0; {init output token to empty}
if base <> 10 then begin {not decimal, need radix prefix ?}
string_f_int (tk, base); {init token with number base string}
string_append1 (tk, '#'); {separator before integer digits}
end;
flags := [string_fi_leadz_k]; {add leading zeros as needed to fill field}
if base <> 10 then begin {not decimal ?}
flags := flags + [string_fi_unsig_k]; {treat the input number as unsigned}
end;
string_f_int_max_base ( {convert integer to string representation}
tki, {output string}
i, {input integer}
base, {number base (radix)}
nd, {number of digits, 0 = free form}
flags, {modifier flags}
stat);
sys_error_abort (stat, '', '', nil, 0);
string_append (tk, tki); {make final integer token}
wtk (tk); {write it to the output line}
end;
{
********************************************************************************
*
* Subroutine WFP (FP, ND)
*
* Write the floating point value FP as the next token to the current output
* line. ND is the number of digits to write right of the decimal point.
}
procedure wfp ( {write floating point token to output file line}
in fp: real; {the floating point value}
in nd: sys_int_machine_t); {number of digits right of decimal point}
val_param;
var
tk: string_var32_t; {scratch token}
begin
tk.max := size_char(tk.str); {init local var string}
string_f_fp_fixed (tk, fp, nd); {make string representation of FP number}
wtk (tk); {write it to the output line}
end;
{
********************************************************************************
*
* Subroutine WCFG (ADR, MASK, NBITS)
*
* Write the CONFIG command for the word at address ADR with the mask MASK.
* The mask will be written in binary with NBITS bits.
}
procedure wcfg ( {write one CONFIG command}
in adr: picprg_adr_t; {address of the config word}
in mask: picprg_dat_t; {the mask for this config word}
in nbits: sys_int_machine_t); {config word width in bits}
val_param;
begin
ws (' '(0)); {indent into this ID block}
wtks ('config'); {command name}
wint (adr, 16, 0); {address}
if mask = 0
then begin {this config word isn't really used}
wtks ('0');
end
else begin {at least one bit is used in this config word}
wint (mask, 2, nbits); {show the mask in binary}
end
;
wline;
end;
{
********************************************************************************
*
* Subroutine DOCONFIG_18 (PIC)
*
* Write the CONFIG commands for a PIC 18.
}
procedure doconfig_18 ( {write config commands for PIC 18}
in pic: picprg_idblock_t); {descriptor for the particular PIC}
val_param;
var
cfg: array[0 .. 15] of picprg_dat_t; {mask values for each config word}
cfgst, cfgen: picprg_adr_t; {config word start and end addresses}
cfgn: sys_int_machine_t; {number of config words}
a: picprg_adr_t; {config word address}
alast: picprg_adr_t; {config word that must be written last, 0 = none}
adr_p: picprg_adrent_p_t; {pointer to address descriptor}
begin
if pic.config_p = nil then return; {no config addresses, nothing to write ?}
a := pic.config_p^.adr; {get address of first listed config word}
alast := 0; {init to no word needs to be written last}
if a >= 16#300000
then begin {normal 18F config address range}
cfgst := 16#300000;
cfgn := 16;
alast := 16#30000B;
end
else begin {special 18FJ config address range}
cfgst := a & 16#FFFFF8;
cfgn := 8;
end
;
cfgen := cfgst + cfgn - 1; {last config word address}
for a := 0 to 15 do begin {init all config words to unused (mask = 0)}
cfg[a] := 0;
end;
adr_p := pic.config_p;
while adr_p <> nil do begin {scan the list of defined config words}
a := adr_p^.adr; {get the address of this config word}
if (a < cfgst) or (a > cfgen) then begin
writeln ('Config address of ', a, ' is out of range for PIC 18.');
sys_bomb;
end;
cfg[a - cfgst] := adr_p^.mask; {set mask for this config address}
adr_p := adr_p^.next_p;
end;
for a := cfgst to cfgen do begin {write all but the word that must be last}
if a = alast then next;
wcfg (a, cfg[a - cfgst], 8);
end;
if alast <> 0 then begin {a word must be written last ?}
wcfg (alast, cfg[alast - cfgst], 8);
end;
end;
{
********************************************************************************
*
* Subroutine DOCONFIG_30 (PIC)
*
* Write the CONFIG commands for a PIC 30.
}
procedure doconfig_30 ( {write config commands for PIC 30}
in pic: picprg_idblock_t); {descriptor for the particular PIC}
val_param;
const
cfgst = 16#F80000; {config words start address}
cfgn = 32; {number of config words}
cfgen = cfgst + cfgn - 1; {config words end address}
var
cfg: array[cfgst .. cfgen] of picprg_dat_t; {mask values for each config word}
a: picprg_adr_t; {config word address}
adr_p: picprg_adrent_p_t; {pointer to address descriptor}
nbits: sys_int_machine_t; {width of mask value}
lastu: sys_int_machine_t; {last used address}
tk: string_var32_t; {scratch token}
begin
if pic.config_p = nil then return; {no config addresses, nothing to write ?}
tk.max := size_char(tk.str); {init local var string}
for a := cfgst to cfgen do begin {init all config words to unused (mask = 0)}
cfg[a] := 0;
end;
nbits := 8; {init to masks are only 8 bits wide}
lastu := cfgst + 14; {init minimum last used config address}
adr_p := pic.config_p; {init to first config word in list}
while adr_p <> nil do begin {scan the list of defined config words}
a := adr_p^.adr; {get the address of this config word}
if (a < cfgst) or (a > cfgen) then begin
string_f_int32h (tk, a);
writeln ('Config address of ', tk.str:tk.len, 'h is out of range');
writeln ('in definition of ', pic.name_p^.name.str:pic.name_p^.name.len);
sys_bomb;
end;
cfg[a] := adr_p^.mask; {set mask for this config address}
if (adr_p^.mask & ~255) <> 0 then begin {this mask wider than 8 bits ?}
nbits := 16;
end;
lastu := max(lastu, a); {update last used address}
adr_p := adr_p^.next_p;
end;
lastu := lastu ! 1; {always end on odd address}
for a := cfgst to lastu do begin {write the CONFIG commands}
wcfg (a, cfg[a], nbits);
end;
end;
{
********************************************************************************
*
* Subroutine DOOTHER_30 (PIC)
*
* Write the OTHER commands for a PIC 30 and related.
}
procedure doother_30 ( {write OTHER commands for PIC 30}
in pic: picprg_idblock_t); {descriptor for the particular PIC}
val_param;
var
adr_p: picprg_adrent_p_t; {pointer to address descriptor}
bitw: sys_int_machine_t; {width of data for curr address, bits}
begin
adr_p := pic.other_p; {point to first OTHER word}
while adr_p <> nil do begin {once for each OTHER list entry}
if odd(adr_p^.adr) {determine number of bits at this address}
then bitw := 8
else bitw := 16;
ws (' '(0));
wtks ('other');
wint (adr_p^.adr, 16, 0); {write address}
wint (adr_p^.mask, 16, (bitw + 3) div 4);
wline;
if not odd(adr_p^.adr) then begin {just wrote even (low) adr of prog mem word ?}
if {need implicit 0 for high byte ?}
(adr_p^.next_p = nil) or else
(adr_p^.next_p^.adr <> adr_p^.adr+1)
then begin
ws (' '(0));
wtks ('other');
wint (adr_p^.adr+1, 16, 0); {write address of high byte}
wint (0, 16, 2);
wline;
end;
end;
adr_p := adr_p^.next_p; {advance to next entry in list}
end;
end;
{
********************************************************************************
*
* Start of main routine.
}
begin
string_cmline_init; {init for reading the command line}
string_cmline_end_abort; {no command line parameters allowed}
picprg_init (pr); {init library state}
picprg_open (pr, stat); {open the PICPRG library}
sys_error_abort (stat, '', '', nil, 0);
npics := 0; {init number of PICs found config info for}
pic_p := pr.env.idblock_p; {init to first PIC in list}
while pic_p <> nil do begin {once for each PIC in list}
npics := npics + 1; {count one more PIC}
pic_p := pic_p^.next_p; {advance to next PIC in list}
end;
writeln (npics, ' PICs in list');
if npics <= 0 then return;
file_open_write_text (string_v('picprg'), '.env', conn, stat); {open the output file}
sys_error_abort (stat, '', '', nil, 0);
{
* Make the PICs list. This is a list of pointers to the PIC descriptors.
}
sys_mem_alloc ( {allocate memory for the list}
sizeof(pics_p^[1]) * npics, {amount of memory to allocate}
pics_p); {returned pointer to the new memory}
ii := 0; {init number of PICs written to list}
pic_p := pr.env.idblock_p; {init to first PIC in list}
while pic_p <> nil do begin {once for each PIC in list}
ii := ii + 1; {make list index of this PIC}
pics_p^[ii] := pic_p; {fill in this list entry}
pic_p := pic_p^.next_p; {advance to next PIC in list}
end;
{
* Sort the PICs list by ascending PIC name.
}
for ii := 1 to npics-1 do begin {outer sort loop}
for jj := ii+1 to npics do begin {inner sort loop}
if string_compare_opts ( {entries out of order ?}
pics_p^[ii]^.name_p^.name, {first entry in list}
pics_p^[jj]^.name_p^.name, {second entry in list}
[])
> 0 then begin
pic_p := pics_p^[ii]; {swap the two list entries}
pics_p^[ii] := pics_p^[jj];
pics_p^[jj] := pic_p;
end;
end;
end;
{
* Write the organization ID defintions to the output file.
}
for org := picprg_org_min_k to picprg_org_max_k do begin {once each possible organization ID}
if pr.env.org[org].name.len > 0 then begin {this organization ID is defined ?}
wtks ('org'(0)); {ORG command}
wint (ord(org), 10, 0); {organization ID}
wtk (pr.env.org[org].name); {organization name}
wtk (pr.env.org[org].webpage); {organization's web page}
wline;
end;
end;
{
* Write out the information about each PIC to the output file.
}
prev_p := nil; {init to no previous PIC to compare against}
nunique := 0; {init number of unique PICs found}
for ii := 1 to npics do begin {scan the list of PIC definitions}
with pics_p^[ii]^:pic do begin {PIC is abbreviation for this PIC definition}
{
* Check for this PIC is a duplicate of the previous PIC. Duplicates are
* always adjacent since the list is sorted.
}
if {this PIC is duplicate of previous ?}
(prev_p <> nil) and then {previous PIC exists ?}
string_equal (pic.name_p^.name, prev_p^.name_p^.name) {name matches previous}
then begin
string_vstring (diffs, 'IDSPACE'(0), -1);
if pic.idspace <> prev_p^.idspace
then goto dupdiff;
string_vstring (diffs, 'MASK'(0), -1);
if pic.mask <> prev_p^.mask
then goto dupdiff;
string_vstring (diffs, 'ID'(0), -1);
if pic.id <> prev_p^.id
then goto dupdiff;
string_vstring (diffs, 'VDD LOW'(0), -1);
if pic.vdd.low <> prev_p^.vdd.low
then goto dupdiff;
string_vstring (diffs, 'VDD NORM'(0), -1);
if pic.vdd.norm <> prev_p^.vdd.norm
then goto dupdiff;
string_vstring (diffs, 'VDD HIGH'(0), -1);
if pic.vdd.high <> prev_p^.vdd.high
then goto dupdiff;
string_vstring (diffs, 'VPP MIN'(0), -1);
if pic.vppmin <> prev_p^.vppmin
then goto dupdiff;
string_vstring (diffs, 'VPP MAX'(0), -1);
if pic.vppmax <> prev_p^.vppmax
then goto dupdiff;
string_vstring (diffs, 'REV MASK'(0), -1);
if pic.rev_mask <> prev_p^.rev_mask
then goto dupdiff;
string_vstring (diffs, 'REV SHIFT'(0), -1);
if pic.rev_shft <> prev_p^.rev_shft
then goto dupdiff;
string_vstring (diffs, 'WBUF SIZE'(0), -1);
if pic.wbufsz <> prev_p^.wbufsz
then goto dupdiff;
string_vstring (diffs, 'WBUF START'(0), -1);
if pic.wbstrt <> prev_p^.wbstrt
then goto dupdiff;
string_vstring (diffs, 'WBUF REGION LEN'(0), -1);
if pic.wblen <> prev_p^.wblen
then goto dupdiff;
string_vstring (diffs, 'PINS'(0), -1);
if pic.pins <> prev_p^.pins
then goto dupdiff;
string_vstring (diffs, 'NPROG'(0), -1);
if pic.nprog <> prev_p^.nprog
then goto dupdiff;
string_vstring (diffs, 'NDAT'(0), -1);
if pic.ndat <> prev_p^.ndat
then goto dupdiff;
string_vstring (diffs, 'ADRRES'(0), -1);
if pic.adrres <> prev_p^.adrres
then goto dupdiff;
string_vstring (diffs, 'MASK PRG E'(0), -1);
if pic.maskprg.maske <> prev_p^.maskprg.maske
then goto dupdiff;
string_vstring (diffs, 'MASK PRG O'(0), -1);
if pic.maskprg.masko <> prev_p^.maskprg.masko
then goto dupdiff;
string_vstring (diffs, 'MASK DAT E'(0), -1);
if pic.maskdat.maske <> prev_p^.maskdat.maske
then goto dupdiff;
string_vstring (diffs, 'MASK DAT O'(0), -1);
if pic.maskdat.masko <> prev_p^.maskdat.masko
then goto dupdiff;
string_vstring (diffs, 'DATMAP'(0), -1);
if pic.datmap <> prev_p^.datmap
then goto dupdiff;
string_vstring (diffs, 'TPROGP'(0), -1);
if pic.tprogp <> prev_p^.tprogp
then goto dupdiff;
string_vstring (diffs, 'TPROGD'(0), -1);
if pic.tprogd <> prev_p^.tprogd
then goto dupdiff;
string_vstring (diffs, 'FAM'(0), -1);
if pic.fam <> prev_p^.fam
then goto dupdiff;
string_vstring (diffs, 'EECON1'(0), -1);
if pic.eecon1 <> prev_p^.eecon1
then goto dupdiff;
string_vstring (diffs, 'EEADR'(0), -1);
if pic.eeadr <> prev_p^.eeadr
then goto dupdiff;
string_vstring (diffs, 'EEADRH'(0), -1);
if pic.eeadrh <> prev_p^.eeadrh
then goto dupdiff;
string_vstring (diffs, 'EEDATA'(0), -1);
if pic.eedata <> prev_p^.eedata
then goto dupdiff;
string_vstring (diffs, 'VISI'(0), -1);
if pic.visi <> prev_p^.visi
then goto dupdiff;
string_vstring (diffs, 'TBLPAG'(0), -1);
if pic.tblpag <> prev_p^.tblpag
then goto dupdiff;
string_vstring (diffs, 'NVMCON'(0), -1);
if pic.nvmcon <> prev_p^.nvmcon
then goto dupdiff;
string_vstring (diffs, 'NVMKEY'(0), -1);
if pic.nvmkey <> prev_p^.nvmkey
then goto dupdiff;
string_vstring (diffs, 'NVMADR'(0), -1);
if pic.nvmadr <> prev_p^.nvmadr
then goto dupdiff;
string_vstring (diffs, 'NVMADRU'(0), -1);
if pic.nvmadru <> prev_p^.nvmadru
then goto dupdiff;
string_vstring (diffs, 'HDOUBLE'(0), -1);
if pic.hdouble <> prev_p^.hdouble
then goto dupdiff;
string_vstring (diffs, 'EEDOUBLE'(0), -1);
if pic.eedouble <> prev_p^.eedouble
then goto dupdiff;
string_vstring (diffs, 'ADRRESKN'(0), -1);
if pic.adrreskn <> prev_p^.adrreskn
then goto dupdiff;
string_vstring (diffs, 'NAMES'(0), -1);
idname_p := prev_p^.name_p;
idname2_p := pic.name_p;
while true do begin {compare names lists}
if not string_equal (idname2_p^.name, idname_p^.name) then goto dupdiff;
if idname2_p^.vdd.low <> idname_p^.vdd.low then goto dupdiff;
if idname2_p^.vdd.norm <> idname_p^.vdd.norm then goto dupdiff;
if idname2_p^.vdd.high <> idname_p^.vdd.high then goto dupdiff;
idname_p := idname_p^.next_p;
idname2_p := idname2_p^.next_p;
if idname_p = nil then begin
if idname2_p <> nil then goto dupdiff;
exit;
end;
if idname2_p = nil then goto dupdiff;
end;
string_vstring (diffs, 'CONFIG'(0), -1);
adr_p := prev_p^.config_p;
adr2_p := pic.config_p;
while true do begin {compare config addresses list}
if adr_p = nil then begin
if adr2_p <> nil then begin
string_f_int32h (tk, adr2_p^.adr);
string_appends (diffs, ' address '(0));
string_append (diffs, tk);
goto dupdiff;
end;
exit;
end;
if adr2_p = nil then begin
string_f_int32h (tk, adr_p^.adr);
string_appends (diffs, ' address '(0));
string_append (diffs, tk);
goto dupdiff;
end;
if adr2_p^.adr <> adr_p^.adr then begin
string_f_int32h (tk, adr_p^.adr);
string_appends (diffs, ' mask at address '(0));
string_append (diffs, tk);
goto dupdiff;
end;
if adr2_p^.mask <> adr_p^.mask then begin
string_f_int32h (tk, adr_p^.adr);
string_appends (diffs, ' mask at address '(0));
string_append (diffs, tk);
goto dupdiff;
end;
adr_p := adr_p^.next_p;
adr2_p := adr2_p^.next_p;
end;
string_vstring (diffs, 'OTHER'(0), -1);
adr_p := prev_p^.other_p;
adr2_p := pic.other_p;
while true do begin {compare config addresses list}
while (adr_p <> nil) and then (adr_p^.mask = 0) {skip words with 0 mask}
do adr_p := adr_p^.next_p;
while (adr2_p <> nil) and then (adr2_p^.mask = 0) {skip words with 0 mask}
do adr2_p := adr2_p^.next_p;
if adr_p = nil then begin
if adr2_p <> nil then goto dupdiff;
exit;
end;
if adr2_p = nil then goto dupdiff;
if adr2_p^.adr <> adr_p^.adr then goto dupdiff;
if adr2_p^.mask <> adr_p^.mask then goto dupdiff;
adr_p := adr_p^.next_p;
adr2_p := adr2_p^.next_p;
end;
next; {new PIC is duplicate, silently skip it}
dupdiff: {duplicate, but different from previous}
writeln ('Multiple but different definitions for ',
pic.name_p^.name.str:pic.name_p^.name.len, ' found.');
if diffs.len > 0 then begin
writeln ('Difference: ', diffs.str:diffs.len);
end;
sys_bomb;
end; {done handling duplicate PIC}
prev_p := pics_p^[ii]; {this PIC will be previous next time}
nunique := nunique + 1; {count one more unique PIC found}
{
* Write the info about this PIC to the output file.
}
writeln (pic.name_p^.name.str:pic.name_p^.name.len); {show this pic on STD out}
wline; {blank line after previous PIC definition}
hasid := {TRUE if this PIC has a chip ID}
(pic.id <> 0) or ((pic.mask & 16#FFFFFFFF) <> 16#FFFFFFFF);
pbits := 0; {init bits in widest program memory word}
while rshft(pic.maskprg.maske ! pic.maskprg.masko, pbits) <> 0 do begin
pbits := pbits + 1;
end;
wtks ('id');
case pic.idspace of
picprg_idspace_12_k: wtks ('12');
picprg_idspace_16_k: wtks ('16');
picprg_idspace_16b_k: wtks ('16B');
picprg_idspace_18_k: wtks ('18');
picprg_idspace_18b_k: wtks ('18B');
picprg_idspace_30_k: wtks ('30');
otherwise
writeln ('Encountered unexpected namespace ID of ', ord(pic.idspace));
sys_bomb;
end;
if hasid
then begin {ID is chip ID with valid bits indicated by MASK}
ws (' '(0));
for jj := 31 downto 0 do begin {look for first valid ID bit}
if rshft(pic.mask, jj) <> 0 then exit; {found it ?}
end;
for kk := jj downto 0 do begin {loop thru the bits starting with highest valid}
if (rshft(pic.mask, kk) & 1) = 0
then begin {this is a don't care bit}
ws ('x');
end
else begin {this is a defined bit}
if (rshft(pic.id, kk) & 1) = 0
then ws ('0')
else ws ('1');
end
;
end;
end
else begin {no chip ID}
wtks ('none');
end
;
wline;
if hasid then begin
ws (' '(0)); {REV command}
wtks ('rev');
if (pic.rev_mask & ~255) = 0
then wint (pic.rev_mask, 2, 0) {8 bits or less, write in binary}
else wint (pic.rev_mask, 16, 0); {more than 8 bits, write in HEX}
wint (pic.rev_shft, 10, 0);
wline;
end;
ws (' '(0)); {NAMES command}
wtks ('names');
idname_p := pic.name_p;
while idname_p <> nil do begin
wtk (idname_p^.name);
idname_p := idname_p^.next_p;
end;
wline;
ws (' '(0));
wtks ('type'); {TYPE command}
case pic.fam of {which PIC family type is this ?}
picprg_picfam_10f_k: wtks ('10F');
picprg_picfam_12f_k: wtks ('12F');
picprg_picfam_16f_k: wtks ('16F');
picprg_picfam_12f6xx_k: wtks ('12F6XX');
picprg_picfam_12f1501_k: wtks ('12F1501');
picprg_picfam_16f77_k: wtks ('16F77');
picprg_picfam_16f88_k: wtks ('16F88');
picprg_picfam_16f61x_k: wtks ('16F61X');
picprg_picfam_16f62x_k: wtks ('16F62X');
picprg_picfam_16f62xa_k: wtks ('16F62XA');
picprg_picfam_16f688_k: wtks ('16F688');
picprg_picfam_16f716_k: wtks ('16F716');
picprg_picfam_16f7x7_k: wtks ('16F7X7');
picprg_picfam_16f720_k: wtks ('16F720');
picprg_picfam_16f72x_k: wtks ('16F72X');
picprg_picfam_16f84_k: wtks ('16F84');
picprg_picfam_16f87xa_k: wtks ('16F87XA');
picprg_picfam_16f88x_k: wtks ('16F88X');
picprg_picfam_16f182x_k: wtks ('16F182X');
picprg_picfam_16f15313_k: wtks ('16F15313');
picprg_picfam_16f183xx_k: wtks ('16F183XX');
picprg_picfam_18f_k: wtks ('18F');
picprg_picfam_18f2520_k: wtks ('18F2520');
picprg_picfam_18f2523_k: wtks ('18F2523');
picprg_picfam_18f6680_k: wtks ('18F6680');
picprg_picfam_18f6310_k: wtks ('18F6310');
picprg_picfam_18j_k: wtks ('18J');
picprg_picfam_18k80_k: wtks ('18K80');
picprg_picfam_18f14k22_k: wtks ('18F14K22');
picprg_picfam_18f14k50_k: wtks ('18F14K50');
picprg_picfam_18f25q10_k: wtks ('18F25Q10');
picprg_picfam_30f_k: wtks ('30F');
picprg_picfam_24h_k: wtks ('24H');
picprg_picfam_24f_k: wtks ('24F');
picprg_picfam_24fj_k: wtks ('24FJ');
picprg_picfam_33ep_k: wtks ('33EP');
otherwise
writeln ('Encountered unexpected PIC family ID of ', ord(pic.fam));
sys_bomb;
end;
wline;
idname_p := pic.name_p;
while idname_p <> nil do begin
ws (' '(0));
wtks ('vdd'); {VDD command for specific name}
wfp (idname_p^.vdd.low, 1);
wfp (idname_p^.vdd.norm, 1);
wfp (idname_p^.vdd.high, 1);
if {only write name if multiple names defined}
(pic.name_p^.next_p <> nil)
then begin
wtk (idname_p^.name);
end;
wline;
idname_p := idname_p^.next_p;
end;
ws (' '(0));
wtks ('vpp'); {VPP command}
wfp (pic.vppmin, 1);
wfp (pic.vppmax, 1);
wline;
ws (' '(0));
wtks ('resadr'); {RESADR command}
if pic.adrreskn
then begin {reset address is known}
wint (pic.adrres, 16, 0);
end
else begin {reset address is unknown}
wtks ('none');
end
;
wline;
ws (' '(0));
wtks ('pins'); {PINS command}
wint (pic.pins, 10, 0);
wline;
ws (' '(0));
wtks ('nprog'); {NPROG command}
wint (pic.nprog, 10, 0);
wline;
if pic.maskprg.maske = pic.maskprg.masko
then begin {no odd/even program memory mask distinction}
ws (' '(0));
wtks ('maskprg');
wint (pic.maskprg.maske, 16, 0);
wline;
end
else begin {different masks for odd/even prog memory words}
ws (' '(0));
wtks ('maskprge');
wint (pic.maskprg.maske, 16, 0);
wline;
ws (' '(0));
wtks ('maskprgo');
wint (pic.maskprg.masko, 16, 0);
wline;
end
;
ws (' '(0));
wtks ('tprog'); {TPROG command}
wfp (pic.tprogp * 1000.0, 3);
wline;
ws (' '(0));
wtks ('writebuf'); {WRITEBUF command}
wint (pic.wbufsz, 10, 0);
wline;
if pic.wblen > 0 then begin
ws (' '(0));
wtks ('wbufrange'); {WBUFRANGE command}
wint (pic.wbstrt, 16, 0);
wint (pic.wblen, 16, 0);
wline;
end;
ws (' '(0));
wtks ('ndat'); {NDAT command}
wint (pic.ndat, 10, 0);
wline;
if pic.ndat > 0 then begin
if pic.maskdat.maske = pic.maskdat.masko
then begin {no odd/even EEPROM mask distinction}
ws (' '(0));
wtks ('maskdat');
wint (pic.maskdat.maske, 16, 0);
wline;
end
else begin {different masks for odd/even EEPROM words}
ws (' '(0));
wtks ('maskdate');
wint (pic.maskdat.maske, 16, 0);
wline;
ws (' '(0));
wtks ('maskdato');
wint (pic.maskdat.masko, 16, 0);
wline;
end
;
ws (' '(0));
wtks ('tprogd');
wfp (pic.tprogd * 1000.0, 3);
wline;
ws (' '(0));
wtks ('datmap');
wint (pic.datmap, 16, 0);
wline;
end;
if {write PIC 18 register addresses ?}
(pic.idspace = picprg_idspace_18_k) and {this is a PIC 18 ?}
( (pic.eecon1 <> 16#FA6) or {any reg not at the default address ?}
(pic.eeadr <> 16#FA9) or
(pic.eeadrh <> 16#FAA) or
(pic.eedata <> 16#FA8))
then begin
ws (' '(0)); {write addresses of all variable registers}
wtks ('eecon1');
wint (pic.eecon1, 16, 3);
wline;
ws (' '(0));
wtks ('eeadr');
wint (pic.eeadr, 16, 3);
wline;
ws (' '(0));
wtks ('eeadrh');
wint (pic.eeadrh, 16, 3);
wline;
ws (' '(0));
wtks ('eedata');
wint (pic.eedata, 16, 3);
wline;
end;
if {write PIC 30 register addresses ?}
(pic.idspace = picprg_idspace_30_k) and {this is a PIC 80 ?}
( (pic.visi <> 16#784) or {any reg not at the default address ?}
(pic.tblpag <> 16#032) or
(pic.nvmcon <> 16#760) or
(pic.nvmkey <> 16#766) or
(pic.nvmadr <> 16#762) or
(pic.nvmadru <> 16#764))
then begin
ws (' '(0)); {write addresses of all variable registers}
wtks ('visi');
wint (pic.visi, 16, 3);
wline;
ws (' '(0));
wtks ('tblpag');
wint (pic.tblpag, 16, 3);
wline;
ws (' '(0));
wtks ('nvmcon');
wint (pic.nvmcon, 16, 3);
wline;
ws (' '(0));
wtks ('nvmkey');
wint (pic.nvmkey, 16, 3);
wline;
ws (' '(0));
wtks ('nvmadr');
wint (pic.nvmadr, 16, 3);
wline;
ws (' '(0));
wtks ('nvmadru');
wint (pic.nvmadru, 16, 3);
wline;
end;
case pic.idspace of {check for special handling of OTHER words}
picprg_idspace_18_k: begin
doconfig_18 (pic);
end;
picprg_idspace_30_k: begin
doconfig_30 (pic);
end;
otherwise {normal config word handling}
adr_p := pic.config_p;
while adr_p <> nil do begin {loop thru the CONFIG addresses}
wcfg (adr_p^.adr, adr_p^.mask, pbits);
adr_p := adr_p^.next_p;
end;
end;
case pic.idspace of {check for special handling of OTHER words}
picprg_idspace_30_k: begin
doother_30 (pic);
end;
otherwise {normal OTHER word handling}
adr_p := pic.other_p;
while adr_p <> nil do begin {loop thru the OTHER addresses}
ws (' '(0));
wtks ('other');
wint (adr_p^.adr, 16, 0);
wint (adr_p^.mask, 16, (pbits + 3) div 4);
adr_p := adr_p^.next_p;
wline;
end;
end;
ws (' '(0));
wtks ('endid');
wline;
end; {done with PIC abbreviation}
end; {back to do next PIC in list}
picprg_close (pr, stat);
sys_error_abort (stat, '', '', nil, 0);
writeln;
writeln (npics, ' PIC definitions found, ', nunique, ' unique, ',
npics - nunique, ' duplicates.');
end.
|
unit UFmShareFileExplorer;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, VirtualTrees, ImgList, ComCtrls, ToolWin, Menus, ExtCtrls;
type
TFrameShareFiles = class(TFrame)
vstShareFiles: TVirtualStringTree;
tbVstShareFile: TToolBar;
tbtnRefresh: TToolButton;
tbtnAddFavorite: TToolButton;
ilTb: TImageList;
ilTbGray: TImageList;
PmVstShareFile: TPopupMenu;
Refresh1: TMenuItem;
AddFavorite1: TMenuItem;
plDownShareHistoryTitle: TPanel;
procedure vstShareFilesGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
procedure vstShareFilesGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: String);
procedure vstShareFilesInitChildren(Sender: TBaseVirtualTree;
Node: PVirtualNode; var ChildCount: Cardinal);
procedure vstShareFilesChecked(Sender: TBaseVirtualTree;
Node: PVirtualNode);
procedure vstShareFilesFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
procedure tbtnRefreshClick(Sender: TObject);
procedure tbtnAddFavoriteClick(Sender: TObject);
procedure Refresh1Click(Sender: TObject);
procedure AddFavorite1Click(Sender: TObject);
public
SharePcID : string;
procedure IniVstShareFile;
procedure SetSharePcID( _SharePcID : string );
end;
const
VstShareFile_FileName = 0;
VstShareFile_FileSize = 1;
VstShareFile_FileTime = 2;
ShowText_Waiting = 'Waiting...';
implementation
uses UMyShareFace, UIconUtil, UMyUtil, UMyShareControl, UFormFileShareExplorer, UFormUtil;
{$R *.dfm}
procedure TFrameShareFiles.AddFavorite1Click(Sender: TObject);
begin
tbtnAddFavorite.Click;
end;
procedure TFrameShareFiles.IniVstShareFile;
begin
vstShareFiles.NodeDataSize := SizeOf( TVstShareFolderData );
vstShareFiles.Images := MyIcon.getSysIcon;
end;
procedure TFrameShareFiles.Refresh1Click(Sender: TObject);
begin
tbtnRefresh.Click;
end;
procedure TFrameShareFiles.SetSharePcID(_SharePcID: string);
begin
SharePcID := _SharePcID;
end;
procedure TFrameShareFiles.tbtnAddFavoriteClick(Sender: TObject);
var
SelectData : PVstShareFolderData;
begin
if not Assigned( vstShareFiles.FocusedNode ) then
Exit;
SelectData := vstShareFiles.GetNodeData( vstShareFiles.FocusedNode );
MyFileShareControl.AddFavorite( SelectData.FilePath, SharePcID, SelectData.IsFolder );
end;
procedure TFrameShareFiles.tbtnRefreshClick(Sender: TObject);
var
RefreshNode : PVirtualNode;
begin
RefreshNode := vstShareFiles.FocusedNode;
if not Assigned( RefreshNode ) then
Exit;
vstShareFiles.DeleteChildren( RefreshNode );
frmShareExplorer.SelectShareFolder( SharePcID, vstShareFiles, RefreshNode );
end;
procedure TFrameShareFiles.vstShareFilesChecked(Sender: TBaseVirtualTree;
Node: PVirtualNode);
begin
frmShareExplorer.EnableBtnOK;
end;
procedure TFrameShareFiles.vstShareFilesFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
begin
tbtnRefresh.Enabled := Assigned( Node );
tbtnAddFavorite.Enabled := Assigned( Node );
PmVstShareFile.Items[0].Visible := Assigned( Node );
PmVstShareFile.Items[1].Visible := Assigned( Node );
end;
procedure TFrameShareFiles.vstShareFilesGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
var
NodeData : PVstShareFolderData;
begin
if ( Column = 0 ) and
( ( Kind = ikNormal ) or ( Kind = ikSelected ) )
then
begin
NodeData := Sender.GetNodeData( Node );
if NodeData.FilePath = ShareFile_NotExist then
ImageIndex := MyShellTransActionIconUtil.getLoadedError
else
if NodeData.IsFolder then
ImageIndex := MyShellIconUtil.getFolderIcon
else
ImageIndex := MyIcon.getIconByFileExt( NodeData.FilePath );
end
else
ImageIndex := -1;
end;
procedure TFrameShareFiles.vstShareFilesGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: String);
var
NodeData : PVstShareFolderData;
begin
NodeData := Sender.GetNodeData( Node );
if Column = VstShareFile_FileName then
begin
if Node.Parent = Sender.RootNode then
CellText := NodeData.FilePath
else
CellText := MyFileInfo.getFileName( NodeData.FilePath );
end
else
if NodeData.IsWaiting then
CellText := ''
else
if Column = VstShareFile_FileTime then
CellText := DateTimeToStr( NodeData.FileTime )
else
if not NodeData.IsFolder then
CellText := MySize.getFileSizeStr( NodeData.FileSize )
else
CellText := '';
end;
procedure TFrameShareFiles.vstShareFilesInitChildren(Sender: TBaseVirtualTree;
Node: PVirtualNode; var ChildCount: Cardinal);
begin
frmShareExplorer.SelectShareFolder( SharePcID, vstShareFiles, Node );
Inc( ChildCount );
end;
end.
|
//-----------------------------------------------------------------------------
//
// Copyright 1982-2001 Pervasive Software Inc. All Rights Reserved
//
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
//
// BTRCLASS.PAS
//
// This software is part of the Pervasive Software Developer Kit.
//
// This source code is only intended as a supplement to the
// Pervasive.SQL documentation; see that documentation for detailed
// information regarding the use of Pervasive.SQL.
//
// This unit illustrates using a simple Delphi class to 'wrap' the
// Pervasive.SQL Transactional API.
//
//-----------------------------------------------------------------------------
unit BtrClass;
interface
uses
SysUtils, BtrConst, BtrAPI32;
const
// Keep path <= 64 for SQL compatibility
BTRCLASS_GENERAL_ERROR = -1;
type
TBtrvFile = class(TObject)
private
FStatus: SmallInt;
FFileOpen: Boolean;
FPosBlock: POS_BLOCK_T;
FFilePath: String[MAX_FILE_NAME_LENGTH];
FKeyBuffer: array[0..MAX_KEY_SIZE - 1] of Char;
FDataLength: Word;
FKeyNumber: SmallInt;
FDataBuffer: PChar;
function CallBtrv(Op: SmallInt): SmallInt;
public
constructor Create;
destructor Destroy; override;
procedure SetFilePath(FileName: String);
procedure SetDataBuffer(Buffer: Pointer);
procedure SetDataLength(DataLength: SmallInt);
function SetKey(Key: SmallInt) : SmallInt;
procedure ClearKeyBuffer;
procedure PutKeyInfo(Src: PChar; Start, Size: SmallInt);
function MakeDataBuffer(Size: Word) : Boolean;
function Open: SmallInt;
function Close: SmallInt;
function GetFirst: SmallInt;
function GetEqual: SmallInt;
function GetNext: SmallInt;
function GetLast: SmallInt;
function GetGE: SmallInt;
function GetGT: SmallInt;
function GetLE: SmallInt;
function GetLT: SmallInt;
function GetPosition(var Position: Longint): SmallInt;
function GetDirect(Position: Longint): SmallInt;
function GetPrev: SmallInt;
function Update: SmallInt;
function Delete: SmallInt;
function Insert: SmallInt;
function IsOpen: Boolean;
function ResetBtrv: SmallInt;
function GetLastStatus: SmallInt;
function GetSpecs(var Specs: FILE_CREATE_BUFFER_T): SmallInt;
function Recreate: SmallInt;
end;
implementation
function Max(A, B: integer): Integer;
begin
if A >= B then
Result := A
else
Result := B;
end;
{ TBtrvFile }
{ Private declarations }
function TBtrvFile.CallBtrv(Op: SmallInt): SmallInt;
begin
if FDataBuffer <> nil then
begin
// Status gets set and returned on every call
FStatus := BTRV(Op, FPosBlock, FDataBuffer^, FDataLength, FKeyBuffer, FKeyNumber);
Result := FStatus;
end
else
Result := BTRCLASS_GENERAL_ERROR;
end;
{ Public declarations }
constructor TBtrvFile.Create;
begin
inherited Create;
FFilePath := '';
FillChar(FPosBlock, SizeOf(FPosBlock), #0);
FillChar(FKeyBuffer, SizeOf(FKeyBuffer), #0);
FDataBuffer := nil;
FDataLength := 0;
FKeyNumber := 0;
FFileOpen := False;
end;
destructor TBtrvFile.Destroy;
begin
if FFileOpen then
Close;
inherited Destroy;
end;
procedure TBtrvFile.SetFilePath(FileName: String);
begin
FFilePath := FileName;
end;
procedure TBtrvFile.SetDataBuffer(Buffer: Pointer);
begin
FDataBuffer := Buffer;
end;
procedure TBtrvFile.SetDataLength(DataLength: SmallInt);
begin
FDataLength := DataLength;
end;
function TBtrvFile.SetKey(Key: SmallInt) : SmallInt;
begin
Result := FKeyNumber;
FKeyNumber := Key;
end;
procedure TBtrvFile.ClearKeyBuffer;
begin
FillChar(FKeyBuffer, SizeOf(FKeyBuffer), #0);
end;
procedure TBtrvFile.PutKeyInfo(Src: pchar; Start, Size: SmallInt);
var
I, J: SmallInt;
begin
if Src <> nil then
begin
J := 0;
//Move(FKeyBuffer[Start], Src, Size);
for I := Start to Start + Size do
begin
FKeyBuffer[I] := Src[J];
Inc(J);
end;
end;
end;
function TBtrvFile.MakeDataBuffer(Size: Word): Boolean;
var
OK: Boolean;
P : PChar;
begin
OK := True;
P := nil;
// allocate memory of Size bytes
try
GetMem(P, Size);
except
OK := False;
end;
if OK then
FDataBuffer := P;
Result := OK;
end;
function TBtrvFile.Open: SmallInt;
begin
Result := BTRCLASS_GENERAL_ERROR;
if (FFilePath <> '') then
begin
FillChar(FKeyBuffer, SizeOf(FKeyBuffer), #0);
Move(FFilePath[1], FKeyBuffer, Byte(FFilePath[0]));
CallBtrv(B_OPEN);
if FStatus = B_NO_ERROR then
FFileOpen := True;
Result := FStatus;
end;
end;
function TBtrvFile.Close: SmallInt;
begin
CallBtrv(B_CLOSE);
FFileOpen := False;
Result := FStatus;
end;
function TBtrvFile.GetFirst: SmallInt;
begin
CallBtrv(B_GET_FIRST);
Result := FStatus;
end;
function TBtrvFile.GetEqual: SmallInt;
begin
CallBtrv(B_GET_EQUAL);
Result := FStatus;
end;
function TBtrvFile.GetNext: SmallInt;
begin
CallBtrv(B_GET_NEXT);
Result := FStatus;
end;
function TBtrvFile.GetLast: SmallInt;
begin
CallBtrv(B_GET_LAST);
Result := FStatus;
end;
function TBtrvFile.GetGE: SmallInt;
begin
CallBtrv(B_GET_GE);
Result := FStatus;
end;
function TBtrvFile.GetGT: SmallInt;
begin
CallBtrv(B_GET_GT);
Result := FStatus;
end;
function TBtrvFile.GetLE: SmallInt;
begin
CallBtrv(B_GET_LE);
Result := FStatus;
end;
function TBtrvFile.GetLT: SmallInt;
begin
CallBtrv(B_GET_LT);
Result := FStatus;
end;
function TBtrvFile.GetDirect(Position: Longint): SmallInt;
begin
FillChar(FDataBuffer^, FDataLength, #0);
Move(Position, FDataBuffer^, SizeOf(Position));
CallBtrv(B_GET_DIRECT);
Result := FStatus;
end;
function TBtrvFile.GetPrev: SmallInt;
begin
CallBtrv(B_GET_PREVIOUS);
Result := FStatus;
end;
function TBtrvFile.IsOpen: Boolean;
begin
Result := FFileOpen;
end;
function TBtrvFile.GetPosition(var Position: Longint): SmallInt;
var
SaveLength: Longint;
SaveBuffer: PChar;
begin
SaveLength := FDataLength;
SaveBuffer := FDataBuffer;
FDataBuffer := @Position;
FDataLength := SizeOf(Position);
try
CallBtrv(B_GET_POSITION);
Result := FStatus;
finally
FDataBuffer := SaveBuffer;
FDataLength := SaveLength;
end;
end;
function TBtrvFile.Update: SmallInt;
begin
Result := CallBtrv(B_UPDATE);
end;
function TBtrvFile.ResetBtrv: SmallInt;
begin
Result := CallBtrv(B_RESET);
FFileOpen := False;
end;
function TBtrvFile.Insert: SmallInt;
begin
Result := CallBtrv(B_INSERT);
end;
function TBtrvFile.Delete: SmallInt;
begin
Result := CallBtrv(B_DELETE);
end;
function TBtrvFile.GetLastStatus: SmallInt;
begin
Result := FStatus;
end;
function TBtrvFile.GetSpecs(var Specs: FILE_CREATE_BUFFER_T): SmallInt;
begin
Result := CallBtrv(B_STAT);
Move(FDataBuffer^, Specs, SizeOf(Specs));
end;
function TBtrvFile.Recreate: SmallInt;
var
Specs: FILE_CREATE_BUFFER_T;
B : Byte;
W : Word;
FN : String;
begin
GetSpecs(Specs);
W := 0;
BTRV(B_CLOSE, FPosBlock, B, W, B, 0);
FN := Trim(Copy(FKeyBuffer, 1, SizeOf(FKeyBuffer)));
Result := BTRV(B_CREATE, FPosBlock, FDataBuffer^, FDataLength, FFilePath[1], FKeyNumber);
if Result = 0 then
Result := Open
else
FStatus := Result;
end;
end.
|
unit hash;
interface
uses
global,
stdio,
ctype,
cstring;
function InsertIntoLabelTable(label_name: PAnsiChar; instruction_number: Integer): Boolean;
function Duplicate_variable_check(label_name: PAnsiChar): Boolean;
function HashCode(key: PAnsiChar; size: integer ): Integer;
procedure PrintErrorProcessingHashCode();
//function SearchInOpTable(key: PAnsiChar): TOpcodeItemPtr;
function InsertIntoSymbolTable(TokenPtr: TTokenPtr): Boolean;
procedure PrintErrorWithNullInputs();
function SearchInLabelTable(Key: PAnsiChar): TLabelItemPtr;
function SearchInSymbolTable(key: PAnsiChar): TTokenPtr;
function SearchInConstantSymbolTable(key: PAnsiChar): TConstantSymbolItemPtr;
implementation
uses
AsmInstruction;
function InsertIntoSymbolTable(TokenPtr: TTokenPtr): Boolean;
var
hashIndex: Integer;
tItem: TTokenPtr;
begin
if (main_symbol_table.HashTableCount < 0) or (TokenPtr = nil) or (TokenPtr^.Spelling = nil) then
begin
printErrorWithNullInputs();
Exit(false);
end;
if TokenPtr.Kind = TTokenKind.VAR_IDENTIFIER then
begin
if (duplicate_variable_check(TokenPtr.Spelling)) then
Error('Nome de variavel duplicado: %s', TokenPtr.Spelling);
end;
hashIndex := HashCode(TokenPtr.Spelling, main_symbol_table.HashTableSize);
if (hashIndex = -1) then
begin
printErrorProcessingHashCode();
Exit(false);
end;
if not (main_symbol_table.Items[hashIndex] = nil) then
begin
tItem := main_symbol_table.Items[hashIndex];
if (stricmp(tItem^.Spelling, TokenPtr.Spelling) = 0) then
begin
TokenPtr^.next := main_symbol_table.Items[hashIndex]^.next;
main_symbol_table.Items[hashIndex] := TokenPtr;
Inc(main_symbol_table.HashTableCount);
Exit(true);
end;
while not (tItem^.next = nil) do
tItem := tItem^.next;
tItem^.next := TokenPtr;
Inc(main_symbol_table.HashTableCount);
Exit(true);
end;
main_symbol_table.Items[hashIndex] := TokenPtr;
Inc(main_symbol_table.HashTableCount);
Exit(true);
end;
procedure PrintErrorWithNullInputs();
begin
//printf('No Records'#10);
end;
//function searchInOpTable(key: PAnsichar): TOpcodeItemPtr;
//var
// hashIndex: integer;
// item: TOpcodeItemPtr;
//begin
//
// if (main_op_table.hashTableCount < 1) or (key = nil) then
// begin
// printErrorWithNullInputs();
// Exit(nil);
// end;
//
// hashIndex := hashCode(key, main_op_table.hashTableSize);
// if (hashIndex = -1) then
// begin
// printErrorProcessingHashCode();
// Exit(nil);
// end;
//
// item := main_op_table.item[hashIndex];
// while not (item = nil) do
// begin
// if (strcmp(item^.name, key) = 0) then
// Exit(item);
//
// item := item^.next;
// end;
//
// Result := nil;
//end;
function SumOfChars(Str: PAnsiChar): Integer;
var
i,
len,
sum: Integer;
begin
len := strlen(str);
sum := 0;
for i := 0 to len - 1 do
sum := sum + Ord(tolower(str[i]));
Result := sum;
end;
procedure printErrorProcessingHashCode();
begin
Error(#10'Erro ao gerar código hash'#10);
end;
// // retorna -1 se a entrada nil for dada else retorna o hashCode gerado com chave e tamanho
function HashCode(key: PAnsiChar; size: integer ): Integer;
begin
if (key = nil) then
Result := -1
else
begin
Result := SumOfChars(key) mod size;
end;
end;
{
function InsertIntoOpTable(Name: PAnsiChar; Code: Integer): Boolean;
var
item: TOpcodeItemPtr;
HashIndex: Integer;
tItem: TOpcodeItemPtr;
begin
if (main_op_table.hashTableCount < 0) or (Name = nil) then
begin
PrintErrorWithNullInputs();
Exit(False);
end;
item := AllocMem(SizeOf(TOpcodeItem));
strcpy(item^.Name, Name);
Item^.Code := Code;
Item^.Next := nil;
HashIndex := HashCode(Name, main_op_table.hashTableSize);
if (hashIndex = -1) then
begin
printErrorProcessingHashCode();
Exit(false);
end;
if not (main_op_table.item[hashIndex] = nil) then
begin
tItem := main_op_table.item[hashIndex];
if (strcmp(tItem^.Name, Name) = 0) then
begin
item^.Next := main_op_table.item[hashIndex]^.Next;
main_op_table.item[hashIndex] := item;
Inc(main_op_table.hashTableCount);
Exit(True);
end;
while not (tItem^.next = nil) do
tItem := tItem^.Next;
tItem^.Next := item;
Inc(main_op_table.hashTableCount);
Exit(True);
end;
main_op_table.item[hashIndex] := item;
Inc(main_op_table.hashTableCount);
Exit(True);
end;
}
function SearchInLabelTable(Key: PAnsiChar): TLabelItemPtr;
var
HashIndex: Integer;
item: TLabelItemPtr;
begin
if (main_label_table.count < 1) or (key = nil) then
begin
PrintErrorWithNullInputs();
Exit(nil);
end;
HashIndex := HashCode(key, main_label_table.size);
if (hashIndex = -1) then
begin
PrintErrorProcessingHashCode();
Exit(nil);
end;
item := main_label_table.item[hashIndex];
while not (item = nil) do
begin
if (stricmp(item^.Name, key) = 0) then
Exit(item);
item := item^.next;
end;
Result := nil;
end;
function SearchInSymbolTable(key: PAnsiChar): TTokenPtr;
var
hashIndex: integer;
item: TTokenPtr;
begin
if (main_symbol_table.HashTableCount < 1) or (key = nil) then
begin
PrintErrorWithNullInputs();
Exit(nil);
end;
hashIndex := HashCode(key, main_symbol_table.HashTableSize);
if (hashIndex = -1) then
begin
PrintErrorProcessingHashCode();
Exit(nil);
end;
item := main_symbol_table.Items[hashIndex];
while not (item = nil) do
begin
if (stricmp(item^.Spelling, key) = 0) then
Exit(item);
item := item^.next;
end;
Result := nil;
end;
function SearchInConstantSymbolTable(key: PAnsiChar): TConstantSymbolItemPtr;
var
hashIndex: Integer;
item: TConstantSymbolItemPtr;
begin
if (main_constant_symbol_table.count < 1) or (key = nil) then
begin
PrintErrorWithNullInputs();
Exit(nil);
end;
hashIndex := HashCode(key, main_constant_symbol_table.size);
if (hashIndex = -1) then
begin
printErrorProcessingHashCode();
Exit(nil);
end;
item := main_constant_symbol_table.item[hashIndex];
while not (item = nil) do
begin
if (stricmp(item^.Name, key) = 0) then
Exit(item);
item := item^.next;
end;
Result := nil;
end;
{
function searchInOpTable(key: PAnsiChar): TOpcodeItemPtr;
var
hashIndex: Integer;
item: TOpcodeItemPtr;
begin
if (main_op_table.hashTableCount < 1) or (key = nil) then
begin
printErrorWithNullInputs();
Exit(nil);
end;
hashIndex := hashCode(key, main_op_table.hashTableSize);
if (hashIndex = -1) then
begin
printErrorProcessingHashCode();
Exit(nil);
end;
item := main_op_table.item[hashIndex];
while not (item = nil) do
begin
if (strcmp(item^.name, key) = 0) then
Exit(item);
item := item^.next;
end;
Result := nil;
end;
}
function duplicate_variable_check(label_name: PAnsiChar): Boolean;
var
item: TLabelItemPtr;
symbl_item: TTokenPtr;
const_item: TConstantSymbolItemPtr;
// op_code_item: TOpcodeItemPtr;
begin
item := searchInLabelTable(label_name);
symbl_item := searchInSymbolTable(label_name);
const_item := searchInConstantSymbolTable(label_name);
// op_code_item := searchInOpTable(label_name);
if (item <> nil) or (symbl_item <> nil) or (const_item <> nil) {or (op_code_item <> nil)} then
begin
printf('palavra duplicada : %s'#10, label_name);
Result := True;
end
else
Result := False;
end;
function InsertIntoLabelTable(label_name: PAnsiChar; instruction_number: Integer): Boolean;
var
item: TLabelItemPtr;
hashIndex: integer;
tItem: TLabelItemPtr;
begin
if (main_label_table.count < 0) or (label_name = nil) then
begin
PrintErrorWithNullInputs();
Exit(False);
end;
if (duplicate_variable_check(label_name)) then
Exit(false);
item := AllocMem(SizeOf(TLabelItem));
item^.Name := AllocMem(SizeOf(AnsiChar) * (strlen(label_name) + 1));
strcpy(item^.Name, label_name);
item^.instruction_number := instruction_number;
item^.next := nil;
hashIndex := hashCode(label_name, main_label_table.size);
if (hashIndex = -1) then
begin
PrintErrorProcessingHashCode();
Exit(false);
end;
if not (main_label_table.item[hashIndex] = nil) then
begin
tItem := main_label_table.item[hashIndex];
if (stricmp(tItem^.Name, label_name) = 0) then
begin
item^.next := main_label_table.item[hashIndex]^.next;
main_label_table.item[hashIndex] := item;
Inc(main_label_table.count);
Exit(true);
end;
while not (tItem^.next = nil) do
tItem := tItem^.next;
tItem^.next := item;
Inc(main_label_table.count);
Exit(true);
end;
main_label_table.item[hashIndex] := item;
Inc(main_label_table.count);
Result := true;
end;
end.
|
unit jMain;
interface
uses
Windows, Messages, SysUtils, Classes, MMSystem,
glApplication, glWindow, glGraphics, glSound, glError, glSprite, glCanvas, glUtil, glConst, glControls,
D3DX8, {$IFDEF DXG_COMPAT}DirectXGraphics{$ELSE}Direct3D8{$ENDIF};
type
TCompassDirection = (cdNorth, cdNorthEast, cdEast, cdSouthEast, cdSouth,
cdSouthWest, cdWest, cdNorthWest);
TDirectionOffset = array[TCompassDirection] of TPoint;
TNode = record
Direction: TCompassDirection;
GridPt: TPoint;
end;
PNode = ^TNode;
THeader = record
Version: Integer;
Description: string[255];
Width, Height: Integer;
end;
TTile = record
Index: Integer;
Collide: Boolean;
end;
TWindow1 = class(TWindow)
private
FileWork: string;
MapHeader: THeader;
Engine: TSpriteEngine;
Pictures: TPictures;
protected
procedure DoCreate; override;
procedure DoInitialize; override;
public
procedure DoFrame(Sender: TObject; TimeDelta: Single);
procedure DoIdleFrame(Sender: TObject; TimeDelta: Single);
procedure LoadFromFile(const FileName: string);
procedure DoClick; override;
end;
TGraphics1 = class(TGraphics)
private
procedure DoInitialize; override;
public
procedure CreateShoot(MyX, MyY: Single; MyAngle: Single);
end;
var
Window1: TWindow1;
Graphics1: TGraphics1;
Background: TBackgroundSprite;
StartPt, EndPt: TPoint;
SetStart: Boolean;
PathQueue: TList;
MapGrid: array[0..14, 0..19] of Byte;
VisitedNodes: array[0..14, 0..19] of Boolean;
const
PATH_IMG = 'Media\Img\';
PATH_SOUND = 'Media\Sound\';
Path_MUSIC = 'Media\Music\';
DirectionOffset: TDirectionOffset = ((X: 0; Y: - 1), (X: 1; Y: - 1), (X: 1; Y: 0),
(X: 1; Y: 1), (X: 0; Y: 1), (X: - 1; Y: 1), (X: - 1; Y: 0), (X: - 1; Y: - 1));
NODECLEAR = 0;
NODEOBSTACLE = 1;
NODESTART = 2;
NODEEND = 3;
NODEPATH = 4;
NODEVISITED = 5;
procedure ClearPathQueue;
implementation
procedure TWindow1.DoCreate;
begin
Left := 50;
Top := 50;
Width := 640;
Height := 480;
Caption := 'Bomber IskaTreK';
ClientRect := Bounds(0, 0, 640, 480);
StartPt := Point(2, 2);
EndPt := Point(10, 10);
SetStart := True;
PathQueue := TList.Create;
end;
procedure ClearPathQueue;
var
iCount: Integer;
begin
for iCount := 0 to PathQueue.Count - 1 do
FreeMem(PathQueue[iCount], SizeOf(TNode));
PathQueue.Clear;
end;
procedure TWindow1.DoInitialize;
begin
Application.OnDoFrame := DoFrame;
Application.OnDoIdleFrame := DoIdleFrame;
end;
procedure TWindow1.DoFrame(Sender: TObject; TimeDelta: Single);
begin
if Window1.Key[VK_F2] then
Application.Pause;
if Window1.Key[VK_ESCAPE] then
Application.Terminate;
Graphics1.Clear;
Engine.Move(1000 div 60);
Engine.Dead;
Graphics1.BeginScene;
Canvas.SpriteBegin;
Engine.Draw;
Canvas.SpriteEnd;
Canvas.TextOut(10, 10, IntToStr(Application.Fps));
Graphics1.EndScene;
Graphics1.Flip;
end;
procedure TWindow1.DoIdleFrame(Sender: TObject; TimeDelta: Single);
begin
if Window.Key[VK_F3] then
Application.UnPause;
if Window.Key[VK_ESCAPE] then
Application.Terminate;
Graphics.Clear;
Graphics.BeginScene;
Canvas.SpriteBegin;
Canvas.SpriteEnd;
Canvas.TextOut(10, 10, IntToStr(Application.Fps));
Canvas.TextOut(10, 30, 'Pressione Esc para sair.');
Canvas.TextOut(10, 50, 'Parado');
Graphics.EndScene;
Graphics.Flip;
end;
procedure TWindow1.LoadFromFile(const FileName: string);
var
FileHeader: file of THeader;
FileTile: file of TTile;
Tile: TTile;
Header: THeader;
I, J: Integer;
begin
if Length(FileName) = 0 then
Exit;
FileWork := FileName;
AssignFile(FileHeader, FileName);
{$I-}
Reset(FileHeader);
{$I+}
if IORESULT <> 0 then
begin
CloseFile(FileHeader);
Exit;
end;
Read(FileHeader, Header);
CloseFile(FileHeader);
MapHeader := Header;
Background.SetMapSize(MapHeader.Width, MapHeader.Height);
AssignFile(FileTile, FileName);
{$I-}
Reset(FileTile);
{$I+}
if IORESULT <> 0 then
begin
CloseFile(FileTile);
Exit;
end;
Seek(FileTile, SizeOf(FileHeader));
try
for I := 0 to Background.MapWidth - 1 do
for J := 0 to Background.MapHeight - 1 do
begin
Read(FileTile, Tile);
Background.Chips[I, J] := Tile.Index;
Background.CollisionMap[I, J] := Tile.Collide;
end;
finally
CloseFile(FileTile);
end;
end;
procedure TWindow1.DoClick;
var
iCount, iCount2: Integer;
CurPt, EvalPt, NewPt: TPoint;
TempNode: PNode;
Dist, EvalDist: Longword;
Dir, NewDir: TCompassDirection;
SearchDirs: array[0..2] of TCompassDirection;
begin
{don’t do anything until a starting and ending point have been set}
if (StartPt.X = -1) or (EndPt.X = -1) then
Exit;
{clear out the visited nodes array}
FillChar(VisitedNodes, SizeOf(VisitedNodes), 0);
{populate the map grid with the specified impassible tiles}
for iCount := 0 to 19 do
for iCount2 := 0 to 14 do
if Background.Chips[iCount, iCount2] = NODEOBSTACLE then
MapGrid[iCount, iCount2] := 1
else
MapGrid[iCount, iCount2] := 0;
{delete the current path}
ClearPathQueue;
{initialize the tracking variables}
CurPt := StartPt;
VisitedNodes[CurPt.X, CurPt.Y] := TRUE;
{determine the initial direction}
{destination left of origin}
if EndPt.X < StartPt.X then
begin
if EndPt.Y > StartPt.Y then
Dir := cdSouthWest
else
if EndPt.Y < StartPt.Y then
Dir := cdNorthWest
else
Dir := cdWest;
end
else
{destination right of origin}
if EndPt.X > StartPt.X then
begin
if EndPt.Y > StartPt.Y then
Dir := cdSouthEast
else
if EndPt.Y < StartPt.Y then
Dir := cdNorthEast
else
Dir := cdEast;
end
else
{destination directly above or below origin}
if EndPt.Y > StartPt.Y then
Dir := cdSouth
else
Dir := cdNorth;
{create a node object}
GetMem(TempNode, SizeOf(TNode));
{initialize the node object with our current (starting) node information}
TempNode^.Direction := Dir;
TempNode^.GridPt.X := CurPt.X;
TempNode^.GridPt.Y := CurPt.Y;
{add this starting node to the path list}
PathQueue.Add(TempNode);
{begin searching the path until we reach the destination node}
while (CurPt.X <> EndPt.X) or (CurPt.Y <> EndPt.Y) do
begin
{reset the new coordinates to indicate nothing has been found}
NewPt := Point(-1, -1);
{reset our distance to the largest value available (new nodes should
be well under this distance to the destination)}
Dist := $FFFFFFFF;
{determine the 3 search directions}
SearchDirs[0] := Pred(Dir);
if Ord(SearchDirs[0]) < Ord(cdNorth) then
SearchDirs[0] := cdNorthWest;
SearchDirs[1] := Dir;
SearchDirs[2] := Succ(Dir);
if Ord(SearchDirs[2]) > Ord(cdNorthWest) then
SearchDirs[2] := cdNorth;
{evaluate grid locations in 3 directions}
for iCount := 0 to 2 do
begin
{get the coordinates of the next node to examine relative to the
current node, based on the direction we are facing }
EvalPt.X := CurPt.X + DirectionOffset[SearchDirs[iCount]].X;
EvalPt.Y := CurPt.Y + DirectionOffset[SearchDirs[iCount]].Y;
{make sure this node is on the map}
if (EvalPt.X > -1) and (EvalPt.X < 15) and
(EvalPt.Y > -1) and (EvalPt.Y < 15) then
{make sure we’ve never visited this node}
if not VisitedNodes[EvalPt.X, EvalPt.Y] then
{make sure this isn’t an impassible node}
if MapGrid[EvalPt.X, EvalPt.Y] = 0 then
begin
{this is a clear node that we could move to. calculate
the distance from this node to the destination.
NOTE: since we’re interested in just relative distances as
opposed to exact distances, we don’t need to perform a square
root. this will dramatically speed up this calculation}
EvalDist := ((EndPt.X - EvalPt.X) * (EndPt.X - EvalPt.X)) +
((EndPt.Y - EvalPt.Y) * (EndPt.Y - EvalPt.Y));
{if we have found a node closer to the destination, make this
the current node}
if EvalDist < Dist then
begin
{record the new distance and node}
Dist := EvalDist;
NewPt := EvalPt;
{record the direction of this new node}
NewDir := SearchDirs[iCount];
end
end;
end;
{at this point, if NewPt is still (–1, –1), we’ve run into a wall and
cannot move any further. thus, we have to back up one and try again.
otherwise, we can add this new node to our list of nodes}
{we’ve got a valid node}
if NewPt.X <> -1 then
begin
{make this new node our current node}
CurPt := NewPt;
{point us in the direction of this new node}
Dir := NewDir;
{mark this node as visited}
VisitedNodes[CurPt.X, CurPt.Y] := TRUE;
{create a node object}
GetMem(TempNode, SizeOf(TNode));
{initialize this node object with the new node information}
TempNode^.Direction := Dir;
TempNode^.GridPt.X := CurPt.X;
TempNode^.GridPt.Y := CurPt.Y;
{put this new node in the path list}
PathQueue.Add(TempNode);
{if we’ve recorded 50 nodes, break out of this loop}
if PathQueue.Count > 50 then
Break;
end
else
begin
{we’ve backed up to the point where we can no longer back up. thus, a
path could not be found. we could improve this algorithm by
recalculating the starting direction and trying again until we’ve
searched in all possible directions}
if PathQueue.Count = 1 then
Break;
{point us in the direction of the previous node}
Dir := TNode(PathQueue[PathQueue.Count - 2]^).Direction;
{retrieve the coordinates of the previous node and make that
our current node}
CurPt := Point(TNode(PathQueue[PathQueue.Count - 2]^).GridPt.X,
TNode(PathQueue[PathQueue.Count - 2]^).GridPt.Y);
{free the last node in the list and delete it}
FreeMem(PathQueue[PathQueue.Count - 1], SizeOf(TNode));
PathQueue.Delete(PathQueue.Count - 1);
end;
end;
for iCount := 0 to 19 do
for iCount2 := 0 to 14 do
if VisitedNodes[iCount, iCount2] then
Background.Chips[iCount, iCount2] := NODEVISITED;
{specify nodes on the path}
for iCount := 0 to PathQueue.Count - 1 do
begin
Background.Chips[TNode(PathQueue[iCount]^).GridPt.X,
TNode(PathQueue[iCount]^).GridPt.Y] := NODEPATH;
end;
{specify the starting and ending nodes}
Background.Chips[StartPt.X, StartPt.Y] := NODESTART;
Background.Chips[EndPt.X, EndPt.Y] := NODEEND;
end;
procedure TGraphics1.DoInitialize;
var
I, J: Integer;
begin
Window1.Engine := TSpriteEngine.Create(nil);
Window1.Engine.SurfaceRect := Bounds(0, 0, Window1.Width, Window1.Height);
Window1.Pictures := TPictures.Create(TPicture);
with Form.Pictures.Add do
begin
Name := 'Tile';
PatternWidth := 32;
PatternHeight := 32;
SkipWidth := 1;
SkipHeight := 1;
TransparentColor := clFuchsia;
FileName := PATH_IMG + 'Tile.bmp';
end;
with Form.Pictures.Add do
begin
Name := 'Tank';
PatternWidth := 32;
PatternHeight := 32;
SkipWidth := 1;
SkipHeight := 1;
TransparentColor := clBlack;
FileName := PATH_IMG + 'Tank.bmp';
end;
with Form.Pictures.Add do
begin
Name := 'Tiro';
PatternWidth := 8;
PatternHeight := 8;
SkipWidth := 0;
SkipHeight := 0;
TransparentColor := clBlack;
FileName := PATH_IMG + 'Tiro1.bmp';
end;
Background := TBackground.Create(Form.Engine);
with Background do
begin
Image := Form.Pictures.Find('Tile');
SetMapSize(20, 15);
X := -32;
Y := -32;
Z := -1;
Width := Image.Width;
Height := Image.Height;
Tile := False;
Collisioned := True;
for I := 0 to MapWidth - 1 do
for J := 0 to MapHeight - 1 do
begin
Chips[I, J] := 0;
CollisionMap[I, J] := False;
end;
end;
Form.LoadFromFile(PATH_MAP + 'Mapa.map');
with TPlayerTank.Create(Form.Engine) do
begin
Image := Form.Pictures.Find('Tank');
X := 0;
Y := 0;
Z := 3;
Width := 28;
Height := 28;
AnimStart := 0;
AnimCount := 7;
AnimLooped := True;
AnimSpeed := 15 / 1000;
AnimPos := 0;
Angle := 0.0;
Center := D3DXVector2(Image.Width div 2, Image.Height div 2);
Shadow := False;
end;
end;
procedure TGraphics1.CreateShoot(MyX, MyY: Single; MyAngle: Single);
begin
with TShoot.Create(Form.Engine) do
begin
Image := Form.Pictures.Find('Tiro');
X := MyX;
Y := MyY;
Z := 2;
Angle := MyAngle;
Width := 8;
Height := 8;
MyTime := 60;
Aceleration := 3.0;
end;
end;
end.
|
unit uStackDemo;
interface
function IsPalindrome(const aString: string): Boolean;
implementation
uses
Generics.Collections
, System.SysUtils
, Character
;
type
TCharStack = TStack<Char>;
function IsPalindrome(const aString: string): Boolean;
var
Stack: TCharStack;
C: Char;
TempStr: string;
i: integer;
CharOnly: string;
begin
Stack := TCharStack.Create;
try
for C in aString do
begin
if TCharacter.IsLetter(C) then
Stack.Push(TCharacter.ToLower(C));
end;
TempStr := '';
for i := 0 to Stack.Count - 1 do
begin
TempStr := TempStr + Stack.Pop;
end;
CharOnly := '';
for C in aString do
begin
if TCharacter.IsLetter(C) then
CharOnly := CharOnly + C.ToLower;
end;
Result := TempStr = CharOnly;
finally
Stack.Free;
end;
end;
end.
|
unit CatConsoleCore;
{
Catarinka Console Core
Copyright (c) 2012-2014, Felipe Daragon
Based on TConsole. Copyright (c) 2002-2003, Michael Eldsörfer
License: MPL, dual (see below)
ChangeLog:
- Added two new properties (LastCommand and LastPrompt).
- The PasteFromClipboard procedure was implemented.
- Fixed some characters not working, like ', #, $, % and (
TODO, FIXME: not working properly with the original TConsole demo
application.
}
(*
Class: TConsole
Version: 1.0
Date: 09.07.2003
Author: Michael Elsdörfer
Copyright: (c)2002/2003 by Michael Eldsörfer
eMail: michael@elsdoerfer.net
Internet: http://www.elsdoerfer.net
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.
*)
interface
uses Windows, Classes, StdCtrls, Controls, Graphics, Messages, Math, ClipBrd,
Types;
const
// Constants defining the default look of the console
CONSOLE_DEFAULT_BACKGROUND = clBlack;
CONSOLE_DEFAULT_FOREGROUND = clWhite;
CONSOLE_DEFAULT_FONTNAME = 'Courier New';
CONSOLE_DEFAULT_FONTSIZE = 10;
CONSOLE_DEFAULT_FONTSTYLE = [fsBold];
CONSOLE_DEFAULT_PROMPT = '>';
type
// Forward
TCustomConsole = class;
// Events
TBootEvent = procedure(Sender: TCustomConsole; var ABootFinished: boolean) of object;
TShutDownEvent = procedure(Sender: TCustomConsole) of object;
TCommandExecuteEvent = procedure(Sender: TCustomConsole; ACommand: string;
var ACommandFinished: boolean) of object;
TGetPromptEvent = procedure(Sender: TCustomConsole; var APrompt: string;
var ADefaultText: string; var ADefaultCaretPos: Integer) of object;
TCommandKeyPressEvent = procedure(Sender: TCustomConsole; var AKey: Char;
var ATerminateCommand: boolean) of object;
TPromptKeyPressEvent = procedure(Sender: TCustomConsole; var AKey: Char) of object;
// TConsoleCaretType
TConsoleCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock);
// TCustomConsoleLine: Represents a single line
PConsoleLine = ^TCustomConsoleLine;
TCustomConsoleLine = record
IsPromptLine: boolean; // True, if the line is a prompt line
Prompt: string; // Contains the prompt string of the line, if IsPromptLine is True
Text: string; // If IsPromptLine is True, Text contains the typed command string, else it containes the whole line string
end;
// TConsoleLines
TConsoleLines = class(TObject)
private
fOwner: TCustomConsole;
fLines: TList;
function GetLines(Index: Integer): PConsoleLine;
procedure SetLines(Index: Integer; const Value: PConsoleLine);
function GetCount: Integer;
function GetCurrLine: PConsoleLine;
procedure SetCurrLine(const Value: PConsoleLine);
function GetWrappedLines(Index: Integer): string;
function GetWrappedLineCount: Integer;
function GetWrapWidth: Integer;
protected
function AddLine(Force: boolean = False): PConsoleLine;
procedure Writeln(ALine: string);
procedure Write(AText: string);
public
constructor Create(AOwner: TCustomConsole);
destructor Destroy; override;
procedure Clear;
function IsEmptyLine(ALine: PConsoleLine): boolean;
function GetFullLineText(ALine: Integer): string;
function LogicalToWrappedLineIndex(ALine: Integer): Integer;
property CurrLine: PConsoleLine read GetCurrLine write SetCurrLine;
property Lines[Index: Integer]: PConsoleLine read GetLines write SetLines; default;
property Count: Integer read GetCount;
property WrappedLines[Index: Integer]: string read GetWrappedLines;
property WrappedLineCount: Integer read GetWrappedLineCount;
property WrapWidth: Integer read GetWrapWidth;
end;
// TCustomConsole
TCustomConsole = class(TCustomControl)
private
fPrompt: boolean;
fCaretX: Integer;
fLines: TConsoleLines;
fCaretOffset: TPoint;
fPaintLock: Integer;
//fScrollBars: TScrollStyle;
//fMouseWheelAccumulator: integer;
fInsertMode: boolean;
fOverwriteCaret: TConsoleCaretType;
fInsertCaret: TConsoleCaretType;
FActive: boolean;
FOnBoot: TBootEvent;
FOnCommandExecute: TCommandExecuteEvent;
FOnShutDown: TShutDownEvent;
FOnGetPrompt: TGetPromptEvent;
FBorderSize: Integer;
FExtraLineSpacing: Integer;
FAutoUseInsertMode: boolean;
FOnCommandKeyPress: TCommandKeyPressEvent;
FMinLeftCaret: Integer;
FOnPromptKeyPress: TPromptKeyPressEvent;
FLastCommand:string;
FLastPrompt:string;
function GetCanPaste: Boolean;
function GetFont: TFont;
procedure SetCaretX(Value: Integer);
procedure SetFont(const Value: TFont);
//procedure SetScrollBars(const Value: TScrollStyle);
procedure SizeOrFontChanged(bFont: boolean);
procedure UpdateScrollBars;
function CaretXYPix: TPoint;
function GetAcceptInput: boolean;
function GetTopLine: Integer;
function GetTextHeight: Integer;
function RowColumnToPixels(rowcol: TPoint): TPoint;
function LogicalToPhysicalPos(p: TPoint): TPoint;
procedure SetInsertCaret(const Value: TConsoleCaretType);
procedure SetInsertMode(const Value: boolean);
procedure SetOverwriteCaret(const Value: TConsoleCaretType);
function GetCharWidth: Integer;
function GetLinesInWindow: Integer;
procedure SetActive(const Value: boolean);
function GetLines: TConsoleLines;
procedure SetLines(const Value: TConsoleLines);
procedure SetOnBoot(const Value: TBootEvent);
procedure SetOnCommandExecute(const Value: TCommandExecuteEvent);
procedure SetOnShutDown(const Value: TShutDownEvent);
procedure SetOnGetPrompt(const Value: TGetPromptEvent);
function GetPrompt: boolean;
procedure SetPrompt(const Value: boolean);
function GetCurrLine: PConsoleLine;
procedure SetCurrLine(const Value: PConsoleLine);
procedure SetBorderSize(const Value: Integer);
procedure SetExtraLineSpacing(const Value: Integer);
procedure SetAutoUseInsertMode(const Value: boolean);
procedure SetOnCommandKeyPress(const Value: TCommandKeyPressEvent);
procedure SetMinLeftCaret(const Value: Integer);
procedure SetOnPromptKeyPress(const Value: TPromptKeyPressEvent);
protected
// Status Flags
sfLinesChanging: boolean;
// Windows Events
procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL;
procedure WMPaste(var Message: TMessage); message WM_PASTE;
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS;
procedure WMSize(var Msg: TWMSize); message WM_SIZE;
procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;
// More methods
procedure InvalidateRect(const aRect: TRect; aErase: boolean);
procedure DecPaintLock;
procedure IncPaintLock;
procedure InitializeCaret;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
procedure Loaded; override;
procedure Paint; override;
procedure PaintTextLines(AClip: TRect; FirstLine, CurrLine: integer); virtual;
procedure InvalidateLine(Line: integer);
procedure InvalidateLines(FirstLine, LastLine: integer);
procedure HideCaret;
procedure ShowCaret;
procedure DoOnPrompt(var APrompt: string; var DefaultText: string;
var DefaultCaretPos: Integer);
procedure KeyCommandHandler(AKey: Char);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
// Boot methods
procedure Boot;
procedure Shutdown;
// Paintlock methods
procedure BeginUpdate;
procedure EndUpdate;
// Various methods
procedure UpdateCaret;
procedure WndProc(var Msg: TMessage); override;
procedure PasteFromClipboard;
// Output methods
procedure BeginExternalOutput;
procedure EndExternalOutput;
procedure Writeln(ALine: string = '');
procedure Write(AText: string; AUpdateMinLeftCaret: boolean = False);
procedure Clear;
// Active: To work with TCustomConsole, Active must be set to True
property Active: boolean read FActive write SetActive;
// AcceptInput: If False, key events are not regognized
property AcceptInput: boolean read GetAcceptInput;
// Automatically changes to Insert mode when a new prompt is activated
property AutoUseInsertMode: boolean read FAutoUseInsertMode write SetAutoUseInsertMode;
// CharWidth: Returns the width of a single char
property CharWidth: Integer read GetCharWidth;
// CanPaste: Returns True if text from the clipboard can be pasted
property CanPaste: boolean read GetCanPaste;
// CaretX: CaretX stores the caret position in the current line
property CaretX: Integer read fCaretX write SetCaretX;
// Font: Wrapped to Canvas.Font
property Font: TFont read GetFont write SetFont;
// Lines: Provides access to the lines
property LastCommand: string read fLastCommand write FlastCommand;
// LastCommand: Stores the last entered command
property LastPrompt: string read fLastPrompt write FlastPrompt;
// LastPrompt: Stores the last prompt
property Lines: TConsoleLines read GetLines write SetLines;
// InsertMode: Switch between Insert and Overwrite mode
property InsertMode: boolean read FInsertMode write SetInsertMode;
// Insert Caret + Overwrite Caret
property InsertCaret: TConsoleCaretType read FInsertCaret write SetInsertCaret;
property OverwriteCaret: TConsoleCaretType read FOverwriteCaret write SetOverwriteCaret;
// PaintLock: PaintLock Counter; Can be modified by BeginUpdate and EndUpdate
property PaintLock: Integer read fPaintLock;
// CurrLine: Easy access to the current line
property CurrLine: PConsoleLine read GetCurrLine write SetCurrLine;
// TextHeight: Returns the high of a single text line
property TextHeight: Integer read GetTextHeight;
// TopLine: Stores the index of the first line visible
property TopLine: Integer read GetTopLine;
// LinesInWindow: Returns the number of visible lines
property LinesInWindow: Integer read GetLinesInWindow;
// Prompt: Returns True, if currently in prompting mode
property Prompt: boolean read GetPrompt write SetPrompt;
// BorderSize: Specifies the border size in pixels
property BorderSize: Integer read FBorderSize write SetBorderSize;
// ExtraLineSpacing: Makes it possible to add change the space between the single lines
property ExtraLineSpacing: Integer read FExtraLineSpacing write SetExtraLineSpacing;
// MinLeftCaret: Only available in command mode
property MinLeftCaret: Integer read FMinLeftCaret write SetMinLeftCaret;
// Events
property OnBoot: TBootEvent read FOnBoot write SetOnBoot;
property OnShutDown: TShutDownEvent read FOnShutDown write SetOnShutDown;
property OnCommandExecute: TCommandExecuteEvent read FOnCommandExecute write SetOnCommandExecute;
property OnGetPrompt: TGetPromptEvent read FOnGetPrompt write SetOnGetPrompt;
property OnCommandKeyPress: TCommandKeyPressEvent read FOnCommandKeyPress write SetOnCommandKeyPress;
property OnPromptKeyPress: TPromptKeyPressEvent read FOnPromptKeyPress write SetOnPromptKeyPress;
end;
TConsole = class(TCustomConsole)
published
// TCustomConsole properties and events
property AutoUseInsertMode;
property InsertMode;
property InsertCaret;
property OverwriteCaret;
property BorderSize;
property ExtraLineSpacing;
property OnBoot;
property OnShutDown;
property OnCommandExecute;
property OnGetPrompt;
property OnCommandKeyPress;
property OnPromptKeyPress;
// inherited properties
property Align;
property Anchors;
property Constraints;
property Color;
property Ctl3D;
property ParentCtl3D;
property Enabled;
property Font;
property Height;
property Name;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop default True;
property Visible;
property Width;
// inherited events
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnStartDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
TCommandParser = class
private
FParamList: TStringList;
FCommand: string;
function GetParameters(Index: Integer): string;
function GetParamCount: Integer;
public
constructor Create(ACommand: string); overload;
constructor Create; overload;
destructor Destroy; override;
procedure ParseCommand(ACommand: string);
property Command: string read FCommand;
property Parameters[Index: Integer]: string read GetParameters;
property ParamCount: Integer read GetParamCount;
end;
procedure Register;
implementation
procedure Register;
Begin
RegisterComponents('elsdoerfer.net', [TConsole]);
end;
{ TCustomConsole }
// IncPaintLock: prevents TCustomConsole from painting itself until EndUpdate is called
procedure TCustomConsole.BeginUpdate;
begin
IncPaintLock;
end;
// CaretXYPix: Returns the caret position in pixels
function TCustomConsole.CaretXYPix: TPoint;
var p: TPoint;
begin
// If CurrLine is nil, then exit
if CurrLine = nil then exit;
// Y Caret position is always the last (logical) line. However, this line may
// be wrapped. In this case it's possible that the carets phyiscal position is
// above the last line.
p.Y := fLines.WrappedLineCount -
(
((Length(CurrLine.Prompt + CurrLine.Text)) div (fLines.WrapWidth)) -
((fCaretX + Length(CurrLine.Prompt) - 1) div (fLines.WrapWidth))
);
// X Caret position is definied by fCaretX. Again, the line may be wrapped and
// the caret phyiscal position differs from it's logical one.
p.X := (fCaretX + Length(CurrLine.Prompt)) mod (fLines.WrapWidth);
if p.X = 0 then p.X := fLines.WrapWidth;
// Convert value to pixel and return
Result := RowColumnToPixels(p);
end;
// Clear: Delete all lines
procedure TCustomConsole.Clear;
begin
fLines.Clear;
Invalidate;
end;
// Create: Constructor
constructor TCustomConsole.Create(AOwner: TComponent);
begin
// Inherited
inherited;
ControlStyle := ControlStyle + [csOpaque];
// Defaults settings
fActive := False;
fPrompt := False;
fInsertMode := True;
fBorderSize := 3;
fExtraLineSpacing := 0;
FAutoUseInsertMode := True;
// Font
Font.Name := CONSOLE_DEFAULT_FONTNAME;
Font.Style := CONSOLE_DEFAULT_FONTSTYLE;
Font.Size := CONSOLE_DEFAULT_FONTSIZE;
Font.Color := CONSOLE_DEFAULT_FOREGROUND;
// Background Color
Color := CONSOLE_DEFAULT_BACKGROUND;
// Default carets
InsertCaret := ctHorizontalLine;
OverwriteCaret := ctHalfBlock;
// Create Lines Object
fLines := TConsoleLines.Create(Self);
end;
// DecPaintLock: Decrements the paint lock counter
procedure TCustomConsole.DecPaintLock;
begin
Dec(fPaintLock);
if fPaintLock = 0 then Invalidate;
end;
// Destroy: Destructor
destructor TCustomConsole.Destroy;
begin
// Free Lines Object
fLines.Free;
// Inherited
inherited;
end;
// LogicalToPhysicalPos: Takes a logical caret position (based on line index 0)
// and makes a physical caret position out of it (based on first visible line)
function TCustomConsole.LogicalToPhysicalPos(p: TPoint): TPoint;
var s: string;
i: integer;
x: integer;
begin
if p.Y - 1 < fLines.Count then begin
s := fLines.WrappedLines[p.Y - 1];
x := 0;
for i := 1 to p.x - 1 do begin
inc(x);
end;
p.x := x + 1;
end;
Result := p;
end;
// RowColumnToPixels: Calculates the pixels for a certain caret position
function TCustomConsole.RowColumnToPixels(RowCol: TPoint): TPoint;
var P: TPoint;
i: integer;
lText: string;
begin
P := LogicalToPhysicalPos(RowCol);
Result.X := BorderSize;
if ((RowCol.Y - 1) < fLines.WrappedLineCount) then
for i := 1 to (P.X - 1) do Begin
lText := fLines.WrappedLines[RowCol.Y - 1];
if lText <> '' then Result.X := Result.X + Canvas.TextWidth(lText[1]);
end;
Result.Y := (RowCol.Y - TopLine) * TextHeight;
end;
// EndUpdate: See DecPaintLock
procedure TCustomConsole.EndUpdate;
begin
DecPaintLock;
end;
// GetCanPaste: Returns True if text from the clipboard can be pasted
function TCustomConsole.GetCanPaste: Boolean;
begin
Result := not AcceptInput and (Clipboard.HasFormat(CF_TEXT));
end;
// GetFont
function TCustomConsole.GetFont: TFont;
begin
Result := Canvas.Font
end;
// GetAcceptInput: Only True, if fActive is also True
function TCustomConsole.GetAcceptInput: boolean;
begin
Result := Active;
end;
// GetTextHeight: Calculates the height of a line
function TCustomConsole.GetTextHeight: Integer;
begin
Result := Canvas.TextHeight('Ay%ü') + ExtraLineSpacing;
end;
// GetTopLine: Returns the physical line displayed on the very top of the control
function TCustomConsole.GetTopLine: Integer;
begin
Result := Max(fLines.GetWrappedLineCount - LinesInWindow + 2, 1);
end;
// HideCaret
procedure TCustomConsole.HideCaret;
begin
Windows.HideCaret(Handle);
end;
// IncPaintLock: Increments the Paint Lock Counter
procedure TCustomConsole.IncPaintLock;
begin
Inc(fPaintLock);
end;
// InitializeCaret: Creates a caret object
procedure TCustomConsole.InitializeCaret;
var ct: TConsoleCaretType;
cw, ch: integer;
begin
// Caret type depends on keyboard mode
if InsertMode then ct := fInsertCaret
else ct := fOverwriteCaret;
// Set values depending on caret type
case ct of
ctHorizontalLine:
begin
cw := CharWidth;
ch := 2;
fCaretOffset := Point(0, TextHeight - ExtraLineSpacing - 2);
end;
ctHalfBlock:
begin
cw := CharWidth;
ch := (TextHeight - 2) div 2;
fCaretOffset := Point(0, ch);
end;
ctBlock:
begin
cw := CharWidth;
ch := TextHeight - 2;
FCaretOffset := Point(0, 0);
end;
else begin // Vertical Line
cw := 2;
ch := TextHeight - 2;
FCaretOffset := Point(0, 0);
end;
end;
// Create Caret
CreateCaret(Handle, 0, cw, ch);
// Show it
UpdateCaret;
end;
// InvalidateLine: Calculates the rect of a certain line and uses InvalidateRect
// to repaint it (reduces flickering)
procedure TCustomConsole.InvalidateLine(Line: integer);
var rcInval: TRect;
begin
if Visible and (Line >= TopLine) and (Line <= TopLine + LinesInWindow) and
(Line <= Lines.Count) and HandleAllocated then
begin
rcInval := Rect(0, TextHeight * (Line - TopLine), ClientWidth, 0);
rcInval.Bottom := rcInval.Top + TextHeight;
InvalidateRect(rcInval, False);
end;
end;
// InvalidateLines: Calculates the rect of a certain line range und uses
// InvalidateRect to repaint it
procedure TCustomConsole.InvalidateLines(FirstLine, LastLine: integer);
var rcInval: TRect;
begin
if Visible and HandleAllocated then
if (FirstLine = -1) and (LastLine = -1) then begin
rcInval := ClientRect;
InvalidateRect(rcInval, false);
end else begin
FirstLine := Max(FirstLine, TopLine);
LastLine := Min(LastLine, TopLine + LinesInWindow);
if (LastLine >= FirstLine) then begin
rcInval := Rect(0, TextHeight * (FirstLine - TopLine),
ClientWidth, TextHeight * (LastLine - TopLine + 1));
InvalidateRect(rcInval, false);
end;
end;
end;
// InvalidateRect
procedure TCustomConsole.InvalidateRect(const aRect: TRect; aErase: boolean);
begin
Windows.InvalidateRect(Handle, @aRect, aErase);
end;
// KeyDown
procedure TCustomConsole.KeyDown(var Key: Word; Shift: TShiftState);
begin
inherited;
case key of // FD 18.11.2012, keys moved from KeyCommandHandler
VK_LEFT: CaretX := CaretX - 1;
VK_RIGHT: CaretX := CaretX + 1;
VK_END: CaretX := length(CurrLine.Text) + 1;
VK_HOME: CaretX := 1;
VK_INSERT:
Begin
InsertMode := not InsertMode;
InitializeCaret;
end;
VK_UP:
begin
CurrLine.Text := FLastCommand;
CaretX := Length(FLastCommand) + 1; Invalidate;
end;
VK_DOWN:
Begin
// Should Be Handled By An Event TODO : todo
end;
end;
end;
// KeyPress
procedure TCustomConsole.KeyPress(var Key: Char);
begin
inherited;
KeyCommandHandler(Key);
end;
// Loaded
procedure TCustomConsole.Loaded;
begin
inherited;
UpdateScrollBars;
Invalidate;
end;
// Paint
procedure TCustomConsole.Paint;
var rcClip, rcDraw: TRect;
nL1, nL2: Integer;
begin
// Only paint if Paint Lock Counter is 0
if fPaintLock <> 0 then exit;
// Get the invalidated rect
rcClip := Canvas.ClipRect;
// Calculate Line Range
nL1 := Max(TopLine + ((rcClip.Top) div TextHeight), TopLine) - 1;
nL2 := Min(TopLine + ((rcClip.Bottom + TextHeight - 1) div TextHeight), fLines.WrappedLineCount) - 1;
// Now paint everything while the caret is hidden
HideCaret;
try
rcDraw := rcClip;
rcDraw.Left := 0;
rcDraw.Right := ClientWidth;
PaintTextLines(rcDraw, nL1, nL2);
finally
UpdateCaret;
end;
end;
// PaintTextLines
procedure TCustomConsole.PaintTextLines(AClip: TRect; FirstLine, CurrLine: integer);
var rcLine, rcToken: TRect;
function ColumnToXValue(Col: integer): integer;
begin
Result := Pred(Col) * CharWidth;
end;
procedure PaintLines;
var nLine: integer;
sLine: string;
begin
// Initialize rcLine for drawing. Note that Top and Bottom are updated
// inside the loop. Get only the starting point for this.
rcLine := AClip;
rcLine.Bottom := (FirstLine - TopLine + 1) * TextHeight;
// Now loop through all the lines
for nLine := FirstLine to CurrLine do begin
// Assign line
sLine := Lines.WrappedLines[nLine];
// Update the rcLine rect to this line
rcLine.Top := rcLine.Bottom;
Inc(rcLine.Bottom, TextHeight);
// We will need this later to fill the non-text area
rcToken := rcLine;
// Paint
if not Canvas.HandleAllocated then exit;
Brush.Color := Color;
Brush.Style := bsSolid;
Canvas.FillRect(Rect(0, rcLine.Top, BorderSize, rcLine.Bottom));
Canvas.TextOut(BorderSize, rcLine.Top, sLine);
Canvas.FillRect(Rect(BorderSize + Canvas.TextWidth(sLine), rcLine.Top, rcLine.Right, rcLine.Bottom));
end;
end;
begin
// Without this painting does not work until the first time FillRect is called - no clue where the problem is
Canvas.Brush.Color := Color;
Canvas.FillRect(Rect(0, 0, ClientWidth, 0));
try
PaintLines;
finally
end;
// If there is anything visible below the last line, then fill this as well
rcToken := AClip;
rcToken.Top := (CurrLine + 1 - TopLine + 1) * TextHeight;
if (rcToken.Top < rcToken.Bottom) then
begin
Canvas.Brush.Color := Color;
Canvas.FillRect(rcToken);
end;
end;
// SetCaretX
procedure TCustomConsole.SetCaretX(Value: Integer);
begin
if (Value < 1) then Value := 1
else if (Value < MinLeftCaret) and (not Prompt) then Value := FMinLeftCaret
else if (CurrLine <> nil) and (Value > length(CurrLine.Text) + 1) then
Value := length(CurrLine.Text) + 1;
if Value <> fCaretX then Begin
fCaretX := Value;
UpdateCaret;
end;
end;
// SetFont
procedure TCustomConsole.SetFont(const Value: TFont);
begin
Canvas.Font.Assign(Value);
end;
{procedure TCustomConsole.SetScrollBars(const Value: TScrollStyle);
begin
// TODO : add scrollbar support
end; }
procedure TCustomConsole.ShowCaret;
begin
Windows.ShowCaret(Handle);
end;
procedure TCustomConsole.SizeOrFontChanged(bFont: boolean);
begin
Invalidate;
end;
procedure TCustomConsole.UpdateCaret;
var CX, CY: Integer;
iClientRect: TRect;
begin
CX := CaretXYPix.X + FCaretOffset.X;
CY := CaretXYPix.Y + FCaretOffset.Y + 1;
iClientRect := GetClientRect;
if (CX >= iClientRect.Left) and (CX < iClientRect.Right) and
(CY >= iClientRect.Top) and (CY < iClientRect.Bottom) and
(AcceptInput) and (fActive) then
begin
SetCaretPos(CX, CY);
ShowCaret;
end else begin
HideCaret;
SetCaretPos(CX, CY);
end;
end;
procedure TCustomConsole.UpdateScrollBars;
begin
{ TODO : add scrollbar support }
end;
procedure TCustomConsole.WMEraseBkgnd(var Msg: TMessage);
begin
Msg.Result := 1;
end;
procedure TCustomConsole.WMGetDlgCode(var Msg: TWMGetDlgCode);
begin
inherited;
Msg.Result := DLGC_WANTARROWS or DLGC_WANTCHARS or
DLGC_WANTTAB or DLGC_WANTALLKEYS;
end;
procedure TCustomConsole.WMHScroll(var Msg: TWMScroll);
begin
{ TODO : add scrolling support }
end;
procedure TCustomConsole.WMKillFocus(var Msg: TWMKillFocus);
begin
HideCaret;
Windows.DestroyCaret;
end;
procedure TCustomConsole.WMMouseWheel(var Msg: TMessage);
begin
{ TODO : add scrolling support }
end;
procedure TCustomConsole.WMPaste(var Message: TMessage);
begin
if AcceptInput then PasteFromClipboard;
Message.Result := ord(True);
end;
procedure TCustomConsole.WMSetFocus(var Msg: TWMSetFocus);
begin
InitializeCaret;
end;
procedure TCustomConsole.WMSize(var Msg: TWMSize);
begin
SizeOrFontChanged(False);
end;
procedure TCustomConsole.WMVScroll(var Msg: TWMScroll);
begin
{ TODO : add scrolling support }
end;
procedure TCustomConsole.WndProc(var Msg: TMessage);
begin
inherited;
end;
procedure TCustomConsole.SetInsertCaret(const Value: TConsoleCaretType);
begin
FInsertCaret := Value;
end;
procedure TCustomConsole.SetInsertMode(const Value: boolean);
begin
if fInsertMode <> Value then Begin
fInsertMode := Value;
InitializeCaret;
end;
end;
procedure TCustomConsole.SetOverwriteCaret(const Value: TConsoleCaretType);
begin
FOverwriteCaret := Value;
end;
function TCustomConsole.GetCharWidth: Integer;
begin
Result := Canvas.TextWidth('a');
end;
function TCustomConsole.GetLinesInWindow: Integer;
begin
Result := ClientHeight div TextHeight;
end;
// Set Active: Use this to boot or to shutdown the console
procedure TCustomConsole.SetActive(const Value: boolean);
var BootFinished: boolean;
begin
if (Value <> fActive) then Begin
case Value of
True:
begin
// Clear current lines
Clear;
// Add a first, empty line
fLines.AddLine;
// Call onBoot Event
BootFinished := True;
if Assigned(FOnBoot) then FOnBoot(Self, BootFinished);
if BootFinished then Prompt := True;
InitializeCaret;
end;
False:
begin
if Assigned(FOnShutDown) then FOnShutDown(Self);
end;
end;
fActive := Value;
end;
end;
procedure TCustomConsole.PasteFromClipboard;
begin
fLines.CurrLine.Text := fLines.CurrLine.Text + Clipbrd.Clipboard.AsText;
CaretX := Length(fLines.CurrLine.Text) + 1;
Invalidate;
end;
function TCustomConsole.GetLines: TConsoleLines;
begin
Result := fLines;
end;
procedure TCustomConsole.SetLines(const Value: TConsoleLines);
begin
fLines := Value;
end;
procedure TCustomConsole.Writeln(ALine: string);
begin
if not Prompt then Begin
fLines.Writeln(ALine);
fCaretX := length(ALine) + 1;
Invalidate;
end;
end;
procedure TCustomConsole.Boot;
begin
Active := True;
end;
procedure TCustomConsole.Shutdown;
begin
Active := False;
end;
procedure TCustomConsole.SetOnBoot(const Value: TBootEvent);
begin
FOnBoot := Value;
end;
procedure TCustomConsole.SetOnCommandExecute(const Value: TCommandExecuteEvent);
begin
FOnCommandExecute := Value;
end;
procedure TCustomConsole.SetOnShutDown(const Value: TShutDownEvent);
begin
FOnShutDown := Value;
end;
procedure TCustomConsole.SetOnGetPrompt(const Value: TGetPromptEvent);
begin
FOnGetPrompt := Value;
end;
procedure TCustomConsole.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited;
Windows.SetFocus(Handle);
end;
function TCustomConsole.GetPrompt: boolean;
begin
Result := fPrompt;
end;
procedure TCustomConsole.SetPrompt(const Value: boolean);
begin
if Value <> fPrompt then Begin
fPrompt := Value;
if Value = True then Begin
CaretX := 1;
MinLeftCaret := 1;
with fLines.AddLine^ do Begin
IsPromptLine := True;
DoOnPrompt(Prompt, Text, fCaretX);
CaretX := fCaretX; // just for valid range checking
end;
if AutoUseInsertMode then InsertMode := True;
ShowCaret;
Invalidate;
end else Begin
fLines.AddLine;
end; // end else
end; // end if
end;
procedure TCustomConsole.Write(AText: string; AUpdateMinLeftCaret: boolean = False);
begin
if not Prompt then Begin
fLines.Write(AText);
CaretX := length(CurrLine.Text) + 1;
if (AUpdateMinLeftCaret) then MinLeftCaret := length(CurrLine.Text) + 1;
end;
end;
function TCustomConsole.GetCurrLine: PConsoleLine;
begin
Result := fLines.CurrLine;
end;
procedure TCustomConsole.SetCurrLine(const Value: PConsoleLine);
begin
fLines.CurrLine := Value;
Invalidate;
end;
{ TConsoleLines }
function TConsoleLines.AddLine(Force: boolean = False): PConsoleLine;
begin
if (IsEmptyLine(CurrLine)) and (not Force) then Result := CurrLine
else Begin
New(Result);
Result.IsPromptLine := False;
Result.Prompt := '';
Result.Text := '';
fLines.Add(Result);
end;
end;
procedure TConsoleLines.Clear;
var i: integer;
begin
try
for i := 0 to fLines.Count -1 do Dispose(fLines[i]);
finally
fLines.Clear;
end;
end;
constructor TConsoleLines.Create(AOwner: TCustomConsole);
begin
fLines := TList.Create;
fOwner := AOwner;
end;
destructor TConsoleLines.Destroy;
begin
try
Clear;
finally
fLines.Free;
end;
inherited;
end;
function TConsoleLines.GetCount: Integer;
begin
Result := fLines.Count;
end;
function TConsoleLines.GetFullLineText(ALine: Integer): string;
begin
Result := Lines[ALine].Prompt + Lines[ALine].Text;
end;
function TConsoleLines.GetCurrLine: PConsoleLine;
begin
if fLines.Count = 0 then Result := nil
else Result := fLines[fLines.Count - 1];
end;
function TConsoleLines.GetLines(Index: Integer): PConsoleLine;
begin
Result := fLines[Index];
end;
procedure TConsoleLines.SetCurrLine(const Value: PConsoleLine);
begin
fLines[fLines.Count - 1] := Value;
end;
procedure TConsoleLines.SetLines(Index: Integer;
const Value: PConsoleLine);
begin
fLines[Index] := Value;
end;
procedure TConsoleLines.Write(AText: string);
begin
CurrLine.Text := CurrLine.Text + AText;
end;
procedure TConsoleLines.Writeln(ALine: string);
begin
CurrLine.Text := CurrLine.Text + ALine;
AddLine(True);
end;
procedure TCustomConsole.SetBorderSize(const Value: Integer);
begin
FBorderSize := Value;
end;
procedure TCustomConsole.SetExtraLineSpacing(const Value: Integer);
begin
FExtraLineSpacing := Value;
end;
procedure TCustomConsole.BeginExternalOutput;
begin
Prompt := False;
end;
procedure TCustomConsole.EndExternalOutput;
begin
Prompt := True;
end;
function TConsoleLines.IsEmptyLine(ALine: PConsoleLine): boolean;
begin
Result := (ALine <> nil) and (not ALine.IsPromptLine) and (ALine.Text = '');
end;
function TConsoleLines.GetWrappedLines(Index: Integer): string;
var i, j, c: integer;
FullLine: string;
begin
c := 0;
Result := '';
for i := 0 to fLines.Count - 1 do Begin
Inc(c, (Length(Lines[i].Prompt + Lines[i].Text) div WrapWidth) + 1);
if c > Index then Begin
Dec(c, (Length(Lines[i].Prompt + Lines[i].Text) div WrapWidth) + 1);
FullLine := Lines[i].Prompt + Lines[i].Text;
j := c;
while j < Index do Begin
Delete(FullLine, 1, WrapWidth);
inc(j);
end; // end while
Result := Copy(FullLine, 1, WrapWidth);
break;
end; // end if
end; // end for
end;
function TConsoleLines.GetWrappedLineCount: Integer;
var i: integer;
begin
Result := 0;
for i := 0 to fLines.Count - 1 do
Result := Result + ((Length(Lines[i].Prompt + Lines[i].Text)) div WrapWidth ) + 1;
end;
function TConsoleLines.GetWrapWidth: Integer;
begin
Result := (TCustomConsole(fOwner).ClientWidth -
TCustomConsole(fOwner).BorderSize * 2) div TCustomConsole(fOwner).CharWidth;
end;
function TConsoleLines.LogicalToWrappedLineIndex(ALine: Integer): Integer;
begin
Result := 0;
end;
procedure TCustomConsole.DoOnPrompt(var APrompt, DefaultText: string;
var DefaultCaretPos: Integer);
begin
if Assigned(fOnGetPrompt) then
fOnGetPrompt(Self, APrompt, DefaultText, DefaultCaretPos)
else Begin
APrompt := CONSOLE_DEFAULT_PROMPT;
end;
LastPrompt := APrompt;
end;
procedure TCustomConsole.KeyCommandHandler(AKey: Char);
var CommandFinished: boolean;
ATerminate: boolean;
begin
// If we are not in prompt mode, filter keys by user event
ATerminate := False;
if not (Prompt) and (Assigned(fOnCommandKeyPress)) then
fOnCommandKeyPress(Self, AKey, ATerminate)
else if (Assigned(fOnPromptKeyPress)) then fOnPromptKeyPress(Self, AKey);
// Case Key
case Ord(AKey) of
VK_RETURN:
Begin
if Prompt then Begin // prompt mode
BeginExternalOutput;
CommandFinished := True;
if fLines[fLines.Count - 2].Text <> '' then
FLastCommand := fLines[fLines.Count - 2].Text; // FD 18.11.2012
if Assigned(fOnCommandExecute) then
fOnCommandExecute(Self, fLines[fLines.Count - 2].Text, CommandFinished);
if CommandFinished and fActive then EndExternalOutput;
Invalidate;
end;
end;
VK_BACK:
Begin
if (Prompt) or (CaretX > MinLeftCaret) then Begin
if (CaretX > length(CurrLine.Text)) then
Delete(CurrLine.Text, Length(CurrLine.Text), 1)
else Delete(CurrLine.Text, CaretX - 1, 1);
CaretX := CaretX - 1;
Invalidate;
end;
end;
VK_TAB:
Begin
// Should Be Handled By An Event { TODO : todo }
end;
else if (AKey <> #0) then // Insert char
Begin
if (CaretX > length(CurrLine.Text)) then CurrLine.Text := CurrLine.Text + AKey
else if InsertMode then Insert(AKey, CurrLine.Text, CaretX) // Insert Mode
else Begin // Overwrite Mode
Delete(CurrLine.Text, CaretX, 1);
Insert(AKey, CurrLine.Text, CaretX);
end;
inc(fCaretX);
Invalidate;
end;
end;
if (ATerminate) then EndExternalOutput;
end;
procedure TCustomConsole.SetAutoUseInsertMode(const Value: boolean);
begin
FAutoUseInsertMode := Value;
end;
procedure TCustomConsole.SetOnCommandKeyPress(
const Value: TCommandKeyPressEvent);
begin
FOnCommandKeyPress := Value;
end;
{ TCommandParser }
constructor TCommandParser.Create(ACommand: string);
begin
Create;
ParseCommand(ACommand);
end;
constructor TCommandParser.Create;
begin
FParamList := TStringList.Create;
end;
destructor TCommandParser.Destroy;
begin
FParamList.Free;
inherited;
end;
function TCommandParser.GetParamCount: Integer;
begin
Result := FParamList.Count;
end;
function TCommandParser.GetParameters(Index: Integer): string;
begin
if Index = 0 then Result := Command
else Result := FParamList[Index - 1];
end;
procedure TCommandParser.ParseCommand(ACommand: string);
var t: string;
Apost: boolean;
i: integer;
procedure StoreSubString(AString: string);
Begin
if (AString <> '') then
// Store string (first substring as command, the others as parameters)
if (FCommand = '') then FCommand := AString
else FParamList.Add(AString);
end;
begin
// Reset
FParamList.Clear;
FCommand := '';
Apost := False;
// Parse
i := 1;
while (i <= length(ACommand)) do Begin
case ACommand[i] of
' ': if not APost then Begin
StoreSubString(t);
t := '';
end else t := t + ACommand[i];
'"': Apost := not Apost;
else t := t + ACommand[i];
end;
inc(i);
end;
StoreSubString(t);
end;
procedure TCustomConsole.SetMinLeftCaret(const Value: Integer);
begin
FMinLeftCaret := Value;
if CaretX > FMinLeftCaret then CaretX := FMinLeftCaret;
end;
procedure TCustomConsole.SetOnPromptKeyPress(
const Value: TPromptKeyPressEvent);
begin
FOnPromptKeyPress := Value;
end;
end.
|
{********************************************************************}
{ }
{ Extention for }
{ Developer Express Visual Component Library }
{ from http://pyatochkin.blogspot.com/ }
{ }
{********************************************************************}
unit cxDBLookupComboBoxIMP;
interface
uses
cxFilter,
StrUtils,
SysUtils, Classes, Controls, cxControls, cxContainer, cxEdit, cxTextEdit,
cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox,
ExtCtrls;
type
// IMP - типа Improved
// на текущий момент реализует следующие варианты
// фильтрации списка подстановок
TSearchOption = (
soNotConsiderOrdrer, // НЕ учитывать порядок введенных через пробел шаблонов
soConsiderOrdrer // учитывать порядок введенных через пробел шаблонов
);
const
CDefaultSearchOption = soNotConsiderOrdrer;
type
TConditionParser = class(TObject)
private
FSl: TStringList;
function Get(StrIndex: Integer): string;
procedure SetSearchText(const Value: string);
function GetSearchText: string;
function GetCount: Integer;
public
property SearchCondition[Index: Integer]: string read Get; default;
property Count: Integer read GetCount;
property SearchText: string read GetSearchText write SetSearchText;
constructor Create(AOwner: TComponent);
destructor Destroy; override;
end;
TcxDBLookupComboBoxIMP = class(TcxDBLookupComboBox)
private
{ Private declarations }
FUseDelayTimer: Boolean;
FSearchOption: TSearchOption;
procedure OnChangeText(Sender: TObject);
procedure DoFilter(Sender: TObject);
procedure SetUseDelayTimer(const Value: Boolean);
procedure SetSearchOption(const Value: TSearchOption);
protected
{ Protected declarations }
FDelayTimer: TTimer;
Condition: TConditionParser;
procedure ApplyFilter; virtual;
procedure Init; virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property SearchOption: TSearchOption read FSearchOption write SetSearchOption
default soNotConsiderOrdrer;
// если операция поиска быстрая, то можно не использовать таймер
property UseDelayTimer: Boolean read FUseDelayTimer write SetUseDelayTimer
default True;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Express DBEditors 6', [TcxDBLookupComboBoxIMP]);
end;
{ TcxDBLookupComboBoxIMP }
constructor TcxDBLookupComboBoxIMP.Create(AOwner: TComponent);
begin
inherited;
FDelayTimer := TTimer.Create(self);
FDelayTimer.Enabled := False;
Condition := TConditionParser.Create(self);
Init;
end;
destructor TcxDBLookupComboBoxIMP.Destroy;
begin
FDelayTimer.Enabled := False;
inherited;
end;
procedure TcxDBLookupComboBoxIMP.ApplyFilter;
var
I: Integer;
SearchFor: string;
begin
{ TODO : сейчас ищет только по Properties.ListColumns[0] - можно сделать учет нескольких колонок... }
Properties.DataController.Filter.BeginUpdate;
with Properties.DataController.Filter.Root do
begin
Clear;
BoolOperatorKind := fboAnd;
if SearchOption = soNotConsiderOrdrer then
begin
for I := 0 to Condition.Count - 1 do
begin
SearchFor := '%' + AnsiUpperCase(Condition[I]) + '%';
AddItem(Properties.ListColumns[0], foLike, SearchFor, SearchFor);
end;
end
else
begin
SearchFor := AnsiUpperCase('%' +
AnsiReplaceText(trim(Condition.SearchText), ' ', '%')
+ '%');
AddItem(Properties.ListColumns[0], foLike, SearchFor, SearchFor);
end;
end;
Properties.DataController.Filter.Active := True;
Properties.DataController.Filter.EndUpdate;
end;
procedure TcxDBLookupComboBoxIMP.Init;
begin
SearchOption := CDefaultSearchOption;
UseDelayTimer := True;
FDelayTimer.OnTimer := DoFilter;
FDelayTimer.Interval := 300;
Properties.DataController.Filter.AutoDataSetFilter := True;
Properties.IncrementalSearch := False;
Properties.IncrementalFiltering := False;
Properties.DataController.Filter.Options :=
Properties.DataController.Filter.Options + [fcoCaseInsensitive];
Properties.OnChange := OnChangeText;
end;
procedure TcxDBLookupComboBoxIMP.DoFilter(Sender: TObject);
begin
if (csDesigning in ComponentState) then
Exit;
FDelayTimer.Enabled := False;
if Condition.SearchText = trim(Self.Text) then
Exit;
if trim(Self.Text) = '' then
begin
Properties.DataController.Filter.Root.Clear;
Exit;
end;
Condition.SearchText := Self.Text;
ApplyFilter;
if DroppedDown and (Properties.ListSource.DataSet.RecordCount > 0) then
begin
DroppedDown := False;
DroppedDown := True;
end;
end;
procedure TcxDBLookupComboBoxIMP.OnChangeText(Sender: TObject);
begin
if (csDesigning in ComponentState) then
Exit;
if FUseDelayTimer then
begin
FDelayTimer.Enabled := False;
FDelayTimer.Enabled := True;
end
else
begin
FDelayTimer.Enabled := False;
DoFilter(Sender);
end;
end;
procedure TcxDBLookupComboBoxIMP.SetSearchOption(const Value: TSearchOption);
begin
FSearchOption := Value;
end;
procedure TcxDBLookupComboBoxIMP.SetUseDelayTimer(const Value: Boolean);
begin
FUseDelayTimer := Value;
if not FUseDelayTimer then
FDelayTimer.Enabled := False;
end;
{ TConditionParser }
constructor TConditionParser.Create(AOwner: TComponent);
begin
FSl := TStringList.Create;
end;
destructor TConditionParser.Destroy;
begin
FSl.Free;
inherited;
end;
function TConditionParser.Get(StrIndex: Integer): string;
begin
Result := FSl[StrIndex];
end;
function TConditionParser.GetCount: Integer;
begin
Result := FSl.Count;
end;
function TConditionParser.GetSearchText: string;
begin
Result := FSl.Text;
end;
procedure TConditionParser.SetSearchText(const Value: string);
begin
FSl.DelimitedText := Value;
end;
end.
|
{
ORM Brasil é um ORM simples e descomplicado para quem utiliza Delphi
Copyright (c) 2016, Isaque Pinheiro
All rights reserved.
GNU Lesser General Public License
Versão 3, 29 de junho de 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
A todos é permitido copiar e distribuir cópias deste documento de
licença, mas mudá-lo não é permitido.
Esta versão da GNU Lesser General Public License incorpora
os termos e condições da versão 3 da GNU General Public License
Licença, complementado pelas permissões adicionais listadas no
arquivo LICENSE na pasta principal.
}
{ @abstract(ORMBr Framework.)
@created(20 Jul 2016)
@author(Isaque Pinheiro <isaquepsp@gmail.com>)
@abstract(Website : http://www.ormbr.com.br)
@abstract(Telagram : https://t.me/ormbr)
}
unit ormbr.objects.manager;
interface
uses
DB,
Rtti,
Classes,
SysUtils,
Variants,
Generics.Collections,
/// ormbr
ormbr.command.factory,
ormbr.objects.manager.abstract,
dbcbr.types.mapping,
dbcbr.mapping.classes,
dbebr.factory.interfaces,
dbcbr.mapping.explorer;
type
TObjectManager<M: class, constructor> = class sealed(TObjectManagerAbstract<M>)
private
FOwner: TObject;
FObjectInternal: M;
procedure FillAssociation(const AObject: M);
procedure FillAssociationLazy(const AOwner, AObject: TObject);
protected
FConnection: IDBConnection;
// Fábrica de comandos a serem executados
FDMLCommandFactory: TDMLCommandFactoryAbstract;
// Controle de paginação vindo do banco de dados
FPageSize: Integer;
procedure ExecuteOneToOne(AObject: TObject; AProperty: TRttiProperty;
AAssociation: TAssociationMapping); override;
procedure ExecuteOneToMany(AObject: TObject; AProperty: TRttiProperty;
AAssociation: TAssociationMapping); override;
function FindSQLInternal(const ASQL: String): TObjectList<M>; override;
public
constructor Create(const AOwner: TObject; const AConnection: IDBConnection;
const APageSize: Integer); override;
destructor Destroy; override;
// Procedures
procedure InsertInternal(const AObject: M); override;
procedure UpdateInternal(const AObject: TObject;
const AModifiedFields: TDictionary<string, string>); override;
procedure DeleteInternal(const AObject: M); override;
procedure LoadLazy(const AOwner, AObject: TObject); override;
procedure NextPacketList(const AObjectList: TObjectList<M>;
const APageSize, APageNext: Integer); overload; override;
procedure NextPacketList(const AObjectList: TObjectList<M>;
const AWhere, AOrderBy: String;
const APageSize, APageNext: Integer); overload; override;
function NextPacketList: TObjectList<M>; overload; override;
function NextPacketList(const APageSize,
APageNext: Integer): TObjectList<M>; overload; override;
function NextPacketList(const AWhere, AOrderBy: String;
const APageSize, APageNext: Integer): TObjectList<M>; overload; override;
// Functions
function GetDMLCommand: string; override;
function ExistSequence: Boolean; override;
// DataSet
function SelectInternalWhere(const AWhere: string;
const AOrderBy: string): string; override;
function SelectInternalAll: IDBResultSet; override;
function SelectInternalID(const AID: Variant): IDBResultSet; override;
function SelectInternal(const ASQL: String): IDBResultSet; override;
function SelectInternalAssociation(const AObject: TObject): String; override;
function NextPacket: IDBResultSet; overload; override;
function NextPacket(const APageSize,
APageNext: Integer): IDBResultSet; overload; override;
function NextPacket(const AWhere, AOrderBy: String;
const APageSize, APageNext: Integer): IDBResultSet; overload; override;
// ObjectSet
function Find: TObjectList<M>; overload; override;
function Find(const AID: Variant): M; overload; override;
function FindWhere(const AWhere: string;
const AOrderBy: string): TObjectList<M>; override;
end;
implementation
uses
ormbr.bind,
ormbr.session.abstract,
ormbr.objects.helper,
ormbr.rtti.helper;
{ TObjectManager<M> }
constructor TObjectManager<M>.Create(const AOwner: TObject;
const AConnection: IDBConnection; const APageSize: Integer);
begin
inherited;
FOwner := AOwner;
FPageSize := APageSize;
if not (AOwner is TSessionAbstract<M>) then
raise Exception
.Create('O Object Manager não deve ser instânciada diretamente, use as classes TSessionObject<M> ou TSessionDataSet<M>');
FConnection := AConnection;
FObjectInternal := M.Create;
// ROTINA NÃO FINALIZADA DEU MUITO PROBLEMA, QUEM SABE UM DIA VOLTO A OLHAR
// Mapeamento dos campos Lazy Load
// TMappingExplorer.GetMappingLazy(TObject(FObjectInternal).ClassType);
// Fabrica de comandos SQL
FDMLCommandFactory := TDMLCommandFactory.Create(FObjectInternal,
AConnection,
AConnection.GetDriverName);
end;
destructor TObjectManager<M>.Destroy;
begin
// FExplorer := nil;
FDMLCommandFactory.Free;
FObjectInternal.Free;
inherited;
end;
procedure TObjectManager<M>.DeleteInternal(const AObject: M);
begin
FDMLCommandFactory.GeneratorDelete(AObject);
end;
function TObjectManager<M>.SelectInternalAll: IDBResultSet;
begin
Result := FDMLCommandFactory.GeneratorSelectAll(M, FPageSize);
end;
function TObjectManager<M>.SelectInternalAssociation(
const AObject: TObject): String;
var
LAssociationList: TAssociationMappingList;
LAssociation: TAssociationMapping;
begin
// Result deve sempre iniciar vazio
Result := '';
LAssociationList := TMappingExplorer.GetMappingAssociation(AObject.ClassType);
if LAssociationList = nil then
Exit;
for LAssociation in LAssociationList do
begin
if LAssociation.ClassNameRef <> FObjectInternal.ClassName then
Continue;
if LAssociation.Lazy then
Continue;
if LAssociation.Multiplicity in [OneToOne, ManyToOne] then
Result := FDMLCommandFactory
.GeneratorSelectAssociation(AObject,
FObjectInternal.ClassType,
LAssociation)
else
if LAssociation.Multiplicity in [OneToMany, ManyToMany] then
Result := FDMLCommandFactory
.GeneratorSelectAssociation(AObject,
FObjectInternal.ClassType,
LAssociation)
end;
end;
function TObjectManager<M>.SelectInternalID(const AID: Variant): IDBResultSet;
begin
Result := FDMLCommandFactory.GeneratorSelectID(M, AID);
end;
function TObjectManager<M>.SelectInternalWhere(const AWhere: string;
const AOrderBy: string): string;
begin
Result := FDMLCommandFactory.GeneratorSelectWhere(M, AWhere, AOrderBy, FPageSize);
end;
procedure TObjectManager<M>.FillAssociation(const AObject: M);
var
LAssociationList: TAssociationMappingList;
LAssociation: TAssociationMapping;
begin
// Se o driver selecionado for do tipo de banco NoSQL,
// o atributo Association deve ser ignorado.
if FConnection.GetDriverName = dnMongoDB then
Exit;
if Assigned(AObject) then
begin
LAssociationList := TMappingExplorer.GetMappingAssociation(AObject.ClassType);
if LAssociationList = nil then
Exit;
for LAssociation in LAssociationList do
begin
if LAssociation.Lazy then
Continue;
if LAssociation.Multiplicity in [OneToOne, ManyToOne] then
ExecuteOneToOne(AObject, LAssociation.PropertyRtti, LAssociation)
else
if LAssociation.Multiplicity in [OneToMany, ManyToMany] then
ExecuteOneToMany(AObject, LAssociation.PropertyRtti, LAssociation);
end;
end;
end;
procedure TObjectManager<M>.FillAssociationLazy(const AOwner, AObject: TObject);
var
LAssociationList: TAssociationMappingList;
LAssociation: TAssociationMapping;
begin
// Se o driver selecionado for do tipo de banco NoSQL, o atributo
// Association deve ser ignorado.
if FConnection.GetDriverName = dnMongoDB then
Exit;
LAssociationList := TMappingExplorer.GetMappingAssociation(AOwner.ClassType);
if LAssociationList = nil then
Exit;
for LAssociation in LAssociationList do
begin
if not LAssociation.Lazy then
Continue;
if Pos(LAssociation.ClassNameRef, AObject.ClassName) = 0 then
Continue;
if LAssociation.Multiplicity in [OneToOne, ManyToOne] then
ExecuteOneToOne(AOwner, LAssociation.PropertyRtti, LAssociation)
else
if LAssociation.Multiplicity in [OneToMany, ManyToMany] then
ExecuteOneToMany(AOwner, LAssociation.PropertyRtti, LAssociation);
end;
end;
procedure TObjectManager<M>.ExecuteOneToOne(AObject: TObject;
AProperty: TRttiProperty; AAssociation: TAssociationMapping);
var
LResultSet: IDBResultSet;
LObjectValue: TObject;
begin
LResultSet := FDMLCommandFactory
.GeneratorSelectOneToOne(AObject,
AProperty.PropertyType.AsInstance.MetaclassType,
AAssociation);
try
while LResultSet.NotEof do
begin
LObjectValue := AProperty.GetNullableValue(AObject).AsObject;
if LObjectValue = nil then
begin
LObjectValue := AProperty.PropertyType.AsInstance.MetaclassType.Create;
AProperty.SetValue(AObject, TValue.from<TObject>(LObjectValue));
end;
// Preenche o objeto com os dados do ResultSet
TBind.Instance.SetFieldToProperty(LResultSet, LObjectValue);
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(LObjectValue);
end;
finally
LResultSet.Close;
end;
end;
procedure TObjectManager<M>.ExecuteOneToMany(AObject: TObject;
AProperty: TRttiProperty; AAssociation: TAssociationMapping);
var
LPropertyType: TRttiType;
LObjectCreate: TObject;
LObjectList: TObject;
LResultSet: IDBResultSet;
begin
LPropertyType := AProperty.PropertyType;
LPropertyType := AProperty.GetTypeValue(LPropertyType);
LResultSet := FDMLCommandFactory
.GeneratorSelectOneToMany(AObject,
LPropertyType.AsInstance.MetaclassType,
AAssociation);
try
while LResultSet.NotEof do
begin
// Instancia o objeto do tipo definido na lista
LObjectCreate := LPropertyType.AsInstance.MetaclassType.Create;
LObjectCreate.MethodCall('Create', []);
// Popula o objeto com os dados do ResultSet
TBind.Instance.SetFieldToProperty(LResultSet, LObjectCreate);
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(LObjectCreate);
// Adiciona o objeto a lista
LObjectList := AProperty.GetNullableValue(AObject).AsObject;
if LObjectList <> nil then
LObjectList.MethodCall('Add', [LObjectCreate]);
end;
finally
LResultSet.Close;
end;
end;
function TObjectManager<M>.ExistSequence: Boolean;
begin
Result := FDMLCommandFactory.ExistSequence;
end;
function TObjectManager<M>.GetDMLCommand: string;
begin
Result := FDMLCommandFactory.GetDMLCommand;
end;
function TObjectManager<M>.NextPacket: IDBResultSet;
begin
Result := FDMLCommandFactory.GeneratorNextPacket;
end;
function TObjectManager<M>.NextPacket(const APageSize,
APageNext: Integer): IDBResultSet;
begin
Result := FDMLCommandFactory.GeneratorNextPacket(TClass(M), APageSize, APageNext);
end;
function TObjectManager<M>.NextPacketList: TObjectList<M>;
var
LResultSet: IDBResultSet;
LObjectList: TObjectList<M>;
begin
LObjectList := TObjectList<M>.Create;
LResultSet := NextPacket;
try
while LResultSet.NotEof do
begin
LObjectList.Add(M.Create);
TBind.Instance
.SetFieldToProperty(LResultSet, TObject(LObjectList.Last));
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(LObjectList.Last);
end;
Result := LObjectList;
finally
LResultSet.Close;
end;
end;
function TObjectManager<M>.NextPacket(const AWhere, AOrderBy: String;
const APageSize, APageNext: Integer): IDBResultSet;
begin
Result := FDMLCommandFactory
.GeneratorNextPacket(TClass(M),
AWhere,
AOrderBy,
APageSize,
APageNext);
end;
function TObjectManager<M>.NextPacketList(const AWhere, AOrderBy: String;
const APageSize, APageNext: Integer): TObjectList<M>;
var
LResultSet: IDBResultSet;
LObjectList: TObjectList<M>;
begin
LObjectList := TObjectList<M>.Create;
LResultSet := NextPacket(AWhere, AOrderBy, APageSize, APageNext);
try
while LResultSet.NotEof do
begin
LObjectList.Add(M.Create);
TBind.Instance
.SetFieldToProperty(LResultSet, TObject(LObjectList.Last));
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(LObjectList.Last);
end;
Result := LObjectList;
finally
LResultSet.Close;
end;
end;
procedure TObjectManager<M>.NextPacketList(const AObjectList: TObjectList<M>;
const AWhere, AOrderBy: String; const APageSize, APageNext: Integer);
var
LResultSet: IDBResultSet;
begin
LResultSet := NextPacket(AWhere, AOrderBy, APageSize, APageNext);
try
while LResultSet.NotEof do
begin
AObjectList.Add(M.Create);
TBind.Instance
.SetFieldToProperty(LResultSet, TObject(AObjectList.Last));
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(AObjectList.Last);
end;
finally
// Essa tag é controlada pela session, mas como esse método fornece
// dados para a session, tiver que muda-la aqui.
if LResultSet.RecordCount = 0 then
TSessionAbstract<M>(FOwner).FetchingRecords := True;
LResultSet.Close;
end;
end;
procedure TObjectManager<M>.NextPacketList(const AObjectList: TObjectList<M>;
const APageSize, APageNext: Integer);
var
LResultSet: IDBResultSet;
begin
LResultSet := NextPacket(APageSize, APageNext);
try
while LResultSet.NotEof do
begin
AObjectList.Add(M.Create);
TBind.Instance
.SetFieldToProperty(LResultSet, TObject(AObjectList.Last));
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(AObjectList.Last);
end;
finally
// Essa tag é controlada pela session, mas como esse método fornece
// dados para a session, tiver que muda-la aqui.
if LResultSet.RecordCount = 0 then
TSessionAbstract<M>(FOwner).FetchingRecords := True;
LResultSet.Close;
end;
end;
function TObjectManager<M>.NextPacketList(const APageSize,
APageNext: Integer): TObjectList<M>;
var
LResultSet: IDBResultSet;
LObjectList: TObjectList<M>;
begin
LObjectList := TObjectList<M>.Create;
LResultSet := NextPacket(APageSize, APageNext);
try
while LResultSet.NotEof do
begin
LObjectList.Add(M.Create);
TBind.Instance
.SetFieldToProperty(LResultSet, TObject(LObjectList.Last));
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(LObjectList.Last);
end;
Result := LObjectList;
finally
LResultSet.Close;
end;
end;
function TObjectManager<M>.SelectInternal(const ASQL: String): IDBResultSet;
begin
Result := FDMLCommandFactory.GeneratorSelect(ASQL, FPageSize);
end;
procedure TObjectManager<M>.UpdateInternal(const AObject: TObject;
const AModifiedFields: TDictionary<string, string>);
begin
FDMLCommandFactory.GeneratorUpdate(AObject, AModifiedFields);
end;
procedure TObjectManager<M>.InsertInternal(const AObject: M);
begin
FDMLCommandFactory.GeneratorInsert(AObject);
end;
procedure TObjectManager<M>.LoadLazy(const AOwner, AObject: TObject);
begin
FillAssociationLazy(AOwner, AObject);
end;
function TObjectManager<M>.FindSQLInternal(const ASQL: String): TObjectList<M>;
var
LResultSet: IDBResultSet;
LObject: M;
begin
Result := TObjectList<M>.Create;
if ASQL = '' then
LResultSet := SelectInternalAll
else
LResultSet := SelectInternal(ASQL);
try
while LResultSet.NotEof do
begin
LObject := M.Create;
// TObject(LObject) = Para D2010
TBind.Instance.SetFieldToProperty(LResultSet, TObject(LObject));
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(LObject);
// Adiciona o Object a lista de retorno
Result.Add(LObject);
end;
finally
LResultSet.Close;
end;
end;
function TObjectManager<M>.Find: TObjectList<M>;
begin
Result := FindSQLInternal('');
end;
function TObjectManager<M>.Find(const AID: Variant): M;
var
LResultSet: IDBResultSet;
begin
LResultSet := SelectInternalID(AID);
try
if LResultSet.RecordCount = 1 then
begin
Result := M.Create;
TBind.Instance
.SetFieldToProperty(LResultSet, TObject(Result));
// Alimenta registros das associações existentes 1:1 ou 1:N
FillAssociation(Result);
end
else
Result := nil;
finally
LResultSet.Close;
end;
end;
function TObjectManager<M>.FindWhere(const AWhere: string;
const AOrderBy: string): TObjectList<M>;
begin
Result := FindSQLInternal(SelectInternalWhere(AWhere, AOrderBy));
end;
end.
|
{*******************************************************************************
Title: T2Ti ERP 3.0
Description: Model relacionado à tabela [TRIBUT_ICMS_UF]
The MIT License
Copyright: Copyright (C) 2021 T2Ti.COM
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
The author may be contacted at:
t2ti.com@gmail.com
@author Albert Eije (alberteije@gmail.com)
@version 1.0.0
*******************************************************************************}
unit TributIcmsUf;
interface
uses
MVCFramework.Serializer.Commons, ModelBase;
type
[MVCNameCase(ncLowerCase)]
TTributIcmsUf = class(TModelBase)
private
FId: Integer;
FIdTributConfiguraOfGt: Integer;
FUfDestino: string;
FCfop: Integer;
FCsosn: string;
FCst: string;
FModalidadeBc: string;
FAliquota: Extended;
FValorPauta: Extended;
FValorPrecoMaximo: Extended;
FMva: Extended;
FPorcentoBc: Extended;
FModalidadeBcSt: string;
FAliquotaInternaSt: Extended;
FAliquotaInterestadualSt: Extended;
FPorcentoBcSt: Extended;
FAliquotaIcmsSt: Extended;
FValorPautaSt: Extended;
FValorPrecoMaximoSt: Extended;
public
// procedure ValidarInsercao; override;
// procedure ValidarAlteracao; override;
// procedure ValidarExclusao; override;
[MVCColumnAttribute('ID', True)]
[MVCNameAsAttribute('id')]
property Id: Integer read FId write FId;
[MVCColumnAttribute('ID_TRIBUT_CONFIGURA_OF_GT')]
[MVCNameAsAttribute('idTributConfiguraOfGt')]
property IdTributConfiguraOfGt: Integer read FIdTributConfiguraOfGt write FIdTributConfiguraOfGt;
[MVCColumnAttribute('UF_DESTINO')]
[MVCNameAsAttribute('ufDestino')]
property UfDestino: string read FUfDestino write FUfDestino;
[MVCColumnAttribute('CFOP')]
[MVCNameAsAttribute('cfop')]
property Cfop: Integer read FCfop write FCfop;
[MVCColumnAttribute('CSOSN')]
[MVCNameAsAttribute('csosn')]
property Csosn: string read FCsosn write FCsosn;
[MVCColumnAttribute('CST')]
[MVCNameAsAttribute('cst')]
property Cst: string read FCst write FCst;
[MVCColumnAttribute('MODALIDADE_BC')]
[MVCNameAsAttribute('modalidadeBc')]
property ModalidadeBc: string read FModalidadeBc write FModalidadeBc;
[MVCColumnAttribute('ALIQUOTA')]
[MVCNameAsAttribute('aliquota')]
property Aliquota: Extended read FAliquota write FAliquota;
[MVCColumnAttribute('VALOR_PAUTA')]
[MVCNameAsAttribute('valorPauta')]
property ValorPauta: Extended read FValorPauta write FValorPauta;
[MVCColumnAttribute('VALOR_PRECO_MAXIMO')]
[MVCNameAsAttribute('valorPrecoMaximo')]
property ValorPrecoMaximo: Extended read FValorPrecoMaximo write FValorPrecoMaximo;
[MVCColumnAttribute('MVA')]
[MVCNameAsAttribute('mva')]
property Mva: Extended read FMva write FMva;
[MVCColumnAttribute('PORCENTO_BC')]
[MVCNameAsAttribute('porcentoBc')]
property PorcentoBc: Extended read FPorcentoBc write FPorcentoBc;
[MVCColumnAttribute('MODALIDADE_BC_ST')]
[MVCNameAsAttribute('modalidadeBcSt')]
property ModalidadeBcSt: string read FModalidadeBcSt write FModalidadeBcSt;
[MVCColumnAttribute('ALIQUOTA_INTERNA_ST')]
[MVCNameAsAttribute('aliquotaInternaSt')]
property AliquotaInternaSt: Extended read FAliquotaInternaSt write FAliquotaInternaSt;
[MVCColumnAttribute('ALIQUOTA_INTERESTADUAL_ST')]
[MVCNameAsAttribute('aliquotaInterestadualSt')]
property AliquotaInterestadualSt: Extended read FAliquotaInterestadualSt write FAliquotaInterestadualSt;
[MVCColumnAttribute('PORCENTO_BC_ST')]
[MVCNameAsAttribute('porcentoBcSt')]
property PorcentoBcSt: Extended read FPorcentoBcSt write FPorcentoBcSt;
[MVCColumnAttribute('ALIQUOTA_ICMS_ST')]
[MVCNameAsAttribute('aliquotaIcmsSt')]
property AliquotaIcmsSt: Extended read FAliquotaIcmsSt write FAliquotaIcmsSt;
[MVCColumnAttribute('VALOR_PAUTA_ST')]
[MVCNameAsAttribute('valorPautaSt')]
property ValorPautaSt: Extended read FValorPautaSt write FValorPautaSt;
[MVCColumnAttribute('VALOR_PRECO_MAXIMO_ST')]
[MVCNameAsAttribute('valorPrecoMaximoSt')]
property ValorPrecoMaximoSt: Extended read FValorPrecoMaximoSt write FValorPrecoMaximoSt;
end;
implementation
{ TTributIcmsUf }
end. |
unit DesInvoices;
interface
uses
SysUtils, Variants, Classes, Controls, StrUtils,
ZAbstractRODataset, ZAbstractDataset, ZDataset, ZAbstractConnection, ZConnection,
AbraEntities, DesUtils, DesFastReports, AArray;
type
TDesInvoice = class
private
function prepareFastReportData : string;
public
ID : string[10];
OrdNumber : integer;
VS : string;
isReverseChargeDeclared : boolean;
DocDate,
DueDate,
VATDate : double;
Castka : currency; // LocalAmount
CastkaZaplaceno : currency; // se započítáním zaplacení dobropisů
CastkaZaplacenoZakaznikem : currency; // se započítáním zaplacení dobropisů
CastkaDobropisovano : currency;
CastkaNezaplaceno : currency;
CisloDokladu, // složené ABRA "lidské" číslo dokladu jak je na faktuře
CisloDokladuZkracene : string; // složené ABRA "lidské" číslo dokladu
DefaultPdfName : string;
// vlastnosti z DocQueues
DocQueueID : string[10];
DocQueueCode : string[10];
DocumentType : string[2]; // 60 typ dokladu dobopis fa vydaných (DO), 61 je typ dokladu dobropis faktur přijatých (DD), 03 je faktura vydaná, 04 je faktura přijatá, 10 je ZL
Year : string; // rok, do kterého doklad spadá, např. "2023"
Firm : TAbraFirm;
ResidenceAddress : TAbraAddress;
reportAry: TAArray;
constructor create(DocumentID : string; DocumentType : string = '03');
function createPdfByFr3(Fr3FileName : string; OverwriteExistingPdf : boolean) : TDesResult;
function printByFr3(Fr3FileName : string) : TDesResult;
end;
TNewDesInvoiceAA = class
public
AA : TAArray;
constructor create(DocDate : double; VarSymbol : string; DocumentType : string = '03');
function createNew0Row(RowText : string) : TAArray;
function createNew1Row(RowText : string) : TAArray;
function createNewRow_NoVat(RowType : integer; RowText : string) : TAArray;
end;
implementation
constructor TDesInvoice.create(DocumentID : string; DocumentType : string = '03');
begin
with DesU.qrAbraOC do begin
if DocumentType = '10' then //'10' mají zálohové listy (ZL)
SQL.Text :=
'SELECT ii.Firm_ID, ii.DocQueue_ID, ii.OrdNumber, ii.VarSymbol,'
+ ' ''N'' as IsReverseChargeDeclared, ii.DocDate$DATE, ii.DueDate$DATE, 0 as VATDate$DATE,'
+ ' ii.LocalAmount, ii.LocalPaidAmount, 0 as LocalCreditAmount, 0 as LocalPaidCreditAmount,'
+ ' d.Code as DocQueueCode, d.DocumentType, p.Code as YearCode,'
+ ' f.Name as FirmName, f.Code as AbraCode, f.OrgIdentNumber, f.VATIdentNumber,'
+ ' f.ResidenceAddress_ID, a.Street, a.City, a.PostCode '
+ 'FROM IssuedDInvoices ii'
+ ' JOIN DocQueues d ON ii.DocQueue_ID = d.ID'
+ ' JOIN Periods p ON ii.Period_ID = p.ID'
+ ' JOIN Firms f ON ii.Firm_ID = f.ID'
+ ' JOIN Addresses a ON f.ResidenceAddress_ID = a.ID'
+ ' WHERE ii.ID = ''' + DocumentID + ''''
else // default '03', cteni z IssuedInvoices
SQL.Text :=
'SELECT ii.Firm_ID, ii.DocQueue_ID, ii.OrdNumber, ii.VarSymbol,'
+ ' ii.IsReverseChargeDeclared, ii.DocDate$DATE, ii.DueDate$DATE, ii.VATDate$DATE,'
+ ' ii.LocalAmount, ii.LocalPaidAmount, ii.LocalCreditAmount, ii.LocalPaidCreditAmount,'
+ ' d.Code as DocQueueCode, d.DocumentType, p.Code as YearCode,'
+ ' f.Name as FirmName, f.Code as AbraCode, f.OrgIdentNumber, f.VATIdentNumber,'
+ ' f.ResidenceAddress_ID, a.Street, a.City, a.PostCode '
+ 'FROM IssuedInvoices ii'
+ ' JOIN DocQueues d ON ii.DocQueue_ID = d.ID'
+ ' JOIN Periods p ON ii.Period_ID = p.ID'
+ ' JOIN Firms f ON ii.Firm_ID = f.ID'
+ ' JOIN Addresses a ON f.ResidenceAddress_ID = a.ID'
+ ' WHERE ii.ID = ''' + DocumentID + '''';
Open;
if not Eof then begin
self.ID := DocumentID;
self.OrdNumber := FieldByName('OrdNumber').AsInteger;
self.VS := FieldByName('VarSymbol').AsString;
self.isReverseChargeDeclared := FieldByName('IsReverseChargeDeclared').AsString = 'A';
self.DocDate := FieldByName('DocDate$Date').asFloat;
self.DueDate := FieldByName('DueDate$Date').asFloat;
self.VATDate := FieldByName('VATDate$Date').asFloat;
self.Castka := FieldByName('LocalAmount').asCurrency;
self.CastkaZaplaceno := FieldByName('LocalPaidAmount').asCurrency
- FieldByName('LocalPaidCreditAmount').asCurrency;
self.CastkaZaplacenoZakaznikem := FieldByName('LocalPaidAmount').asCurrency;
self.CastkaDobropisovano := FieldByName('LocalCreditAmount').asCurrency;
self.CastkaNezaplaceno := self.Castka - self.CastkaZaplaceno - self.CastkaDobropisovano;
self.DocQueueID := FieldByName('DocQueue_ID').asString;
self.DocQueueCode := FieldByName('DocQueueCode').asString;
self.DocumentType := FieldByName('DocumentType').asString;
self.Year := FieldByName('YearCode').asString;
self.CisloDokladu := Format('%s-%d/%s', [self.DocQueueCode, self.OrdNumber, self.Year]); // s leading nulami by bylo jako '%s-%5.5d/%s'
self.CisloDokladuZkracene := Format('%s-%d/%s', [self.DocQueueCode, self.OrdNumber, RightStr(self.Year, 2)]);
self.Firm := TAbraFirm.create(
FieldByName('Firm_ID').asString,
FieldByName('FirmName').asString,
FieldByName('AbraCode').asString,
FieldByName('OrgIdentNumber').asString,
FieldByName('VATIdentNumber').asString
);
self.ResidenceAddress := TAbraAddress.create(
FieldByName('ResidenceAddress_ID').asString,
FieldByName('Street').asString,
FieldByName('City').asString,
FieldByName('PostCode').asString
);
end;
Close;
end;
reportAry := TAArray.create;
end;
function TDesInvoice.prepareFastReportData : string;
var
slozenkaCastka,
slozenkaVS,
slozenkaSS: string;
Celkem,
Saldo,
Zaplatit: double;
i: integer;
begin
if self.DocumentType = '10' then
reportAry['Title'] := 'Zálohový list na připojení k internetu'
else
reportAry['Title'] := 'Faktura za připojení k internetu';
reportAry['Author'] := 'Družstvo Eurosignal';
reportAry['AbraKod'] := self.Firm.AbraCode;
reportAry['OJmeno'] := self.Firm.Name;
reportAry['OUlice'] := self.ResidenceAddress.Street;
reportAry['OObec'] := self.ResidenceAddress.PostCode + ' ' + self.ResidenceAddress.City;
//reportAry['OICO'] := self.Firm.OrgIdentNumber;
if Trim(self.Firm.OrgIdentNumber) <> '' then
reportAry['OICO'] := 'IČ: ' + Trim(self.Firm.OrgIdentNumber)
else
reportAry['OICO'] := ' ';
//reportAry['ODIC'] := self.Firm.VATIdentNumber;
if Trim(self.Firm.VATIdentNumber) <> '' then
reportAry['ODIC'] := 'DIČ: ' + Trim(self.Firm.VATIdentNumber)
else
reportAry['ODIC'] := ' ';
reportAry['ID'] := self.ID;
reportAry['DatumDokladu'] := self.DocDate;
reportAry['DatumSplatnosti'] := self.DueDate;
reportAry['DatumPlneni'] := self.VATDate;
reportAry['VS'] := self.VS;
reportAry['Celkem'] := self.Castka;
reportAry['Zaplaceno'] := self.CastkaZaplacenoZakaznikem;
if self.IsReverseChargeDeclared then
reportAry['DRCText'] := 'Podle §92a zákona č. 235/2004 Sb. o DPH daň odvede zákazník. '
else
reportAry['DRCText'] := ' ';
Saldo := 0;
with DesU.qrAbraOC do begin
// všechny Firm_Id pro Abrakód firmy
SQL.Text := 'SELECT * FROM DE$_Code_To_Firm_Id (' + Ap + self.Firm.AbraCode + ApZ;
Open;
// a saldo pro všechny Firm_Id (saldo je záporné, pokud zákazník dluží)
while not EOF do
begin
if self.DocQueueCode = 'FO3' then begin
DesU.qrAbraOC2.SQL.Text := 'SELECT SaldoPo + SaldoZL + Ucet325 FROM DE$_Firm_Totals (' + Ap + DesU.qrAbraOC.Fields[0].AsString + ApC + FloatToStr(Date) + ')'; //pro FO3
end else begin
DesU.qrAbraOC2.SQL.Text := 'SELECT SaldoPo + SaldoZLPo + Ucet325 FROM DE$_Firm_Totals (' + Ap + DesU.qrAbraOC.Fields[0].AsString + ApC + FloatToStr(self.DocDate) + ')'; //pro FO1
end;
DesU.qrAbraOC2.Open;
Saldo := Saldo + DesU.qrAbraOC2.Fields[0].AsFloat;
DesU.qrAbraOC2.Close;
Next;
end;
end; // with DesU.qrAbraOC
if self.DocQueueCode = 'FO3' then begin
Zaplatit := -Saldo; // FO3
end else begin
Saldo := Saldo + self.CastkaZaplacenoZakaznikem; //FO1 - Saldo je po splatnosti (SaldoPo), je-li faktura už zaplacena, přičte se platba
Zaplatit := self.Castka - Saldo; // FO1 - Celkem k úhradě = Celkem za fakt. období - Zůstatek minulých období(saldo)
end;
{ //právě převáděná faktura může být před splatností *HWTODO probrat a vyhodit, faktura je vždy před splatností
if Date <= DatumSplatnosti then begin
Saldo := Saldo + self.CastkaZaplacenoZakaznikem; //FO1 - Saldo je po splatnosti (SaldoPo), je-li faktura už zaplacena, přičte se platba
Zaplatit := self.Castka - Saldo; // FO1 - Celkem k úhradě = Celkem za fakt. období - Zůstatek minulých období(saldo)
//anebo je po splatnosti
end else begin
Zaplatit := -Saldo;
Saldo := Saldo + Celkem; // částka faktury se odečte ze salda, aby tam nebyla dvakrát
end;
}
if Zaplatit < 0 then Zaplatit := 0;
reportAry['Saldo'] := Saldo;
reportAry['ZaplatitCislo'] := Zaplatit;
//reportAry['Zaplatit'] := Format('%.2f Kč', [Zaplatit]);
reportAry['Zaplatit'] := Zaplatit;
// text na fakturu
if Saldo > 0 then reportAry['Platek'] := 'Přeplatek'
else if Saldo < 0 then reportAry['Platek'] := 'Nedoplatek'
else reportAry['Platek'] := ' ';
reportAry['Vystaveni'] := FormatDateTime('dd.mm.yyyy', reportAry['DatumDokladu']);
reportAry['Plneni'] := FormatDateTime('dd.mm.yyyy', reportAry['DatumPlneni']);
reportAry['Splatnost'] := FormatDateTime('dd.mm.yyyy', reportAry['DatumSplatnosti']);
reportAry['SS'] := Format('%6.6d%s', [self.OrdNumber, RightStr(self.Year, 2)]);
reportAry['Cislo'] := self.CisloDokladu;
reportAry['Resume'] := Format('Částku %.0f,- Kč uhraďte, prosím, do %s na účet 2100098382/2010 s variabilním symbolem %s.',
[Zaplatit, reportAry['Splatnost'], reportAry['VS']]);
// načtení údajů z tabulky Smlouvy
with DesU.qrZakos do begin
Close;
SQL.Text := 'SELECT Postal_name, Postal_street, Postal_PSC, Postal_city FROM customers'
+ ' WHERE Variable_symbol = ' + Ap + reportAry['VS'] + Ap;
Open;
reportAry['PJmeno'] := FieldByName('Postal_name').AsString;
reportAry['PUlice'] := FieldByName('Postal_street').AsString;
reportAry['PObec'] := FieldByName('Postal_PSC').AsString + ' ' + FieldByName('Postal_city').AsString;
Close;
end;
// zasílací adresa
if (reportAry['PJmeno'] = '') or (reportAry['PObec'] = '') then begin
reportAry['PJmeno'] := reportAry['OJmeno'];
reportAry['PUlice'] := reportAry['OUlice'];
reportAry['PObec'] := reportAry['OObec'];
end;
// text pro QR kód
reportAry['QRText'] := Format('SPD*1.0*ACC:CZ6020100000002100098382*AM:%d*CC:CZK*RN:EUROSIGNAL*DT:%s*X-VS:%s*X-SS:%s*MSG:QR PLATBA INTERNET',[
Round(reportAry['ZaplatitCislo']),
FormatDateTime('yyyymmdd', reportAry['DatumSplatnosti']),
reportAry['VS'],
reportAry['SS']]);
slozenkaCastka := Format('%6.0f', [Zaplatit]);
//nahradíme vlnovkou poslední mezeru, tedy dáme vlnovku před první číslici
for i := 2 to 6 do
if slozenkaCastka[i] <> ' ' then begin
slozenkaCastka[i-1] := '~';
Break;
end;
slozenkaVS := self.VS.PadLeft(10, '0'); // přidáme nuly na začátek pro VS s délkou kratší než 10 znaků
slozenkaSS := Format('%8.8d%s', [self.OrdNumber, RightStr(self.Year, 2)]);
reportAry['C1'] := slozenkaCastka[1];
reportAry['C2'] := slozenkaCastka[2];
reportAry['C3'] := slozenkaCastka[3];
reportAry['C4'] := slozenkaCastka[4];
reportAry['C5'] := slozenkaCastka[5];
reportAry['C6'] := slozenkaCastka[6];
reportAry['V01'] := slozenkaVS[1];
reportAry['V02'] := slozenkaVS[2];
reportAry['V03'] := slozenkaVS[3];
reportAry['V04'] := slozenkaVS[4];
reportAry['V05'] := slozenkaVS[5];
reportAry['V06'] := slozenkaVS[6];
reportAry['V07'] := slozenkaVS[7];
reportAry['V08'] := slozenkaVS[8];
reportAry['V09'] := slozenkaVS[9];
reportAry['V10'] := slozenkaVS[10];
reportAry['S01'] := slozenkaSS[1];
reportAry['S02'] := slozenkaSS[2];
reportAry['S03'] := slozenkaSS[3];
reportAry['S04'] := slozenkaSS[4];
reportAry['S05'] := slozenkaSS[5];
reportAry['S06'] := slozenkaSS[6];
reportAry['S07'] := slozenkaSS[7];
reportAry['S08'] := slozenkaSS[8];
reportAry['S09'] := slozenkaSS[9];
reportAry['S10'] := slozenkaSS[10];
reportAry['VS2'] := reportAry['VS']; // asi by stačil jeden VS, ale nevadí
reportAry['SS2'] := reportAry['SS']; // SS2 se liší od SS tak, že má 8 míst. SS má 6 míst (zleva jsou vždy přidané nuly)
reportAry['Castka'] := slozenkaCastka + ',-';
DesFastReport.reportData := reportAry;
end;
function TDesInvoice.createPdfByFr3(Fr3FileName : string; OverwriteExistingPdf : boolean) : TDesResult;
var
PdfFileName,
ExportDirName,
FullPdfFileName : string;
FVysledek : TDesResult;
begin
DesFastReport.init('invoice', Fr3FileName); // nastavení typu reportu a fr3 souboru
if self.DocQueueCode = 'FO1' then //FO1 mají pětimístné číslo dokladu, ostatní čtyřmístné
PdfFileName := Format('%s-%5.5d.pdf', [self.DocQueueCode, self.OrdNumber]) // pro test 'new-%s-%5.5d.pdf'
else
PdfFileName := Format('%s-%4.4d.pdf', [self.DocQueueCode, self.OrdNumber]);
ExportDirName := Format('%s%s\%s\', [DesU.PDF_PATH, self.Year, FormatDateTime('mm', self.DocDate)]);
DesFastReport.setExportDirName(ExportDirName);
FullPdfFileName := ExportDirName + PdfFileName;
self.prepareFastReportData;
DesFastReport.prepareInvoiceDataSets(self.ID, self.DocumentType);
Result := DesFastReport.createPdf(FullPdfFileName, OverwriteExistingPdf);
end;
function TDesInvoice.printByFr3(Fr3FileName : string) : TDesResult;
var
PdfFileName,
ExportDirName,
FullPdfFileName : string;
FVysledek : TDesResult;
begin
DesFastReport.init('invoice', Fr3FileName); // nastavení typu reportu a fr3 souboru
self.prepareFastReportData;
DesFastReport.prepareInvoiceDataSets(self.ID, self.DocumentType);
Result := DesFastReport.print();
if Result.Code = 'ok' then
Result.Messg := Format('Doklad %s byl odeslán na tiskárnu.', [self.CisloDokladu]);
end;
constructor TNewDesInvoiceAA.create(DocDate : double; VarSymbol : string; DocumentType : string = '03');
begin
AA := TAArray.Create;
AA['VarSymbol'] := VarSymbol;
AA['DocDate$DATE'] := DocDate;
AA['Period_ID'] := AbraEnt.getPeriod('Code=' + FormatDateTime('yyyy', DocDate)).ID;
AA['Address_ID'] := '7000000101'; // FA CONST
AA['BankAccount_ID'] := '1400000101'; // Fio
AA['ConstSymbol_ID'] := '0000308000';
AA['TransportationType_ID'] := '1000000101'; // FA CONST
AA['PaymentType_ID'] := '1000000101'; // typ platby: na bankovní účet
if DocumentType = '03' then begin
AA['AccDate$DATE'] := DocDate;
AA['PricesWithVAT'] := True;
AA['VATFromAbovePrecision'] := 0; // 6 je nejvyšší přesnost, ABRA nabízí 0 - 6; v praxi jsou položky faktury i v DB stejně na 2 desetinná místa, ale třeba je to takhle přesnější výpočet
AA['TotalRounding'] := 259; // zaokrouhlení na koruny dolů, ať zákazníky nedráždíme haléřovými "příplatky"
end;
end;
function TNewDesInvoiceAA.createNew0Row(RowText : string) : TAArray;
var
RowAA: TAArray;
begin
RowAA := AA.addRow();
RowAA['RowType'] := 0;
RowAA['Text'] := RowText;
RowAA['Division_ID'] := AbraEnt.getDivisionId;
Result := RowAA;
end;
function TNewDesInvoiceAA.createNew1Row(RowText : string) : TAArray;
var
RowAA: TAArray;
begin
RowAA := AA.addRow();
RowAA['RowType'] := 1;
RowAA['Text'] := RowText;
RowAA['Division_ID'] := AbraEnt.getDivisionId;
RowAA['VATRate_ID'] := AbraEnt.getVatIndex('Code=Výst' + DesU.VAT_RATE).VATRate_ID;
RowAA['VATIndex_ID'] := AbraEnt.getVatIndex('Code=Výst' + DesU.VAT_RATE).ID;
RowAA['IncomeType_ID'] := AbraEnt.getIncomeType('Code=SL').ID; // služby
Result := RowAA;
end;
function TNewDesInvoiceAA.createNewRow_NoVat(RowType : integer; RowText : string) : TAArray;
var
RowAA: TAArray;
begin
RowAA := AA.addRow();
RowAA['RowType'] := RowType;
RowAA['Text'] := RowText;
RowAA['Division_ID'] := AbraEnt.getDivisionId;
Result := RowAA;
end;
end.
|
unit Server.Models.Ativo.DadosLigacao.Factory;
interface
uses Server.Models.Ativo.DadosLigacao, Generics.Collections;
type
TFactoryComprasItem = class
public
class function CriarComprasItem: TComprasItem; Overload;
class function CriarComprasItem(
pDESCONTO: Double;
pQDT: Integer;
pDESCRICAO: String;
pUN_MEDIDA: String;
pVALOR_UN: Double;
pCODPROD: String
): TComprasItem; Overload;
end;
TFactoryCompras = class
public
class function CriarCompras: TCompras; Overload;
class function CriarCompras
(pVALOR: Double; pDESCRICAO: String;
pCODIGO: Integer; pFORMA_PGTO: String;
pDATA: TDate; pItens: TObjectList<TObject>): TCompras; Overload;
end;
TFactoryAgenda = class
public
class function CriarAgenda: TAgenda; Overload;
class function CriarAgenda
(pCAMPANHA: String;
pCODIGO: Integer;
pOPERADOR: String;
pDT_AGENDAMENTO: TDateTime;
pDT_RESULTADO: TDateTime;
pFONE2: String;
pRESULTADO: String;
pFONE1: String;
pOPERADOR_LIGACAO, pPROPOSTA: String): TAgenda; Overload;
end;
TFactoryHistorico = class
public
class function CriarHistorico: THistorico; Overload;
class function CriarHistorico
(pTIPO_LIGACAO: String;
pCAMPANHA: String;
pCODIGO: Integer;
pFIM: TDateTime;
pOPERADOR: String;
pINICIO: TDateTime;
pRESULTADO: String;
pTELEFONE, pOBSERVACAO, pCOR: String): THistorico; Overload;
end;
implementation
{ TFactoryComprasItem }
uses Infotec.Utils;
class function TFactoryComprasItem.CriarComprasItem: TComprasItem;
begin
Result := TComprasItem.Create;
end;
class function TFactoryComprasItem.CriarComprasItem(pDESCONTO: Double;
pQDT: Integer; pDESCRICAO, pUN_MEDIDA: String; pVALOR_UN: Double;
pCODPROD: String): TComprasItem;
begin
Result := CriarComprasItem;
Result.CODPROD := pCODPROD;
Result.DESCRICAO := TInfotecUtils.RemoverEspasDuplas(pDESCRICAO);
Result.QDT := pQDT;
Result.UN_MEDIDA := pUN_MEDIDA;
Result.VALOR_UN := pVALOR_UN;
Result.DESCONTO := pDESCONTO;
end;
{ TFactoryCompras }
class function TFactoryCompras.CriarCompras: TCompras;
begin
Result := TCompras.create;
end;
class function TFactoryCompras.CriarCompras(pVALOR: Double; pDESCRICAO: String;
pCODIGO: Integer; pFORMA_PGTO: String; pDATA: TDate;
pItens: TObjectList<TObject>): TCompras;
var
vItem:TObject;
begin
Result := CriarCompras;
Result.CODIGO := pCODIGO;
Result.DATA := pDATA;
Result.DESCRICAO := TInfotecUtils.RemoverEspasDuplas(pDESCRICAO);
Result.VALOR := pVALOR;
Result.FORMA_PGTO := pFORMA_PGTO;
for vItem in pItens do
begin
Result.Itens.Add(TComprasItem(vItem));
end;
end;
{ TFactoryAgenda }
class function TFactoryAgenda.CriarAgenda: TAgenda;
begin
Result := TAgenda.Create;
end;
class function TFactoryAgenda.CriarAgenda(pCAMPANHA: String; pCODIGO: Integer;
pOPERADOR: String; pDT_AGENDAMENTO, pDT_RESULTADO: TDateTime; pFONE2,
pRESULTADO, pFONE1, pOPERADOR_LIGACAO, pPROPOSTA: String): TAgenda;
begin
Result := CriarAgenda;
Result.CODIGO := pCODIGO;
Result.DT_AGENDAMENTO := pDT_AGENDAMENTO;
Result.FONE1 := pFONE1;
Result.FONE2 := pFONE2;
Result.OPERADOR := pOPERADOR;
Result.OPERADOR_LIGACAO := pOPERADOR_LIGACAO;
Result.RESULTADO := pRESULTADO;
Result.DT_RESULTADO := pDT_RESULTADO;
Result.CAMPANHA := pCAMPANHA;
Result.PROPOSTA := pPROPOSTA;
end;
{ TFactoryHistorico }
class function TFactoryHistorico.CriarHistorico: THistorico;
begin
Result := THistorico.Create;
end;
class function TFactoryHistorico.CriarHistorico(pTIPO_LIGACAO,
pCAMPANHA: String; pCODIGO: Integer; pFIM: TDateTime; pOPERADOR: String;
pINICIO: TDateTime; pRESULTADO, pTELEFONE, pOBSERVACAO, pCOR: String): THistorico;
begin
Result := CriarHistorico;
Result.TIPO_LIGACAO := pTIPO_LIGACAO;
Result.CAMPANHA := pCAMPANHA;
Result.CODIGO := pCODIGO;
Result.FIM := pFIM;
Result.OPERADOR := pOPERADOR;
Result.INICIO := pINICIO;
Result.RESULTADO:= pRESULTADO;
Result.TELEFONE := pTELEFONE;
Result.OBSERVACAO := TInfotecUtils.RemoverEspasDuplas(pOBSERVACAO);
Result.COR := pCOR;
end;
end.
|
{ *************************************************************************** }
{ }
{ NLDMemLeak - www.nldelphi.com Open Source Delphi runtime library }
{ }
{ Initiator: Albert de Weerd (aka NGLN) }
{ License: Free to use, free to modify }
{ GitHub path: https://github.com/NLDelphi/NLDUtils/blob/main/NLDMemLeak.pas }
{ }
{ *************************************************************************** }
unit NLDMemLeak;
interface
implementation
uses
Winapi.Windows, SysUtils;
var
StartMem: Cardinal;
MemoryLeak: Cardinal;
initialization
StartMem := GetHeapStatus.TotalAllocated;
finalization
MemoryLeak := GetHeapStatus.TotalAllocated - StartMem;
if MemoryLeak <> 0 then
MessageBox(0, PChar(IntToStr(MemoryLeak) + ' Bytes.'#10), PChar('Memory leak!'), Mb_OK + Mb_IconWarning);
end. |
(*
* Copyright (c) 2008, Susnea Andrei
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
unit Tests.TimeCheck;
interface
uses SysUtils, TestFramework,
HelperLib.TypeSupport,
HelperLib.Collections.Dictionary,
HelperLib.Collections.KeyValuePair,
HelperLib.Collections.Map,
HelperLib.Collections.Exceptions,
HelperLib.Date.DateTime,
HelperLib.Date.TimeSpan;
type
TExceptionClosure = reference to procedure;
TClassOfException = class of Exception;
TTestTimeAvgs = class(TTestCase)
private
function CreateDictionary(const NrElem : Integer; const RandomRange : Integer; var LastKey : Integer) : HDictionary<Integer, Integer>;
function CreateMap(const NrElem : Integer; const RandomRange : Integer; var LastKey : Integer) : HMap<Integer, Integer>;
published
procedure TestMapVsDictAvgInsert();
procedure TestMapVsDictFindAverage();
procedure TestMapVsUnsortedArray();
end;
implementation
{ TTestTimeMediums }
function TTestTimeAvgs.CreateDictionary(const NrElem,
RandomRange: Integer; var LastKey : Integer): HDictionary<Integer, Integer>;
var
I, X : integer;
Dict : HDictionary<Integer,Integer>;
begin
Dict := HDictionary<Integer,Integer>.Create();
Randomize;
for I := 0 to NrElem - 1 do
begin
X := Random(RandomRange);
if not Dict.ContainsKey(X) then
begin
Dict.Add(X, I);
LastKey := X;
end;
end;
Result := Dict;
end;
function TTestTimeAvgs.CreateMap(const NrElem,
RandomRange: Integer; var LastKey : Integer): HMap<Integer, Integer>;
var
I, X : integer;
Map : HMap<Integer,Integer>;
begin
Map := HMap<Integer,Integer>.Create();
Randomize;
for I := 0 to NrElem - 1 do
begin
X := Random(RandomRange);
if not Map.Contains(X) then
Map.Insert(X, I);
end;
LastKey := Map[Map.Count - 1].Key;
Result := Map;
end;
procedure TTestTimeAvgs.TestMapVsDictAvgInsert;
const
NrItems = 100000;
var
I, X, MapLastKey, DictLastKey: integer;
Map : HMap<Integer, Integer>;
Dict : HDictionary<Integer,Integer>;
DS, DE : HDateTime;
MS, ME : HDateTime;
DT, MT : HTimeSpan;
begin
{ inserting elements into dict and map }
DS := HDateTime.Now;
Dict := CreateDictionary(NrItems, $FFFF, DictLastKey);
DE := HDateTime.Now;
MS := HDateTime.Now;
Map := CreateMap(NrItems,$FFFF, MapLastKey);
ME := HDateTime.Now;
DT := (DE - DS);
MT := (ME - MS);
Check((MT.TotalMilliseconds / 8) >= DT.TotalMilliseconds, 'Map should be 8x slower than Dictionary at medium insert times.');
Dict.Free;
Map.Free;
end;
procedure TTestTimeAvgs.TestMapVsDictFindAverage;
const
NrItems = 100000;
var
I, X, MapLastKey, DictLastKey, DictKeysFound, MapKeysFound: integer;
Map : HMap<Integer, Integer>;
Dict : HDictionary<Integer,Integer>;
DS, DE : HDateTime;
MS, ME : HDateTime;
DT, MT : HTimeSpan;
RandomKeyArray : array of Integer;
begin
DictKeysFound := 0;
MapKeysFound := 0;
Dict := CreateDictionary(NrItems, $FFFF, DictLastKey);
Map := CreateMap(NrItems,$FFFF, MapLastKey);
randomize;
{ searching for random elements }
SetLength(RandomKeyArray,NrItems);
for I := 0 to NrItems - 1 do
begin
RandomKeyArray[I] := Random($FFFF);
end;
DS := HDateTime.Now;
for I := 0 to NrItems - 1 do
begin
if Dict.ContainsKey(RandomKeyArray[I]) then
Inc(DictKeysFound);
end;
DE := HDateTime.Now;
MS := HDateTime.Now;
for I := 0 to NrItems - 1 do
begin
if Map.Contains(RandomKeyArray[I]) then
Inc(MapKeysFound);
end;
ME := HDateTime.Now;
DT := (DE - DS);
MT := (ME - MS);
Check((MT.TotalMilliseconds / 5) >= DT.TotalMilliseconds, 'Map should be 5x slower than Dictionary at medium Contains times.');
if MapKeysFound > DictKeysFound then
begin
Dict.Free;
Map.Free;
Exit();
end;
Dict.Free;
Map.Free;
end;
procedure TTestTimeAvgs.TestMapVsUnsortedArray;
const
NrItems = 10000;
var
I, J, X, MapLastKey, DKeyFound, MKeyFound: integer;
Map : HMap<Integer, Integer>;
DS, DE : HDateTime;
MS, ME : HDateTime;
DT, MT : HTimeSpan;
RandomKeyArray : array of Integer;
RandomValuesArray : array of HKeyValuePair<Integer,Integer>;
begin
Map := CreateMap(NrItems,$FFFF, MapLastKey);
randomize;
{ searching for random elements }
SetLength(RandomKeyArray,NrItems);
for I := 0 to NrItems - 1 do
begin
RandomKeyArray[I] := Random($FFFF);
end;
SetLength(RandomValuesArray,NrItems);
for I := 0 to NrItems - 1 do
begin
RandomValuesArray[I].Create(Random($FFFF),Random($FFFF));
//RandomValuesArray[I].Value := Random($FFFF);
end;
DS := HDateTime.Now;
for I := 0 to NrItems - 1 do
for J := 0 to NrItems - 1 do
begin
if RandomValuesArray[J].Key = RandomKeyArray[I] then
Inc(DKeyFound);
end;
DE := HDateTime.Now;
MS := HDateTime.Now;
for I := 0 to NrItems - 1 do
begin
if Map.Contains(RandomKeyArray[I]) then
Inc(MKeyFound);
end;
ME := HDateTime.Now;
DT := (DE - DS);
MT := (ME - MS);
Check(MT.TotalMilliseconds < DT.TotalMilliseconds, 'Map should be faster than n^2.');
if MKeyFound > DKeyFound then
begin
Map.Free;
Exit();
end;
Map.Free;
end;
initialization
TestFramework.RegisterTest(TTestTimeAvgs.Suite);
end.
|
unit AniMap;
interface
uses
Classes,
sdl,
SiegeTypes;
type
TAniMap = class( TObject )
private
FWidth : Longint;
FHeight : Longint;
FMapData : HGLOBAL;
FTransparentColor : TSDL_Color;
FColorMatch : word;
FAmbientColor : TSDL_Color;
FAmbientIntensity : integer;
FUseLighting : Boolean;
FUseAmbientOnly : Boolean;
FTileSize : Word;
LastItem : Word;
// SubMaps :TList;
procedure SetWidth( VWidth : Longint );
procedure SetHeight( VHeight : Longint );
procedure SetTileSize( Size : Word );
procedure SetAmbientColor( Color : TSDL_Color );
procedure SetAmbientIntensity( Value : Integer );
function GetZoneCount : word;
procedure SetTransparentColor( Color : TSDL_Color );
function GetColorMatch : word;
protected
public
LightR : double;
LightG : double;
LightB : double;
FirstItem : Word;
NeedColorMatch : boolean;
StripWidth : Word;
StripHeight : Word;
TileHeight : Word;
TileWidth : Word;
BitWidth : Longint;
BitHeight : Longint;
Zones : TList;
//Item Instance Information
ItemList : array[ 1..ItemListSize ] of ItemInstanceInfo;
constructor Create;
destructor Destroy; override;
function AddItem( Zone, ItemIndex : Word; X, Y, Z : Longint; FilterID : Smallint;
Collidable : Boolean ) : PItemInstanceInfo;
procedure Clear;
procedure FreeResources;
procedure FreeDefinitions;
function GetTile( X, Y : Longint ) : PGridInfo;
procedure SetTile( X, Y, Layer : Longint; Zone, Index : Word );
procedure SetDiamondTile( X, Y : Longint; ZoneTop, TileTop, ZoneRight, TileRight, ZoneBottom, TileBottom, ZoneLeft, TileLeft : Word );
procedure SetCollisionMask( X, Y : Longint; CollisionMask : Word );
procedure SetLineOfSightMask( X, Y : Longint; LineOfSightMask : Word );
procedure SetTrigger( X, Y : Longint; TriggerID : SmallInt ); overload;
procedure SetTrigger( X, Y : Longint; TriggerID : SmallInt; TriggerMask : Word ); overload;
procedure SetFilter( X, Y : Longint; FilterID : SmallInt ); overload;
procedure SetFilter( X, Y : Longint; FilterID : SmallInt; FilterMask : Word ); overload;
procedure DefineTile( Zone, Index : Word; Image : PSDL_Surface );
function DefineItem( Zone, Index : Word; Image : PSDL_Surface; const StripHeights, CollisionMasks, LineOfSightMasks, LightPoints : array of Word; Slope : Single; Visible, AutoTransparent, Vertical : Boolean ) : PItemInfo;
procedure Sort;
procedure RenderMap;
procedure MoveZoneToVideo( Index : integer );
function GetZoneMemoryUsage( Index : integer ) : longint;
function AddZone : Word;
function AddLightZone : Word;
function AddLight( Color : TSDL_Color; Intensity : Integer; Radius : Longint; Flicker : TFlicker; X, Y, Z : Longint ) : Word;
function LineOfSight( X1, Y1, X2, Y2 : Longint ) : Boolean;
function LineOfCollision( X1, Y1, X2, Y2 : Longint ) : Boolean;
function GetItemIndex( Item : PItemInstanceInfo ) : word;
function GetItemAddress( Index : word ) : PItemInstanceInfo;
procedure SaveMapKnownInfo( Stream : TStream );
procedure LoadMapKnownInfo( Stream : TStream );
procedure SaveToStream( Stream : TStream );
procedure LoadFromStream( Stream : TStream );
property ItemCount : word read LastItem;
property ColorMatch : word read GetColorMatch;
published
property Width : Longint read FWidth write SetWidth default 10;
property Height : Longint read FHeight write SetHeight default 20;
property TileSize : Word read FTileSize write SetTileSize default 4;
property TransparentColor : TSDL_Color read FTransparentColor write SetTransparentColor;
property AmbientIntensity : Integer read FAmbientIntensity write SetAmbientIntensity;
property AmbientColor : TSDL_Color read FAmbientColor write SetAmbientColor;
property UseLighting : Boolean read FUseLighting write FUseLighting;
property UseAmbientOnly : Boolean read FUseAmbientOnly write FUseAmbientOnly;
property ZoneCount : word read GetZoneCount;
end;
TSubMap = class( TAniMap )
public
X1, Y1 : Longint;
X2, Y2 : Longint;
Visible : Boolean;
end;
implementation
uses
Zone;
constructor TAniMap.Create;
var
GridSize, i : Longint;
GridLoc : ^GridInfo;
NewZone : TZone;
begin
inherited;
FWidth := 10;
FHeight := 20;
FTileSize := 4;
TileWidth := FTileSize * 16;
TileHeight := FTileSize * 8;
BitWidth := FWidth * TileWidth;
BitHeight := FHeight * TileHeight;
StripWidth := TileWidth shr 2;
StripHeight := TileHeight shr 2;
// clFuchsia
FTransparentColor.r := 0;
FTransparentColor.g := 255;
FTransparentColor.b := 255;
NeedColorMatch := true;
if ( FWidth > 0 ) and ( FHeight > 0 ) then
begin
GridSize := FWidth * FHeight;
// TODO : FMapData := GlobalAlloc( GPTR, GridSize * SizeOf( GridInfo ) );
// TODO : GridLoc := GlobalLock( FMapData );
for i := 1 to GridSize do
begin
GridLoc^.Tile[ 0 ] := $FFFF;
GridLoc^.Tile[ 1 ] := $FFFF;
Inc( GridLoc );
end;
// TODO : GlobalUnlock( FMapData );
end;
Zones := TList.Create;
NewZone := TZone.Create( Self );
Zones.Add( NewZone );
end;
destructor TAniMap.Destroy;
var
i : Integer;
begin
// if not (csDesigning in ComponentState) then begin
if ( FMapData <> 0 ) then
begin
// TODO : GlobalFree( FMapData );
FMapData := 0;
end;
for i := 0 to Zones.Count - 1 do
TZone( Zones.Items[ i ] ).Free;
Zones.Free;
// end;
inherited Destroy;
end;
procedure TAniMap.SaveToStream( Stream : TStream );
var
GridLoc : ^GridInfo;
MemSize : longint;
begin
Stream.write( FirstItem, sizeof( FirstItem ) );
Stream.write( LastItem, sizeof( LastItem ) );
Stream.write( ItemList[ 1 ], LastItem * sizeof( ItemInstanceInfo ) );
Stream.write( FWidth, sizeof( FWidth ) );
Stream.write( FHeight, sizeof( FHeight ) );
MemSize := FWidth * FHeight * sizeof( GridInfo );
// TODO : GridLoc := GlobalLock( FMapData );
Stream.write( GridLoc^, MemSize );
end;
procedure TAniMap.LoadFromStream( Stream : TStream );
var
GridLoc : ^GridInfo;
MemSize : longint;
begin
Stream.read( FirstItem, sizeof( FirstItem ) );
Stream.read( LastItem, sizeof( LastItem ) );
Stream.read( ItemList[ 1 ], LastItem * sizeof( ItemInstanceInfo ) );
Stream.read( FWidth, sizeof( FWidth ) );
Stream.read( FHeight, sizeof( FHeight ) );
BitWidth := FWidth * TileWidth;
BitHeight := FHeight * TileHeight;
MemSize := FWidth * FHeight * sizeof( GridInfo );
if ( FMapData <> 0 ) then
begin
// TODO : GlobalFree( FMapData );
FMapData := 0;
end;
// TODO : FMapData := GlobalAlloc( GMEM_FIXED, MemSize );
// TODO : GridLoc := GlobalLock( FMapData );
Stream.read( GridLoc^, MemSize );
end;
function TAniMap.GetItemIndex( Item : PItemInstanceInfo ) : word;
begin
result := 1 + ( longword( Item ) - longword( @ItemList[ 1 ] ) ) div sizeof( ItemInstanceInfo );
end;
function TAniMap.GetItemAddress( Index : word ) : PItemInstanceInfo;
begin
result := @ItemList[ Index ];
end;
procedure TAniMap.FreeResources;
var
i : Integer;
begin
for i := 0 to Zones.Count - 1 do
begin
TZone( Zones.Items[ i ] ).TileImages := nil;
TZone( Zones.Items[ i ] ).ItemImages := nil;
TZone( Zones.Items[ i ] ).Cached := False;
TZone( Zones.Items[ i ] ).TileBitWidth := 0;
TZone( Zones.Items[ i ] ).TileBitHeight := 0;
TZone( Zones.Items[ i ] ).TileMaxIndex := 0;
TZone( Zones.Items[ i ] ).TileMaxColumnIndex := 0;
TZone( Zones.Items[ i ] ).ItemBitWidth := 0;
TZone( Zones.Items[ i ] ).ItemBitHeight := 0;
TZone( Zones.Items[ i ] ).ItemColumn := 0;
TZone( Zones.Items[ i ] ).ItemColumnBitHeight := 0;
end;
end;
procedure TAniMap.FreeDefinitions;
var
i : Integer;
begin
for i := 0 to Zones.Count - 1 do
begin
TZone( Zones.Items[ i ] ).DisposeDef;
end;
end;
procedure TAniMap.Clear;
var
i : Longint;
// GridSize: longint;
// GridLoc: ^GridInfo;
NewZone : TZone;
begin
if ( FMapData <> 0 ) then
begin
// TODO : GlobalFree( FMapData );
FMapData := 0;
{ if (FWidth > 0) and (FHeight > 0) then begin
GridSize := FWidth * FHeight;
GridLoc := GlobalLock(FMapData);
for i := 1 to GridSize do begin
GridLoc^.Tile[0] := $FFFF;
GridLoc^.Tile[1] := $FFFF;
GridLoc^.CollisionMask := 0;
GridLoc^.LineOfSightMask := 0;
GridLoc^.Figure := nil;
Inc(GridLoc);
end;
GlobalUnlock(FMapData);
end; }
end;
FreeResources;
for i := 0 to Zones.count - 1 do
TZone( Zones.items[ i ] ).free;
Zones.Clear;
NewZone := TZone.Create( Self );
Zones.Add( NewZone );
FirstItem := 0;
LastItem := 0;
end;
procedure TAniMap.SetWidth( VWidth : Longint );
var
i, GridSize : Longint;
GridLoc : ^GridInfo;
begin
FWidth := VWidth;
BitWidth := FWidth * TileWidth;
if ( FMapData <> 0 ) then
begin
// TODO : GlobalFree( FMapData );
FMapData := 0;
end;
if ( FWidth > 0 ) and ( FHeight > 0 ) then
begin
GridSize := FWidth * FHeight;
// TODO : FMapData := GlobalAlloc( GPTR, GridSize * SizeOf( GridInfo ) );
// TODO : GridLoc := GlobalLock( FMapData );
for i := 1 to GridSize do
begin
GridLoc^.Tile[ 0 ] := $FFFF;
GridLoc^.Tile[ 1 ] := $FFFF;
Inc( GridLoc );
end;
// TODO : GlobalUnlock( FMapData );
end;
end;
procedure TAniMap.SetHeight( VHeight : Longint );
var
i, GridSize : Longint;
GridLoc : ^GridInfo;
begin
FHeight := VHeight;
BitHeight := FHeight * TileHeight;
if ( FMapData <> 0 ) then
begin
// TODO : GlobalFree( FMapData );
FMapData := 0;
end;
if ( FWidth > 0 ) and ( FHeight > 0 ) then
begin
GridSize := FWidth * FHeight;
// TODO : FMapData := GlobalAlloc( GPTR, GridSize * SizeOf( GridInfo ) );
// TODO : GridLoc := GlobalLock( FMapData );
for i := 1 to GridSize do
begin
GridLoc^.Tile[ 0 ] := $FFFF;
GridLoc^.Tile[ 1 ] := $FFFF;
Inc( GridLoc );
end;
// TODO : GlobalUnlock( FMapData );
end;
end;
procedure TAniMap.SetAmbientColor( Color : TSDL_Color );
begin
FAmbientColor.r := Color.r;
FAmbientColor.g := Color.g;
FAmbientColor.b := Color.b;
LightR := ( FAmbientColor.r ) * ( FAmbientIntensity / 100 );
LightG := ( ( FAmbientColor.g ) shr 8 ) * ( FAmbientIntensity / 100 );
LightB := ( ( FAmbientColor.b ) shr 16 ) * ( FAmbientIntensity / 100 );
end;
procedure TAniMap.SetAmbientIntensity( Value : Integer );
begin
FAmbientIntensity := Value;
LightR := round( ( FAmbientColor.r ) * ( FAmbientIntensity / 100 ) );
LightG := round( ( ( FAmbientColor.g ) shr 8 ) * ( FAmbientIntensity / 100 ) );
LightB := round( ( ( FAmbientColor.b ) shr 16 ) * ( FAmbientIntensity / 100 ) );
end;
function TAniMap.GetZoneMemoryUsage( Index : integer ) : longint;
begin
with TZone( Zones.items[ Index ] ) do
begin
result := ItemBitWidth * ItemBitHeight + TileBitWidth * TileBitHeight;
//Log.Log(inttostr(FItemBitWidth)+'x'+inttostr(FitemBitHeight));
end;
end;
procedure TAniMap.MoveZoneToVideo( Index : integer );
begin
if not ( TZone( Zones.items[ Index ] ).TilesInVideo and TZone( Zones.items[ Index ] ).ItemsInVideo ) then
TZone( Zones.items[ Index ] ).MoveToVideo;
end;
function TAniMap.GetZoneCount : word;
begin
result := Zones.count;
end;
procedure TAniMap.SetTransparentColor( Color : TSDL_Color );
begin
FTransparentColor := Color;
// TODO : FColorMatch := FindColorMatch( Color );
NeedColorMatch := false;
end;
function TAniMap.GetColorMatch : word;
begin
if NeedColorMatch then
begin
// TODO FColorMatch := FindColorMatch( FTransparentColor );
NeedColorMatch := false;
end;
result := FColorMatch;
end;
function TAniMap.AddZone : Word;
var
NewZone : TZone;
begin
NewZone := TZone.Create( Self );
NewZone.Index := Zones.Add( NewZone );
Result := NewZone.Index;
end;
function TAniMap.AddLightZone : Word;
var
NewZone : TZone;
begin
NewZone := TLightZone.Create( Self );
NewZone.Index := Zones.Add( NewZone );
Result := NewZone.Index;
end;
function TAniMap.AddLight( Color : TSDL_Color; Intensity : Integer; Radius : Longint; Flicker : TFlicker; X, Y, Z : Longint ) : Word;
var
NewZone : TLightZone;
R2 : Longint;
begin
Result := 0;
if Radius <= 0 then
Exit;
NewZone := TLightZone.Create( Self );
NewZone.Color.r := Color.r;
NewZone.Color.g := Color.g;
NewZone.Color.b := Color.b;
NewZone.Intensity := Intensity;
NewZone.Radius := Radius;
NewZone.Flicker := Flicker;
NewZone.State := 1;
NewZone.X := X;
NewZone.Y := Y;
NewZone.Z := Z;
NewZone.Index := Zones.Add( NewZone );
NewZone.X1 := ( X - Radius ) div TileWidth;
if ( Radius mod TileWidth ) = 0 then
dec( NewZone.X1 );
if NewZone.X1 < 0 then
NewZone.X1 := 0;
NewZone.X2 := ( X + Radius ) div TileWidth;
if NewZone.X2 >= width then
NewZone.X2 := width - 1;
R2 := Radius div 2;
NewZone.Y1 := ( Y - R2 ) div TileHeight;
if ( R2 mod TileHeight ) = 0 then
dec( NewZone.Y1 );
if NewZone.Y1 < 0 then
NewZone.Y1 := 0;
NewZone.Y2 := ( Y + R2 ) div TileHeight;
if NewZone.Y2 >= Height then
NewZone.Y2 := Height - 1;
case NewZone.Flicker of
flCandle :
begin
NewZone.States := 4;
NewZone.FlickerX[ 1 ] := NewZone.X;
NewZone.FlickerY[ 1 ] := NewZone.Y;
NewZone.FlickerZ[ 1 ] := NewZone.Z;
NewZone.FlickerRadius[ 1 ] := NewZone.Radius;
NewZone.FlickerIntensity[ 1 ] := NewZone.Intensity;
NewZone.FlickerX[ 2 ] := NewZone.X + random( 5 ) - 2;
NewZone.FlickerY[ 2 ] := NewZone.Y + random( 5 ) - 2;
NewZone.FlickerZ[ 2 ] := NewZone.Z + random( 2 );
NewZone.FlickerRadius[ 2 ] := NewZone.Radius - 4;
NewZone.FlickerIntensity[ 2 ] := 15 * NewZone.Intensity div 16;
NewZone.FlickerX[ 3 ] := NewZone.X + random( 5 ) - 2;
NewZone.FlickerY[ 3 ] := NewZone.Y + random( 5 ) - 2;
NewZone.FlickerZ[ 3 ] := NewZone.Z + random( 4 );
NewZone.FlickerRadius[ 3 ] := NewZone.Radius - 8;
NewZone.FlickerIntensity[ 3 ] := 14 * NewZone.Intensity div 16;
NewZone.FlickerX[ 4 ] := NewZone.X + random( 5 ) - 2;
NewZone.FlickerY[ 4 ] := NewZone.Y + random( 5 ) - 2;
NewZone.FlickerZ[ 4 ] := NewZone.Z + random( 4 );
NewZone.FlickerRadius[ 4 ] := NewZone.Radius - 16;
NewZone.FlickerIntensity[ 4 ] := 13 * NewZone.Intensity div 16;
end;
flTorch :
begin
NewZone.States := 3;
NewZone.FlickerX[ 1 ] := NewZone.X;
NewZone.FlickerY[ 1 ] := NewZone.Y;
NewZone.FlickerZ[ 1 ] := NewZone.Z;
NewZone.FlickerRadius[ 1 ] := NewZone.Radius;
NewZone.FlickerIntensity[ 1 ] := NewZone.Intensity;
NewZone.FlickerX[ 2 ] := NewZone.X + random( 9 ) - 4;
NewZone.FlickerY[ 2 ] := NewZone.Y + random( 9 ) - 4;
NewZone.FlickerZ[ 2 ] := NewZone.Z + random( 4 );
NewZone.FlickerRadius[ 2 ] := NewZone.Radius - 8;
NewZone.FlickerIntensity[ 2 ] := 3 * NewZone.Intensity div 4;
NewZone.FlickerX[ 3 ] := NewZone.X + random( 9 ) - 4;
NewZone.FlickerY[ 3 ] := NewZone.Y + random( 9 ) - 4;
NewZone.FlickerZ[ 3 ] := NewZone.Z + random( 4 );
NewZone.FlickerRadius[ 3 ] := NewZone.Radius - 16;
NewZone.FlickerIntensity[ 3 ] := NewZone.Intensity div 2;
end;
flFluorescent :
begin
NewZone.States := 2;
NewZone.FlickerX[ 1 ] := NewZone.X;
NewZone.FlickerY[ 1 ] := NewZone.Y;
NewZone.FlickerZ[ 1 ] := NewZone.Z;
NewZone.FlickerRadius[ 1 ] := NewZone.Radius;
NewZone.FlickerIntensity[ 1 ] := NewZone.Intensity;
NewZone.FlickerX[ 2 ] := NewZone.X;
NewZone.FlickerY[ 2 ] := NewZone.Y;
NewZone.FlickerZ[ 2 ] := NewZone.Z;
NewZone.FlickerRadius[ 2 ] := NewZone.Radius;
NewZone.FlickerIntensity[ 2 ] := 0;
end;
flNone :
begin
NewZone.States := 1;
NewZone.FlickerX[ 1 ] := NewZone.X;
NewZone.FlickerY[ 1 ] := NewZone.Y;
NewZone.FlickerZ[ 1 ] := NewZone.Z;
NewZone.FlickerRadius[ 1 ] := NewZone.Radius;
NewZone.FlickerIntensity[ 1 ] := NewZone.Intensity;
end;
else
begin
NewZone.States := 1;
NewZone.FlickerX[ 1 ] := NewZone.X;
NewZone.FlickerY[ 1 ] := NewZone.Y;
NewZone.FlickerZ[ 1 ] := NewZone.Z;
NewZone.FlickerRadius[ 1 ] := NewZone.Radius;
NewZone.FlickerIntensity[ 1 ] := NewZone.Intensity;
end;
end;
Result := NewZone.Index;
end;
procedure TAniMap.SaveMapKnownInfo( Stream : TStream );
var
GridSize, i : Longint;
GridLoc : ^GridInfo;
Bits : longword;
begin
if ( FWidth > 0 ) and ( FHeight > 0 ) then
begin
GridSize := FWidth * FHeight;
// TODO : GridLoc := GlobalLock( FMapData );
Bits := 0;
for i := 1 to GridSize do
begin
Bits := Bits shl 1;
if ( GridLoc^.BitField and $40 ) <> 0 then
Bits := Bits or 1;
if ( i mod 32 ) = 0 then
begin
Stream.write( Bits, sizeof( Bits ) );
Bits := 0;
end;
Inc( GridLoc );
end;
// TODO : GlobalUnlock( FMapData );
end;
end;
procedure TAniMap.LoadMapKnownInfo( Stream : TStream );
var
GridSize, i : Longint;
GridLoc : ^GridInfo;
Bits : longword;
begin
if ( FWidth > 0 ) and ( FHeight > 0 ) then
begin
GridSize := FWidth * FHeight;
// TODO : GridLoc := GlobalLock( FMapData );
Bits := 0;
for i := 1 to GridSize do
begin
if ( i mod 32 ) = 1 then
begin
Stream.Read( Bits, sizeof( Bits ) );
end;
if ( Bits and $80000000 ) <> 0 then
GridLoc^.BitField := GridLoc^.BitField or $40;
Bits := Bits shl 1;
Inc( GridLoc );
end;
// TODO : GlobalUnlock( FMapData );
end;
end;
procedure TAniMap.RenderMap;
var
GridBase, p : ^GridInfo;
ZoneTile : TZone;
Index : Word;
tX, tY : word;
SrcX, SrcY : Longint;
X1, Y1, Z1 : longint;
X2, Y2 : Longint;
i, j, k, m : Longint;
RL, GL, BL : word;
R1, G1, B1 : word;
D : Double;
IL1 : integer;
Overlap, OverlapTile, LightZones : TList;
CurrentZone, Test : TLightZone;
Zone : Word;
CurrentIndex : Integer;
OVERLAPPED : Boolean;
X, Y : Longint;
NewTileIndex, ItemCount : Word;
HasLayer1 : Boolean;
Layer : Integer;
A, A1, A2, Slope : Single;
State : Integer;
ZoneX, ZoneY, ZoneZ : Longint;
ZoneIntensity : double;
ZoneRadius : Longint;
HalfWidth, HalfHeight : Integer;
SortedZones : TList;
ColorMatch : word;
DblColorMatch : longword;
// TODO : BltFx : TDDBLTFX;
// TODO : ddsd : TDDSurfaceDesc;
C16 : word;
p16 : ^word;
TempSurface : PSDL_Surface;
LightR1, LightG1, LightB1 : word;
Pitch : longint;
TimeCount : longword;
begin
if not UseLighting then
Exit;
LightR1 := round( LightR );
LightG1 := round( LightG );
LightB1 := round( LightB );
HalfWidth := TileWidth div 2;
HalfHeight := TileHeight div 2;
// TODO : GridBase := GlobalLock( FMapData );
{TransparentColor.r := FTransparentColor.r;
TransparentColor.g := FTransparentColor.g;
TransparentColor.b := FTransparentColor.b;}
ColorMatch := self.ColorMatch;
DblColorMatch := ColorMatch or ( DblColorMatch shl 16 );
if not FUseAmbientOnly then
begin
OverlapTile := TList.Create;
LightZones := TList.Create;
//Make sure flicker lighting is evaluated last
SortedZones := TList.create;
for Zone := 0 to Zones.Count - 1 do
begin
ZoneTile := Zones.Items[ Zone ];
if ZoneTile is TLightZone then
begin
if TLightZone( ZoneTile ).States = 1 then
SortedZones.add( ZoneTile );
end
else
SortedZones.add( ZoneTile );
end;
for Zone := 0 to Zones.Count - 1 do
begin
ZoneTile := Zones.Items[ Zone ];
if ZoneTile is TLightZone then
begin
if TLightZone( ZoneTile ).States > 1 then
SortedZones.add( ZoneTile );
end;
end;
//Apply lighting to tiles
// TODO : TimeCount := GetTickCount;
for Zone := 1 to SortedZones.Count - 1 do
begin
ZoneTile := SortedZones.Items[ Zone ];
if ZoneTile is TLightZone then
begin
CurrentZone := SortedZones.Items[ Zone ];
LightZones.Add( CurrentZone );
Overlap := TList.Create;
Overlap.Add( currentZone );
NewTileIndex := 0;
CurrentIndex := -1;
for i := 1 to SortedZones.Count - 1 do
begin
if ( i <> Zone ) then
begin
ZoneTile := SortedZones.Items[ i ];
if ZoneTile is TLightZone then
begin
Test := SortedZones.Items[ i ];
if ( Test.X1 <= CurrentZone.X2 ) and ( Test.X2 >= CurrentZone.X1 ) and
( Test.Y1 <= CurrentZone.Y2 ) and ( Test.Y2 > CurrentZone.Y1 ) then
begin
if i <= Zone then
CurrentIndex := Overlap.Add( Test )
else
Overlap.Add( Test );
end;
end;
end;
TLightZone( CurrentZone ).OverlapZones := Overlap;
end;
// TODO : TempSurface := DDGetSurface( lpDD, FTileWidth, FTileHeight, TransparentColor, false );
for State := 1 to CurrentZone.States do
begin
HasLayer1 := False;
for Layer := 0 to 1 do
begin
if ( Layer = 0 ) or ( ( Layer = 1 ) and HasLayer1 ) then
begin
for Y := CurrentZone.Y1 to CurrentZone.Y2 do
begin
p := GridBase;
Inc( p, Y * FWidth + CurrentZone.X1 );
for X := CurrentZone.X1 to CurrentZone.X2 do
begin
OverlapTile.Clear;
OVERLAPPED := False;
for i := 1 to Overlap.Count - 1 do
begin
Test := Overlap.Items[ i ];
if ( Test.X1 < X + 1 ) and ( Test.X2 >= X ) and
( Test.Y1 < Y + 1 ) and ( Test.Y2 >= Y ) then
begin
OverlapTile.Add( Test );
if i > CurrentIndex then
begin
OVERLAPPED := True;
Break;
end;
end;
end;
if not OVERLAPPED then
begin
HasLayer1 := HasLayer1 or ( p^.Tile[ 1 ] <> $FFFF );
if ( ( p^.BitField and $80 ) <> 0 ) then
HasLayer1 := HasLayer1 or ( p^.Tile[ 2 ] <> $FFFF ) or ( p^.Tile[ 3 ] <> $FFFF ) or ( p^.Tile[ 4 ] <> $FFFF );
Index := p^.Tile[ Layer ];
if ( Index <> $FFFF ) or ( ( ( p^.BitField and $80 ) <> 0 ) and ( Layer = 1 ) ) then
begin
OverlapTile.Add( CurrentZone );
ZoneTile := Zones.Items[ p^.Zone[ Layer ] ];
if ( ( ( p^.BitField and $80 ) <> 0 ) and ( Layer = 1 ) ) then
begin
// TODO : BltFx.dwSize := SizeOf( BltFx );
// TODO : BltFx.dwFillColor := ColorMatch;
// TODO : WrapperBlt( TempSurface, Rect( 0, 0, FTileWidth, FTileHeight ), nil, Rect( 0, 0, FTileWidth, FTileHeight ), DDBLT_COLORFILL + DDBLT_WAIT, BltFx );
if ( Index <> $FFFF ) then
begin
SrcX := ( Index div ZoneTile.TileMaxColumnIndex ) * TileWidth;
SrcY := ( Index mod ZoneTile.TileMaxColumnIndex ) * TileHeight + HalfHeight;
// TODO : WrapperBltFast( TempSurface, 0, 0, ZoneTile.FTileImages, Rect( SrcX, SrcY, SrcX + FTileWidth, SrcY + HalfHeight ), DDBLTFAST_SRCCOLORKEY or DDBLTFAST_WAIT );
end;
Index := p^.Tile[ 2 ];
if ( Index <> $FFFF ) then
begin
SrcX := ( Index div ZoneTile.TileMaxColumnIndex ) * TileWidth;
SrcY := ( Index mod ZoneTile.TileMaxColumnIndex ) * TileHeight;
ZoneTile := Zones.Items[ p^.Zone[ 2 ] ];
// TODO : WrapperBltFast( TempSurface, HalfWidth, 0, ZoneTile.FTileImages, Rect( SrcX, SrcY, SrcX + HalfWidth, SrcY + FTileHeight ), DDBLTFAST_SRCCOLORKEY or DDBLTFAST_WAIT );
end;
Index := p^.Tile[ 3 ];
if ( Index <> $FFFF ) then
begin
SrcX := ( Index div ZoneTile.TileMaxColumnIndex ) * TileWidth;
SrcY := ( Index mod ZoneTile.TileMaxColumnIndex ) * TileHeight;
ZoneTile := Zones.Items[ p^.Zone[ 3 ] ];
// TODO : WrapperBltFast( TempSurface, 0, HalfHeight, ZoneTile.FTileImages, Rect( SrcX, SrcY, SrcX + FTileWidth, SrcY + HalfHeight ), DDBLTFAST_SRCCOLORKEY or DDBLTFAST_WAIT );
end;
Index := p^.Tile[ 4 ];
if ( Index <> $FFFF ) then
begin
SrcX := ( Index div ZoneTile.TileMaxColumnIndex ) * TileWidth + HalfWidth;
SrcY := ( Index mod ZoneTile.TileMaxColumnIndex ) * TileHeight;
ZoneTile := Zones.Items[ p^.Zone[ 4 ] ];
// TODO : WrapperBltFast( TempSurface, 0, 0, ZoneTile.FTileImages, Rect( SrcX, SrcY, SrcX + HalfWidth, SrcY + FTileHeight ), DDBLTFAST_SRCCOLORKEY or DDBLTFAST_WAIT );
end;
end
else
begin
SrcX := ( Index div ZoneTile.TileMaxColumnIndex ) * TileWidth;
SrcY := ( Index mod ZoneTile.TileMaxColumnIndex ) * TileHeight;
// TODO : WrapperBltFast( TempSurface, 0, 0, ZoneTile.FTileImages, Rect( SrcX, SrcY, SrcX + FTileWidth, SrcY + FTileHeight ), DDBLTFAST_SRCCOLORKEY or DDBLTFAST_WAIT );
end;
//Render Tile
// TODO : ddsd.dwSize := SizeOf( ddsd );
// TODO : if TempSurface.Lock( nil, ddsd, DDLOCK_WAIT, 0 ) = DD_OK then
begin
try
for j := 0 to TileHeight - 1 do
begin
Y2 := j + Y * TileHeight;
// TODO : p16 := ddsd.lpSurface;
// TODO : inc( PChar( p16 ), j * ddsd.lPitch );
for i := 0 to TileWidth - 1 do
begin
X2 := i + X * TileWidth;
C16 := p16^;
if C16 <> ColorMatch then
begin
R1 := LightR1;
G1 := LightG1;
B1 := LightB1;
for k := 0 to OverlapTile.Count - 1 do
begin
Test := OverlapTile.Items[ k ];
if Test = CurrentZone then
begin
ZoneX := Test.FlickerX[ State ];
ZoneY := Test.FlickerY[ State ];
ZoneZ := Test.FlickerZ[ State ];
ZoneRadius := Test.FlickerRadius[ State ];
ZoneIntensity := Test.FlickerIntensity[ State ] / 100;
end
else
begin
ZoneX := Test.X;
ZoneY := Test.Y;
ZoneZ := Test.Z;
ZoneRadius := Test.Radius;
ZoneIntensity := Test.Intensity / 100;
end;
if ZoneIntensity > 0 then
begin
RL := Test.Color.r;
GL := Test.Color.g shr 8;
BL := Test.Color.b shr 16;
X1 := sqr( ZoneX - X2 );
Y1 := sqr( ( ZoneY - Y2 ) * 2 );
Z1 := sqr( ZoneZ );
D := sqrt( X1 + Y1 + Z1 ) / ZoneRadius;
if D <= 1 then
begin
if LineOfCollision( ZoneX, ZoneY, X2, Y2 ) then
begin
IL1 := trunc( ( 1 - D ) * ZoneIntensity * 256 );
inc( R1, ( IL1 * RL ) shr 8 );
inc( G1, ( IL1 * GL ) shr 8 );
inc( B1, ( IL1 * BL ) shr 8 );
end;
end;
end;
end;
if ( R1 <> $FF ) or ( G1 <> $FF ) or ( B1 <> $FF ) then
begin
// TODO :
{if PixelFormat = pf555 then
asm
push EBX
mov BX,C16
mov AL,BL
and EAX,$1F
mul B1
test EAX,$FFFFE000
jz @@StoreBlue
mov CX,$1F
jmp @@Green
@@StoreBlue:
shr AX,8
mov CX,AX
@@Green:
mov AX,BX
shr AX,5
and EAX,$1F //*
mul G1
test EAX,$FFFFE000 //*
jz @@StoreGreen
or CX,$3E0 //*
jmp @@Red
@@StoreGreen:
shr AX,3 //*
and AX,$3E0 //*
or CX,AX
@@Red:
xor EAX,EAX
mov AH,BH
shr AX,10 //*
mul R1
test EAX,$FFFFE000
jz @@StoreRed
or CH,$F8
jmp @@Continue
@@StoreRed:
shl AH,2 //*
or CH,AH
@@Continue:
mov EAX,p16
mov [EAX],CX
pop EBX
end
else
asm
push EBX
mov BX,C16
mov AL,BL
and EAX,$1F
mul B1
test EAX,$FFFFE000
jz @@StoreBlue
mov CX,$1F
jmp @@Green
@@StoreBlue:
shr AX,8
mov CX,AX
@@Green:
mov AX,BX
shr AX,5
and EAX,$3F //*
mul G1
test EAX,$FFFFC000 //*
jz @@StoreGreen
or CX,$7E0 //*
jmp @@Red
@@StoreGreen:
shr AX,3 //*
and AX,$7E0 //*
or CX,AX
@@Red:
xor EAX,EAX
mov AH,BH
shr AX,11 //*
mul R1
test EAX,$FFFFE000
jz @@StoreRed
or CH,$F8
jmp @@Continue
@@StoreRed:
shl AH,3 //*
or CH,AH
@@Continue:
mov EAX,p16
mov [EAX],CX
pop EBX
end;}
end;
end;
inc( p16 );
end;
end;
finally
// TODO : TempSurface.UnLock( nil );
end;
end;
if ( State = CurrentZone.States ) then
begin //only update grid on last state
p^.Zone[ Layer ] := CurrentZone.Index;
p^.Tile[ Layer ] := NewTileIndex;
if ( Layer = 1 ) then
p^.BitField := p^.BitField and $7F; //This is no longer a diamond tile
end;
Inc( NewTileIndex );
CurrentZone.DefineTile( NewTileIndex, TempSurface, FTransparentColor );
end;
end;
Inc( p );
end; //X
end; //Y
end; //Has layer
end; //Layer loop
CurrentZone.NewTileState;
end; //State loop
TempSurface := nil;
end;
end;
// TODO : GlobalUnlock( FMapData );
SortedZones.free;
// TODO : TimeCount := GetTickCount - TimeCount;
//Apply lighting to items
// TODO : TimeCount := GetTickCount;
ItemCount := 0;
m := StripWidth div 2;
if ( LightZones.Count > 0 ) then
begin
for State := 1 to MaxLightStates do
begin
i := FirstItem;
while ( i <> 0 ) do
begin
ZoneTile := Zones.Items[ ItemList[ i ].Zone ];
X := ItemList[ i ].X div TileWidth;
Y := ItemList[ i ].Y div TileHeight;
OverlapTile.Clear;
for j := 0 to LightZones.Count - 1 do
begin
Test := LightZones[ j ];
if Test.States >= State then
begin
if ( X >= Test.X1 ) and ( X <= Test.X2 ) and
( Y >= Test.Y1 ) and ( Y <= Test.Y2 ) then
begin
OverlapTile.Add( Test );
end;
end;
end;
if OverlapTile.Count > 0 then
begin
Zone := TZone( OverlapTile[ OverlapTile.Count - 1 ] ).Index;
// TODO :
{TempSurface := DDGetSurface( lpDD, FStripWidth, ItemList[ i ].Height, TransparentColor, false );
WrapperBltFast( TempSurface, 0, 0, ZoneTile.FItemImages,
Rect( ItemList[ i ].ImageX, ItemList[ i ].ImageY, ItemList[ i ].ImageX + FStripWidth,
ItemList[ i ].ImageY + ItemList[ i ].Height ), DDBLTFAST_SRCCOLORKEY or DDBLTFAST_WAIT );
ddsd.dwSize := SizeOf( ddsd );
if TempSurface.Lock( nil, ddsd, DDLOCK_WAIT, 0 ) = DD_OK then
begin
try
for X := 0 to FStripWidth - 1 do
begin
X2 := ItemList[ i ].X + X;
if ( X = 0 ) then
begin
Slope := ItemList[ i ].Slope1;
A := ArcTan( Slope );
if ( Slope > 0 ) then
begin
A2 := A;
A1 := A + PI;
end
else
begin
A2 := 2 * PI + A;
A1 := A2 - PI;
end;
end
else if ( X = m ) then
begin
Slope := ItemList[ i ].Slope2;
A := ArcTan( Slope );
if ( Slope > 0 ) then
begin
A2 := A;
A1 := A + PI;
end
else
begin
A2 := 2 * PI + A;
A1 := A2 - PI;
end;
end;
p16 := ddsd.lpSurface;
inc( p16, X );
if ItemList[ i ].Vertical then
Y2 := ItemList[ i ].Y + Round( ( X - m ) * Slope ) //If vertical, Y2 remains constant
else //so only calculate once
Y2 := 0;
for Y := 0 to ItemList[ i ].Height - 1 do
begin
if not ItemList[ i ].Vertical then
Y2 := ItemList[ i ].Y - ItemList[ i ].VHeight + Y;
C16 := p16^;
if C16 <> ColorMatch then
begin
R1 := LightR1;
G1 := LightG1;
B1 := LightB1;
for j := 0 to OverlapTile.Count - 1 do
begin
Test := OverlapTile.Items[ j ];
if Test = Zones.Items[ Zone ] then
begin
ZoneX := Test.FlickerX[ State ];
ZoneY := Test.FlickerY[ State ];
ZoneZ := Test.FlickerZ[ State ];
ZoneRadius := Test.FlickerRadius[ State ];
ZoneIntensity := Test.FlickerIntensity[ State ] / 100;
end
else
begin
ZoneX := Test.X;
ZoneY := Test.Y;
ZoneZ := Test.Z;
ZoneRadius := Test.Radius;
ZoneIntensity := Test.Intensity / 100;
end;
if ZoneIntensity > 0 then
begin
A := ATan( X2 - ZoneX, Y2 - ZoneY );
if ( ( A2 >= A1 ) and ( ( A > A1 ) and ( A < A2 ) ) ) or ( ( A2 < A1 ) and ( ( A < A2 ) or ( A > A1 ) ) ) then
begin
RL := Test.Color and $FF;
GL := Test.Color and $FF00 shr 8;
BL := Test.Color and $FF0000 shr 16;
X1 := sqr( ZoneX - X2 );
Y1 := sqr( ( ZoneY - Y2 ) * 2 );
if ItemList[ i ].Vertical then
Z1 := sqr( Y2 - ItemList[ i ].Y + ItemList[ i ].VHeight - Y - ZoneZ - 1 )
else
Z1 := sqr( ZoneZ );
D := sqrt( X1 + Y1 + Z1 ) / ZoneRadius;
if D <= 1 then
begin
if LineOfCollision( ZoneX, ZoneY, X2, Y2 + 4 ) then
begin
IL1 := trunc( ( 1 - D ) * ZoneIntensity * 256 );
inc( R1, ( IL1 * RL ) shr 8 );
inc( G1, ( IL1 * GL ) shr 8 );
inc( B1, ( IL1 * BL ) shr 8 );
end;
end;
end;
end;
end;
if ( R1 <> $FF ) or ( G1 <> $FF ) or ( B1 <> $FF ) then
begin
if PixelFormat = pf555 then
asm
push EBX
mov BX,C16
mov AL,BL
and EAX,$1F
mul B1
test EAX,$FFFFE000
jz @@StoreBlue
mov CX,$1F
jmp @@Green
@@StoreBlue:
shr AX,8
mov CX,AX
@@Green:
mov AX,BX
shr AX,5
and EAX,$1F //*
mul G1
test EAX,$FFFFE000 //*
jz @@StoreGreen
or CX,$3E0 //*
jmp @@Red
@@StoreGreen:
shr AX,3 //*
and AX,$3E0 //*
or CX,AX
@@Red:
xor EAX,EAX
mov AH,BH
shr AX,10 //*
mul R1
test EAX,$FFFFE000
jz @@StoreRed
or CH,$F8
jmp @@Continue
@@StoreRed:
shl AH,2 //*
or CH,AH
@@Continue:
mov EAX,p16
mov [EAX],CX
pop EBX
end
else
asm
push EBX
mov BX,C16
mov AL,BL
and EAX,$1F
mul B1
test EAX,$FFFFE000
jz @@StoreBlue
mov CX,$1F
jmp @@Green
@@StoreBlue:
shr AX,8
mov CX,AX
@@Green:
mov AX,BX
shr AX,5
and EAX,$3F //*
mul G1
test EAX,$FFFFC000 //*
jz @@StoreGreen
or CX,$7E0 //*
jmp @@Red
@@StoreGreen:
shr AX,3 //*
and AX,$7E0 //*
or CX,AX
@@Red:
xor EAX,EAX
mov AH,BH
shr AX,11 //*
mul R1
test EAX,$FFFFE000
jz @@StoreRed
or CH,$F8
jmp @@Continue
@@StoreRed:
shl AH,3 //*
or CH,AH
@@Continue:
mov EAX,p16
mov [EAX],CX
pop EBX
end;
end;
end;
inc( PChar( p16 ), ddsd.lPitch );
end;
end;
finally
TempSurface.UnLock( nil );
end;
end;}
if ( State = TLightZone( Zones.Items[ Zone ] ).States ) then
begin
TLightZone( Zones[ Zone ] ).AddStrip( TempSurface, ItemList[ i ].ImageX, ItemList[ i ].ImageY );
ItemList[ i ].Zone := Zone;
end
else
begin
TLightZone( Zones[ Zone ] ).AddStrip( TempSurface, tX, tY );
end;
Inc( ItemCount );
TempSurface := nil;
end;
i := ItemList[ i ].Next;
end;
for j := 0 to LightZones.Count - 1 do
begin
Test := LightZones[ j ];
if Test.States >= State then
begin
Test.NewItemState;
end;
end;
end;
end;
OverlapTile.Free;
// TODO : TimeCount := GetTickCount - TimeCount;
//Construct item list for all light zones
if LightZones.Count > 0 then
begin
i := FirstItem;
while ( i <> 0 ) do
begin
ZoneTile := Zones.Items[ ItemList[ i ].Zone ];
if ZoneTile is TLightZone then
begin
Test := TLightZone( ZoneTile );
if not Assigned( Test.Items ) then
Test.Items := TList.Create;
Test.Items.Add( @ItemList[ i ] );
end;
i := ItemList[ i ].Next;
end;
end;
end;
if ( LightR <> $FF ) or ( LightG <> $FF ) or ( LightB <> $FF ) then
begin
//Render ambient color in all zones
// TODO : TimeCount := GetTickCount;
for Zone := 0 to Zones.Count - 1 do
begin
ZoneTile := Zones.Items[ Zone ];
if not ( ZoneTile is TLightZone ) then
begin
//Do tiles first
if Assigned( ZoneTile.TileImages ) then
begin
// TODO :
{ddsd.dwSize := SizeOf( ddsd );
if ZoneTile.TileImages.Lock( nil, ddsd, DDLOCK_WAIT, 0 ) = DD_OK then
begin
try
j := ZoneTile.FTileBitHeight;
i := ZoneTile.FTileBitWidth;
p16 := ddsd.lpSurface;
Pitch := ddsd.lPitch;
if ( i > 0 ) and ( j > 0 ) then
begin
if PixelFormat = pf555 then
asm
push EBX
push ESI
push EDI
mov ECX,j
@@OuterLoop:
push ECX
dec ECX
mov EAX,Pitch
mul ECX
mov ESI,p16
add ESI,EAX
mov EDI,i
@@InnerLoop:
mov EBX,[ESI]
cmp EBX,DblColorMatch
je @@Next2
mov ECX,EBX
cmp BX,ColorMatch
je @@Next1
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue1
mov CX,$1F
jmp @@Green1
@@StoreBlue1:
shr AX,8
mov CX,AX
@@Green1:
mov AX,BX
shr AX,5
and EAX,$1F //*
mul LightG1
test EAX,$FFFFE000 //*
jz @@StoreGreen1
or CX,$3E0 //*
jmp @@Red1
@@StoreGreen1:
shr AX,3 //*
and AX,$3E0 //*
or CX,AX
@@Red1:
xor EAX,EAX
mov AH,BH
shr AX,10 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed1
or CH,$F8
jmp @@Next1
@@StoreRed1:
shl AH,2 //*
or CH,AH
@@Next1:
rol ECX,16
rol EBX,16
cmp BX,ColorMatch
je @@Continue
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue2
mov CX,$1F
jmp @@Green2
@@StoreBlue2:
shr AX,8
mov CX,AX
@@Green2:
mov AX,BX
shr AX,5
and EAX,$1F //*
mul LightG1
test EAX,$FFFFE000 //*
jz @@StoreGreen2
or CX,$3E0 //*
jmp @@Red2
@@StoreGreen2:
shr AX,3 //*
and AX,$3E0 //*
or CX,AX
@@Red2:
xor EAX,EAX
mov AH,BH
shr AX,10 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed2
or CH,$F8
jmp @@Continue
@@StoreRed2:
shl AH,2 //*
or CH,AH
@@Continue:
ror ECX,16
mov [ESI],ECX
@@Next2:
add ESI,4
sub EDI,2
jnz @@InnerLoop
pop ECX
dec ECX
jnz @@OuterLoop
pop EDI
pop ESI
pop EBX
end
else
asm
push EBX
push ESI
push EDI
mov ECX,j
@@OuterLoop:
push ECX
dec ECX
mov EAX,Pitch
mul ECX
mov ESI,p16
add ESI,EAX
mov EDI,i
@@InnerLoop:
mov EBX,[ESI]
cmp EBX,DblColorMatch
je @@Next2
mov ECX,EBX
cmp BX,ColorMatch
je @@Next1
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue1
mov CX,$1F
jmp @@Green1
@@StoreBlue1:
shr AX,8
mov CX,AX
@@Green1:
mov AX,BX
shr AX,5
and EAX,$3F //*
mul LightG1
test EAX,$FFFFC000 //*
jz @@StoreGreen1
or CX,$7E0 //*
jmp @@Red1
@@StoreGreen1:
shr AX,3 //*
and AX,$7E0 //*
or CX,AX
@@Red1:
xor EAX,EAX
mov AH,BH
shr AX,11 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed1
or CH,$F8
jmp @@Next1
@@StoreRed1:
shl AH,3 //*
or CH,AH
@@Next1:
rol ECX,16
rol EBX,16
cmp BX,ColorMatch
je @@Continue
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue2
mov CX,$1F
jmp @@Green2
@@StoreBlue2:
shr AX,8
mov CX,AX
@@Green2:
mov AX,BX
shr AX,5
and EAX,$3F //*
mul LightG1
test EAX,$FFFFC000 //*
jz @@StoreGreen2
or CX,$7E0 //*
jmp @@Red2
@@StoreGreen2:
shr AX,3 //*
and AX,$7E0 //*
or CX,AX
@@Red2:
xor EAX,EAX
mov AH,BH
shr AX,11 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed2
or CH,$F8
jmp @@Continue
@@StoreRed2:
shl AH,3 //*
or CH,AH
@@Continue:
ror ECX,16
mov [ESI],ECX
@@Next2:
add ESI,4
sub EDI,2
jnz @@InnerLoop
pop ECX
dec ECX
jnz @@OuterLoop
pop EDI
pop ESI
pop EBX
end;
end;
finally
ZoneTile.FTileImages.UnLock( nil );
end;
end;}
end;
//Do Items
if Assigned( ZoneTile.ItemImages ) then
begin
// TODO :
{ddsd.dwSize := SizeOf( ddsd );
if ZoneTile.FItemImages.Lock( nil, ddsd, DDLOCK_WAIT, 0 ) = DD_OK then
begin
try
j := ZoneTile.FItemBitHeight;
i := ZoneTile.FItemBitWidth;
p16 := ddsd.lpSurface;
Pitch := ddsd.lPitch;
if ( i > 0 ) and ( j > 0 ) then
begin
if PixelFormat = pf555 then
asm
push EBX
push ESI
push EDI
mov ECX,j
@@OuterLoop:
push ECX
dec ECX
mov EAX,Pitch
mul ECX
mov ESI,p16
add ESI,EAX
mov EDI,i
@@InnerLoop:
mov EBX,[ESI]
cmp EBX,DblColorMatch
je @@Next2
mov ECX,EBX
cmp BX,ColorMatch
je @@Next1
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue1
mov CX,$1F
jmp @@Green1
@@StoreBlue1:
shr AX,8
mov CX,AX
@@Green1:
mov AX,BX
shr AX,5
and EAX,$1F //*
mul LightG1
test EAX,$FFFFE000 //*
jz @@StoreGreen1
or CX,$3E0 //*
jmp @@Red1
@@StoreGreen1:
shr AX,3 //*
and AX,$3E0 //*
or CX,AX
@@Red1:
xor EAX,EAX
mov AH,BH
shr AX,10 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed1
or CH,$F8
jmp @@Next1
@@StoreRed1:
shl AH,2 //*
or CH,AH
@@Next1:
rol ECX,16
rol EBX,16
cmp BX,ColorMatch
je @@Continue
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue2
mov CX,$1F
jmp @@Green2
@@StoreBlue2:
shr AX,8
mov CX,AX
@@Green2:
mov AX,BX
shr AX,5
and EAX,$1F //*
mul LightG1
test EAX,$FFFFE000 //*
jz @@StoreGreen2
or CX,$3E0 //*
jmp @@Red2
@@StoreGreen2:
shr AX,3 //*
and AX,$3E0 //*
or CX,AX
@@Red2:
xor EAX,EAX
mov AH,BH
shr AX,10 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed2
or CH,$F8
jmp @@Continue
@@StoreRed2:
shl AH,2 //*
or CH,AH
@@Continue:
ror ECX,16
mov [ESI],ECX
@@Next2:
add ESI,4
sub EDI,2
jnz @@InnerLoop
pop ECX
dec ECX
jnz @@OuterLoop
pop EDI
pop ESI
pop EBX
end
else
asm
push EBX
push ESI
push EDI
mov ECX,j
@@OuterLoop:
push ECX
dec ECX
mov EAX,Pitch
mul ECX
mov ESI,p16
add ESI,EAX
mov EDI,i
@@InnerLoop:
mov EBX,[ESI]
cmp EBX,DblColorMatch
je @@Next2
mov ECX,EBX
cmp BX,ColorMatch
je @@Next1
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue1
mov CX,$1F
jmp @@Green1
@@StoreBlue1:
shr AX,8
mov CX,AX
@@Green1:
mov AX,BX
shr AX,5
and EAX,$3F //*
mul LightG1
test EAX,$FFFFC000 //*
jz @@StoreGreen1
or CX,$7E0 //*
jmp @@Red1
@@StoreGreen1:
shr AX,3 //*
and AX,$7E0 //*
or CX,AX
@@Red1:
xor EAX,EAX
mov AH,BH
shr AX,11 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed1
or CH,$F8
jmp @@Next1
@@StoreRed1:
shl AH,3 //*
or CH,AH
@@Next1:
rol ECX,16
rol EBX,16
cmp BX,ColorMatch
je @@Continue
mov AL,BL
and EAX,$1F
mul LightB1
test EAX,$FFFFE000
jz @@StoreBlue2
mov CX,$1F
jmp @@Green2
@@StoreBlue2:
shr AX,8
mov CX,AX
@@Green2:
mov AX,BX
shr AX,5
and EAX,$3F //*
mul LightG1
test EAX,$FFFFC000 //*
jz @@StoreGreen2
or CX,$7E0 //*
jmp @@Red2
@@StoreGreen2:
shr AX,3 //*
and AX,$7E0 //*
or CX,AX
@@Red2:
xor EAX,EAX
mov AH,BH
shr AX,11 //*
mul LightR1
test EAX,$FFFFE000
jz @@StoreRed2
or CH,$F8
jmp @@Continue
@@StoreRed2:
shl AH,3 //*
or CH,AH
@@Continue:
ror ECX,16
mov [ESI],ECX
@@Next2:
add ESI,4
sub EDI,2
jnz @@InnerLoop
pop ECX
dec ECX
jnz @@OuterLoop
pop EDI
pop ESI
pop EBX
end;
end;
finally
ZoneTile.FItemImages.UnLock( nil );
end;
end;}
end;
end;
end;
// TODO : TimeCount := GetTickCount - TimeCount;
end;
if not FUseAmbientOnly then
begin
//Update flickering light zone items such that they can be updated correctly without
//re-rendering the entire map.
for i := 0 to LightZones.Count - 1 do
begin
Test := LightZones[ i ];
Test.State := Test.States;
if ( Test.Flicker <> flNone ) then
begin
Test.MoveToVideo;
Test.FullRefresh := Test.TilesInVideo and Test.ItemsInVideo;
end;
end;
LightZones.Free;
end;
end;
function TAniMap.LineOfSight( X1, Y1, X2, Y2 : Longint ) : Boolean;
var
GridBase, p : ^GridInfo;
i, i1, i2 : Longint;
j, k : Longint;
Dx, dy : Longint;
X, Y : Longint;
sX, sY, s : Longint;
R : Double;
Offset : Longint;
Mask : Word;
W, H : Integer;
a, a2 : Double;
b, b2 : Double;
c2 : Double;
d2 : Double;
R2 : Double;
Pass : Boolean;
StripX, StripY : Longint;
begin
//This routine does not check for visibility within the starting tile.
//To do so would cause a number of special cases and would slow performance.
//Frankly, if you're standing in the same tile visibilty should not be a problem anyway.
// TODO : GridBase := GlobalLock( FMapDAta );
Dx := X2 - X1;
dy := Y2 - Y1;
W := StripWidth div 2;
H := StripHeight div 2;
StripX := ( X2 div StripWidth ) * StripWidth + W;
StripY := ( Y2 div StripHeight ) * StripHeight + H;
R2 := sqr( W );
if ( Dx <> 0 ) then
begin
if ( X1 < X2 ) then
begin
i1 := X1 div TileWidth + 1;
i2 := X2 div TileWidth;
Offset := 0;
end
else
begin
i1 := X2 div TileWidth + 1;
i2 := X1 div TileWidth;
Offset := -1;
end;
X := i1 * TileWidth;
for i := i1 to i2 do
begin
R := ( X - X1 ) / Dx;
Y := Y1 + Round( R * dy );
j := Y div TileHeight;
if ( Y mod TileHeight ) = 0 then
if ( Y2 < Y1 ) then
Dec( j );
if j >= 0 then
begin
p := GridBase;
Inc( p, j * FWidth + i + Offset );
if ( p^.LineOfSightMask <> 0 ) then
begin
k := j * TileHeight;
Mask := p^.LineOfSightMask;
for s := 0 to 15 do
begin
if ( Mask and 1 ) = 1 then
begin
sX := X + ( s mod 4 ) * StripWidth + W + Offset * TileWidth;
if ( Offset < 0 ) then
Pass := ( sX > X2 )
else
Pass := ( sX <= X2 );
if Pass then
begin
sY := k + ( 3 - ( s div 4 ) ) * StripHeight + H;
if ( Y2 < Y1 ) then
Pass := sY > Y2 - H
else
Pass := sY <= Y2 + H;
if Pass then
begin
if ( sX <> StripX ) or ( sY <> StripY ) then
begin
if Dx = 0 then
begin
d2 := sqr( X2 - sX );
end
else if dy = 0 then
begin
d2 := sqr( 2 * ( Y2 - sY ) );
end
else
begin
a := 2 * ( sY - ( dy * ( sX - X1 ) / Dx + Y1 ) );
b := sX - ( Dx * ( sY - Y1 ) / dy + X1 );
a2 := sqr( a );
b2 := sqr( b );
c2 := a2 + b2;
if c2 = 0 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
d2 := a2 * b2 / c2;
end;
if d2 <= r2 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
end;
end;
end;
end;
Mask := Mask shr 1;
end;
end;
end;
Inc( X, TileWidth );
end;
end;
if ( dy <> 0 ) then
begin
if ( Y1 < Y2 ) then
begin
i1 := Y1 div TileHeight + 1;
i2 := Y2 div TileHeight;
Offset := 0;
end
else
begin
i1 := Y2 div TileHeight + 1;
i2 := Y1 div TileHeight;
Offset := -FWidth;
end;
Y := i1 * TileHeight;
for i := i1 to i2 do
begin
R := ( Y - Y1 ) / dy;
X := X1 + Round( R * Dx );
j := X div TileWidth;
if ( X mod TileWidth ) = 0 then
if ( X2 < X1 ) then
Dec( j );
if ( j >= 0 ) then
begin
p := GridBase;
Inc( p, i * FWidth + j + Offset );
if ( p^.LineOfSightMask <> 0 ) then
begin
k := j * TileWidth;
Mask := p^.LineOfSightMask;
for s := 0 to 15 do
begin
if ( Mask and 1 ) = 1 then
begin
sY := Y + ( 3 - ( s div 4 ) ) * StripHeight + H;
if ( Offset < 0 ) then
begin
Dec( sY, TileHeight );
Pass := ( sY > Y2 );
end
else
begin
Pass := ( sY <= Y2 );
end;
if Pass then
begin
sX := k + ( s mod 4 ) * StripWidth + W;
if ( X2 < X1 ) then
Pass := sX > X2 - W
else
Pass := sX <= X2 + W;
if Pass then
begin
if ( sX <> StripX ) or ( sY <> StripY ) then
begin
if Dx = 0 then
begin
d2 := sqr( X2 - sX );
end
else if dy = 0 then
begin
d2 := sqr( 2 * ( Y2 - sY ) );
end
else
begin
a := 2 * ( sY - ( dy * ( sX - X1 ) / Dx + Y1 ) );
b := sX - ( Dx * ( sY - Y1 ) / dy + X1 );
a2 := sqr( a );
b2 := sqr( b );
c2 := a2 + b2;
if c2 = 0 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
d2 := a2 * b2 / c2;
end;
if d2 <= r2 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
end;
end;
end;
end;
Mask := Mask shr 1;
end;
end;
end;
Inc( Y, TileHeight );
end;
end;
// TODO : GlobalUnlock( FMapData );
Result := True;
end;
function TAniMap.LineOfCollision( X1, Y1, X2, Y2 : Longint ) : Boolean;
var
GridBase, p : ^GridInfo;
i, i1, i2 : Longint;
j, k : Longint;
Dx, dy : Longint;
X, Y : Longint;
sX, sY, s : Longint;
R : Double;
Offset : Longint;
Mask : Word;
W, H : Integer;
a, a2 : Double;
b, b2 : Double;
c2 : Double;
d2 : Double;
R2 : Double;
Pass : Boolean;
StripX, StripY : Longint;
begin
//This routine does not check for visibility within the starting tile.
//To do so would cause a number of special cases and would slow performance.
//Frankly, if you're standing in the same tile visibilty should not be a problem anyway.
// TODO : GridBase := GlobalLock( FMapDAta );
Dx := X2 - X1;
dy := Y2 - Y1;
W := StripWidth div 2;
H := StripHeight div 2;
StripX := ( X2 div StripWidth ) * StripWidth + W;
StripY := ( Y2 div StripHeight ) * StripHeight + H;
R2 := sqr( W );
if ( Dx <> 0 ) then
begin
if ( X1 < X2 ) then
begin
i1 := X1 div TileWidth + 1;
i2 := X2 div TileWidth;
Offset := 0;
end
else
begin
i1 := X2 div TileWidth + 1;
i2 := X1 div TileWidth;
Offset := -1;
end;
X := i1 * TileWidth;
for i := i1 to i2 do
begin
R := ( X - X1 ) / Dx;
Y := Y1 + Round( R * dy );
j := Y div TileHeight;
if ( Y mod TileHeight ) = 0 then
if ( Y2 < Y1 ) then
Dec( j );
if j >= 0 then
begin
p := GridBase;
Inc( p, j * FWidth + i + Offset );
if ( p^.CollisionMask <> 0 ) then
begin
k := j * TileHeight;
Mask := p^.CollisionMask;
for s := 0 to 15 do
begin
if ( Mask and 1 ) = 1 then
begin
sX := X + ( s mod 4 ) * StripWidth + W + Offset * TileWidth;
if ( Offset < 0 ) then
Pass := ( sX > X2 )
else
Pass := ( sX <= X2 );
if Pass then
begin
sY := k + ( 3 - ( s div 4 ) ) * StripHeight + H;
if ( Y2 < Y1 ) then
Pass := sY > Y2 - H
else
Pass := sY <= Y2 + H;
if Pass then
begin
if ( sX <> StripX ) or ( sY <> StripY ) then
begin
if Dx = 0 then
begin
d2 := sqr( X2 - sX );
end
else if dy = 0 then
begin
d2 := sqr( 2 * ( Y2 - sY ) );
end
else
begin
a := 2 * ( sY - ( dy * ( sX - X1 ) / Dx + Y1 ) );
b := sX - ( Dx * ( sY - Y1 ) / dy + X1 );
a2 := sqr( a );
b2 := sqr( b );
c2 := a2 + b2;
if c2 = 0 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
d2 := a2 * b2 / c2;
end;
if d2 <= r2 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
end;
end;
end;
end;
Mask := Mask shr 1;
end;
end;
end;
Inc( X, TileWidth );
end;
end;
if ( dy <> 0 ) then
begin
if ( Y1 < Y2 ) then
begin
i1 := Y1 div TileHeight + 1;
i2 := Y2 div TileHeight;
Offset := 0;
end
else
begin
i1 := Y2 div TileHeight + 1;
i2 := Y1 div TileHeight;
Offset := -FWidth;
end;
Y := i1 * TileHeight;
for i := i1 to i2 do
begin
R := ( Y - Y1 ) / dy;
X := X1 + Round( R * Dx );
j := X div TileWidth;
if ( X mod TileWidth ) = 0 then
if ( X2 < X1 ) then
Dec( j );
if ( j >= 0 ) then
begin
p := GridBase;
Inc( p, i * FWidth + j + Offset );
if ( p^.CollisionMask <> 0 ) then
begin
k := j * TileWidth;
Mask := p^.CollisionMask;
for s := 0 to 15 do
begin
if ( Mask and 1 ) = 1 then
begin
sY := Y + ( 3 - ( s div 4 ) ) * StripHeight + H;
if ( Offset < 0 ) then
begin
Dec( sY, TileHeight );
Pass := ( sY > Y2 );
end
else
begin
Pass := ( sY <= Y2 );
end;
if Pass then
begin
sX := k + ( s mod 4 ) * StripWidth + W;
if ( X2 < X1 ) then
Pass := sX > X2 - W
else
Pass := sX <= X2 + W;
if Pass then
begin
if ( sX <> StripX ) or ( sY <> StripY ) then
begin
if Dx = 0 then
begin
d2 := sqr( X2 - sX );
end
else if dy = 0 then
begin
d2 := sqr( 2 * ( Y2 - sY ) );
end
else
begin
a := 2 * ( sY - ( dy * ( sX - X1 ) / Dx + Y1 ) );
b := sX - ( Dx * ( sY - Y1 ) / dy + X1 );
a2 := sqr( a );
b2 := sqr( b );
c2 := a2 + b2;
if c2 = 0 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
d2 := a2 * b2 / c2;
end;
if d2 <= r2 then
begin
// TODO : GlobalUnlock( FMapData );
Result := False;
Exit;
end;
end;
end;
end;
end;
Mask := Mask shr 1;
end;
end;
end;
Inc( Y, TileHeight );
end;
end;
// TODO : GlobalUnlock( FMapData );
Result := True;
end;
function TAniMap.DefineItem( Zone, Index : Word; Image : PSDL_Surface; const StripHeights, CollisionMasks, LineOfSightMasks, LightPoints : array of Word; Slope : Single; Visible, AutoTransparent, Vertical : Boolean ) : PItemInfo;
begin
if ( Zone >= Zones.Count ) then
begin
Result := nil;
Exit;
end;
Result := TZone( Zones.Items[ Zone ] ).DefineItem( Index, Image, StripHeights, CollisionMasks, LineOfSightMasks, LightPoints, FTransparentColor, Slope, Visible, AutoTransparent, Vertical );
end;
procedure TAniMap.DefineTile( Zone, Index : Word; Image : PSDL_Surface );
begin
if ( Zone >= Zones.Count ) then
Exit;
TZone( Zones.Items[ Zone ] ).DefineTile( Index, Image, FTransparentColor );
end;
function TAniMap.GetTile( X, Y : Longint ) : PGridInfo;
var
GridLoc : ^GridInfo;
Loc : Integer;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
Loc := X + Y * FWidth;
// TODO : GridLoc := GlobalLock( FMapData );
Inc( GridLoc, Loc );
Result := pointer( GridLoc );
// TODO : GlobalUnlock( FMapData );
end
else
begin
Result := nil;
end;
end
else
begin
Result := nil;
end;
end;
procedure TAniMap.SetDiamondTile( X, Y : Longint; ZoneTop, TileTop, ZoneRight, TileRight, ZoneBottom, TileBottom, ZoneLeft, TileLeft : Word );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
if TileTop = 0 then
begin
p^.Zone[ 1 ] := 0;
p^.Tile[ 1 ] := $FFFF;
end
else
begin
p^.Zone[ 1 ] := ZoneTop;
p^.Tile[ 1 ] := TZone( Zones.Items[ ZoneTop ] ).Tile[ TileTop ].ImageIndex;
end;
if TileRight = 0 then
begin
p^.Zone[ 2 ] := 0;
p^.Tile[ 2 ] := $FFFF;
end
else
begin
p^.Zone[ 2 ] := ZoneRight;
p^.Tile[ 2 ] := TZone( Zones.Items[ ZoneRight ] ).Tile[ TileRight ].ImageIndex;
end;
if TileBottom = 0 then
begin
p^.Zone[ 3 ] := 0;
p^.Tile[ 3 ] := $FFFF;
end
else
begin
p^.Zone[ 3 ] := ZoneBottom;
p^.Tile[ 3 ] := TZone( Zones.Items[ ZoneBottom ] ).Tile[ TileBottom ].ImageIndex;
end;
if TileLeft = 0 then
begin
p^.Zone[ 4 ] := 0;
p^.Tile[ 4 ] := $FFFF;
end
else
begin
p^.Zone[ 4 ] := ZoneLeft;
p^.Tile[ 4 ] := TZone( Zones.Items[ ZoneLeft ] ).Tile[ TileLeft ].ImageIndex;
end;
p^.BitField := p^.BitField or $80; //Set high bit to denote a diamond tile
// TODO : GlobalUnlock( FMapData );
end
end;
end;
procedure TAniMap.SetTile( X, Y, Layer : Longint; Zone, Index : Word );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
i, j : Integer;
begin
if ( FMapData <> 0 ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
if ( Index = 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.Zone[ Layer ] := 0;
p^.Tile[ Layer ] := $FFFF;
if ( Layer ) = 1 then
p^.BitField := p^.BitField and $7F; //Turn off high bit to denote rect tile
end;
end
else
begin
for i := 0 to TZone( Zones.Items[ Zone ] ).Tile[ Index ].Columns - 1 do
begin
if ( X + i < FWidth ) then
begin
for j := 0 to TZone( Zones.Items[ Zone ] ).Tile[ Index ].Rows - 1 do
begin
if ( Y + j < FHeight ) then
begin
Loc := ( X + i ) + ( Y + j ) * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.Zone[ Layer ] := Zone;
p^.Tile[ Layer ] := TZone( Zones.Items[ Zone ] ).Tile[ Index ].ImageIndex +
i * TZone( Zones.Items[ Zone ] ).Tile[ Index ].Rows + j;
if ( Layer ) = 1 then
p^.BitField := p^.BitField and $7F; //Turn off high bit to denote rect tile
end;
end;
end;
end;
end;
// TODO : GlobalUnlock( FMapData );
end;
end;
procedure TAniMap.SetCollisionMask( X, Y : Integer; CollisionMask : Word );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.CollisionMask := CollisionMask;
// TODO : GlobalUnlock( FMapData );
end;
end;
end;
procedure TAniMap.SetLineOfSightMask( X, Y : Integer; LineOfSightMask : Word );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.LineOfSightMask := LineOfSightMask;
// TODO : GlobalUnlock( FMapData );
end;
end;
end;
procedure TAniMap.SetTrigger( X, Y : Integer; TriggerID : SmallInt );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.TriggerID := TriggerID;
p^.TriggerMask := $FFFF;
// TODO : GlobalUnlock( FMapData );
end;
end;
end;
procedure TAniMap.SetTrigger( X, Y : Integer; TriggerID : SmallInt; TriggerMask : word );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.TriggerID := TriggerID;
p^.TriggerMask := TriggerMask;
// TODO : GlobalUnlock( FMapData );
end;
end;
end;
procedure TAniMap.SetFilter( X, Y : Integer; FilterID : SmallInt );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.FilterID := FilterID;
p^.FilterMask := $FFFF;
// TODO : GlobalUnlock( FMapData );
end;
end;
end;
procedure TAniMap.SetFilter( X, Y : Integer; FilterID : SmallInt; FilterMask : Word );
var
GridLoc, p : ^GridInfo;
Loc : Longint;
begin
if ( FMapData <> 0 ) then
begin
if ( X < FWidth ) and ( Y < FHeight ) then
begin
// TODO : GridLoc := GlobalLock( FMapData );
Loc := X + Y * FWidth;
p := GridLoc;
Inc( p, Loc );
p^.FilterID := FilterID;
p^.FilterMask := FilterMask;
// TODO : GlobalUnlock( FMapData );
end;
end;
end;
function TAniMap.AddItem( Zone, ItemIndex : Word; X, Y, Z : Longint; FilterID : Smallint;
Collidable : Boolean ) : PItemInstanceInfo;
var
Strip, VStrip : Integer;
i, j, k : integer;
SrcX, SrcY, SrcW : Longint;
StripData : ^Word;
GridBase, GridLoc : ^GridInfo;
Strips, Rows : Integer;
SrcMaskBase, SrcMask : ^Word;
BitMask : Word;
ZoneItem : TZone;
First : Integer;
RefItem, RefDelta, Delta : integer;
InitDelta : boolean;
begin
if ( X < 0 ) and ( ( X mod StripWidth ) <> 0 ) then
X := ( ( X div StripWidth ) - 1 ) * StripWidth
else
X := ( X div StripWidth ) * StripWidth;
if ( Y < 0 ) and ( ( Y mod StripHeight ) <> 0 ) then
Y := ( ( Y div StripHeight ) - 1 ) * StripHeight
else
Y := ( Y div StripHeight ) * StripHeight;
// TODO : GridBase := GlobalLock( FMapData );
ZoneItem := Zones.Items[ Zone ];
with ZoneItem as TZone do
begin
//Apply Collision Mask
if Collidable then
begin
if ( Item[ ItemIndex ].CollisionMasks <> 0 ) then
begin
// TODO : SrcMaskBase := GlobalLock( Item[ ItemIndex ].CollisionMasks );
if Assigned( SrcMaskBase ) then
begin
Strips := Item[ ItemIndex ].Strips shl 2;
Rows := Item[ ItemIndex ].Height div StripHeight;
if ( ( Item[ ItemIndex ].Height mod StripHeight ) <> 0 ) then
Inc( Rows );
for j := 0 to Rows - 1 do
begin
k := Y - ( j + 1 ) * StripHeight;
if k >= 0 then
begin
Y1 := k div TileHeight;
if ( Y1 < FHeight ) then
begin
Y2 := ( Y div StripHeight ) - j - 1;
for i := 0 to Strips - 1 do
begin
SrcMask := SrcMaskBase;
Inc( SrcMask, ( j shr 2 ) * Item[ ItemIndex ].Strips + ( i shr 2 ) );
BitMask := 1 shl ( ( i mod 4 ) + ( ( j mod 4 ) ) * 4 );
if ( ( SrcMask^ and BitMask ) = BitMask ) then
begin
k := X + i * StripWidth;
if k >= 0 then
begin
X1 := k div TileWidth;
if ( X1 < FWidth ) then
begin
X2 := ( X div StripWidth ) + i;
GridLoc := GridBase;
Inc( GridLoc, X1 + Y1 * FWidth );
BitMask := 1 shl ( ( X2 mod 4 ) + ( 3 - ( Y2 mod 4 ) ) * 4 );
GridLoc^.CollisionMask := GridLoc^.CollisionMask or BitMask;
end;
end;
end;
end;
end;
end;
end;
end;
// TODO : GlobalUnlock( Item[ ItemIndex ].CollisionMasks );
end;
end;
//Apply Line of Sight Mask
if Collidable then
begin
if ( Item[ ItemIndex ].LineOfSightMasks <> 0 ) then
begin
// TODO : SrcMaskBase := GlobalLock( Item[ ItemIndex ].LineOfSightMasks );
if Assigned( SrcMaskBase ) then
begin
Strips := Item[ ItemIndex ].Strips shl 2;
Rows := Item[ ItemIndex ].Height div StripHeight;
if ( ( Item[ ItemIndex ].Height mod StripHeight ) <> 0 ) then
Inc( Rows );
for j := 0 to Rows - 1 do
begin
k := Y - ( j + 1 ) * StripHeight;
if k >= 0 then
begin
Y1 := k div TileHeight;
if ( Y1 < FHeight ) then
begin
Y2 := ( Y div StripHeight ) - j - 1;
for i := 0 to Strips - 1 do
begin
SrcMask := SrcMaskBase;
Inc( SrcMask, ( j shr 2 ) * Item[ ItemIndex ].Strips + ( i shr 2 ) );
BitMask := 1 shl ( ( i mod 4 ) + ( ( j mod 4 ) ) * 4 );
if ( ( SrcMask^ and BitMask ) = BitMask ) then
begin
k := X + i * StripWidth;
if k >= 0 then
begin
X1 := k div TileWidth;
if ( X1 < FWidth ) then
begin
X2 := ( X div StripWidth ) + i;
GridLoc := GridBase;
Inc( GridLoc, X1 + Y1 * FWidth );
BitMask := 1 shl ( ( X2 mod 4 ) + ( 3 - ( Y2 mod 4 ) ) * 4 );
GridLoc^.LineOfSightMask := GridLoc^.LineOfSightMask or BitMask;
end;
end;
end;
end;
end;
end;
end;
end;
// TODO : GlobalUnlock( Item[ ItemIndex ].LineOfSightMasks );
end;
end;
//Divide the image into strips and add each strip to the items list as a seperate item
if LastItem >= ItemListSize then
begin
result := nil;
exit;
end;
First := LastItem + 1;
InitDelta := false;
Result := @ItemList[ First ];
RefDelta := 0;
RefItem := First;
for Strip := 1 to Item[ ItemIndex ].Strips do
begin
SrcY := Item[ ItemIndex ].Top + ( Strip - 1 ) * Item[ ItemIndex ].Height;
for VStrip := 0 to 3 do
begin
SrcX := Item[ ItemIndex ].Left + VStrip * StripWidth;
SrcW := ( Strip - 1 ) * TileWidth + VStrip * StripWidth;
if ( SrcW < Item[ ItemIndex ].Width ) then
begin
Inc( LastItem );
if LastItem <= ItemListSize then
begin
ItemList[ LastItem ].ImageX := SrcX;
ItemList[ LastItem ].ImageY := SrcY;
if ( SrcW + StripWidth > Item[ ItemIndex ].Width ) then
ItemList[ LastItem ].Width := Item[ ItemIndex ].Width - SrcW
else
ItemList[ LastItem ].Width := StripWidth;
ItemList[ LastItem ].Height := Item[ ItemIndex ].Height;
ItemList[ LastItem ].Zone := Zone;
ItemList[ LastItem ].FilterID := FilterID;
ItemList[ LastItem ].XRayID := 0;
ItemList[ LastItem ].Slope0 := Item[ ItemIndex ].Slope;
ItemList[ LastItem ].Visible := Item[ ItemIndex ].Visible;
ItemList[ LastItem ].AutoTransparent := Item[ ItemIndex ].AutoTransparent;
ItemList[ LastItem ].Vertical := Item[ ItemIndex ].Vertical;
ItemList[ LastItem ].Last := False;
ItemList[ LastItem ].Next := 0;
if ( Item[ ItemIndex ].StripHeights <> 0 ) then
begin
// TODO : StripData := GlobalLock( Item[ ItemIndex ].StripHeights );
Inc( StripData, ( ( Strip - 1 ) shl 2 ) + VStrip );
ItemList[ LastItem ].VHeight := StripData^ + Z;
// TODO : GlobalUnlock( Item[ ItemIndex ].StripHeights );
end;
ItemList[ LastItem ].X := X + SrcW;
ItemList[ LastItem ].Y := Y - ItemList[ LastItem ].Height + ItemList[ LastItem ].VHeight;
if ItemList[ LastItem ].VHeight <> 0 then
begin
Delta := ItemList[ LastItem ].Y - round( SrcW * ItemList[ LastItem ].Slope0 );
if InitDelta then
begin
if Delta < RefDelta then
begin
RefDelta := Delta;
RefItem := LastItem
end;
end
else
begin
RefDelta := Delta;
RefItem := LastItem;
InitDelta := true;
end;
end;
if ( Item[ ItemIndex ].LightPoints <> 0 ) then
begin
// TODO : StripData := GlobalLock( Item[ ItemIndex ].LightPoints );
Inc( StripData, ( ( Strip - 1 ) shl 2 ) + VStrip );
ItemList[ LastItem ].Slope1 := smallint( StripData^ ) / StripWidth;
ItemList[ LastItem ].Slope2 := ItemList[ LastItem ].Slope1;
// TODO : GlobalUnlock( Item[ ItemIndex ].LightPoints );
end;
//Keep Items sorted by VY //Replaced by BuildRowUpdateInfo
{ if (FirstItem = 0) then begin
FirstItem := LastItem;
ItemList[LastItem].Next := 0;
end
else begin
i := FirstItem;
j := 0;
while (i <> 0) do begin
if (ItemList[i].Y >= ItemList[LastItem].Y) then begin
if (j = 0) then
FirstItem := LastItem
else
ItemList[j].Next := LastItem;
ItemList[LastItem].Next := i;
Break;
end;
j := i;
i := ItemList[i].Next;
end;
if (i = 0) then begin
ItemList[j].Next := LastItem;
ItemList[LastItem].Next := 0;
end;
end; }
end;
end;
end;
end;
for i := First to LastItem do
begin
ItemList[ i ].RefItem := RefItem;
end;
ItemList[ LastItem ].Last := True;
end;
// TODO : GlobalUnlock( FMapData );
end;
procedure TAniMap.SetTileSize( Size : Word );
begin
FTileSize := Size;
TileWidth := FTileSize * 16;
TileHeight := FTileSize * 8;
StripWidth := TileWidth shr 2;
StripHeight := TileHeight shr 2;
BitWidth := FWidth * TileWidth;
BitHeight := FHeight * TileHeight;
end;
procedure TAniMap.Sort;
var
i, j, Y : integer;
MinY, MaxY : longint;
pBase, p : ^longint;
MemSize : longint;
begin
//Sort ItemList
if LastItem > 0 then
begin
MinY := ItemList[ 1 ].Y;
MaxY := MinY;
for i := 2 to LastItem do
begin
if ItemList[ i ].Y < MinY then
MinY := ItemList[ i ].Y
else if ItemList[ i ].Y > MaxY then
MaxY := ItemList[ i ].Y;
end;
MemSize := ( MaxY - MinY + 1 ) * sizeof( longint );
GetMem( pBase, MemSize );
try
FillChar( pBase, MemSize, 0 );
for i := LastItem downto 1 do
begin
Y := ItemList[ i ].Y - MinY;
p := pBase;
inc( p, Y );
ItemList[ i ].Next := p^;
p^ := i;
end;
p := pBase;
FirstItem := p^; //we know the first one is valid
j := FirstItem;
while ItemList[ j ].Next <> 0 do
begin
j := ItemList[ j ].Next;
end;
for i := 1 to ( MaxY - MinY ) do
begin
inc( p );
if p^ <> 0 then
begin
ItemList[ j ].Next := p^;
j := p^;
while ItemList[ j ].Next <> 0 do
begin
j := ItemList[ j ].Next;
end;
end;
end;
finally
FreeMem( pBase );
end;
end;
end;
end.
|
unit SoundPlayerEntrance;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MMSystem;
type
TEntranceSoundPlayer = class(TObject)
private
Fsound_notify: Pointer;
Fsound_chimes: Pointer;
Fsound_tada: Pointer;
procedure Setsound_chimes(const Value: Pointer);
procedure Setsound_notify(const Value: Pointer);
procedure Setsound_tada(const Value: Pointer);
public
constructor Create();
destructor Destroy();override;
procedure play(AResource: Pointer);
property sound_tada: Pointer read Fsound_tada write Setsound_tada;
property sound_chimes: Pointer read Fsound_chimes write Setsound_chimes;
property sound_notify: Pointer read Fsound_notify write Setsound_notify;
end;
implementation
{$R sounds.res}
{ TEntranceSoundPlayer }
constructor TEntranceSoundPlayer.Create;
begin
Fsound_tada := Pointer(FindResource(hInstance, 'tada', 'wave'));
if Fsound_tada <> nil then begin
Fsound_tada := Pointer(LoadResource(hInstance, HRSRC(Fsound_tada)));
if Fsound_tada <> nil then Fsound_tada := LockResource(HGLOBAL(Fsound_tada));
end;
Fsound_chimes := Pointer(FindResource(hInstance, 'chimes', 'wave'));
if Fsound_chimes <> nil then begin
Fsound_chimes := Pointer(LoadResource(hInstance, HRSRC(Fsound_chimes)));
if Fsound_chimes <> nil then Fsound_chimes := LockResource(HGLOBAL(Fsound_chimes));
end;
Fsound_notify := Pointer(FindResource(hInstance, 'notify', 'wave'));
if Fsound_notify <> nil then begin
Fsound_notify := Pointer(LoadResource(hInstance, HRSRC(Fsound_notify)));
if Fsound_notify <> nil then Fsound_notify := LockResource(HGLOBAL(Fsound_notify));
end;
end;
destructor TEntranceSoundPlayer.Destroy;
begin
UnlockResource(HGLOBAL(Fsound_tada));
UnlockResource(HGLOBAL(Fsound_chimes));
UnlockResource(HGLOBAL(Fsound_notify));
inherited;
end;
procedure TEntranceSoundPlayer.play(AResource: Pointer);
begin
sndPlaySound(AResource, SND_MEMORY
or SND_NODEFAULT or SND_ASYNC);
end;
procedure TEntranceSoundPlayer.Setsound_chimes(const Value: Pointer);
begin
Fsound_chimes := Value;
end;
procedure TEntranceSoundPlayer.Setsound_notify(const Value: Pointer);
begin
Fsound_notify := Value;
end;
procedure TEntranceSoundPlayer.Setsound_tada(const Value: Pointer);
begin
Fsound_tada := Value;
end;
end.
|
//
// -----------------------------------------------------------------------------------------------
//
// TAutoNAT -- 自动设置路由器端口映射项控件 For delphi 4,5,6,7,2005
//
// 作者: 王国忠 编写日期:2007年10月
//
// 电子邮件:support@quickburro.com 联系电话:0571-69979828
//
// -----------------------------------------------------------------------------------------------
//
unit autoNat;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Scktcomp, NMUDP, extctrls;
//
// 定义事件类...
type
TTaskSuccessEvent = procedure (Sender: TObject) of object; {任务执行成功事件}
TTaskFailEvent = procedure (Sender: TObject) of object; {任务执行失败事件}
type
TAutoNAT = class(TComponent)
private
//
// 只读属性...
fTimeout: integer; {任务超时值}
fTaskType: integer; {任务列别: 1-搜索 2-取控制页地址 3-增加端口 4-取外网地址 5-删除端口}
fLocalIp: string; {本机内网IP}
fRouterIp: string; {路由器内网IP}
fRouterPort: integer; {路由器控制端口}
fRouterLocation: string; {路由器设备位置URL}
fRouterName: string; {路由器设备名称}
fRouterUSN: string; {路由器设备标识名}
fRouterURL: string; {路由器URL}
fExternalIp: string; {路由器外网IP}
fControlURL: string; {控制页URL}
fServiceType: string; {服务类型串}
fURLbase: string; {控制页基地址}
//
// 事件...
FOnTaskSuccess: TNotifyEvent; {任务执行成功的事件}
FOnTaskFail: TNotifyEvent; {任务执行失败的事件}
//
// 普通变量...
request: string; {socket请求数据包}
requested: boolean; {请求是否已发送}
response: string; {socket应答数据包}
//
UDP: TNMUDP; {UDP对象}
Sock: TClientSocket; {Socket对象}
TaskTimer: TTimer; {任务定时器}
//
TaskExecuting: boolean; {当前是否有任务在执行}
Taskfinished: boolean; {任务是否已经完成}
Tasksuccess: boolean; {任务是否成功}
//
// 其它私有过程...
procedure SetTimeout(Timeout: integer);
procedure SuccessEvent;
procedure FailEvent;
procedure TaskTimerTimer(Sender: TObject); {超时事件}
procedure UDPInvalidHost(var handled: Boolean); {主机无效时的事件}
procedure UDPBufferInvalid(var handled: Boolean; var Buff: array of Char; var length: Integer);
procedure UDPStreamInvalid(var handled: Boolean; Stream: TStream);
procedure UDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer);
procedure ClientSocketWrite(Sender: TObject; Socket: TCustomWinSocket);
procedure ClientSocketRead(Sender: TObject; Socket: TCustomWinSocket);
function ResponseFinished(ResponseData: string): boolean;
procedure ClientSocketError(Sender: TObject; Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer);
procedure ClientSocketDisconnect(Sender: TObject; Socket: TCustomWinSocket);
//
protected
{ Protected declarations }
public
//
// 创建对象...
Constructor Create(AOwner: TComponent); override; {对象创建时的方法}
//
// 撤消对象...
Destructor Destroy(); override; {对象撤消的方法}
//
// 搜索路由器设备(任务1)...
function SearchRouter(): boolean;
//
// 得到路由器控制页{任务2}...
function GetControlURL(): boolean;
//
// 增加端口映射项(任务3)...
function AddNatMapping(NatPortName: string; ExternalPort: integer; LocalIp: string; LocalPort: integer; Protocol: string): boolean;
//
// 取外网IP地址(任务4)...
function GetExternalIp: boolean;
//
// 删除端口映射项(任务5)...
function DeleteNatMapping(ExternalPort: integer; Protocol: string): boolean;
//
published
//
// 控件属性...
property Timeout: integer read fTimeout write settimeout; {任务超时值}
property TaskType: integer read fTaskType; {任务列别: 1-搜索 2-取控制页地址 3-增加端口 4-取外网地址 5-删除端口}
property LocalIp: string read fLocalIp; {本机内网IP}
property RouterIp: string read fRouterIp; {路由器内网IP}
property RouterPort: integer read fRouterPort; {路由器控制端口}
property RouterLocation: string read fRouterLocation; {路由器设备位置URL}
property RouterName: string read fRouterName; {路由器设备名称}
property RouterUSN: string read fRouterUSN; {路由器设备标识名}
property RouterURL: string read fRouterURL; {路由器URL}
property ExternalIp: string read fExternalIp; {路由器外网IP}
property ControlURL: string read fControlURL; {控制页URL}
property ServiceType: string read fServiceType; {服务类型串}
property URLBase: string read fURLBase; {基地址}
//
// 事件...
property OnTaskSuccess: TNotifyEvent read FOnTaskSuccess write FOnTaskSuccess; {任务执行成功的事件}
property OnTaskFail: TNotifyEvent read FOnTaskFail write FOnTaskFail; {任务执行失败的事件}
//
end;
procedure Register;
implementation
//
// 控件注册的过程...
procedure Register;
begin
RegisterComponents('AutoNAT', [TAutoNAT]);
end;
//
// 创建对象的过程...
constructor TAutoNAT.Create(AOwner: TComponent);
begin
//
// 调用TComponent的方法,创建...
inherited;
//
// 创建内部变量...
UDP:=TNMUDP.Create(self); {UDP对象}
udp.RemoteHost:='239.255.255.250'; {广播地址}
udp.RemotePort:=1900; {广播端口}
udp.LocalPort:=1900;
UDP.OnInvalidHost:=UDPInvalidHost; {主机无效事件}
UDP.OnBufferInvalid:=UDPBufferInvalid; {缓冲区无效事件}
UDP.OnStreamInvalid:=UDPStreamInvalid; {流无效事件}
UDP.OnDataReceived:=UDPDataReceived; {收到应答数据时的事件}
//
sock:=TClientSocket.create(self); {ClientSocket对象}
sock.ClientType:=ctNonBlocking; {非阻塞型}
sock.OnWrite:=clientsocketwrite; {提交请求事件}
sock.OnRead:=clientsocketread; {应答响应事件}
sock.OnError:=clientsocketerror; {异常事件}
sock.OnDisconnect:=clientsocketdisconnect; {断开事件}
//
TaskTimer:=TTimer.Create(self); {超时定时器}
TaskTimer.Interval:=1000*5; {默认5秒超时}
TaskTimer.enabled:=false; {不激活定时器}
TaskTimer.OnTimer:=TaskTimerTimer; {指定超时处理事件}
//
taskexecuting:=false; {没有任务在执行}
taskfinished:=false; {未完成}
tasksuccess:=false; {未成功}
//
fexternalip:='0.0.0.0'; {外网IP暂时未知}
ftimeout:=5000; {默认超时值=5秒}
end;
//
// 撤消对象的过程...
destructor TAutoNAT.Destroy;
begin
//
// 释放对象...
UDP.free;
tasktimer.free;
sock.free;
//
// 调用TComponent的方法,撤消...
inherited;
end;
//
// 设置任务超时值的过程...
procedure TAutoNAT.SetTimeout(Timeout: integer);
begin
if (timeout<1000) or (timeout>30*1000) then
begin
messagebox(0,'对不起,超时值范围1000-30000,重新输入!','提示',mb_ok+mb_iconinformation);
exit;
end;
ftimeout:=timeout;
end;
//
// 激发一个成功事件的过程...
procedure TAutoNAT.SuccessEvent;
begin
tasktimer.enabled:=false;
//
// 设置任务已经完成...
taskexecuting:=false; {任务不在执行了}
taskfinished:=true; {任务已经完成}
tasksuccess:=true; {任务成功}
//
// 激发一个成功事件...
if assigned(fontasksuccess) then
fontasksuccess(self);
end;
//
// 激发一个失败事件的过程...
procedure TAutoNAT.FailEvent;
begin
tasktimer.enabled:=false;
//
// 设置任务已经完成...
taskexecuting:=false; {任务不在执行了}
taskfinished:=true; {任务已经完成}
tasksuccess:=false; {任务失败}
//
// 激发一个失败事件...
if assigned(fontaskfail) then
fontaskfail(self);
end;
//
// UDP的主机无效事件...
procedure TAutoNAT.UDPInvalidHost(var handled: Boolean);
begin
failevent; {激发失败事件}
handled:=true;
end;
//
// UDP的缓冲区无效事件...
procedure TAutoNAT.UDPBufferInvalid(var handled: Boolean; var Buff: array of Char; var length: Integer);
begin
failevent; {激发失败事件}
handled:=true;
end;
//
// UDP的流无效事件...
procedure TAutoNAT.UDPStreamInvalid(var handled: Boolean; Stream: TStream);
begin
failevent; {激发失败事件}
handled:=true;
end;
//
// 数据到达事件(搜索设备的应答)...
procedure TAutoNAT.UDPDataReceived(Sender: TComponent; NumberBytes: Integer; FromIP: String; Port: Integer);
var
tmpstr: string;
buffer: array [0..4096] of char;
j: integer;
begin
//
// 无效数据,丢弃...
if (numberbytes<=0) or (numberbytes>4096) then
exit;
//
// 读取数据...
udp.ReadBuffer(buffer,numberbytes);
setlength(tmpstr,numberbytes);
strlcopy(pchar(tmpstr),buffer,numberbytes);
//
// 如果不是有效数据,丢弃...
if uppercase(copy(tmpstr,1,5))<>'HTTP/' then
begin
//
// 激发一个任务失败事件...
if ftasktype=1 then
failevent; {激发失败事件}
exit;
end;
//
// 得到Location...
fRouterLocation:=tmpstr;
j:=pos('LOCATION:',uppercase(fRouterLocation));
if j<0 then
fRouterLocation:=''
else
begin
delete(fRouterLocation,1,j+8);
j:=pos(#13#10,fRouterLocation);
fRouterLocation:=trim(copy(fRouterLocation,1,j-1));
end;
//
// 得到Server...
fRouterName:=tmpstr;
j:=pos('SERVER:',uppercase(fRouterName));
if j<0 then
fRouterName:=''
else
begin
delete(fRouterName,1,j+6);
j:=pos(#13#10,fRouterName);
fRouterName:=trim(copy(fRouterName,1,j-1));
end;
//
// 得到USN...
fRouterUSN:=tmpstr;
j:=pos('USN:',uppercase(fRouterUSN));
if j<0 then
fRouterUSN:=''
else
begin
delete(fRouterUSN,1,j+3);
j:=pos(#13#10,fRouterUSN);
fRouterUSN:=trim(copy(fRouterUSN,1,j-1));
end;
//
// 得到路由器IP地址...
tmpstr:=fRouterLocation;
if copy(uppercase(tmpstr),1,7)='HTTP://' then
delete(tmpstr,1,7);
j:=pos(':',tmpstr);
if j<=0 then
begin
//
// 激发一个任务失败事件...
if ftasktype=1 then
failevent; {激发失败事件}
exit;
end;
fRouterIp:=copy(tmpstr,1,j-1);
delete(tmpstr,1,j);
//
// 得到路由器端口、控制页URL地址...
j:=pos('/',tmpstr);
if j>1 then
begin
try
fRouterPort:=strtoint(copy(tmpstr,1,j-1));
except
fRouterPort:=-1;
end;
delete(tmpstr,1,j-1);
fRouterURL:=tmpstr;
end
else
begin
j:=pos(#13#10,tmpstr);
if j<=1 then
begin
//
// 激发一个任务失败事件...
if ftasktype=1 then
failevent; {激发失败事件}
exit;
end;
try
fRouterPort:=strtoint(copy(tmpstr,1,j-1));
except
fRouterPort:=-1;
end;
fRouterURL:='/';
end;
//
// 得到默认的URLBase...
tmpstr:='http://'+frouterip+':'+inttostr(frouterport)+frouterurl;
furlbase:='';
j:=pos('/',tmpstr);
while j>0 do
begin
furlbase:=furlbase+copy(tmpstr,1,j);
delete(tmpstr,1,j);
j:=pos('/',tmpstr);
end;
delete(furlbase,length(furlbase),1);
//
// 若数据无效...
if (trim(fRouterIp)='') or (fRouterPort<=0) then
begin
//
// 激发一个任务失败事件...
if ftasktype=1 then
failevent; {激发失败事件}
end
//
// 若成功...
else
begin
//
// 激发一个任务成功事件...
if ftasktype=1 then
successevent; {激发成功事件}
end;
end;
//
// 超时时间到的事件...
procedure TAutoNAT.TaskTimerTimer(Sender: TObject);
begin
failevent;
ftasktype:=-1; {撤消任务号}
end;
//
// 判定Socket的应答数据是否全部得到的函数...
function TAutoNAT.ResponseFinished(ResponseData: string): boolean;
var
head: string;
contentlength,j,headlength: integer;
begin
result:=false;
//
// 得到头信息...
j:=pos(#13#10#13#10,responsedata);
if j<=0 then
exit;
head:=copy(responsedata,1,j-1);
headlength:=j+3;
//
// 得到内容长度...
j:=pos('CONTENT-LENGTH:',uppercase(head));
if j<=0 then
begin
result:=true;
exit;
end;
delete(head,1,j+14);
j:=pos(#13#10,head);
try
contentlength:=strtoint(copy(head,1,j-1));
except
contentlength:=9999999;
end;
//
// 判定是否结束...
if (length(responsedata)-headlength)>=contentlength then
result:=true;
end;
//
// 提交查询请求...
procedure TAutoNAT.ClientSocketWrite(Sender: TObject; Socket: TCustomWinSocket);
begin
//
// 若已经发送请求,不再发送...
if requested then
exit;
//
// 发送前,先停止定时器...
tasktimer.enabled:=false;
//
// 发出请求...
response:=''; {还没有应答数据}
socket.SendBuf(request[1],length(request));
requested:=true; {已发送}
end;
//
// 得到Socket应答数据时(取控制页信息、增加NAT、删除NAT,以及取外网IP时的应答)...
procedure TAutoNAT.ClientSocketRead(Sender: TObject; Socket: TCustomWinSocket);
var
tmpstr: string;
j: integer;
begin
//
// 接收数据,放到Response变量中...
j:=socket.ReceiveLength;
setlength(tmpstr,j);
socket.ReceiveBuf(tmpstr[1],j);
response:=response+tmpstr;
//
// 若应答数据未全部得到,等待下个读事件...
if not responsefinished(response) then
exit;
//
// 若已经全部得到,进行结果解析...
case ftasktype of
//
// 取控制页地址时...
2: begin
tmpstr:=response;
//
// 得到基地址...
j:=pos(uppercase('<URLBASE>'),uppercase(tmpstr));
if j>0 then
begin
delete(tmpstr,1,j+length('<URLBASE>')-1);
j:=pos(uppercase('</URLBASE>'),uppercase(tmpstr));
if j>1 then
furlbase:=copy(tmpstr,1,j-1);
end;
//
// 查找设备urn:schemas-upnp-org:device:InternetGatewayDevice:1的描述段...
j:=pos(uppercase('<deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType>'),uppercase(tmpstr));
if j<=0 then
begin
failevent;
socket.Close; {关闭套接字}
exit;
end;
delete(tmpstr,1,j+length('<deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType>')-1);
//
// 再查找urn:schemas-upnp-org:device:WANDevice:1的描述段...
j:=pos(uppercase('<deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType>'),uppercase(tmpstr));
if j<=0 then
begin
failevent;
socket.Close; {关闭套接字}
exit;
end;
delete(tmpstr,1,j+length('<deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType>')-1);
//
// 再查找urn:schemas-upnp-org:device:WANConnectionDevice:1的描述段...
j:=pos(uppercase('<deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType>'),uppercase(tmpstr));
if j<=0 then
begin
failevent;
socket.Close; {关闭套接字}
exit;
end;
delete(tmpstr,1,j+length('<deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType>')-1);
//
// 最后找到服务urn:schemas-upnp-org:service:WANIPConnection:1或urn:schemas-upnp-org:service:WANPPPConnection:1的描述段...
j:=pos(uppercase('<serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType>'),uppercase(tmpstr));
if j<=0 then
begin
j:=pos(uppercase('<serviceType>urn:schemas-upnp-org:service:WANPPPConnection:1</serviceType>'),uppercase(tmpstr));
if j<=0 then
begin
failevent;
socket.Close; {关闭套接字}
exit;
end
else
begin
delete(tmpstr,1,j+length('<serviceType>urn:schemas-upnp-org:service:WANPPPConnection:1</serviceType>')-1);
fservicetype:='urn:schemas-upnp-org:service:WANPPPConnection:1';
end;
end
else
begin
delete(tmpstr,1,j+length('<serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType>')-1);
fservicetype:='urn:schemas-upnp-org:service:WANIPConnection:1';
end;
//
// 得到ControlURL...
j:=pos(uppercase('<controlURL>'),uppercase(tmpstr));
if j<=0 then
begin
failevent;
socket.Close; {关闭套接字}
exit;
end;
delete(tmpstr,1,j+length('<controlURL>')-1);
j:=pos(uppercase('</controlURL>'),uppercase(tmpstr));
if j<=0 then
begin
failevent;
socket.Close; {关闭套接字}
exit;
end;
fcontrolurl:=copy(tmpstr,1,j-1);
//
if (copy(urlbase,length(urlbase),1)='/') and (copy(fcontrolurl,1,1)='/') then
delete(fcontrolurl,1,1);
if (copy(urlbase,length(urlbase),1)<>'/') and (copy(fcontrolurl,1,1)<>'/') then
fcontrolurl:='/'+fcontrolurl;
fcontrolurl:=urlbase+fcontrolurl;
//
// 激发成功事件...
successevent;
end;
//
// 增加NAT项时...
3: begin
tmpstr:=response;
j:=pos(#13#10,tmpstr);
tmpstr:=uppercase(copy(tmpstr,1,j-1));
//
// 假如成功...
if pos('200 OK',tmpstr)>0 then
successevent
//
// 假如失败...
else
failevent;
end;
//
// 取外网地址时...
4: begin
tmpstr:=response;
j:=pos(#13#10,tmpstr);
tmpstr:=uppercase(copy(tmpstr,1,j-1));
//
// 假如成功...
if pos('200 OK',tmpstr)>0 then
begin
//
// 得到外网IP...
j:=pos(uppercase('<NewExternalIPAddress>'),uppercase(response));
if j<=0 then
fexternalip:='0.0.0.0'
else
begin
fexternalip:=response;
delete(fexternalip,1,j+length('<NewExternalIPAddress>')-1);
j:=pos(uppercase('</NewExternalIPAddress>'),uppercase(fexternalip));
if j<=0 then
fexternalip:='0.0.0.0'
else
fexternalip:=copy(fexternalip,1,j-1);
end;
//
// 激发成功事件...
successevent;
end
//
// 假如失败...
else
failevent;
end;
//
// 删除NAT项时...
5: begin
tmpstr:=response;
j:=pos(#13#10,tmpstr);
tmpstr:=uppercase(copy(tmpstr,1,j-1));
//
// 假如成功...
if pos('200 OK',tmpstr)>0 then
successevent
//
// 假如失败...
else
failevent;
end;
end;
//
// 断开...
socket.Close; {关闭套接字}
end;
//
// 屏蔽可能出现的错误...
procedure TAutoNAT.ClientSocketError(Sender: TObject; Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer);
var i:integer;
begin
i:=ord(ErrorEvent);
if taskexecuting then
failevent;
errorcode:=0;
end;
//
// 断开时...
procedure TAutoNAT.ClientSocketDisconnect(Sender: TObject; Socket: TCustomWinSocket);
begin
if taskexecuting then
failevent;
end;
//
// 搜索路由器设备(任务1)...
function TAutoNAT.SearchRouter(): boolean;
var
tmpstr: string;
buffer: array [0..4096] of char;
j: integer;
begin
//
// 假如定时器处于开启状态,异常返回...
if tasktimer.enabled then
begin
result:=false;
exit;
end;
//
// 生成路由器搜索请求...
tmpstr:='M-SEARCH * HTTP/1.1'#13#10
+'HOST: 239.255.255.250:1900'#13#10
+'MAN: "ssdp:discover"'#13#10
+'MX: 3'#13#10
+'ST: upnp:rootdevice'#13#10#13#10;
j:=length(tmpstr);
strplcopy(buffer,tmpstr,j);
//
// 设置各标志...
ftasktype:=1; {设备搜索任务}
taskexecuting:=true; {任务在执行}
taskfinished:=false; {任务未完成}
tasksuccess:=false; {任务未成功}
requested:=false; {未提交请求}
//
// 启动延时定时器...
tasktimer.interval:=ftimeout; {超时值}
tasktimer.enabled:=true;
//
// 发送请求,搜索路由器...
udp.SendBuffer(buffer,j); {发送设备搜索数据包}
//
// 返回成功...
result:=true;
end;
//
// 得到路由器控制页{任务2}...
function TAutoNAT.GetControlURL(): boolean;
begin
//
// 假如有任务在执行,返回失败...
if tasktimer.enabled then
begin
result:=false;
exit;
end;
//
// 生成请求串...
request:='GET '+frouterurl+' HTTP/1.1'#13#10
+'Host: '+frouterip+':'+inttostr(frouterport)+#13#10#13#10;
//
// 设置各标志...
ftasktype:=2; {设备搜索任务}
taskexecuting:=true; {任务在执行}
taskfinished:=false; {任务未完成}
tasksuccess:=false; {任务未成功}
requested:=false; {未提交请求}
//
// 启动延时定时器...
tasktimer.interval:=ftimeout; {超时值}
tasktimer.enabled:=true;
//
// 连接路由器...
sock.host:=frouterip; {路由器IP地址}
sock.port:=frouterport; {路由器端口号}
sock.active:=true; {连接路由器}
//
// 返回成功...
result:=true;
end;
//
// 增加端口映射项(任务3)...
function TAutoNAT.AddNatMapping(NatPortName: string; ExternalPort: integer; LocalIp: string; LocalPort: integer; Protocol: string): boolean;
var
url,body: string;
j: integer;
begin
//
// 假如有任务在执行,返回失败...
if tasktimer.enabled then
begin
result:=false;
exit;
end;
//
// 生成请求串...
body:='<?xml version="1.0"?>'#13#10
+'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"'#13#10
+'s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'#13#10
+'<s:Body>'#13#10
+'<u:AddPortMapping xmlns:u="'+fservicetype+'">'#13#10
+'<NewRemoteHost></NewRemoteHost>'#13#10
+'<NewExternalPort>'+inttostr(externalport)+'</NewExternalPort>'#13#10
+'<NewProtocol>'+protocol+'</NewProtocol>'#13#10
+'<NewInternalPort>'+inttostr(localport)+'</NewInternalPort>'#13#10
+'<NewInternalClient>'+localip+'</NewInternalClient>'#13#10
+'<NewEnabled>1</NewEnabled>'#13#10
+'<NewPortMappingDescription> </NewPortMappingDescription>'#13#10
+'<NewLeaseDuration>0</NewLeaseDuration>'#13#10
+'</u:AddPortMapping>'#13#10
+'</s:Body>'#13#10
+'</s:Envelope>'#13#10;
//
url:=fcontrolurl;
delete(url,1,7);
j:=pos('/',url);
delete(url,1,j-1);
//
request:='POST '+url+' HTTP/1.1'#13#10
+'Host: '+frouterip+':'+inttostr(routerport)+#13#10
+'SoapAction: "'+fservicetype+'#AddPortMapping"'#13#10
+'Content-Type: text/xml; charset="utf-8"'#13#10
+'Content-Length: '+inttostr(length(body))+#13#10#13#10+body;
//
// 设置各标志...
ftasktype:=3; {设备搜索任务}
taskexecuting:=true; {任务在执行}
taskfinished:=false; {任务未完成}
tasksuccess:=false; {任务未成功}
requested:=false; {未提交请求}
//
// 启动延时定时器...
tasktimer.interval:=ftimeout; {超时值}
tasktimer.enabled:=true;
//
// 连接路由器...
sock.host:=frouterip; {路由器IP}
sock.port:=frouterport; {端口}
sock.active:=true;
//
// 返回成功...
result:=true;
end;
//
// 取外网IP地址(任务4)...
function TAutoNAT.GetExternalIp(): boolean;
var
url,body: string;
j: integer;
begin
//
// 假如有任务在执行,返回失败...
if tasktimer.enabled then
begin
result:=false;
exit;
end;
//
// 生成请求串...
body:='<?xml version="1.0"?>'#13#10
+'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'#13#10
+'<s:Body>'#13#10
+'<u:GetExternalIPAddress xmlns:u="'+fservicetype+'">'#13#10
+'</u:GetExternalIPAddress>'#13#10
+'</s:Body>'#13#10
+'</s:Envelope>'#13#10;
//
url:=fcontrolurl;
delete(url,1,7);
j:=pos('/',url);
delete(url,1,j-1);
//
request:='POST '+url+' HTTP/1.0'#13#10
+'Host: '+frouterip+':'+inttostr(frouterport)+#13#10
+'SoapAction: "'+fservicetype+'#GetExternalIPAddress"'#13#10
+'Content-Type: text/xml; charset="utf-8"'#13#10
+'Content-Length: '+inttostr(length(body))+#13#10#13#10+body;
//
// 设置各标志...
ftasktype:=4; {设备搜索任务}
taskexecuting:=true; {任务在执行}
taskfinished:=false; {任务未完成}
tasksuccess:=false; {任务未成功}
requested:=false; {未提交请求}
//
// 启动延时定时器...
tasktimer.interval:=ftimeout; {超时值}
tasktimer.enabled:=true;
//
// 连接路由器...
sock.host:=frouterip;
sock.port:=frouterport;
sock.active:=true;
//
// 返回成功...
result:=true;
end;
//
// 删除端口映射项(任务5)...
function TAutoNAT.DeleteNatMapping(ExternalPort: integer; Protocol: string): boolean;
var
url,body: string;
j: integer;
begin
//
// 假如有任务在执行,返回失败...
if tasktimer.enabled then
begin
result:=false;
exit;
end;
//
// 生成请求串...
body:='<?xml version="1.0"?>'#13#10
+'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'#13#10
+'<s:Body>'#13#10
+'<u:DeletePortMapping xmlns:u="'+fservicetype+'">'#13#10
+'<NewRemoteHost></NewRemoteHost>'#13#10
+'<NewExternalPort>'+inttostr(externalport)+'</NewExternalPort>'#13#10
+'<NewProtocol>'+protocol+'</NewProtocol>'#13#10
+'</u:DeletePortMapping>'#13#10
+'</s:Body>'#13#10
+'</s:Envelope>'#13#10;
//
url:=fcontrolurl;
delete(url,1,7);
j:=pos('/',url);
delete(url,1,j-1);
//
request:='POST '+url+' HTTP/1.0'#13#10
+'Host: '+routerip+':'+inttostr(routerport)+#13#10
+'SoapAction: "'+fservicetype+'#DeletePortMapping"'#13#10
+'Content-Type: text/xml; charset="utf-8"'#13#10
+'Content-Length: '+inttostr(length(body))+#13#10#13#10+body;
//
// 设置各标志...
ftasktype:=5; {设备搜索任务}
taskexecuting:=true; {任务在执行}
taskfinished:=false; {任务未完成}
tasksuccess:=false; {任务未成功}
requested:=false; {未提交请求}
//
// 启动延时定时器...
tasktimer.interval:=ftimeout; {超时值}
tasktimer.enabled:=true;
//
// 连接路由器...
sock.host:=frouterip;
sock.port:=frouterport;
sock.active:=true;
//
// 返回成功...
result:=true;
end;
end.
|
unit uWeatherDataDisplays;
interface
uses uObserverPatternInterfaces, uWeatherData;
type
TWeatherDataDisplay = class(TInterfacedObject, IObserver, IDisplay)
private
FSubject: TWeatherStation;
FTemperature: integer;
FHumidity: integer;
FPressure: Double;
public
constructor Create(aWeatherData: TWeatherStation);
destructor Destroy; override;
procedure Update(aTemperature: integer; aHumidity: integer; aPressure: Double); virtual;
procedure Display; virtual; abstract;
end;
TCurrentConditionsDisplay = class(TWeatherDataDisplay)
public
procedure Display; override;
end;
TStatisticsDisplay = class(TWeatherDataDisplay)
private
MaxTemp, MinTemp: integer;
TempSum: integer;
NumberOfTemps: integer;
public
constructor Create(aWeatherData: TWeatherStation);
procedure Update(aTemperature: integer; aHumidity: integer; aPressure: Double); override;
procedure Display; override;
end;
TForecastDisplay = class(TWeatherDataDisplay)
private
FPreviousPressure: Double;
public
procedure Update(aTemperature: integer; aHumidity: integer; aPressure: Double); override;
procedure Display; override;
end;
implementation
uses
System.SysUtils
;
{ TCurrentConditionsDisplay }
procedure TCurrentConditionsDisplay.Display;
begin
WriteLn('Current Conditions: ', FTemperature, 'F degrees, Humidity is ', FHumidity, ' and the pressure is ', FPressure, ' inches of mercury');
end;
{ TStatisticsDisplay }
constructor TStatisticsDisplay.Create(aWeatherData: TWeatherStation);
begin
inherited Create(aWeatherData);
NumberOfTemps := 1;
FTemperature := 70;
MaxTemp := FTemperature;
MinTemp := FTemperature;
end;
procedure TStatisticsDisplay.Display;
begin
WriteLn('Avg\Min\Max temperature is: ', Format('%f/%d/%d', [TempSum/NumberOfTemps, MinTemp, MaxTemp]));
end;
procedure TStatisticsDisplay.Update(aTemperature: integer; aHumidity: integer; aPressure: Double);
begin
inherited Update(aTemperature, aHumidity, aPressure);
Inc(NumberOfTemps);
TempSum := TempSum + aTemperature;
if aTemperature > MaxTemp then
begin
MaxTemp := aTemperature;
end;
if aTemperature < MinTemp then
begin
MinTemp := aTemperature;
end;
end;
{ TForecastDisplay }
procedure TForecastDisplay.Display;
begin
if (FPressure > FPreviousPressure) then
begin
Writeln('Improving weather on the way!');
end else
begin
if (FPressure = FPreviousPressure) then
begin
WriteLn('More of the same');
end else
begin
WriteLn('Watch out for cooler, rainy weather');
end;
end;
end;
procedure TForecastDisplay.Update(aTemperature: integer; aHumidity: integer; aPressure: Double);
begin
FPreviousPressure := FPressure;
inherited Update(aTemperature, aHumidity, aPressure);
end;
{ TWeatherDataDisplay }
constructor TWeatherDataDisplay.Create(aWeatherData: TWeatherStation);
begin
inherited Create;
FSubject := aWeatherData;
FSubject.RegisterObserver(Self);
end;
destructor TWeatherDataDisplay.Destroy;
begin
FSubject := nil;
inherited;
end;
procedure TWeatherDataDisplay.Update(aTemperature, aHumidity: integer; aPressure: Double);
begin
FTemperature := aTemperature;
FHumidity := aHumidity;
FPressure := aPressure;
Display;
end;
end.
|
unit PadTab;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, SLBtns, SetInit, MMSystem, Menus, ComCtrls, OleBtn, ActiveX;
type
TfrmPadTab = class(TForm)
pbDragBar: TPaintBox;
PopupMenu1: TPopupMenu;
popPadShowEsc: TMenuItem;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure pbDragBarPaint(Sender: TObject);
procedure popPadShowClick(Sender: TObject);
procedure pbDragBarMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormDestroy(Sender: TObject);
private
FHid: Boolean;
FDropTarget: TDropTarget;
FDropEntered: Boolean;
procedure MoveFrame(var m: Integer; const n, f, Frame: Integer);
function GetDropEnabled: Boolean;
procedure SetDropEnabled(Value: Boolean);
procedure OleDragEnter(var DataObject: IDataObject; KeyState: Longint;
Point: TPoint; var dwEffect: Longint);
procedure OleDragOver(var DataObject: IDataObject; KeyState: Integer;
Point: TPoint; var dwEffect: Integer);
procedure OleDragLeave;
public
frmPad: TForm;
HidLeft: Integer;
HidTop: Integer;
HidWidth: Integer;
HidHeight: Integer;
property Hid: Boolean read FHid;
procedure CreateParams(var Params: TCreateParams); override;
procedure WMSettingChange(var Msg: TWMSettingChange); message WM_SETTINGCHANGE;
procedure WMActivate(var Msg: TWMActivate); message WM_ACTIVATE;
procedure WMEnable(var Msg: TWMEnable); message WM_ENABLE;
property DropEnabled: Boolean read GetDropEnabled write SetDropEnabled;
property DropEntered: Boolean read FDropEntered;
procedure SetHideSize;
procedure MoveShow;
procedure MoveHide;
end;
implementation
uses
Pad, Main;
{$R *.DFM}
// CreateParams
procedure TfrmPadTab.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_TOOLWINDOW;
Params.WndParent := GetDesktopWindow;
end;
// フォーム始め
procedure TfrmPadTab.FormCreate(Sender: TObject);
var
NonClientMetrics: TNonClientMetrics;
begin
SetClassLong(Handle, GCL_HICON, Application.Icon.Handle);
FHid := False;
NonClientMetrics.cbSize := SizeOf(NonClientMetrics);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0);
pbDragBar.Font.Handle := CreateFontIndirect(NonClientMetrics.lfCaptionFont);
DropEnabled := True;
end;
// フォーム終わり
procedure TfrmPadTab.FormDestroy(Sender: TObject);
begin
DropEnabled := False;
end;
// フォーム見える
procedure TfrmPadTab.FormShow(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_HIDE);
end;
// コントロールパネルの変更
procedure TfrmPadTab.WMSettingChange(var Msg: TWMSettingChange);
var
NonClientMetrics: TNonClientMetrics;
begin
inherited;
// タイトルバーのフォント
NonClientMetrics.cbSize := SizeOf(NonClientMetrics);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0);
pbDragBar.Font.Handle := CreateFontIndirect(NonClientMetrics.lfCaptionFont);
SetHideSize;
SetBounds(HidLeft, HidTop, HidWidth, HidHeight);
end;
// アクティブが変わる
procedure TfrmPadTab.WMActivate(var Msg: TWMActivate);
begin
inherited;
TfrmPad(frmPad).Foreground := Msg.Active <> WA_INACTIVE;
// if Msg.Active <> WA_INACTIVE then
// MoveShow;
end;
// Enableが変わる
procedure TfrmPadTab.WMEnable(var Msg: TWMEnable);
begin
inherited;
Enabled := Msg.Enabled;
DropEnabled := Msg.Enabled;
end;
// 隠れたときの位置、サイズを指定
procedure TfrmPadTab.SetHideSize;
var
TabSize: Integer;
StickPosition: TStickPosition;
LogFont: TLogFont;
NewFont, OldFont: HFont;
begin
HidLeft := frmPad.Left;
HidTop := frmPad.Top;
HidWidth := frmPad.Width;
HidHeight := frmPad.Height;
StickPosition := spLeft;
if TfrmPad(frmPad).HideVertical then
begin
if spTop in TfrmPad(frmPad).StickPositions then
StickPosition := spTop
else if spBottom in TfrmPad(frmPad).StickPositions then
StickPosition := spBottom
else if spLeft in TfrmPad(frmPad).StickPositions then
StickPosition := spLeft
else if spRight in TfrmPad(frmPad).StickPositions then
StickPosition := spRight
end
else
begin
if spLeft in TfrmPad(frmPad).StickPositions then
StickPosition := spLeft
else if spRight in TfrmPad(frmPad).StickPositions then
StickPosition := spRight
else if spTop in TfrmPad(frmPad).StickPositions then
StickPosition := spTop
else
StickPosition := spBottom
end;
if TfrmPad(frmPad).HideGroupName then
begin
GetObject(Canvas.Font.Handle, SizeOf(LogFont), @LogFont);
if StickPosition = spLeft then
LogFont.lfEscapement := 900
else if StickPosition = spRight then
LogFont.lfEscapement := 2700
else
LogFont.lfEscapement := 0;
NewFont := CreateFontIndirect(LogFont);
try
OldFont := SelectObject(pbDragBar.Canvas.Handle, NewFont);
TabSize := Abs(pbDragBar.Font.Height) + 2;
NewFont := SelectObject(pbDragBar.Canvas.Handle, OldFont);
finally
DeleteObject(NewFont);
end;
end
else
TabSize := TfrmPad(frmPad).HideSize;
case StickPosition of
spLeft:
begin
HidLeft := frmPad.Monitor.Left;
HidWidth := TabSize;
pbDragBar.Align := alRight;
pbDragBar.Width := TabSize;
end;
spRight:
begin
HidLeft := frmPad.Monitor.Left + frmPad.Monitor.Width - TabSize;
HidWidth := TabSize;
pbDragBar.Align := alLeft;
pbDragBar.Width := TabSize;
end;
spTop:
begin
HidTop := frmPad.Monitor.Top;
HidHeight := TabSize;
pbDragBar.Align := alBottom;
pbDragBar.Height := TabSize;
end;
else
begin
HidTop := frmPad.Monitor.Top + frmPad.Monitor.Height - TabSize;
HidHeight := TabSize;
pbDragBar.Align := alTop;
pbDragBar.Height := TabSize;
end;
end;
end;
// アニメーションの1コマ
procedure TfrmPadTab.MoveFrame(var m: Integer; const n, f, Frame: Integer);
begin
m := f - n;
if m <> 0 then
begin
m := m div Frame;
if m = 0 then
if f > n then
m := 1
else
m := -1;
end;
end;
// ドロップ受付
function TfrmPadTab.GetDropEnabled: Boolean;
begin
Result := FDropTarget <> nil;
end;
// ドロップ受付
procedure TfrmPadTab.SetDropEnabled(Value: Boolean);
var
FormatEtc: array[0..4] of TFormatEtc;
i: Integer;
begin
if DropEnabled = Value then
Exit;
if Value then
begin
for i := 0 to 4 do
begin
with FormatEtc[i] do
begin
dwAspect := DVASPECT_CONTENT;
ptd := nil;
tymed := TYMED_HGLOBAL;
lindex := -1;
end;
end;
FormatEtc[0].cfFormat := CF_SLBUTTONS;
FormatEtc[1].cfFormat := CF_HDROP;
FormatEtc[2].cfFormat := CF_IDLIST;
FormatEtc[3].cfFormat := CF_SHELLURL;
FormatEtc[4].cfFormat := CF_NETSCAPEBOOKMARK;
FDropTarget := TDropTarget.Create(@FormatEtc, 5);
FDropTarget.OnDragEnter := OleDragEnter;
FDropTarget.OnDragOver := OleDragOver;
FDropTarget.OnDragLeave := OleDragLeave;
CoLockObjectExternal(FDropTarget, True, False);
RegisterDragDrop(Handle, FDropTarget);
end
else
begin
RevokeDragDrop(Handle);
CoLockObjectExternal(FDropTarget, False, True);
FDropTarget := nil;
end;
end;
// ドラッグ入る
procedure TfrmPadTab.OleDragEnter(var DataObject: IDataObject; KeyState: Longint;
Point: TPoint; var dwEffect: Longint);
begin
dwEffect := DROPEFFECT_NONE;
FDropEntered := True;
end;
// ドラッグオーバー
procedure TfrmPadTab.OleDragOver(var DataObject: IDataObject;
KeyState: Integer; Point: TPoint; var dwEffect: Integer);
begin
dwEffect := DROPEFFECT_NONE;
end;
// ドラッグ離れる
procedure TfrmPadTab.OleDragLeave;
begin
FDropEntered := False;
end;
// 現れる
procedure TfrmPadTab.MoveShow;
var
SLeft, STop, SWidth, SHeight: Integer;
Frame: Integer;
SoundFile: String;
bForeground: Boolean;
WinHotkey: Word;
begin
SoundFile := UserIniFile.ReadString(IS_SOUNDS, 'MoveShow', '');
if SoundFile <> '' then
PlaySound(PChar(SoundFile), 0, SND_ASYNC);
if TfrmPad(frmPad).HideSmooth then
begin
pbDragBar.Visible := False;
Color := frmPad.Color;
Frame := 5;
while True do
begin
MoveFrame(SLeft, Left, frmPad.Left, Frame);
MoveFrame(STop, Top, frmPad.Top, Frame);
MoveFrame(SWidth, Width, frmPad.Width, Frame);
MoveFrame(SHeight, Height, frmPad.Height, Frame);
if (SLeft = 0) and (STop = 0) and (SWidth = 0) and (SHeight = 0) then
Break;
SetBounds(Left+SLeft, Top+STop, Width+SWidth, Height+SHeight);
Dec(Frame);
Sleep(10);
end;
end;
bForeground := TfrmPad(frmPad).Foreground;
FHid := False;
SetWindowPos(frmPad.Handle, Handle, 0, 0, 0, 0, SWP_NOACTIVATE or SWP_NOSIZE or SWP_NOMOVE or SWP_SHOWWINDOW);
if bForeground then
frmPad.SetFocus;
ShowWindow(Handle, SW_HIDE);
WinHotkey := SendMessage(Handle, WM_GETHOTKEY, 0, 0);
SendMessage(Handle, WM_SETHOTKEY, 0, 0);
SendMessage(frmPad.Handle, WM_SETHOTKEY, WinHotkey, 0);
TfrmPad(frmPad).TopMost := TfrmPad(frmPad).TopMost;
end;
// 隠れる
procedure TfrmPadTab.MoveHide;
var
SLeft, STop, SWidth, SHeight: Integer;
Frame: Integer;
SoundFile: String;
WinHotkey: Word;
begin
SoundFile := UserIniFile.ReadString(IS_SOUNDS, 'MoveHide', '');
if SoundFile <> '' then
PlaySound(PChar(SoundFile), 0, SND_ASYNC);
SetHideSize;
FHid := True;
Color := frmPad.Color;
pbDragBar.Visible := False;
ShowWindow(frmPad.Handle, SW_HIDE);
SetWindowPos(Handle, frmPad.Handle, frmPad.Left, frmPad.Top, frmPad.Width, frmPad.Height, SWP_NOACTIVATE or SWP_SHOWWINDOW);
WinHotkey := SendMessage(frmPad.Handle, WM_GETHOTKEY, 0, 0);
SendMessage(frmPad.Handle, WM_SETHOTKEY, 0, 0);
SendMessage(Handle, WM_SETHOTKEY, WinHotkey, 0);
if TfrmPad(frmPad).HideSmooth then
begin
Frame := 5;
while True do
begin
MoveFrame(SLeft, Left, HidLeft, Frame);
MoveFrame(STop, Top, HidTop, Frame);
MoveFrame(SWidth, Width, HidWidth, Frame);
MoveFrame(SHeight, Height, HidHeight, Frame);
if (SLeft = 0) and (STop = 0) and (SWidth = 0) and (SHeight = 0) then
Break;
SetBounds(Left+SLeft, Top+STop, Width+SWidth, Height+SHeight);
Dec(Frame);
Sleep(10);
end;
end;
SetBounds(HidLeft, HidTop, HidWidth, HidHeight);
Color := TfrmPad(frmPad).HideColor;
// pbDragBar.Visible := TfrmPad(frmPad).HideGroupName;
pbDragBar.Visible := True;
TfrmPad(frmPad).Foreground := False;
end;
procedure TfrmPadTab.pbDragBarPaint(Sender: TObject);
var
GrpName: string;
IsGradat: BOOL;
ARect: TRect;
Direction: TDirection;
begin
if TfrmPad(frmPad).ButtonGroup = nil then
Exit;
GrpName := TfrmPad(frmPad).ButtonGroup.Name;
if not SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, @IsGradat, 0) then
IsGradat := False;
with pbDragBar do
begin
if Align = alLeft then
Direction := drBottomUp
else if Align = alRight then
Direction := drTopDown
else
Direction := drLeftRight;
Canvas.Brush.Color := TfrmPad(frmPad).HideColor;
Canvas.Font.Color := GetFontColorFromFaceColor(Canvas.Brush.Color);
if IsGradat and (Canvas.Brush.Color = clInactiveCaption) then
GradationRect(Canvas, ClientRect, Direction, clInactiveCaption, TColor(clGradientInactiveCaption))
else
Canvas.FillRect(ClientRect);
ARect := ClientRect;
// InflateRect(ARect, -1, -1);
if TfrmPad(frmPad).HideGroupName then
begin
Canvas.Brush.Style := bsClear;
RotateTextOut(Canvas, ARect, Direction, GrpName)
end;
end;
end;
procedure TfrmPadTab.popPadShowClick(Sender: TObject);
begin
if Enabled then
MoveShow;
end;
procedure TfrmPadTab.pbDragBarMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Enabled then
MoveShow;
end;
end.
|
unit BetterDLLSearchPath;
{$mode delphi}
interface
{$ifdef windows}
uses
windows, sysutils;
const
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS=$1000;
LOAD_LIBRARY_SEARCH_USER_DIRS=$400;
var
AddDllDirectory: function(dir: PWideChar):pointer; stdcall;
RemoveDllDirectory: function(cookie: pointer): BOOL; stdcall;
SetDefaultDllDirectories: function(v: dword):BOOL; stdcall;
DLLDirectoryCookie: pointer=nil;
{$endif}
implementation
{$ifdef windows}
function AddDllDirectoryNI(dir: PWideChar):pointer; stdcall;
begin
result:=nil;
end;
function RemoveDllDirectoryNI(cookie: pointer): BOOL; stdcall;
begin
result:=true;
end;
function SetDefaultDllDirectoriesNI(v:dword):BOOL; stdcall;
begin
result:=false;
end;
procedure BetterDLLSearchPathInit;
var
k: THandle;
p: widestring;
begin
k:=LoadLibrary('kernel32.dll');
SetDefaultDllDirectories:=GetProcAddress(k,'SetDefaultDllDirectories');
AddDllDirectory:=GetProcAddress(k,'AddDllDirectory');
RemoveDllDirectory:=GetProcAddress(k,'AddDllDirectory');
if assigned(SetDefaultDllDirectories) then
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS or LOAD_LIBRARY_SEARCH_USER_DIRS)
else
SetDefaultDllDirectories:=@SetDefaultDllDirectoriesNI;
{$warn 4104 off}
if assigned(AddDllDirectory) then
begin
{$ifdef cpu32}
p:=ExtractFilePath(ParamStr(0))+'win32';
{$else}
p:=ExtractFilePath(ParamStr(0))+'win64';
{$endif}
DLLDirectoryCookie:=AddDllDirectory(@p[1]);
end
else
AddDllDirectory:=@AddDllDirectoryNI;
if assigned(RemoveDllDirectory)=false then
RemoveDllDirectory:=@RemoveDllDirectoryNI;
{$warn 4104 on}
end;
initialization
BetterDLLSearchPathInit;
{$endif}
end.
|
unit UnitService;
{*------------------------------------------------------------------------------
@author 侯叶飞
@version 2020/01/28 1.0 Initial revision.
@comment 游戏的业务控制
-------------------------------------------------------------------------------}
interface
uses
System.IOUtils, Winapi.Windows, Winapi.GDIPOBJ, Winapi.GDIPAPI;
type
TGameSevice = class
private
//定义属性
FHdc: HDC;
//表示图片的编号
FImageIndex: Integer;
public
//绘制图片
procedure DrawImage(FileName: string; Width, Hegiht: Integer);
//绘制背景
procedure DrawBackGround(Width, Hegiht: Integer);
//绘制窗口
procedure DrawWindow(x, y, w, h: Integer);
//构造方法,方法名相同,参数列表不同称为重载
constructor Create(hdc: HDC); overload;
constructor Create(); overload;
//定义字段
property GameHandle: HDC read FHdc write FHdc;
property ImageIndex: Integer read FImageIndex write FImageIndex;
end;
implementation
uses
UnitConst;
{ TGameSevice }
constructor TGameSevice.Create(hdc: hdc);
begin
GameHandle := hdc;
end;
constructor TGameSevice.Create;
begin
inherited;
end;
procedure TGameSevice.DrawBackGround(Width, Hegiht: Integer);
var
ImageList: TArray<string>;
begin
//获取图片列表
ImageList := TDirectory.GetFiles(UnitConst.BACK_GROUND_IMAGE);
if ImageIndex >= Length(ImageList) then begin
ImageIndex := 0;
end;
//选取图片列表中的某一个图片,展示在窗口
DrawImage(ImageList[ImageIndex], Width, Hegiht);
end;
procedure TGameSevice.DrawImage(FileName: string; Width, Hegiht: Integer);
var
//画笔
Graphics: TGPGraphics;
Image: TGPImage;
begin
//载入我们的图片文件
Image := TGPImage.Create(FileName);
//将载入的图片绘制到指定的组件上(TImage)
Graphics := TGPGraphics.Create(GameHandle);
//绘制图片
Graphics.DrawImage(Image, MakeRect(0, 0, Width, Hegiht));
Graphics.Free;
Image.Free;
end;
{*------------------------------------------------------------------------------
绘制游戏窗口
@param x 游戏窗口的X坐标
@param y 游戏窗口的Y坐标
@param w 游戏窗口的宽度
@param h 游戏窗口的高度
-------------------------------------------------------------------------------}
procedure TGameSevice.DrawWindow(x, y, w, h: Integer);
var
//画笔
Graphics: TGPGraphics;
img: TGPImage;
begin
//载入我们的图片文件
img := TGPImage.Create(UnitConst.GAME_WINDOW);
//将载入的图片绘制到指定的组件上(TImage)
Graphics := TGPGraphics.Create(GameHandle);
//绘制图片
// 左上角
Graphics.DrawImage(img, MakeRect(x, y, UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitConst.GAME_WINDOW_BORDER_WIDTH), 0, 0, UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitPixel);
// 左侧竖线
Graphics.DrawImage(img, MakeRect(x, y + UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitConst.GAME_WINDOW_BORDER_WIDTH, h - UnitConst.GAME_WINDOW_BORDER_WIDTH), 0, UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetWidth - (img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH), img.GetHeight - UnitConst.GAME_WINDOW_BORDER_WIDTH * 2, UnitPixel);
// 左下角
Graphics.DrawImage(img, MakeRect(x, y + h, UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetHeight), 0, img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetHeight, UnitPixel);
// 底部中线
Graphics.DrawImage(img, MakeRect(x + UnitConst.GAME_WINDOW_BORDER_WIDTH, y + h, w - UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetHeight), UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetHeight - UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH * 2, img.GetHeight, UnitPixel);
// 右下角
Graphics.DrawImage(img, MakeRect(x + w, y + h, img.GetWidth, img.GetHeight), img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetHeight - UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetWidth, img.GetHeight, UnitPixel);
// 右侧竖线
Graphics.DrawImage(img, MakeRect(x + w, y + UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetWidth, h - UnitConst.GAME_WINDOW_BORDER_WIDTH), img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetWidth, img.GetHeight - UnitConst.GAME_WINDOW_BORDER_WIDTH * 2, UnitPixel);
// 右上角
Graphics.DrawImage(img, MakeRect(x + w, y, img.GetHeight, UnitConst.GAME_WINDOW_BORDER_WIDTH), img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH, 0, img.GetHeight, UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitPixel);
// 顶部中线
Graphics.DrawImage(img, MakeRect(x + UnitConst.GAME_WINDOW_BORDER_WIDTH, y, w - UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitConst.GAME_WINDOW_BORDER_WIDTH), UnitConst.GAME_WINDOW_BORDER_WIDTH, 0, img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH * 2, UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitPixel);
// 中间
Graphics.DrawImage(img, MakeRect(x + UnitConst.GAME_WINDOW_BORDER_WIDTH, y + UnitConst.GAME_WINDOW_BORDER_WIDTH, w - UnitConst.GAME_WINDOW_BORDER_WIDTH, h - UnitConst.GAME_WINDOW_BORDER_WIDTH), UnitConst.GAME_WINDOW_BORDER_WIDTH, UnitConst.GAME_WINDOW_BORDER_WIDTH, img.GetWidth - UnitConst.GAME_WINDOW_BORDER_WIDTH * 2, img.GetHeight - UnitConst.GAME_WINDOW_BORDER_WIDTH * 2, UnitPixel);
Graphics.Free;
img.Free;
end;
end.
|
unit ULinkPage;
interface
uses UxlClasses, UxlMiscCtrls, UPageSuper, UPageProperty, UxlList, UTypeDef, UEditBox, UxlComboBox;
type
TLinkPage = class (TChildItemContainer)
private
public
class function PageType (): TPageType; override;
class function DefChildType (): TPageType; override;
class procedure GetListShowCols (o_list: TxlIntList); override;
class procedure InitialListProperty (lp: TListProperty); override;
end;
TFastLinkPage = class (TLinkPage)
public
class function PageType (): TPageType; override;
class function SingleInstance (): boolean; override;
end;
TLinkProperty = class (TClonableProperty)
private
public
LinkType: TLinkType;
Link: widestring;
HotKey: THotKey;
Abbrev: widestring;
Remark: widestring;
procedure Load (o_list: TxlStrList); override;
procedure Save (o_list: TxlStrList); override;
class procedure GetShowCols (o_list: TxlIntList);
function GetColText (id_col: integer; var s_result: widestring): boolean; override;
end;
TLinkItem = class (TChildItemSuper)
private
FLink: TLinkProperty;
protected
function GetImageIndex (): integer; override;
public
constructor Create (i_id: integer); override;
destructor Destroy (); override;
class function PageType (): TPageType; override;
// function GetColText (id_col: integer): widestring; override;
class procedure GetSearchCols (o_list: TxlIntList); override;
procedure Delete (); override;
property Link: TLinkProperty read FLink;
end;
TLinkBox = class (TEditBoxSuper)
private
FHotKey: TxlHotKey;
procedure f_CheckEnable ();
protected
function f_DefaultIcon (): integer; override;
function AllowUserDefinedIcon (): boolean; override;
procedure OnInitialize (); override;
procedure OnOpen (); override;
procedure OnClose (); override;
procedure OnCommand (ctrlID: integer); override;
procedure LoadItem (value: TPageSuper); override;
procedure ClearAndNew (); override;
function SaveItem (value: TPageSuper): integer; override;
public
class function PageType (): TPageType; override;
end;
procedure DecryptLink (const s_full: widestring; var s_link, s_dir, s_param: widestring);
implementation
uses Windows, UxlFunctions, UxlListView, UxlCommDlgs, UxlStrUtils, UPageFactory, UOptionManager, UPageStore, ULangManager, UGlobalObj, Resource;
class function TLinkPage.PageType (): TPageType;
begin
result := ptLink;
end;
class function TLinkPage.DefChildType (): TPageType;
begin
result := ptLinkItem;
end;
class procedure TLinkPage.InitialListProperty (lp: TListProperty);
const c_cols: array[0..1] of integer = (sr_Title, sr_Link);
c_widths: array[0..1] of integer = (100, 200);
begin
with lp do
begin
ColList.Populate (c_cols);
WidthList.Populate (c_widths);
CheckBoxes := false;
View := lpvReport;
FullrowSelect := true;
GridLines := false;
end;
end;
class procedure TLinkPage.GetListShowCols (o_list: TxlIntList);
begin
TLinkProperty.GetShowCols (o_list);
end;
//------------------------
class function TFastLinkPage.PageType (): TPageType;
begin
result := ptFastLink;
end;
class function TFastLinkPage.SingleInstance (): boolean;
begin
result := true;
end;
//-----------------------
constructor TLinkItem.Create (i_id: integer);
begin
inherited Create (i_id);
FLink := TLinkProperty.Create (i_id);
FItemProperty := FLink;
AddProperty (FLink);
end;
destructor TLinkItem.Destroy ();
begin
FLink.free;
inherited;
end;
class function TLinkItem.PageType (): TPageType;
begin
result := ptLinkItem;
end;
function TLinkItem.GetImageIndex (): integer;
var s_link, s_dir, s_param: widestring;
begin
if (FLink.LinkType in [ltFile, ltFolder]) and (not OptionMan.Options.LinkOptions.DisableIconRead) then
begin
DecryptLink (FLink.Link, s_link, s_dir, s_param);
if s_link = '' then
result := -1
else
result := PageImageList.ImageFromFile (RelToFullPath (s_link, ProgDir));
end
else
result := PageImageList.IndexOf (PageType) + Ord (FLink.LinkType);
end;
class procedure TLinkItem.GetSearchCols (o_list: TxlIntList);
begin
TLinkProperty.GetShowCols (o_list);
end;
procedure TLinkItem.Delete ();
begin
EventMan.EventNotify (e_LinkItemDeleted, id);
inherited Delete;
end;
//----------------
procedure TLinkProperty.Load (o_list: TxlStrList);
begin
LinkType := TLinkType(StrToIntDef(o_list[0]));
Link := SingleLineToMultiLine (o_list[1]);
HotKey := StrToIntDef(o_list[2]);
Abbrev := o_list[3];
Remark := SingleLineToMultiLine(o_list[4]);
o_list.Delete (0, 5);
end;
procedure TLinkProperty.Save (o_list: TxlStrList);
begin
with o_list do
begin
Add (IntToStr(Ord(LinkType)));
Add (MultiLineToSingleLine(Link));
Add (IntToStr(HotKey));
Add (Abbrev);
Add (MultiLineToSingleLine(Remark));
end;
end;
class procedure TLinkProperty.GetShowCols (o_list: TxlIntList);
const c_cols: array[0..5] of integer = (sr_Title, sr_Link, sr_LinkType, sr_HotKey, sr_Abbrev, sr_Remark);
var i: integer;
begin
for i := Low(c_cols) to High(c_cols) do
o_list.Add (c_cols[i]);
end;
function TLinkProperty.GetColText (id_col: integer; var s_result: widestring): boolean;
begin
result := true;
case id_col of
sr_Title:
s_result := PageStore[FPageId].Name;
sr_LinkType:
s_result := LangMan.GetItem (sr_LinkTypes + Ord(LinkType));
sr_Link:
s_result := Link;
sr_HotKey:
s_result := HotKeyToString(HotKey);
sr_Abbrev:
s_result := Abbrev;
sr_Remark:
s_result := Remark;
else
result := false;
end;
end;
procedure DecryptLink (const s_full: widestring; var s_link, s_dir, s_param: widestring);
var i: integer;
begin
s_link := trim(s_full);
s_dir := '';
s_param := '';
if s_link = '' then exit;
if s_link[1] = '"' then
begin
i := firstpos('"', s_link, 2);
s_param := trimleft(midstr (s_link, i + 1));
s_link := midstr (s_link, 2, i - 2);
end;
if PathFileExists (s_link) then
s_dir := ExtractFilePath (s_link);
end;
//--------------------
procedure TLinkBox.OnInitialize ();
begin
SetTemplate (Link_Box, m_newlink);
end;
const c_LinkBox: array[0..16] of word = (st_title, st_category1, rb_filelink, rb_folderlink, rb_pagelink, rb_emaillink, st_link1,
st_category, rb_batchlink, cb_add, st_link, st_hotkey, st_abbrev, cb_new, st_remark, IDOK, IDCANCEL);
procedure TLinkBox.OnOpen ();
begin
FHotKey := TxlHotKey.Create (self, ItemHandle[hk_linkhotkey]);
inherited;
RefreshItemText (self, c_LinkBox);
end;
procedure TLinkBox.OnClose ();
begin
FHotkey.free;
inherited;
end;
class function TLinkBox.PageType (): TPageType;
begin
result := ptLinkItem;
end;
procedure TLinkBox.f_CheckEnable ();
begin
ItemEnabled[cb_browse] := ItemChecked[rb_filelink] or ItemChecked[rb_folderlink];
ItemEnabled[cb_add] := ItemChecked[rb_batchlink];
ItemEnabled[mle_linktext] := ItemChecked[rb_batchlink];
ItemEnabled[sle_linktext] := not ItemEnabled[mle_linktext];
end;
procedure TLinkBox.LoadItem (value: TPageSuper);
var p: TLinkProperty;
begin
self.Text := LangMan.GetItem(sr_EditLink);
ItemText[sle_title] := value.name;
p := TLinkItem(value).Link;
ItemChecked[rb_filelink] := (p.LinkType = ltFile);
ItemChecked[rb_folderlink] := (p.LinkType = ltFolder);
ItemChecked[rb_pagelink] := (p.Linktype = ltPage);
ItemChecked[rb_emaillink] := (p.Linktype = ltEmail);
ItemChecked[rb_batchlink] := (p.LinkType = ltBatch);
if p.LinkType = ltBatch then
begin
ItemText[mle_linktext] := p.link;
ItemText[sle_linktext] := '';
end
else
begin
ItemText[sle_linktext] := p.link;
ItemText[mle_linktext] := '';
end;
f_checkenable ();
ItemText[sle_abbrev] := p.Abbrev;
// ItemEnabled[sle_abbrev] := value.owner.pagetype = ptFastLink;
ItemText[mle_remark] := p.Remark;
FHotKey.HotKey := p.hotkey;
FocusControl (sle_title);
inherited LoadItem (value);
end;
procedure TLinkBox.ClearAndNew ();
begin
self.Text := LangMan.GetItem(sr_NewLink);
ItemText[sle_title] := '';
ItemChecked[rb_filelink] := true;
ItemChecked[rb_folderlink] := false;
ItemChecked[rb_pagelink] := false;
ItemChecked[rb_emaillink] := false;
ItemChecked[rb_batchlink] := false;
ItemText[mle_linktext] := '';
ItemText[sle_linktext] := '';
f_checkenable ();
ItemText[sle_abbrev] := '';
ItemText[mle_remark] := '';
FHotKey.HotKey := 0;
FocusControl (sle_title);
inherited ClearAndNew;
end;
function TLinkBox.SaveItem (value: TPageSuper): integer;
begin
value.name := ItemText[sle_title];
with TLinkItem (value).Link do
begin
if ItemChecked[rb_filelink] then
LinkType := ltFile
else if ItemChecked[rb_folderlink] then
LinkType := ltFolder
else if ItemChecked[rb_pagelink] then
LinkType := ltpage
else if ItemChecked[rb_emaillink] then
LinkType := ltEmail
else
LinkType := ltBatch;
if LinkType = ltBatch then
Link := ItemText[mle_linktext]
else
Link := ItemText[sle_linktext];
if HotKey <> FHotkey.HotKey then
begin
Hotkey := FHotKey.HotKey;
EventMan.EventNotify (e_LinkHotkeyChanged, value.id, Hotkey);
end;
Abbrev := ItemText[sle_abbrev];
Remark := ItemText[mle_remark];
end;
inherited SaveItem (value);
end;
function TLinkBox.f_DefaultIcon (): integer;
begin
if ItemChecked[rb_filelink] then
result := ic_filelink
else if ItemChecked[rb_folderlink] then
result := ic_folderlink
else if ItemChecked[rb_pagelink] then
result := ic_pagelink
else if ItemChecked[rb_emaillink] then
result := ic_emaillink
else
result := ic_batchlink;
end;
function TLinkBox.AllowUserDefinedIcon (): boolean;
begin
result := true;
end;
procedure TLinkBox.OnCommand (ctrlID: integer);
procedure f_SetLink (const s_linktext, s: widestring);
begin
ItemText[sle_linktext] := FulltoRelPath (s_linktext, ProgDir);
if ItemText[sle_Title] = '' then ItemText[sle_Title] := ExtractFileName (s, false);
end;
var s_files: widestring;
begin
case ctrlID of
cb_add:
begin
s_files := ItemText[mle_linktext];
if AddFiles (s_files) then
begin
ItemTExt[mle_linktext] := s_files;
MoveCursorLast (mle_linktext);
end;
end;
cb_browse:
begin
if ItemChecked[rb_filelink] then
with TxlOpenDialog.create do
begin
Title := LangMan.GetItem (sr_selectfile);
Filter := LangMan.GetItem (sr_filefilter);
FilterIndex := 1;
FileName := ItemText[sle_linktext];
MultiSelect := false;
if Execute then
f_setLink (Path + FileName, Path + FileName);
free;
end
else if ItemChecked[rb_folderlink] then
with TxlPathDialog.Create do
begin
Title := LangMan.GetItem (sr_selectfolder);
Path := ItemText[sle_linktext];
if Execute then
f_setLink (Path, LeftStr(Path, Length(Path) - 1));
free;
end;
MoveCursorLast (sle_linktext);
end;
rb_filelink, rb_folderlink, rb_pagelink, rb_emaillink, rb_batchlink:
begin
f_CheckEnable;
f_DetermineIcon;
if ItemEnabled [sle_linktext] then
MoveCursorLast (sle_linktext)
else
MoveCursorLast (mle_linktext);
end;
else
inherited;
end;
end;
//--------------------
initialization
PageFactory.RegisterClass (TLinkPage);
PageImageList.AddImageWithOverlay (ptLink, m_newLink);
PageNameMan.RegisterDefName (ptLink, sr_defLinkname);
PageFactory.RegisterClass (TFastLinkPage);
PageImageList.AddImageWithOverlay (ptFastLink, m_FastLink);
// PageNameMan.RegisterDefName (ptLink, sr_defLinkname);
PageFactory.RegisterClass (TLinkItem);
PageImageList.AddImages (ptLinkItem, [ic_filelink, ic_folderlink, ic_pagelink, ic_emaillink, ic_batchlink]);
// PageNameMan.RegisterDefName (ptLinkItem, sr_defLinkItemname);
EditBoxFactory.RegisterClass (TLinkBox);
finalization
end.
|
{*******************************************************************************
Title: T2Ti ERP
Description: VO relacionado à tabela [ETIQUETA_LAYOUT]
The MIT License
Copyright: Copyright (C) 2016 T2Ti.COM
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
The author may be contacted at:
t2ti.com@gmail.com
@author Albert Eije (t2ti.com@gmail.com)
@version 2.0
*******************************************************************************}
unit EtiquetaLayoutVO;
interface
uses
VO, Atributos, Classes, Constantes, Generics.Collections, SysUtils;
type
[TEntity]
[TTable('ETIQUETA_LAYOUT')]
TEtiquetaLayoutVO = class(TVO)
private
FID: Integer;
FID_FORMATO_PAPEL: Integer;
FCODIGO_FABRICANTE: String;
FQUANTIDADE: Integer;
FQUANTIDADE_HORIZONTAL: Integer;
FQUANTIDADE_VERTICAL: Integer;
FMARGEM_SUPERIOR: Integer;
FMARGEM_INFERIOR: Integer;
FMARGEM_ESQUERDA: Integer;
FMARGEM_DIREITA: Integer;
FESPACAMENTO_HORIZONTAL: Integer;
FESPACAMENTO_VERTICAL: Integer;
//Transientes
public
[TId('ID', [ldGrid, ldLookup, ldComboBox])]
[TGeneratedValue(sAuto)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property Id: Integer read FID write FID;
[TColumn('ID_FORMATO_PAPEL', 'Id Formato Papel', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property IdFormatoPapel: Integer read FID_FORMATO_PAPEL write FID_FORMATO_PAPEL;
[TColumn('CODIGO_FABRICANTE', 'Codigo Fabricante', 400, [ldGrid, ldLookup, ldCombobox], False)]
property CodigoFabricante: String read FCODIGO_FABRICANTE write FCODIGO_FABRICANTE;
[TColumn('QUANTIDADE', 'Quantidade', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property Quantidade: Integer read FQUANTIDADE write FQUANTIDADE;
[TColumn('QUANTIDADE_HORIZONTAL', 'Quantidade Horizontal', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property QuantidadeHorizontal: Integer read FQUANTIDADE_HORIZONTAL write FQUANTIDADE_HORIZONTAL;
[TColumn('QUANTIDADE_VERTICAL', 'Quantidade Vertical', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property QuantidadeVertical: Integer read FQUANTIDADE_VERTICAL write FQUANTIDADE_VERTICAL;
[TColumn('MARGEM_SUPERIOR', 'Margem Superior', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property MargemSuperior: Integer read FMARGEM_SUPERIOR write FMARGEM_SUPERIOR;
[TColumn('MARGEM_INFERIOR', 'Margem Inferior', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property MargemInferior: Integer read FMARGEM_INFERIOR write FMARGEM_INFERIOR;
[TColumn('MARGEM_ESQUERDA', 'Margem Esquerda', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property MargemEsquerda: Integer read FMARGEM_ESQUERDA write FMARGEM_ESQUERDA;
[TColumn('MARGEM_DIREITA', 'Margem Direita', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property MargemDireita: Integer read FMARGEM_DIREITA write FMARGEM_DIREITA;
[TColumn('ESPACAMENTO_HORIZONTAL', 'Espacamento Horizontal', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property EspacamentoHorizontal: Integer read FESPACAMENTO_HORIZONTAL write FESPACAMENTO_HORIZONTAL;
[TColumn('ESPACAMENTO_VERTICAL', 'Espacamento Vertical', 80, [ldGrid, ldLookup, ldCombobox], False)]
[TFormatter(ftZerosAEsquerda, taCenter)]
property EspacamentoVertical: Integer read FESPACAMENTO_VERTICAL write FESPACAMENTO_VERTICAL;
//Transientes
end;
implementation
initialization
Classes.RegisterClass(TEtiquetaLayoutVO);
finalization
Classes.UnRegisterClass(TEtiquetaLayoutVO);
end.
|
unit UFrmCustomDBBandedTable;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, UFrmRoot, cxGraphics, cxControls, cxLookAndFeels,
cxLookAndFeelPainters, cxStyles, cxCustomData, cxFilter, cxData,
cxDataStorage, cxEdit, cxNavigator, DB, cxDBData, DBClient, dxBar, cxClasses,
cxGridLevel, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
cxGridBandedTableView, cxGridDBBandedTableView, cxGrid, ExtCtrls, UDmImage,
cxCurrencyEdit, cxGridDBTableView, cxSpinEdit,
cxDataControllerConditionalFormattingRulesManagerDialog;
type
TFrmCustomDBBandedTable = class(TFrmRoot)
pnlClient: TPanel;
grdData: TcxGrid;
grdbndtblvwData: TcxGridDBBandedTableView;
grdlvlData: TcxGridLevel;
pnlTop: TPanel;
BarManager: TdxBarManager;
BarTool: TdxBar;
cdsData: TClientDataSet;
dsData: TDataSource;
private
procedure ColumnGetDisplayText(Sender: TcxCustomGridTableItem;
ARecord: TcxCustomGridRecord; var AText: string);
protected
procedure CreateCurrencyFootrtSummary;
procedure GridHideZero(AGrid: TcxGridTableView);
public
end;
var
FrmCustomDBBandedTable: TFrmCustomDBBandedTable;
implementation
{$R *.dfm}
procedure TFrmCustomDBBandedTable.CreateCurrencyFootrtSummary;
var
I: Integer;
lColumn: TcxGridDBBandedColumn;
lSummaryItem: TcxGridDBTableSummaryItem;
begin
with grdbndtblvwData do
begin
DataController.Summary.FooterSummaryItems.BeginUpdate;
try
for I := 0 to ColumnCount - 1 do
begin
lColumn := Columns[I];
if lColumn.PropertiesClass = TcxCurrencyEditProperties then
begin
lSummaryItem := TcxGridDBTableSummaryItem(DataController.Summary.FooterSummaryItems.Add);
lSummaryItem.Kind := skSum;
lSummaryItem.Format := ',#.##;-,#.##';
lSummaryItem.Column := lColumn;
end;
end;
finally
DataController.Summary.FooterSummaryItems.EndUpdate;
end;
end;
end;
procedure TFrmCustomDBBandedTable.ColumnGetDisplayText(
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: string);
var
lValue: Variant;
begin
lValue := Sender.EditValue;
if VarIsNull(lValue) or VarIsEmpty(lValue) or not VarIsFloat(lValue) then
AText := ''
else if lValue = 0 then
AText := '';
end;
procedure TFrmCustomDBBandedTable.GridHideZero(AGrid: TcxGridTableView);
var
I: Integer;
lColumn: TcxGridColumn;
begin
for I := 0 to AGrid.ColumnCount - 1 do
begin
lColumn := AGrid.Columns[I];
if (lColumn.PropertiesClass = TcxCurrencyEditProperties)
or (lColumn.PropertiesClass = TcxSpinEditProperties) then
lColumn.OnGetDisplayText := ColumnGetDisplayText;
end;
end;
end.
|
unit fButtonForm;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Buttons, Menus, uOperationsManager;
type
{ TfrmButtonForm }
TfrmButtonForm = class(TForm)
btnAddToQueue: TBitBtn;
btnCancel: TBitBtn;
btnCreateSpecialQueue: TBitBtn;
btnOK: TBitBtn;
mnuNewQueue: TMenuItem;
mnuQueue1: TMenuItem;
mnuQueue2: TMenuItem;
mnuQueue3: TMenuItem;
mnuQueue4: TMenuItem;
mnuQueue5: TMenuItem;
pmQueuePopup: TPopupMenu;
pnlContent: TPanel;
pnlButtons: TPanel;
procedure btnAddToQueueClick(Sender: TObject);
procedure btnCreateSpecialQueueClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure mnuNewQueueClick(Sender: TObject);
procedure mnuQueueNumberClick(Sender: TObject);
private
function GetQueueIdentifier: TOperationsManagerQueueIdentifier;
public
constructor Create(TheOwner: TComponent); override;
property QueueIdentifier: TOperationsManagerQueueIdentifier read GetQueueIdentifier;
end;
var
frmButtonForm: TfrmButtonForm;
implementation
{$R *.lfm}
var
FQueueIdentifier: TOperationsManagerQueueIdentifier = SingleQueueId;
{ TfrmButtonForm }
procedure TfrmButtonForm.btnCreateSpecialQueueClick(Sender: TObject);
begin
btnCreateSpecialQueue.PopupMenu.PopUp;
end;
procedure TfrmButtonForm.btnAddToQueueClick(Sender: TObject);
begin
ModalResult := btnAddToQueue.ModalResult;
end;
procedure TfrmButtonForm.btnOKClick(Sender: TObject);
begin
FQueueIdentifier := FreeOperationsQueueId;
end;
procedure TfrmButtonForm.mnuNewQueueClick(Sender: TObject);
var
NewQueueId: TOperationsManagerQueueIdentifier;
begin
for NewQueueId := Succ(FreeOperationsQueueId) to MaxInt do
with OperationsManager do
begin
if not Assigned(QueueByIdentifier[NewQueueId]) then
begin
FQueueIdentifier := NewQueueId;
ModalResult := btnAddToQueue.ModalResult;
Break;
end;
end;
end;
procedure TfrmButtonForm.mnuQueueNumberClick(Sender: TObject);
var
NewQueueNumber: TOperationsManagerQueueIdentifier;
begin
if TryStrToInt(Copy((Sender as TMenuItem).Name, 9, 1), NewQueueNumber) then
begin
FQueueIdentifier := NewQueueNumber;
ModalResult := btnAddToQueue.ModalResult;
end;
end;
function TfrmButtonForm.GetQueueIdentifier: TOperationsManagerQueueIdentifier;
begin
Result:= FQueueIdentifier;
end;
constructor TfrmButtonForm.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
if FQueueIdentifier = FreeOperationsQueueId then FQueueIdentifier:= SingleQueueId;
btnAddToQueue.Caption:= btnAddToQueue.Caption + ' #' + IntToStr(FQueueIdentifier);
end;
end.
|
unit dao.Especialidade;
interface
uses
classes.ScriptDDL,
model.Especialidade,
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants;
type
TEspecialidadeDao = class(TObject)
strict private
aDDL : TScriptDDL;
aModel : TEspecialidade;
aLista : TEspecialidades;
constructor Create();
class var aInstance : TEspecialidadeDao;
public
property Model : TEspecialidade read aModel write aModel;
property Lista : TEspecialidades read aLista write aLista;
procedure Load(); virtual; abstract;
procedure Insert();
procedure Update();
procedure AddLista;
function Find(const aCodigo : Integer; const IsLoadModel : Boolean) : Boolean;
function GetCount() : Integer;
class function GetInstance : TEspecialidadeDao;
end;
implementation
{ TEspecialidadeDao }
uses
UDados;
procedure TEspecialidadeDao.AddLista;
var
I : Integer;
o : TEspecialidade;
begin
I := High(aLista) + 2;
o := TEspecialidade.Create;
if (I <= 0) then
I := 1;
SetLength(aLista, I);
aLista[I - 1] := o;
end;
constructor TEspecialidadeDao.Create();
begin
inherited Create;
aDDL := TScriptDDL.GetInstance;
aModel := TEspecialidade.Create;
SetLength(aLista, 0);
end;
function TEspecialidadeDao.Find(const aCodigo: Integer;
const IsLoadModel : Boolean): Boolean;
var
aSQL : TStringList;
aRetorno : Boolean;
begin
aRetorno := False;
aSQL := TStringList.Create;
try
aSQL.BeginUpdate;
aSQL.Add('Select * ');
aSQL.Add('from ' + aDDL.getTableNameEspecialidade);
aSQL.Add('where cd_especialidade = ' + IntToStr(aCodigo));
aSQL.EndUpdate;
with DtmDados, qrySQL do
begin
qrySQL.Close;
qrySQL.SQL.Text := aSQL.Text;
if qrySQL.OpenOrExecute then
begin
aRetorno := (qrySQL.RecordCount > 0);
if aRetorno and IsLoadModel then
begin
Model.Codigo := FieldByName('cd_especialidade').AsInteger;
Model.Descricao := FieldByName('ds_especialidade').AsString;
end;
end;
qrySQL.Close;
end;
finally
aSQL.Free;
Result := aRetorno;
end;
end;
function TEspecialidadeDao.GetCount: Integer;
var
aRetorno : Integer;
aSQL : TStringList;
begin
aRetorno := 0;
aSQL := TStringList.Create;
try
aSQL.BeginUpdate;
aSQL.Add('Select *');
aSQL.Add('from ' + aDDL.getTableNameEspecialidade);
aSQL.EndUpdate;
with DtmDados, qrySQL do
begin
qrySQL.Close;
qrySQL.SQL.Text := aSQL.Text;
OpenOrExecute;
aRetorno := RecordCount;
qrySQL.Close;
end;
finally
aSQL.Free;
Result := aRetorno;
end;
end;
class function TEspecialidadeDao.GetInstance: TEspecialidadeDao;
begin
if not Assigned(aInstance) then
aInstance := TEspecialidadeDao.Create();
Result := aInstance;
end;
procedure TEspecialidadeDao.Insert;
var
aSQL : TStringList;
begin
aSQL := TStringList.Create;
try
aSQL.BeginUpdate;
aSQL.Add('Insert Into ' + aDDL.getTableNameEspecialidade + '(');
aSQL.Add(' cd_especialidade ');
aSQL.Add(' , ds_especialidade ');
aSQL.Add(') values (');
aSQL.Add(' :cd_especialidade ');
aSQL.Add(' , :ds_especialidade ');
aSQL.Add(')');
aSQL.EndUpdate;
with DtmDados, qrySQL do
begin
qrySQL.Close;
qrySQL.SQL.Text := aSQL.Text;
ParamByName('cd_especialidade').AsInteger := Model.Codigo;
ParamByName('ds_especialidade').AsString := Model.Descricao;
ExecSQL;
end;
finally
aSQL.Free;
end;
end;
procedure TEspecialidadeDao.Update;
var
aSQL : TStringList;
begin
aSQL := TStringList.Create;
try
aSQL.BeginUpdate;
aSQL.Add('Update ' + aDDL.getTableNameEspecialidade + ' Set');
aSQL.Add(' ds_especialidade = :ds_especialidade');
aSQL.Add('where cd_especialidade = :cd_especialidade');
aSQL.EndUpdate;
with DtmDados, qrySQL do
begin
qrySQL.Close;
qrySQL.SQL.Text := aSQL.Text;
ParamByName('cd_especialidade').AsInteger := Model.Codigo;
ParamByName('ds_especialidade').AsString := Model.Descricao;
ExecSQL;
end;
finally
aSQL.Free;
end;
end;
end.
|
{ ******************************************************* }
{ }
{ CodeGear Delphi Visual Component Library }
{ }
{ Copyright (c) 1995-2008 CodeGear }
{ }
{ ******************************************************* }
unit DataSnapTestData;
interface
uses Classes, SysUtils, Db, DbClient, SqlExpr,
DBXDataExpressMetaDataProvider, DbxMetaDataProvider, DBXDataGenerator, DBXCustomDataGenerator,
DBXDbMetaData, DBXCommon, FMTBcd;
const
TestStreamSize = 1024;
StringValue = '999999999999999999999999';
Int64Value = $99FFFFFFFF;
type
TDataSnapTestData = class
private
FConnection: TDBXConnection;
FMetaDataProvider: TDBXDataExpressMetaDataProvider;
FMetaDataTable: TDBXMetaDataTable;
FDataGenerator: TDbxDataGenerator;
FRowCount: Integer;
public
constructor Create(DBXConnection: TDBXConnection);
destructor Destroy; override;
class procedure Check(Success: Boolean); static;
procedure ValidateParams(Params: TParams);
procedure ValidateDataSet(DataSet: TDataSet);
procedure ValidateStream(Stream: TStream);
procedure ValidateReader(Reader: TDBXReader);
procedure ValidateVariant(Value: OleVariant);
procedure ValidateString(Value: String);
procedure ValidateInt64(Value: Int64);
procedure PopulateDataSet(DataSet: TClientDataSet);
procedure PopulateBytes(var Bytes: TBytes);
procedure PopulateMemoryStream(Stream: TMemoryStream);
procedure PopulateParams(Params: TParams);
procedure PopulateVariant(var Value: OleVariant);
procedure PopulateString(var Value: String);
procedure PopulateInt64(var Value: Int64);
function CreateTestParams: TParams;
function CreateTestDataSet: TDataSet;
function CreateTestStream: TStream;
procedure CreateTestTable;
end;
implementation
constructor TDataSnapTestData.Create(DBXConnection: TDBXConnection);
begin
FRowCount := 100;
FConnection := DBXConnection;
if FConnection <> nil then
begin
FMetaDataProvider := TDBXDataExpressMetaDataProvider.Create;
FMetaDataProvider.Connection := DBXConnection;
FMetaDataProvider.Open;
end;
FMetaDataTable := TDBXMetaDataTable.Create;
FMetaDataTable.TableName := 'DATASNAP_TEST_DATA';
FMetaDataTable.AddColumn(TDBXInt64Column.Create('CINT64'));
FMetaDataTable.AddColumn(TDBXUnicodeVarCharColumn.Create('CVARCHAR', 16));
FMetaDataTable.AddColumn(TDBXBinaryColumn.Create('CSTREAM', 5000));
FDataGenerator := TDbxDataGenerator.Create;
FDataGenerator.TableName := FMetaDataTable.TableName;
FDataGenerator.MetaDataProvider := FMetaDataProvider;
FDataGenerator.AddColumn(TDBXInt64SequenceGenerator.Create(FMetaDataTable.getColumn(0)));
FDataGenerator.AddColumn(TDBXWideStringSequenceGenerator.Create(FMetaDataTable.getColumn(1)));
FDataGenerator.AddColumn(TDBXBlobSequenceGenerator.Create(FMetaDataTable.getColumn(2)));
end;
destructor TDataSnapTestData.Destroy;
begin
FreeAndNil(FDataGenerator);
FreeAndNil(FMetaDataTable);
FreeAndNil(FMetaDataProvider);
inherited;
end;
procedure TDataSnapTestData.PopulateParams(Params: TParams);
begin
FDataGenerator.PopulateParams(Params);
end;
procedure TDataSnapTestData.PopulateString(var Value: String);
begin
Value := StringValue;
end;
procedure TDataSnapTestData.PopulateVariant(var Value: OleVariant);
var
Bytes: TBytes;
begin
PopulateBytes(Bytes);
Value := Bytes;
end;
function TDataSnapTestData.CreateTestDataSet: TDataSet;
var
ClientDataSet: TClientDataSet;
begin
ClientDataSet := TClientDataSet.Create(nil);
TDBXDBMetaData.AddClientDataSetFields(ClientDataSet, FMetaDataTable);
PopulateDataSet(ClientDataSet);
Result := ClientDataSet;
end;
function TDataSnapTestData.CreateTestParams: TParams;
begin
Result := TParams.Create(nil);
TDBXDBMetaData.AddParams(Result, FMetaDataTable);
PopulateParams(Result);
end;
function TDataSnapTestData.CreateTestStream: TStream;
var
MemoryStream: TMemoryStream;
begin
MemoryStream := TMemoryStream.Create;
PopulateMemoryStream(MemoryStream);
Result := MemoryStream;
end;
class procedure TDataSnapTestData.Check(Success: Boolean);
begin
if not Success then
raise Exception.Create('Operation failed');
end;
procedure TDataSnapTestData.CreateTestTable;
var
Command: TDBXCommand;
Row: Integer;
Transaction: TDBXTransaction;
begin
Command := nil;
Transaction := nil;
try
Command := FConnection.CreateCommand;
Transaction := FConnection.BeginTransaction(TDBXIsolations.ReadCommitted);
FMetaDataProvider.DropTable(FMetaDataTable.TableName);
FMetaDataProvider.CreateTable(FMetaDataTable);
Command.Text := FDataGenerator.CreateParameterizedInsertStatement;
FDataGenerator.AddParameters(Command);
for Row := 0 to FRowCount - 1 do
begin
FDataGenerator.SetInsertParameters(Command, Row);
Command.ExecuteUpdate;
end;
finally
FConnection.CommitFreeAndNil(Transaction);
Command.Free;
end;
end;
procedure TDataSnapTestData.PopulateDataSet(DataSet: TClientDataSet);
begin
if DataSet.Active then
DataSet.EmptyDataSet;
FDataGenerator.PopulateDataSet(DataSet, FRowCount);
end;
procedure TDataSnapTestData.PopulateInt64(var Value: Int64);
begin
Value := Int64Value;
end;
procedure TDataSnapTestData.PopulateBytes(var Bytes: TBytes);
var
Index: Integer;
Count: Integer;
begin
Count := TestStreamSize;
SetLength(Bytes, Count);
for Index := 0 to Count - 1 do
Bytes[Index] := Byte(Index * 3);
end;
procedure TDataSnapTestData.PopulateMemoryStream(Stream: TMemoryStream);
var
Count: Integer;
Bytes: TBytes;
begin
Count := TestStreamSize;
PopulateBytes(Bytes);
Stream.Size := Count;
Stream.Write(Bytes[0], Count);
Stream.Seek(0, TSeekOrigin.soBeginning);
end;
procedure TDataSnapTestData.ValidateDataSet(DataSet: TDataSet);
var
Row: Integer;
begin
Check(Assigned(DataSet));
Row := 0;
DataSet.First;
while not DataSet.Eof do
begin
FDataGenerator.ValidateRow(DataSet, Row);
DataSet.Next;
inc(Row);
end;
Check(Row = FRowCount);
end;
procedure TDataSnapTestData.ValidateInt64(Value: Int64);
begin
Check(Value = Int64Value);
end;
procedure TDataSnapTestData.ValidateParams(Params: TParams);
begin
FDataGenerator.ValidateParams(Params);
end;
procedure TDataSnapTestData.ValidateReader(Reader: TDBXReader);
var
Row: Integer;
begin
Check(Assigned(Reader));
Row := 0;
while Reader.Next do
begin
FDataGenerator.ValidateRow(Reader, Row);
inc(Row);
end;
end;
procedure TDataSnapTestData.ValidateStream(Stream: TStream);
var
Index: Integer;
Count: Integer;
ByteValue: Byte;
begin
Check(Assigned(Stream));
Count := TestStreamSize - 1;
for Index := 0 to Count do
begin
Check(Stream.Read(ByteValue, 1) = 1);
Check(ByteValue = Byte(Index * 3));
end;
Check(Stream.Read(ByteValue, 1) < 1);
end;
procedure TDataSnapTestData.ValidateString(Value: String);
begin
Check(Value = StringValue);
end;
procedure TDataSnapTestData.ValidateVariant(Value: OleVariant);
var
Index: Integer;
Count: Integer;
Bytes: TBytes;
begin
Bytes := Value;
Count := TestStreamSize;
Check(Length(Bytes) = TestStreamSize);
for Index := 0 to Count - 1 do
begin
Check(Bytes[Index] = Byte(Index * 3));
end;
end;
end.
|
{ *******************************************************************************
Title: T2Ti ERP
Description: Controller relacionado aos procedimentos de venda
The MIT License
Copyright: Copyright (C) 2010 T2Ti.COM
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
The author may be contacted at:
t2ti.com@gmail.com</p>
@author Albert Eije (t2ti.com@gmail.com)
@version 1.0
******************************************************************************* }
unit VendaController;
interface
uses
Classes, SysUtils, NfeCabecalhoVO, NfeDetalheVO, Generics.Collections,
DB, VO, Controller, DBClient, Biblioteca, NfeFormaPagamentoVO,
ControleEstoqueController;
type
TVendaController = class(TController)
private
class var FDataSet: TClientDataSet;
public
class procedure Consulta(pFiltro: String; pPagina: String; pConsultaCompleta: Boolean = False);
class function ConsultaLista(pFiltro: String): TObjectList<TNfeCabecalhoVO>;
class function ConsultaObjeto(pFiltro: String): TNfeCabecalhoVO;
class procedure VendaCabecalho(pFiltro: String);
class procedure VendaDetalhe(pFiltro: String);
class procedure Insere(pObjeto: TNfeCabecalhoVO);
class procedure InsereItem(pObjeto: TNfeDetalheVO);
class function Altera(pObjeto: TNfeCabecalhoVO): Boolean;
class function CancelaVenda(pObjeto: TNfeCabecalhoVO): Boolean;
class function CancelaItemVenda(pItem: Integer): Boolean;
class function GetDataSet: TClientDataSet; override;
class procedure SetDataSet(pDataSet: TClientDataSet); override;
class procedure TratarListaRetorno(pListaObjetos: TObjectList<TVO>);
end;
implementation
uses T2TiORM;
class procedure TVendaController.Consulta(pFiltro: String; pPagina: String; pConsultaCompleta: Boolean);
var
Retorno: TObjectList<TNfeCabecalhoVO>;
begin
try
Retorno := TT2TiORM.Consultar<TNfeCabecalhoVO>(pFiltro, pPagina, pConsultaCompleta);
TratarRetorno<TNfeCabecalhoVO>(Retorno);
finally
end;
end;
class function TVendaController.ConsultaLista(pFiltro: String): TObjectList<TNfeCabecalhoVO>;
begin
try
Result := TT2TiORM.Consultar<TNfeCabecalhoVO>(pFiltro, '-1', True);
finally
end;
end;
class function TVendaController.ConsultaObjeto(pFiltro: String): TNfeCabecalhoVO;
begin
try
Result := TT2TiORM.ConsultarUmObjeto<TNfeCabecalhoVO>(pFiltro, True);
finally
end;
end;
class procedure TVendaController.VendaCabecalho(pFiltro: String);
var
ObjetoLocal: TNfeCabecalhoVO;
begin
try
ObjetoLocal := TT2TiORM.ConsultarUmObjeto<TNfeCabecalhoVO>(pFiltro, True);
TratarRetorno<TNfeCabecalhoVO>(ObjetoLocal);
finally
end;
end;
class procedure TVendaController.VendaDetalhe(pFiltro: String);
var
ObjetoLocal: TNfeDetalheVO;
begin
try
ObjetoLocal := TT2TiORM.ConsultarUmObjeto<TNfeDetalheVO>(pFiltro, True);
TratarRetorno<TNfeDetalheVO>(ObjetoLocal);
finally
end;
end;
class procedure TVendaController.Insere(pObjeto: TNfeCabecalhoVO);
var
UltimoID: Integer;
begin
try
UltimoID := TT2TiORM.Inserir(pObjeto);
{ Destinatario }
if pObjeto.NfeDestinatarioVO.CpfCnpj <> '' then
begin
pObjeto.NfeDestinatarioVO.IdNfeCabecalho := UltimoID;
TT2TiORM.Inserir(pObjeto.NfeDestinatarioVO);
end;
VendaCabecalho('ID = ' + IntToStr(UltimoID));
finally
end;
end;
class procedure TVendaController.InsereItem(pObjeto: TNfeDetalheVO);
var
UltimoID: Integer;
begin
try
UltimoID := TT2TiORM.Inserir(pObjeto);
TControleEstoqueController.AtualizarEstoque(pObjeto.QuantidadeComercial * -1, pObjeto.IdProduto, Sessao.VendaAtual.IdEmpresa, Sessao.Configuracao.EmpresaVO.TipoControleEstoque);
{ Detalhe - Imposto - ICMS }
pObjeto.NfeDetalheImpostoIcmsVO.IdNfeDetalhe := UltimoID;
TT2TiORM.Inserir(pObjeto.NfeDetalheImpostoIcmsVO);
VendaDetalhe('ID = ' + IntToStr(UltimoID));
finally
end;
end;
class function TVendaController.Altera(pObjeto: TNfeCabecalhoVO): Boolean;
begin
try
Result := TT2TiORM.Alterar(pObjeto);
{ Destinatario }
if pObjeto.NfeDestinatarioVO.Id > 0 then
Result := TT2TiORM.Alterar(pObjeto.NfeDestinatarioVO)
else
begin
pObjeto.NfeDestinatarioVO.IdNfeCabecalho := pObjeto.Id;
Result := TT2TiORM.Inserir(pObjeto.NfeDestinatarioVO) > 0;
end;
finally
end;
end;
class function TVendaController.CancelaVenda(pObjeto: TNfeCabecalhoVO): Boolean;
var
DetalheEnumerator: TEnumerator<TNfeDetalheVO>;
PagamentoEnumerator: TEnumerator<TNfeFormaPagamentoVO>;
begin
try
Result := TT2TiORM.Alterar(pObjeto);
// Detalhes
try
DetalheEnumerator := pObjeto.ListaNfeDetalheVO.GetEnumerator;
with DetalheEnumerator do
begin
while MoveNext do
begin
Result := TT2TiORM.Alterar(Current)
end;
end;
finally
FreeAndNil(DetalheEnumerator);
end;
// Detalhes
try
PagamentoEnumerator := pObjeto.ListaNfeFormaPagamentoVO.GetEnumerator;
with PagamentoEnumerator do
begin
while MoveNext do
begin
Current.Estorno := 'S';
Result := TT2TiORM.Alterar(Current)
end;
end;
finally
FreeAndNil(PagamentoEnumerator);
end;
finally
end;
end;
class function TVendaController.CancelaItemVenda(pItem: Integer): Boolean;
var
NfeDetalhe: TNfeDetalheVO;
begin
try
NfeDetalhe := TT2TiORM.ConsultarUmObjeto<TNfeDetalheVO>('NUMERO_ITEM=' + IntToStr(pitem) + ' AND ID_NFE_CABECALHO=' + IntToStr(Sessao.VendaAtual.Id), True);
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DETALHE_IMPOSTO_COFINS where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DETALHE_IMPOSTO_PIS where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DETALHE_IMPOSTO_ICMS where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DETALHE_IMPOSTO_II where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DETALHE_IMPOSTO_IPI where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DETALHE_IMPOSTO_ISSQN where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DET_ESPECIFICO_COMBUSTIVEL where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DET_ESPECIFICO_VEICULO where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DET_ESPECIFICO_ARMAMENTO where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DET_ESPECIFICO_MEDICAMENTO where ID_NFE_DETALHE = ' + IntToStr(NfeDetalhe.Id));
// Exercício - atualize o estoque
Result := TT2TiORM.ComandoSQL('DELETE FROM NFE_DETALHE where ID = ' + IntToStr(NfeDetalhe.Id));
TratarRetorno(Result);
finally
end;
end;
class function TVendaController.GetDataSet: TClientDataSet;
begin
Result := FDataSet;
end;
class procedure TVendaController.SetDataSet(pDataSet: TClientDataSet);
begin
FDataSet := pDataSet;
end;
class procedure TVendaController.TratarListaRetorno(pListaObjetos: TObjectList<TVO>);
begin
try
TratarRetorno<TNfeCabecalhoVO>(TObjectList<TNfeCabecalhoVO>(pListaObjetos));
finally
FreeAndNil(pListaObjetos);
end;
end;
initialization
Classes.RegisterClass(TVendaController);
finalization
Classes.UnRegisterClass(TVendaController);
end.
|
// NAME: TUMAKOV KIRILL ALEKSANDROVICH, 203
// ASGN: N3
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons, Gauges, Recognition, RecognitionResult;
type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
GroupBox1: TGroupBox;
Splitter1: TSplitter;
GroupBox2: TGroupBox;
Image1: TImage;
Image2: TImage;
SpeedButton1: TSpeedButton;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
SpeedButton2: TSpeedButton;
SpeedButton11: TSpeedButton;
Panel3: TPanel;
Label1: TLabel;
Gauge1: TGauge;
SpeedButton17: TSpeedButton;
SpeedButton18: TSpeedButton;
SpeedButton19: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton21: TSpeedButton;
SpeedButton22: TSpeedButton;
SpeedButton23: TSpeedButton;
SpeedButton24: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton25: TSpeedButton;
procedure Image1Click(Sender: TObject);
procedure Image2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure Splitter1Moved(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure SpeedButton17Click(Sender: TObject);
procedure SpeedButton19Click(Sender: TObject);
procedure SpeedButton20Click(Sender: TObject);
procedure SpeedButton21Click(Sender: TObject);
procedure SpeedButton22Click(Sender: TObject);
procedure SpeedButton23Click(Sender: TObject);
procedure SpeedButton24Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton25Click(Sender: TObject);
private
public
Source,Binary:TBitmap;
ActiveImage:Integer;
procedure SetActiveImage(const n:Integer);
procedure ReDrawImages;
procedure SetFiltersEnabled(const Enabled:Boolean);
end;
var
Form1: TForm1;
implementation
uses Math, NumberDialog, Filters;
{$R *.dfm}
// ========================================================================== \\
// Main Logic
// ========================================================================== \\
procedure ReDrawImage(const Image:TImage; const Bmp:TBitmap; const Active:Boolean);
var h,w:Integer;
begin;
Image.Picture.Bitmap.Width:=Image.Width;
Image.Picture.Bitmap.Height:=Image.Height;
Image.Canvas.Brush.Color:=clBtnFace;
Image.Canvas.FillRect(Rect(0,0,Image.Width,Image.Height));
if (Bmp<>nil) and (Bmp.Width<>0) and (Bmp.Height<>0) then
begin;
h:=min(Bmp.Height,Round(Bmp.Height*min(Image.Height/Bmp.Height, Image.Width/Bmp.Width)));
w:=min(Bmp.Width, Round(Bmp.Width* min(Image.Height/Bmp.Height, Image.Width/Bmp.Width)));
Image.Canvas.StretchDraw(Rect((Image.Width-w)div 2, (Image.Height-h)div 2, (Image.Width-w)div 2+w, (Image.Height-h)div 2+h),Bmp);
end;
if Active then
begin;
Image.Canvas.Brush.Color:=clBlack;
Image.Canvas.FrameRect(Rect(0,0,Image.Width,Image.Height));
end;
end;
procedure TForm1.ReDrawImages;
begin;
if ActiveImage=1 then
begin;
ReDrawImage(Image1,Source,true);
ReDrawImage(Image2,Binary,false);
end
else
begin;
ReDrawImage(Image1,Source,false);
ReDrawImage(Image2,Binary,true);
end;
end;
procedure TForm1.SetActiveImage(const n:Integer);
begin;
ActiveImage:=n;
ReDrawImages;
end;
procedure TForm1.SetFiltersEnabled(const Enabled:Boolean);
var i:Integer;
begin;
for i:=0 to ComponentCount-1 do if Components[i] is TSpeedButton then
(Components[i] as TSpeedButton).Enabled:=Enabled;
end;
// ========================================================================== \\
// Event Handlers
// ========================================================================== \\
procedure TForm1.Image1Click(Sender: TObject);
begin
SetActiveImage(1);
end;
procedure TForm1.Image2Click(Sender: TObject);
begin
SetActiveImage(2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Source:=TBitmap.Create;
Binary:=TBitmap.Create;
Gauge:=Gauge1;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin;
SetFiltersEnabled(False);
Source.LoadFromFile(OpenDialog1.FileName);
ReDrawImages;
SetFiltersEnabled(True);
end;
end;
procedure TForm1.Splitter1Moved(Sender: TObject);
begin
ReDrawImages;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
ReDrawImages;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
var FileName: String;
begin
if SaveDialog1.Execute then
begin;
FileName:=SaveDialog1.FileName;
Delete(FileName, Length(FileName)-Length(ExtractFileExt(FileName))+1, Length(ExtractFileExt(FileName)));
FileName:=FileName+'.bmp';
if ActiveImage=1 then
Source.SaveToFile(FileName)
else
Binary.SaveToFile(FileName)
end;
end;
procedure TForm1.SpeedButton11Click(Sender: TObject);
var Radius:Integer;
begin
Radius:=RequestNumber('','Please enter Median Radius.',0);
SetFiltersEnabled(False);
if ActiveImage=1 then
MedianFilter(Source,Radius)
else
MedianFilter(Binary,Radius);
SetFiltersEnabled(True);
ReDrawImages;
end;
procedure TForm1.SpeedButton17Click(Sender: TObject);
begin
SetFiltersEnabled(False);
Binary.Assign(Source);
ConvertToBinary(Binary);
SetFiltersEnabled(True);
ReDrawImages;
end;
procedure TForm1.SpeedButton19Click(Sender: TObject);
var Radius:Integer;
begin
Radius:=RequestNumber('','Please enter Expand Radius.',0);
SetFiltersEnabled(False);
BExpand(Binary,Radius);
SetFiltersEnabled(True);
ReDrawImages;
end;
procedure TForm1.SpeedButton20Click(Sender: TObject);
var Radius:Integer;
begin
Radius:=RequestNumber('','Please enter Shrink Radius.',0);
SetFiltersEnabled(False);
BShrink(Binary,Radius);
SetFiltersEnabled(True);
ReDrawImages;
end;
procedure TForm1.SpeedButton21Click(Sender: TObject);
var Radius:Integer;
begin
Radius:=RequestNumber('','Please enter Close Radius.',0);
SetFiltersEnabled(False);
BClose(Binary,Radius);
SetFiltersEnabled(True);
ReDrawImages;
end;
procedure TForm1.SpeedButton22Click(Sender: TObject);
var Radius:Integer;
begin
Radius:=RequestNumber('','Please enter Open Radius.',0);
SetFiltersEnabled(False);
BOpen(Binary,Radius);
SetFiltersEnabled(True);
ReDrawImages;
end;
procedure TForm1.SpeedButton23Click(Sender: TObject);
begin
SetFiltersEnabled(False);
AddContrast(Source,0.07);
SetFiltersEnabled(True);
ReDrawImages;
end;
procedure TForm1.SpeedButton24Click(Sender: TObject);
begin
Form3.ListBox1.Clear;
SetFiltersEnabled(False);
Form3.ListBox1.Items:=Recognize(Binary,Source);
SetFiltersEnabled(True);
ReDrawImages;
if Form3.ListBox1.Items.Count>0 then
Form3.ShowModal;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
var Tmp:TBitmap;
begin
Tmp:=TBitmap.Create;
Tmp.Assign(Source);
Form3.ListBox1.Clear;
SetFiltersEnabled(False);
MedianFilter(Source,1);
Binary.Assign(Source);
ConvertToBinary(Binary);
BClose(Binary,4);
Source.Assign(Tmp);
Form3.ListBox1.Items:=Recognize(Binary,Source);
SetFiltersEnabled(True);
ReDrawImages;
if Form3.ListBox1.Items.Count>0 then
Form3.ShowModal;
Tmp.Free;
end;
procedure TForm1.SpeedButton4Click(Sender: TObject);
var Tmp:TBitmap;
begin
Tmp:=TBitmap.Create;
Tmp.Assign(Source);
Form3.ListBox1.Clear;
SetFiltersEnabled(False);
AddContrast(Source,0.04);
Binary.Assign(Source);
ConvertToBinary(Binary);
Source.Assign(Tmp);
Form3.ListBox1.Items:=Recognize(Binary,Source);
SetFiltersEnabled(True);
ReDrawImages;
if Form3.ListBox1.Items.Count>0 then
Form3.ShowModal;
Tmp.Free;
end;
procedure TForm1.SpeedButton25Click(Sender: TObject);
var Tmp:TBitmap;
begin
Tmp:=TBitmap.Create;
Tmp.Assign(Source);
Form3.ListBox1.Clear;
SetFiltersEnabled(False);
MedianFilter(Source,5);
Binary.Assign(Source);
ConvertToBinary(Binary);
Source.Assign(Tmp);
MedianFilter(Binary,1);
MedianFilter(Binary,1);
MedianFilter(Binary,1);
MedianFilter(Binary,1);
MedianFilter(Binary,1);
BClose(Binary,5);
MedianFilter(Binary,1);
Form3.ListBox1.Items:=Recognize(Binary,Source);
SetFiltersEnabled(True);
ReDrawImages;
if Form3.ListBox1.Items.Count>0 then
Form3.ShowModal;
Tmp.Free;
end;
end.
|
//**************************************************************************************************
//
// Unit Vcl.Styles.Npp.StyleHooks
// unit for the VCL Styles for Notepad++
// https://github.com/RRUZ/vcl-styles-plugins
//
// The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
// you may not use this file except in compliance with the License. You may obtain a copy of the
// License at http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
// ANY KIND, either express or implied. See the License for the specific language governing rights
// and limitations under the License.
//
// The Original Code is Vcl.Styles.Npp.StyleHooks.pas.
//
// The Initial Developer of the Original Code is Rodrigo Ruz V.
//
// Portions created by Rodrigo Ruz V. are Copyright (C) 2014-2021 Rodrigo Ruz V.
// All Rights Reserved.
//
//**************************************************************************************************
unit Vcl.Styles.Npp.StyleHooks;
interface
uses
Winapi.Windows,
System.Types,
System.SysUtils,
Winapi.Messages,
Vcl.Menus,
Vcl.Themes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Styles.Utils.SysStyleHook,
Vcl.Styles.Utils.Forms;
type
TMainWndNppStyleHook = class(TSysDialogStyleHook)
public
constructor Create(AHandle: THandle); override;
end;
TScintillaStyleHook = class(TMouseTrackSysControlStyleHook)
strict private
FBackColor: TColor;
protected
procedure UpdateColors; override;
procedure WndProc(var Message: TMessage); override;
procedure PaintNC(Canvas: TCanvas); override;
function GetBorderSize: TRect; override;
public
property BackColor: TColor read FBackColor write FBackColor;
constructor Create(AHandle: THandle); override;
end;
implementation
uses
Vcl.Styles.Utils.SysControls;
{ TMainWndNppStyleHook }
constructor TMainWndNppStyleHook.Create(AHandle: THandle);
begin
inherited;
OverridePaintNC:=False;
end;
{ TScintillaStyleHook }
constructor TScintillaStyleHook.Create(AHandle: THandle);
begin
inherited;
{$IF CompilerVersion > 23}
StyleElements := [seBorder];
{$ELSE}
OverridePaintNC := True;
OverrideFont := False;
{$IFEND}
end;
function TScintillaStyleHook.GetBorderSize: TRect;
begin
if SysControl.HasBorder then
Result := Rect(2, 2, 2, 2);
end;
procedure TScintillaStyleHook.PaintNC(Canvas: TCanvas);
var
Details: TThemedElementDetails;
R: TRect;
begin
if StyleServicesEnabled and SysControl.HasBorder then
begin
if Focused then
Details := StyleServices.GetElementDetails(teEditBorderNoScrollFocused)
else if MouseInControl then
Details := StyleServices.GetElementDetails(teEditBorderNoScrollHot)
else if SysControl.Enabled then
Details := StyleServices.GetElementDetails(teEditBorderNoScrollNormal)
else
Details := StyleServices.GetElementDetails(teEditBorderNoScrollDisabled);
R := Rect(0, 0, SysControl.Width, SysControl.Height);
InflateRect(R, -2, -2);
ExcludeClipRect(Canvas.Handle, R.Left, R.Top, R.Right, R.Bottom);
StyleServices.DrawElement(Canvas.Handle, Details,
Rect(0, 0, SysControl.Width, SysControl.Height));
end;
end;
procedure TScintillaStyleHook.UpdateColors;
begin
inherited;
end;
procedure TScintillaStyleHook.WndProc(var Message: TMessage);
begin
inherited;
end;
end.
|
unit TectonicStructurePoster;
interface
uses DBGate, BaseObjects, PersistentObjects;
type
// для тектонических структур
TTectonicStructureDataPoster = class(TImplementedDataPoster)
public
function GetFromDB(AFilter: string; AObjects: TIdObjects): integer; override;
function PostToDB(AObject: TIDObject; ACollection: TIDObjects): integer; override;
function DeleteFromDB(AObject: TIDObject; ACollection: TIDObjects): integer; override;
constructor Create; override;
end;
// для тектонических структур
TNewTectonicStructureDataPoster = class(TImplementedDataPoster)
public
function GetFromDB(AFilter: string; AObjects: TIdObjects): integer; override;
function PostToDB(AObject: TIDObject; ACollection: TIDObjects): integer; override;
function DeleteFromDB(AObject: TIDObject; ACollection: TIDObjects): integer; override;
constructor Create; override;
end;
implementation
uses TectonicStructure, DB, Facade, SysUtils;
{ TTectonicStructureDataPoster }
constructor TTectonicStructureDataPoster.Create;
begin
inherited;
Options := [];
DataSourceString := 'TBL_TECTONIC_STRUCT_DICT';
DataDeletionString := '';
DataPostString := '';
KeyFieldNames := 'STRUCT_ID';
FieldNames := 'STRUCT_ID, VCH_STRUCT_FULL_NAME, VCH_STRUCT_CODE, VCH_OLD_STRUCT_CODE, NUM_STRUCT_TYPE, MAIN_STRUCT_ID';
AccessoryFieldNames := '';
AutoFillDates := false;
Sort := '';
end;
function TTectonicStructureDataPoster.DeleteFromDB(
AObject: TIDObject; ACollection: TIDObjects): integer;
begin
Result := 0;
end;
function TTectonicStructureDataPoster.GetFromDB(AFilter: string;
AObjects: TIdObjects): integer;
var ds: TDataSet;
o: TTectonicStructure;
begin
Result := inherited GetFromDB(AFilter, AObjects);
ds := TMainFacade.GetInstance.DBGates.Add(Self);
if not ds.Eof then
begin
ds.First;
while not ds.Eof do
begin
o := AObjects.Add as TTectonicStructure;
o.ID := ds.FieldByName('STRUCT_ID').AsInteger;
o.Name := trim(ds.FieldByName('VCH_STRUCT_FULL_NAME').AsString);
o.MainTectonicStructureID := ds.FieldByName('MAIN_STRUCT_ID').AsInteger;
ds.Next;
end;
ds.First;
end;
end;
function TTectonicStructureDataPoster.PostToDB(AObject: TIDObject;
ACollection: TIDObjects): integer;
begin
Result := 0;
end;
{ TNewTectonicStructureDataPoster }
constructor TNewTectonicStructureDataPoster.Create;
begin
inherited;
Options := [];
DataSourceString := 'TBL_NEW_TECTONIC_STRUCT_DICT';
DataDeletionString := '';
DataPostString := '';
KeyFieldNames := 'STRUCT_ID';
FieldNames := 'STRUCT_ID, VCH_STRUCT_FULL_NAME, VCH_STRUCT_CODE, VCH_FORMATTED_STRUCT_CODE, NUM_STRUCT_TYPE, MAIN_STRUCT_ID, OLD_STRUCT_ID';
AccessoryFieldNames := '';
AutoFillDates := false;
Sort := '';
end;
function TNewTectonicStructureDataPoster.DeleteFromDB(AObject: TIDObject;
ACollection: TIDObjects): integer;
begin
Result := 0;
end;
function TNewTectonicStructureDataPoster.GetFromDB(AFilter: string;
AObjects: TIdObjects): integer;
var ds: TDataSet;
o: TNewTectonicStructure;
begin
Result := inherited GetFromDB(AFilter, AObjects);
ds := TMainFacade.GetInstance.DBGates.Add(Self);
if not ds.Eof then
begin
ds.First;
while not ds.Eof do
begin
o := AObjects.Add as TNewTectonicStructure;
o.ID := ds.FieldByName('STRUCT_ID').AsInteger;
o.Name := trim(ds.FieldByName('VCH_STRUCT_FULL_NAME').AsString);
o.MainTectonicStructureID := ds.FieldByName('MAIN_STRUCT_ID').AsInteger;
ds.Next;
end;
ds.First;
end;
end;
function TNewTectonicStructureDataPoster.PostToDB(AObject: TIDObject;
ACollection: TIDObjects): integer;
begin
Result := 0;
end;
end.
|
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: LinkDebug.pas, released 2002-01-06.
The Initial Developer of the Original Code is David Polberger <dpol att swipnet dott se>
Portions created by David Polberger are Copyright (C) 2002 David Polberger.
All Rights Reserved.
Contributor(s): ______________________________________.
Current Version: 2.00
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.delphi-jedi.org
Description:
LinkDebug.pas provides utility routines designed to aid debugging.
Known Issues:
Please see the accompanying documentation.
-----------------------------------------------------------------------------}
// $Id: JvLinkLabelDebug.pas 12538 2009-10-03 12:18:34Z ahuser $
unit JvLinkLabelDebug;
{$I jvcl.inc}
interface
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
TypInfo, SysUtils,
ComCtrls, Graphics,
JvLinkLabelTree, JvLinkLabelTools, JvLinkLabel;
type
TDebugLinkLabelTools = class(TStaticObject)
public
class procedure NodeTreeToTreeNodes(const LinkLabel: TJvLinkLabel;
const Tree: TTreeNodes);
end;
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$URL: https://jvcl.svn.sourceforge.net/svnroot/jvcl/branches/JVCL3_47_PREPARATION/run/JvLinkLabelDebug.pas $';
Revision: '$Revision: 12538 $';
Date: '$Date: 2009-10-03 14:18:34 +0200 (sam. 03 oct. 2009) $';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
implementation
type
TJvLinkLabelAccessProtected = class(TJvLinkLabel);
class procedure TDebugLinkLabelTools.NodeTreeToTreeNodes(const LinkLabel: TJvLinkLabel;
const Tree: TTreeNodes);
function GetNodeDescription(const Node: TNode): string;
begin
Result := Node.ClassName;
case Node.GetNodeType of
ntStyleNode:
Result := Result + ' (' +
GetEnumName(TypeInfo(TFontStyle), Integer((Node as TStyleNode).Style)) + ')';
ntLinkNode:
Result := Result + ' (' +
GetEnumName(TypeInfo(TLinkState), Integer((Node as TLinkNode).State)) + ')';
ntStringNode:
Result := Result + ' ("' + (Node as TStringNode).Text + '")';
ntActionNode:
Result := Result + ' (' +
GetEnumName(TypeInfo(TActionType), Integer((Node as TActionNode).Action)) + ')';
ntColorNode:
Result := Result + ' ( ' + ColorToString(TColorNode(Node).Color) + ' )';
ntUnknownNode:
Result := Result + ' ("' + (Node as TUnknownNode).Tag + '")';
end;
if Node is TAreaNode then
Result := Result + ' [X: ' + IntToStr(TAreaNode(Node).StartingPoint.X) +
', Y: ' + IntToStr(TAreaNode(Node).StartingPoint.Y) + ']';
end;
procedure Recurse(const Parent: TTreeNode; Node: TNode);
var
TreeParent: TTreeNode;
I: Integer;
begin
TreeParent := Tree.AddChild(Parent, GetNodeDescription(Node));
if Node is TParentNode then
for I := 0 to TParentNode(Node).Children.Count - 1 do
Recurse(TreeParent, TParentNode(Node).Children[I]);
end;
begin
if Assigned(TJvLinkLabelAccessProtected(LinkLabel).FNodeTree) and Assigned(Tree) then
begin
Tree.Clear;
Recurse(nil, TJvLinkLabelAccessProtected(LinkLabel).FNodeTree.Root);
end;
end;
{$IFDEF UNITVERSIONING}
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
end.
|
unit uOSManApplication;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
uModule, TntClasses, TntSysUtils, Windows, ComServ, ComObj, ActiveX, OSMan_TLB,
SysUtils, StdVcl, Variants, uOSMCommon;
implementation
type
TModuleClassList = class(TTNTStringList)
protected
hModule: hModule;
iModule: IOSManModule;
public
constructor create();
destructor destroy; override;
end;
TApplication = class(TAutoObject, IOSManApplication)
protected
appPath: WideString;
moduleList: TTNTStringList;
fLogger:OleVariant;
fZeroCnt:integer;
function createObject(const ObjClassName: WideString): IDispatch;
safecall;
function getModuleClasses(const ModuleName: WideString): OleVariant;
safecall;
function ObjRelease: Integer; override;
function getModules: OleVariant; safecall;
function toString: WideString; safecall;
function getClassName: WideString; safecall;
procedure onModuleUnload(const iModSelfPtr: IUnknown); safecall;
function Get_logger: OleVariant; safecall;
procedure Set_logger(Value: OleVariant); safecall;
procedure log(const msg: WideString); safecall;
property logger: OleVariant read Get_logger write Set_logger;
public
destructor destroy(); override;
procedure initialize(); override;
end;
function TApplication.createObject(
const ObjClassName: WideString): IDispatch;
function getModule(const modName: WideString): TModuleClassList;
var
i: integer;
begin
result := nil;
i := moduleList.IndexOf(modName);
if i < 0 then exit;
result := moduleList.Objects[i] as TModuleClassList;
end;
var
i, j: integer;
ws, wsClass: WideString;
cl: TModuleClassList;
oGUID: TGUID;
begin
result := nil;
cl := nil;
i := posEx('.', ObjClassName, 2,high(integer));
if i > 0 then begin
//full name 'module.class'
ws := copy(ObjClassName, 1, i - 1);
cl := getModule(ws);
if not assigned(cl) then
raise EOleError.create('TApplication.createObjectByName: module "' + ws + '" not found');
wsClass := copy(ObjClassName, i + 1, length(ObjClassName));
try
oGUID := StringToGUID(cl.Values[wsClass]);
except
on E: Exception do
E.Message := 'TApplication.createObjectByName: class "' + wsClass + '" not found';
end;
end
else begin
//short name 'class'
wsClass := ObjClassName;
j := -1;
for i := 0 to moduleList.Count - 1 do begin
cl := moduleList.Objects[i] as TModuleClassList;
j := cl.IndexOfName(wsClass);
if j < 0 then continue;
break;
end;
if j >= 0 then
oGUID := StringToGUID(cl.ValueFromIndex[j])
else
raise EOleError.create('TApplication.createObjectByName: class "' + wsClass + '" not found');
end;
OleCheck(cl.iModule.createObjectByCLSID(oGUID, result));
end;
function TApplication.getModuleClasses(
const ModuleName: WideString): OleVariant;
var
i, l: integer;
clist: TTntStrings;
begin
i := moduleList.IndexOf(ModuleName);
l := 0;
clist := nil;
if (i >= 0) then begin
clist := moduleList.Objects[i] as TTntStrings;
if assigned(clist) then l := clist.Count;
end;
result := VarArrayCreate([0, l - 1], varVariant);
for i := 0 to l - 1 do begin
VarArrayPut(Variant(result), clist.Names[i], [i]);
end;
end;
function TApplication.getModules: OleVariant;
var
l, i: integer;
begin
l := moduleList.Count;
result := VarArrayCreate([0, l - 1], varVariant);
for i := 0 to l - 1 do begin
VarArrayPut(Variant(result), moduleList[i], [i]);
end;
end;
function TApplication.toString: WideString;
begin
result := Format('OSMan.Application.%p', [pointer(self)]);
end;
function TApplication.getClassName: WideString;
begin
result := 'OSManApplication';
end;
procedure TApplication.initialize();
var
ws: WideString;
i: integer;
sr: TSearchRecW;
hMod: hModule;
pModuleFunc: TOSManModuleFunc;
clist: TModuleClassList;
iu: IUnknown;
idi:IDispatch;
cnames, cids: OleVariant;
begin
inherited;
fLogger:=Unassigned;
try
idi:=self;
fZeroCnt:=RefCount;
appPath := getOSManPath();
ws := appPath + '*.omm';
moduleList := TTNTStringList.create();
moduleList.CaseSensitive := true;
i := WideFindFirst(ws, faReadOnly or faHidden or faSysFile or faArchive, sr);
while i = 0 do begin
hMod := loadLibraryW(PWideChar(appPath + sr.Name));
if hMod <> 0 then begin
pModuleFunc := getProcAddress(hMod, 'OSManModule');
if assigned(pModuleFunc) then begin
if succeeded(pModuleFunc(idi,IID_IOSManModule, iu)) and
succeeded((iu as IOSManModule).getClasses(cnames, cids)) then begin
clist := nil;
try
clist := TModuleClassList.create();
clist.CaseSensitive := true;
for i := VarArrayLowBound(cnames, 1) to VarArrayHighBound(cnames, 1) do begin
clist.Values[cnames[i]] := cids[i];
end;
clist.Sorted := true;
clist.hModule := hMod;
clist.iModule := iu as IOSManModule;
iu := nil;
hMod := 0;
except
if assigned(clist) then FreeAndNil(clist);
end;
cnames := Null;
cids := Null;
moduleList.AddObject(WideChangeFileExt(WideExtractFileName(sr.Name), ''), clist);
end;
end;
end;
if hMod <> 0 then
freeLibrary(hMod);
i := WideFindNext(sr);
end;
WideFindClose(sr);
finally
//compare fZeroCnt and RefCount before Release call, so add 1
fZeroCnt:=RefCount-fZeroCnt+1;
end;
end;
destructor TApplication.destroy;
var
i: integer;
o: TObject;
begin
fZeroCnt:=-1;
fLogger:=Unassigned;
if assigned(moduleList) then
for i := moduleList.Count - 1 downto 0 do begin
o := moduleList.Objects[i];
if assigned(o) then begin
o.Free;
moduleList.Objects[i] := nil;
end;
end;
FreeAndNil(moduleList);
inherited;
end;
{ TModuleClassList }
constructor TModuleClassList.create;
begin
hModule := 0;
end;
destructor TModuleClassList.destroy;
begin
if assigned(iModule) then begin
iModule.appRef:=nil;
iModule := nil;
end;
if hModule <> 0 then
freeLibrary(hModule);
hModule := 0;
inherited;
end;
function TApplication.Get_logger: OleVariant;
begin
result:=fLogger;
end;
procedure TApplication.log(const msg: WideString);
begin
if not VarIsType(fLogger,varDispatch) then
debugPrint(msg)
else
try
fLogger.log(msg);
except
logger:=0;
end;
end;
procedure TApplication.Set_logger(Value: OleVariant);
begin
fLogger:=Value;
end;
function TApplication.ObjRelease: Integer;
begin
if (RefCount<=fZeroCnt) then begin
if RefCount=fZeroCnt then
destroy();
result:=0;
end
else
result:=inherited ObjRelease();
end;
procedure TApplication.onModuleUnload(const iModSelfPtr: IUnknown);
var
i:integer;
clist:TModuleClassList;
intf:IOSManModule;
begin
for i:=0 to moduleList.Count-1 do begin
clist:=moduleList.Objects[i] as TModuleClassList;
intf:=iModSelfPtr as IOSManModule;
if(clist.iModule=intf) then begin
moduleList.Objects[i]:=nil;
clist.Free();
moduleList.Delete(i);
break;
end;
end;
end;
initialization
TAutoObjectFactory.create(ComServer, TApplication, Class_Application,
ciMultiInstance, tmApartment);
end.
|
{$include kode.inc}
unit kode_filter_moog;
{
http://musicdsp.org/showArchiveComment.php?ArchiveID=253
Notes :
hacked from the exemple of user script in FL Edison
Code :
TLP24DB = class
constructor create;
procedure process(inp,Frq,Res:single;SR:integer);
public outlp:single;
end;
----------------------------------------
implementation
constructor TLP24DB.create;
begin
end;
// the result is in outlp
// 1/ call MyTLP24DB.Process
// 2/then get the result from outlp.
// this filter have a fantastic sound w/a very special res
// _kd is the denormal killer value.
}
//----------------------------------------------------------------------
interface
//----------------------------------------------------------------------
type
KFilter_Moog = class
private
FSamplerate : single;
f,p,k,t,t2 : single;
r : single;
y1, y2, y3, y4 : single;
oldx, oldy1, oldy2, oldy3: Single;
public
constructor create;
procedure setSamplerate(ARate:Single);
procedure setFreq(Freq:Single; SR:Single{Integer});
procedure setFreq(Freq:Single);
procedure setRes(Res:Single);
function process(inp:Single) : Single;
function process(inp:Single; Frq:Single; Res:Single; SR:Single{Integer}) : Single;
end;
const
_kd = 1.0e-24; // ??
//----------------------------------------------------------------------
implementation
//----------------------------------------------------------------------
uses
kode_const;
//----------
constructor KFilter_Moog.create;
begin
inherited;
y1:=0;
y2:=0;
y3:=0;
y4:=0;
oldx:=0;
oldy1:=0;
oldy2:=0;
oldy3:=0;
end;
//----------
procedure KFilter_Moog.setSamplerate(ARate:Single);
begin
FSamplerate := ARate;
end;
//----------
procedure KFilter_Moog.setFreq(Freq:Single; SR:Single{Integer});
begin
f := (Freq+Freq) / SR;
p := f * (1.8-0.8*f);
k := p + p - 1.0;
t := (1.0-p) * 1.386249;
t2 := 12.0 + t * t;
end;
//----------
procedure KFilter_Moog.setFreq(Freq:Single);
begin
setFreq(Freq,FSamplerate);
end;
//----------
procedure KFilter_Moog.setRes(Res:Single);
begin
r := Res*(t2+6.0*t)/(t2-6.0*t);
end;
//----------
function KFilter_Moog.process(inp:Single) : Single;
var
x : single;
begin
x := inp - r*y4;
y1 := x*p + oldx*p - k*y1;
y2 := y1*p+oldy1*p - k*y2;
y3 := y2*p+oldy2*p - k*y3;
y4 := y3*p+oldy3*p - k*y4;
y4 := y4 - ((y4*y4*y4)/6.0);
oldx := x;
oldy1 := y1+_kd;
oldy2 := y2+_kd;;
oldy3 := y3+_kd;;
result := y4;
end;
//----------
function KFilter_Moog.process(inp:Single; Frq:Single; Res:Single; SR:Single{Integer}) : Single;
var
x : single;
begin
f := (Frq+Frq) / SR;
p := f*(1.8-0.8*f);
k := p+p-1.0;
t := (1.0-p)*1.386249;
t2 := 12.0+t*t;
r := res*(t2+6.0*t)/(t2-6.0*t);
x := inp - r*y4;
y1 := x*p + oldx*p - k*y1;
y2 := y1*p+oldy1*p - k*y2;
y3 := y2*p+oldy2*p - k*y3;
y4 := y3*p+oldy3*p - k*y4;
y4 := y4 - ((y4*y4*y4)/6.0);
oldx := x;
oldy1 := y1+_kd;
oldy2 := y2+_kd;;
oldy3 := y3+_kd;;
result := y4;
end;
//----------------------------------------------------------------------
end.
|
unit Materials;
interface
uses
System.Classes,
System.SysUtils,
FMX.Types3D,
FMX.Graphics,
FMX.Materials,
FMX.MaterialSources;
type
TFeatheredEdgeMaterialSource = class(TMaterialSource)
private
FImage: TBitmap;
procedure SetImage(const AValue: TBitmap);
function GetFeather: Single;
procedure SetFeather(const AValue: Single);
procedure HandleImageChanged(Sender: TObject);
protected
function CreateMaterial: TMaterial; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Image: TBitmap read FImage write SetImage;
property Feather: Single read GetFeather write SetFeather;
end;
type
TFeatheredEdgeMaterial = class(TCustomMaterial)
private class var
FShaderArch: TContextShaderArch;
FVertexShaderData: TBytes;
FPixelShaderData: TBytes;
FMatrixIndex: Integer;
FMatrixSize: Integer;
FFloatSize: Integer;
private
FTexture: TTexture; // Reference
FFeather: Single;
procedure SetTexture(const AValue: TTexture);
procedure SetFeather(const AValue: Single);
private
class procedure LoadShaders; static;
class function LoadShader(const AResourceName: String): TBytes; static;
protected
procedure DoInitialize; override;
procedure DoApply(const Context: TContext3D); override;
public
property Texture: TTexture read FTexture write SetTexture;
property Feather: Single read FFeather write SetFeather;
end;
implementation
uses
System.Types,
System.Math.Vectors,
{$IF Defined(MSWINDOWS)}
FMX.Context.DX9,
FMX.Context.DX11;
{$ELSEIF Defined(ANDROID)}
FMX.Context.GLES;
{$ELSEIF Defined(IOS)}
FMX.Context.GLES,
FMX.Context.Metal;
{$ELSEIF Defined(MACOS)}
FMX.Context.Mac,
FMX.Context.Metal;
{$ELSE}
{$MESSAGE Error 'Unsupported platform'}
{$ENDIF}
{$R 'Shaders\Shaders.res'}
{ TFeatheredEdgeMaterialSource }
constructor TFeatheredEdgeMaterialSource.Create(AOwner: TComponent);
begin
inherited;
FImage := TTextureBitmap.Create;
FImage.OnChange := HandleImageChanged;
end;
function TFeatheredEdgeMaterialSource.CreateMaterial: TMaterial;
begin
Result := TFeatheredEdgeMaterial.Create;
end;
destructor TFeatheredEdgeMaterialSource.Destroy;
begin
FImage.Free;
inherited;
end;
function TFeatheredEdgeMaterialSource.GetFeather: Single;
begin
Result := TFeatheredEdgeMaterial(Material).Feather;
end;
procedure TFeatheredEdgeMaterialSource.HandleImageChanged(Sender: TObject);
begin
if (not FImage.IsEmpty) then
TFeatheredEdgeMaterial(Material).Texture := TTextureBitmap(FImage).Texture;
end;
procedure TFeatheredEdgeMaterialSource.SetFeather(const AValue: Single);
begin
TFeatheredEdgeMaterial(Material).Feather := AValue;
end;
procedure TFeatheredEdgeMaterialSource.SetImage(const AValue: TBitmap);
begin
FImage.Assign(AValue);
end;
{ TFeatheredEdgeMaterial }
procedure TFeatheredEdgeMaterial.DoApply(const Context: TContext3D);
begin
inherited;
Context.SetShaderVariable('Texture', FTexture);
Context.SetShaderVariable('Feather', [Vector3D(FFeather, 0, 0, 0)]);
end;
procedure TFeatheredEdgeMaterial.DoInitialize;
begin
inherited;
if (FShaderArch = TContextShaderArch.Undefined) then
LoadShaders;
FVertexShader := TShaderManager.RegisterShaderFromData('FeatheredEdge.fvs',
TContextShaderKind.VertexShader, '', [
TContextShaderSource.Create(FShaderArch, FVertexShaderData,
[TContextShaderVariable.Create('MVPMatrix', TContextShaderVariableKind.Matrix,
FMatrixIndex, FMatrixSize)])
]);
FPixelShader := TShaderManager.RegisterShaderFromData('FeatheredEdge.fps',
TContextShaderKind.PixelShader, '', [
TContextShaderSource.Create(FShaderArch, FPixelShaderData,
[TContextShaderVariable.Create('Texture', TContextShaderVariableKind.Texture, 0, 0),
TContextShaderVariable.Create('Feather', TContextShaderVariableKind.Float, 0, FFloatSize)])
]);
end;
class function TFeatheredEdgeMaterial.LoadShader(const AResourceName: String): TBytes;
begin
var Stream := TResourceStream.Create(HInstance, AResourceName, RT_RCDATA);
try
SetLength(Result, Stream.Size);
Stream.ReadBuffer(Result, Length(Result));
finally
Stream.Free;
end;
end;
class procedure TFeatheredEdgeMaterial.LoadShaders;
begin
var Suffix := '';
var ContextClass := TContextManager.DefaultContextClass;
{$IF Defined(MSWINDOWS)}
if (ContextClass.InheritsFrom(TCustomDX9Context)) then
begin
FShaderArch := TContextShaderArch.DX9;
FMatrixIndex := 0;
FMatrixSize := 4;
FFloatSize := 1;
Suffix := 'DX9';
end
else if (ContextClass.InheritsFrom(TCustomDX11Context)) then
begin
FShaderArch := TContextShaderArch.DX11;
FMatrixIndex := 0;
FMatrixSize := 64;
FFloatSize := 4;
Suffix := 'DX11';
end;
{$ELSE}
if (ContextClass.InheritsFrom(TCustomContextOpenGL)) then
begin
FShaderArch := TContextShaderArch.GLSL;
FMatrixIndex := 0;
FMatrixSize := 4;
FFloatSize := 1;
Suffix := 'GL';
end;
{$ENDIF}
{$IF Defined(MACOS)}
if (ContextClass.InheritsFrom(TCustomContextMetal)) then
begin
FShaderArch := TContextShaderArch.Metal;
FMatrixIndex := 1;
FMatrixSize := 4;
FFloatSize := 1;
Suffix := 'MTL';
end;
{$ENDIF}
if (FShaderArch = TContextShaderArch.Undefined) then
raise EContext3DException.Create('Unknown or unsupported 3D context class');
FVertexShaderData := LoadShader('VERTEX_SHADER_' + Suffix);
FPixelShaderData := LoadShader('PIXEL_SHADER_' + Suffix);
end;
procedure TFeatheredEdgeMaterial.SetFeather(const AValue: Single);
begin
if (AValue <> FFeather) then
begin
FFeather := AValue;
DoChange;
end;
end;
procedure TFeatheredEdgeMaterial.SetTexture(const AValue: TTexture);
begin
FTexture := AValue;
DoChange;
end;
end.
|
unit BaseConsts;
interface
const
sAutoSaveMessage = 'Сохранить изменения? '+ #13 + #10 + '(если не хотите всё время отвечать на этот вопрос - поднимите флаг автосохранения).';
EMPLOYEE_NIKONOV = 3;
NO_TECTONIC_BLOCK_ID = 0;
PODV_TECTONIC_BLOCK_ID = 7;
CORE_MECH_STATE_STRINGS = 10; // керн столбики - ранее цилиндры
EXCEL_XL_SOLID = 1;
EXCEL_XL_AUTOMATIC = -4105;
EXCEL_XL_ThemeColorDark1 = 1;
SUBDIVISION_COMMENT_NULL = 0;
SUBDIVISION_COMMENT_STOP = 5;
SUBDIVISION_COMMENT_NOT_PRESENT = 3;
SUBDIVISION_COMMENT_NOT_DIVIDED = 1; // нр
SUBDIVISION_COMMENT_NO_DATA = 2;
SUBDIVISION_COMMENT_NOT_CROSSED = 4; // не вскрыто
sNoDataMessage = 'не указан';
CoreDirector1 = 'Кручинин С.А.';
CoreDirector2 = 'Рогов И.Г.';
CoreDirector3 = 'Комайгородская С.В.';
RemoteCoreFilesPath = '\\srvdb.tprc\DocsBank$\PhotoBoxs\';
RemoteCoreFilesDiskLetter = 'F:';
RemoteSrvName = '\\srvdb.tprc';
GARAGE_PART_PLACEMENT_ID = 2500; //ангар
BASEMENT_PART_PLACEMENT_ID = 2700; // подвал
// типы перевозки
CORE_TRANSFER_TYPE_TRANSFER_ID = 1;
CORE_TRANSFER_TYPE_REPLACING_ID = 2;
CORE_TRANSFER_TYPE_LIC_ID = 3;
CORE_TRANSFER_TYPE_ARRIVE_ID = 4;
CORE_TRANSFER_TYPE_PASS_ID = 5;
DISTRICT_OBJECT_TYPE_ID = 37; // тип объекта - георегион
PETROL_REGION_OBJECT_TYPE_ID = 38; // тип объекта - нефтегазоносный регион
TECTONIC_STRUCT_OBJECT_TYPE_ID = 39; // тип объекта - тектоническая структура
LICENSE_ZONE_OBJECT_TYPE_ID = 29; // тип объекта - лицензионный участок
ORGANIZATION_OBJECT_TYPE_ID = 40; // тип объекта - организация недропользователь
RESERVES_RESERVE_VALUE_TYPE_ID = 1;
// тип группы параметров
GRR_WELL_PARAM_GROUP_TYPE = 1;
GRR_GEOPHYSICAL_PARAM_GROUP_TYPE = 9;
GRR_NIR_PARAM_GROUP_TYPE = 5;
// типы параметров
GRR_NUMERIC_PARAM_TYPE_ID = 1;
GRR_STRING_PARAM_TYPE_ID = 2;
GRR_DATE_PARAM_TYPE_ID = 3;
GRR_DOMAIN_PARAM_TYPE_ID = 4;
// группы параметров
GRR_GENERAL_PARAMETER_GROUP = 1;
GRR_CONSTRUCTION_PARAMETER_GROUP = 2;
GRR_WELL_TEST_PARAMETER_GROUP = 3; // испытания в открытом стволе
GRR_CORE_PARAMETER_GROUP = 4;
GRR_STRAT_PARAMETER_GROUP = 5;
GRR_COST_PARAMETER_GROUP = 16;
GRR_COLUMN_WELL_TEST_PARAMETER_GROUP = 17; // испытания в колонне
GRR_OIL_SHOWING_WELL_PARAMETER_GROUP = 18; // нефтегазопроявления
GRR_ACCIDENT_WELL_PARAMETER_GROUP = 19; // аварии
GRR_SEISMIC_REWORK_PARAMETER_GROUP = 23;
GRR_SEISMIC_2D_PARAMETER_GROUP = 12;
GRR_SEISMIC_3D_PARAMETER_GROUP = 13;
GRR_SEISMIC_VSP_GROUP = 29;
GRR_SEISMIC_MKS_GROUP = 30;
GRR_ELECTRO_GROUP = 31;
GRR_PROGRAM_GROUP = 20;
GRR_RESERVES_RECOUNTING_GROUP = 21;
GRR_BED_RESERVES_GROUP = 22;
GRR_OTHER_NIR_GROUP = 34;
// альтитуды
ROTOR_ALTITUDE_ID = 1;
EARTH_ALTITUDE_ID = 2;
FLOOR_ALTITUDE_ID = 3;
// тип организации
RAZVED_ORG_STATUS_ID = 5;
// тип системы измерений для альтитуд
BALT_ALT_MEASURE_SYSTEM_ID = 1;
// тип структуры - месторождение
FIELD_STRUCTURE_TYPE_ID = 4;
// запасы или тип изменения балансовых запасов
RESERVE_VALUE_TYPE_RESERVE = 1;
// категории запасов
RESOURCE_CATEGORY_A = 1;
RESOURCE_CATEGORY_B = 2;
RESOURCE_CATEGORY_C1 = 11;
RESOURCE_CATEGORY_AB = 8;
RESOURCE_CATEGORY_ABC1 = 7;
// геологические и извлекаемые ресурсы
RESOURCE_TYPE_GEO = 1;
RESOURCE_TYPE_RECOVERABLE = 2;
// начальные и остаточные запасы
RESERVE_KIND_START = 1;
RESERVE_KIND_REM = 2;
// тип интервала - для интервалов испытаниц
GRR_WELL_INTERVAL_TYPE_UNK = 0;
GRR_WELL_INTERVAL_TYPE_TEST = 1;
GRR_WELL_INTERVAL_TYPE_CORE = 2;
GRR_WELL_INTERVAL_TYPE_STRAT = 3;
GRR_COLUMN_WELL_INTERVAL_TYPE_TEST = 4; // интервал испытания в колонне
GRR_WELL_INTERVAL_TYPE_CONSTRUCTION = 5; // интервал по конструкции
GRR_WELL_INTERVAL_TYPE_OIL = 6;
GRR_WELL_INTERVAL_TYPE_ACCIDENT = 7;
// тип коллекции
PALEONTHOLOGIC_COLLECTION_ID = 1;
// таксономия страт-подразделений
// система
SYSTEM_TAXONOMY_ID = 3;
// отдел
SERIES_TAXONOMY_ID = 4;
// ярус
STAGE_TAXONOMY_ID = 6;
// подъярус
SUBSTAGE_TAXONOMY_ID = 7;
// надъярус
SUPERSTAGE_TAXONOMY_ID = 5;
//типы таксономических единиц
GENERAL_TAXONOMY_TYPE_ID = 1;
REGIONAL_TAXONOMY_TYPE_ID = 2;
SUBREGIONAL_TAXONOMY_TYPE_ID = 6;
LOCAL_TAXONOMY_TYPE_ID = 4;
UNKNOWN_TAXONOMY_TYPE_ID = 0;
// причины изменения
NO_REASON_CHANGE_ID = 1;
// единица изменения не задана
DEFAULT_MEASURE_UNIT_ID = 0;
// категории скважин
WELL_CATEGORY_NOT_DEFINED = 7;
WELL_CATEGORY_PROSPECTING = 13; //поисковая
WELL_CATEGORY_PROSPECTING_AND_EVALUATION = 14; //поисково-оценочное
WELL_CATEGORY_STRUCTURAL_PROSPECT = 19; //
// состояния скважин
WELL_STATE_LIQIUDATED = 3;
// типы сейсмоотчетов
SEISMIC_REPORT_TYPE_REWORK = 1;
SEISMIC_REPORT_TYPE_2D = 2;
SEISMIC_REPORT_TYPE_3D = 3;
GRR_PROGRAM_REPORT_TYPE = 4;
RESERVES_RECOUNTING_REPORT_TYPE = 5;
SEISMIC_REPORT_TYPE_VSP = 6;
SEISMIC_REPORT_TYPE_MKS = 7;
SEISMIC_REPORT_TYPE_ELECTRO = 8;
GRR_OTHER_NIR_REPORT_TYPE = 9;
// виды фонда структур
FIELD_FUND_TYPE_ID = 4;
CORE_SAMPLE_TYPE_COMMON_ID = 6;
// типы клиентов
LICENSE_ZONE_CLIENT_TYPE_ID = 16;
// типы лицензий
LICENSE_TYPE_ID_NE = 2;
LICENSE_TYPE_ID_NR = 1;
LICENSE_TYPE_ID_NP = 3;
SEISWORK_TYPE_2D = 1;
SEISWORK_TYPE_3D = 2;
SEISWORK_TYPE_UNKNOWN = 3;
SEISWORK_TYPE_CAROTAGE = 5;
SEISWORK_TYPE_VSP = 6;
SEISWORK_TYPE_ELECTRO = 7;
SEISWORK_TYPE_2D_AND_3D = 8;
BINDING_OBJECT_TYPE_WELL = 1;
BINDING_OBJECT_TYPE_AREA = 2;
BINDING_OBJECT_TYPE_NGR = 3;
BINDING_OBJECT_TYPE_NGO = 4;
BINDING_OBJECT_TYPE_NGP = 5;
// виды мест хранения керна
CORE_MAIN_GARAGE_ID = 2500;
// виды работ по НИР (tbl_NIR_Type_Dict)
NIR_TYPE_OTHER = -1; // прочие работы
NIR_TYPE_ECO = -2; // экологические работы
NIR_TYPE_COUNTING = -3; // подсчёт запасов
NIR_TYPE_SEISMIC = -4; //
NIR_TYPE_NIR = -5;
NIR_TYPE_DRILLING = -6;
NIR_TYPE_EXP = -7;
NIR_TYPE_GEOPHIS = -8;
NIR_TYPE_GEOCHEM = -9;
NIR_TYPE_GRR_REPORT = -10;
NIR_TYPE_START_WORKS = -11;
NIR_TYPE_GRR_PROGRAM = -12;
NIR_TYPE_UNK = -13;
NIR_TYPE_SUPER = -14;
NIR_TYPE_PIR = -15;
NIR_TYPE_KRS = -16;
implementation
end.
|
// adds item reference to the leveled list
function addToLeveledList(list: IInterface; entry: IInterface; level: integer): IInterface;
var
listElement: IInterface;
begin
listElement := addItem(
ElementByPath(list, 'Leveled List Entries'), // take list of entries
entry,
1 // amount of items
);
// set distribution level
SetElementEditValues(listElement, 'LVLO\Level', level);
Result := listElement;
end;
|
(* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TurboPower Abbrevia
*
* The Initial Developer of the Original Code is
* Robert Love
*
* Portions created by the Initial Developer are Copyright (C) 1997-2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** *)
unit AbZipViewTests;
interface
uses
TestFrameWork,abTestFrameWork,AbZView,AbZBrows,SysUtils,Classes,Menus,abMeter;
type
TAbZipViewTests = class(TabCompTestCase)
private
Component : TAbZipView;
protected
procedure SetUp; override;
procedure TearDown; override;
published
procedure TestDefaultStreaming;
procedure TestComponentLinks;
end;
implementation
{ TAbZipViewTests }
procedure TAbZipViewTests.SetUp;
begin
inherited;
Component := TAbZipView.Create(TestForm);
end;
procedure TAbZipViewTests.TearDown;
begin
inherited;
end;
procedure TAbZipViewTests.TestComponentLinks;
var
Menu : TPopupMenu;
ZipBrow : TAbZipBrowser;
begin
Menu := TPopupMenu.Create(TestForm);
ZipBrow := TAbZipBrowser.Create(TestForm);
Component.PopupMenu := Menu;
Component.ZipComponent := ZipBrow;
Menu.Free;
ZipBrow.Free;
Check(Component.PopupMenu = nil,'Notification does not work for TAbZipView.PopupMenu');
Check(Component.ZipComponent = nil,'Notification does not work for TAbZipView.ZipComponent');
end;
procedure TAbZipViewTests.TestDefaultStreaming;
var
CompStr : STring;
CompTest : TAbZipView;
begin
RegisterClass(TAbZipView);
CompStr := StreamComponent(Component);
CompTest := (UnStreamComponent(CompStr) as TAbZipView);
CompareComponentProps(Component,CompTest);
UnRegisterClass(TAbZipView);
end;
initialization
TestFramework.RegisterTest('Abbrevia.Component Level Test Suite',
TAbZipViewTests.Suite);
end.
|
{********************************************************}
{ }
{ Zeos Database Objects }
{ Interbase Database component }
{ }
{ Copyright (c) 1999-2001 Sergey Seroukhov }
{ Copyright (c) 1999-2002 Zeos Development Group }
{ }
{********************************************************}
unit ZIbSqlCon;
interface
{$R *.dcr}
uses
Classes, SysUtils, ZConnect, ZDirIbSql, ZLibIbSql, ZToken;
{$IFNDEF LINUX}
{$INCLUDE ..\Zeos.inc}
{$ELSE}
{$INCLUDE ../Zeos.inc}
{$ENDIF}
type
{ Interbase database component }
TZIbSqlDatabase = class(TZDatabase)
private
FParams: TStrings;
function GetSqlDialect: Integer;
procedure SetSqlDialect(Value: Integer);
function GetCharSet: string;
procedure SetCharSet(Value: string);
function GetSqlRole: string;
procedure SetSqlRole(Value: string);
procedure SetParams(Value: TStrings);
procedure ProcessParams;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Connect; override;
published
property Host;
property Database;
property Encoding;
property Login;
property Password;
property LoginPrompt;
property Params: TStrings read FParams write SetParams;
property SqlDialect: Integer read GetSqlDialect write SetSqlDialect;
property SqlRole: string read GetSQLRole write SetSQLRole;
property CharSet: string read GetCharSet write SetCharSet;
property Connected;
end;
implementation
uses ZDbaseConst;
{***************** TZIbSqlDatabase implementation *****************}
{ Class constructor }
constructor TZIbSqlDatabase.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FHandle := TDirIbSqlConnect.Create;
FParams := TStringList.Create;
end;
{ Class destructor }
destructor TZIbSqlDatabase.Destroy;
begin
inherited Destroy;
FParams.Free;
end;
{ Get interbase sql dialect value }
function TZIbSqlDatabase.GetSqlDialect: Integer;
begin
Result := TDirIbSqlConnect(FHandle).Dialect;
end;
{ Set interbase sql dialect value }
procedure TZIbSqlDatabase.SetSqlDialect(Value: Integer);
begin
TDirIbSqlConnect(FHandle).Dialect := Value;
end;
{Get Database CharSet}
function TZIbSqlDatabase.GetCharSet: string;
begin
Result := TDirIbSqlConnect(FHandle).CharSet;
end;
{Set Database CharSet}
procedure TZIbSqlDatabase.SetCharSet(Value: string);
begin
TDirIbSqlConnect(FHandle).CharSet := Value;
end;
{Get Sql Role}
function TZIbSqlDatabase.GetSqlRole: string;
begin
Result := TDirIbSqlConnect(FHandle).SqlRole
end;
{Set Sql Role}
procedure TZIbSqlDatabase.SetSqlRole(Value: string);
begin
TDirIbSqlConnect(FHandle).SqlRole := Value;
end;
{ Assign new database parameters }
procedure TZIbSqlDatabase.SetParams(Value: TStrings);
begin
FParams.Assign(Value);
end;
{ Process database parameter block }
procedure TZIbSqlDatabase.ProcessParams;
const
MAX_DPB_PARAMS = 21;
ParamNames: array[1..MAX_DPB_PARAMS] of string = (
'user_name', 'password', 'password_enc',
'sys_user_name', 'license', 'encrypt_key',
'lc_messages', 'lc_ctype', 'sql_role_name',
'num_buffers', 'dbkey_scope', 'force_write',
'no_reserve', 'damaged', 'verify', 'sweep',
'sweep_interval', 'activate_shadow',
'delete_shadow', 'begin_log', 'quit_log'
);
ParamIndexes: array[1..MAX_DPB_PARAMS] of SmallInt = (
isc_dpb_user_name, isc_dpb_password, isc_dpb_password_enc,
isc_dpb_sys_user_name, isc_dpb_license, isc_dpb_encrypt_key,
isc_dpb_lc_messages, isc_dpb_lc_ctype, isc_dpb_sql_role_name,
isc_dpb_num_buffers, isc_dpb_dbkey_scope, isc_dpb_force_write,
isc_dpb_no_reserve, isc_dpb_damaged, isc_dpb_verify, isc_dpb_sweep,
isc_dpb_sweep_interval, isc_dpb_activate_shadow,
isc_dpb_delete_shadow, isc_dpb_begin_log, isc_dpb_quit_log
);
var
I, J: Integer;
Buffer, ParamName, ParamValue: string;
ParamList: TIbParamList;
const
BPBPrefix = 'isc_dpb_';
begin
ParamList := TDirIbSqlConnect(Handle).Params;
ParamList.Clear;
for I := 0 to Params.Count - 1 do
begin
Buffer := Params[I];
if Trim(Buffer) = '' then
Continue;
ParamName := LowerCase(StrTok(Buffer, ' ='#9#10#13));
ParamValue := StrTok(Buffer, ' ='#9#10#13);
if Pos(BPBPrefix, ParamName) = 1 then
Delete(ParamName, 1, Length(BPBPrefix));
for J := 1 to MAX_DPB_PARAMS do
begin
if ParamName = ParamNames[J] then
begin
ParamList.Add(ParamIndexes[J], ParamValue);
Break;
end;
end;
end;
end;
{ Connect to database }
procedure TZIbSqlDatabase.Connect;
begin
if Connected then Exit;
ProcessParams;
inherited Connect;
end;
end.
|
unit UfrmNewProjectOptions;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
UProject, USlideTemplate, Vcl.StdCtrls, UframeProjectProperties, Vcl.CheckLst;
type
TfrmNewProjectOptions = class(TForm)
btnOK: TButton;
btnCancel: TButton;
FrameProjectProperties1: TFrameProjectProperties;
lbSlideOptions: TCheckListBox;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
FNonOptionalSlideTypeOptions: TSlideTypeOptions;
public
procedure ProjectToForm(project: TProject);
procedure FormToProject(project: TProject);
procedure OptionsToForm(ASlideTypeOptions: TSlideTypeOptions);
function FormToOptions: TSlideTypeOptions;
end;
function GetProjectInfo(project: TProject; var ASlideTypeOptions: TSlideTypeOptions): boolean;
implementation
{$R *.dfm}
uses
GNUGetText;
function GetProjectInfo(project: TProject; var ASlideTypeOptions: TSlideTypeOptions): boolean;
var
frmProjectOptions: TfrmNewProjectOptions;
begin
frmProjectOptions := TfrmNewProjectOptions.Create(Application);
try
frmProjectOptions.ProjectToForm(project);
frmProjectOptions.OptionsToForm(ASlideTypeOptions);
Result := frmProjectOptions.ShowModal = mrOK;
if Result then
begin
frmProjectOptions.FormToProject(project);
ASlideTypeOptions := frmProjectOptions.FormToOptions;
end;
finally
frmProjectOptions.Free;
end;
end;
{ TfrmProjectOptions }
procedure TfrmNewProjectOptions.FormCreate(Sender: TObject);
begin
TranslateComponent(self);
end;
function TfrmNewProjectOptions.FormToOptions: TSlideTypeOptions;
var
i: Integer;
begin
Result := FNonOptionalSlideTypeOptions;
for i := 0 to lbSlideOptions.Items.Count -1 do
begin
if lbSlideOptions.Checked[i] then
include(Result, TSlideTypeOption(lbSlideOptions.Items.Objects[i]));
end;
// combine
if (stKidsclub06 in Result) and (stKompas78 in Result) then
begin
Exclude(Result, stKidsclub06);
Exclude(Result, stKompas78);
Include(Result, stKidsclub06AndKompas78);
end;
end;
procedure TfrmNewProjectOptions.FormToProject(project: TProject);
begin
project.Properties['speaker'] := FrameProjectProperties1.Speaker;
project.Properties['collecte1'] := FrameProjectProperties1.Collecte1;
project.Properties['collecte2'] := FrameProjectProperties1.Collecte2;
end;
procedure TfrmNewProjectOptions.OptionsToForm(
ASlideTypeOptions: TSlideTypeOptions);
begin
FNonOptionalSlideTypeOptions := [];
if stNone in ASlideTypeOptions then
Include(FNonOptionalSlideTypeOptions, stNone);
if stEAD in ASlideTypeOptions then
lbSlideOptions.Items.AddObject(_('AED'), TObject(ord(stEAD)));
if (stKidsclub06 in ASlideTypeOptions) or (stKidsclub06AndKompas78 in ASlideTypeOptions) then
lbSlideOptions.Items.AddObject(_('Kidsclub groep 0-6'), TObject(ord(stKidsclub06)));
if (stKompas78 in ASlideTypeOptions) or (stKidsclub06AndKompas78 in ASlideTypeOptions) then
lbSlideOptions.Items.AddObject(_('Kompas groep 7-8'), TObject(ord(stKompas78)));
if (stAfscheid1500 in ASlideTypeOptions) then
lbSlideOptions.Items.AddObject(_('Afscheid 1500 uur'), TObject(ord(stAfscheid1500)));
if (stAfscheid1500 in ASlideTypeOptions) then
lbSlideOptions.Items.AddObject(_('Afscheid 1630 uur'), TObject(ord(stAfscheid1630)));
if (stAfscheid1500 in ASlideTypeOptions) then
lbSlideOptions.Items.AddObject(_('Afscheid 1900 uur'), TObject(ord(stAfscheid1900)));
end;
procedure TfrmNewProjectOptions.ProjectToForm(project: TProject);
begin
FrameProjectProperties1.Speaker := project.Properties['speaker'];
FrameProjectProperties1.Collecte1 := project.Properties['collecte1'];
FrameProjectProperties1.Collecte2 := project.Properties['collecte2'];
end;
end.
|
{----------------------------------------------------------------------
DEVIUM Content Management System
Copyright (C) 2004 by DEIV Development Team.
http://www.deiv.com/
$Header: /devium/Devium\040CMS\0402/Source/PhotoGallery/pgGalleryListForm.pas,v 1.4 2004/04/17 12:19:01 paladin Exp $
------------------------------------------------------------------------}
unit pgGalleryListForm;
interface
uses
Forms, Menus, TB2Item, TB2Dock, TB2Toolbar, Classes, Controls, TBSkinPlus,
ComCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxEdit,
DB, cxDBData, cxGridLevel, cxClasses, cxControls, cxGridCustomView,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
ActnList;
type
TGalleryListForm = class(TForm)
TBDock1: TTBDock;
TBToolbar1: TTBToolbar;
TBPopupMenu1: TTBPopupMenu;
StatusBar: TStatusBar;
cxGrid1DBTableView1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
is_visible: TcxGridDBColumn;
title: TcxGridDBColumn;
TBSubmenuItem1: TTBSubmenuItem;
TBItem1: TTBItem;
TBItem2: TTBItem;
ActionList1: TActionList;
GalEdit: TAction;
GalNew: TAction;
GalDel: TAction;
MoveUp: TAction;
MoveDown: TAction;
TBItem3: TTBItem;
TBItem4: TTBItem;
TBItem5: TTBItem;
TBItem6: TTBItem;
TBSeparatorItem1: TTBSeparatorItem;
TBItem7: TTBItem;
TBSeparatorItem2: TTBSeparatorItem;
TBItem8: TTBItem;
TBItem9: TTBItem;
TBItem10: TTBItem;
TBSeparatorItem3: TTBSeparatorItem;
TBItem11: TTBItem;
TBItem12: TTBItem;
TBItem13: TTBItem;
TBItem14: TTBItem;
TBItem15: TTBItem;
TBSeparatorItem4: TTBSeparatorItem;
TBSeparatorItem5: TTBSeparatorItem;
procedure GalNewExecute(Sender: TObject);
procedure GalEditExecute(Sender: TObject);
procedure GalDelExecute(Sender: TObject);
procedure cxGrid1DBTableView1DblClick(Sender: TObject);
procedure GalEditUpdate(Sender: TObject);
procedure MoveUpUpdate(Sender: TObject);
procedure MoveUpExecute(Sender: TObject);
procedure MoveDownExecute(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function GetGalleryListForm: Integer;
implementation
uses pgMainForm, pgDataModule, pgGalleryForm, Windows, DeviumLib;
{$R *.dfm}
function GetGalleryListForm: Integer;
var
Form: TGalleryListForm;
begin
Form := TGalleryListForm.Create(Application);
try
Result := Form.ShowModal;
finally
Form.Free;
end;
end;
procedure TGalleryListForm.GalNewExecute(Sender: TObject);
begin
with DM.List do
begin
Append;
if GetGalleryForm = mrOK then
Post
else
Cancel;
end;
end;
procedure TGalleryListForm.GalEditExecute(Sender: TObject);
begin
with DM.List do
begin
Edit;
if GetGalleryForm = mrOK then
Post
else
Cancel;
end;
end;
procedure TGalleryListForm.GalDelExecute(Sender: TObject);
var
s: String;
begin
if MessageBox(Handle, 'Вы точно уверенны что хотите это сделать?' + #13#10 +
'Удаление галереии прибедет к удалению всех альбомов.',
PChar(Caption),
MB_YESNO + MB_ICONQUESTION) = IDNO then Exit;
{ TODO : }
s := DM.GetFilesPath(DM.List);
ForceDeleteDir(s);
while DM.Albums.Locate('gallery_id', DM.List['id'], []) do
begin
while DM.Photos.Locate('album_id', DM.Albums['id'], []) do
DM.Photos.Delete;
DM.Albums.Delete;
end;
DM.List.Delete;
end;
procedure TGalleryListForm.cxGrid1DBTableView1DblClick(Sender: TObject);
begin
GalEdit.Execute;
end;
procedure TGalleryListForm.GalEditUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := DM.List.RecordCount > 0;
end;
procedure TGalleryListForm.MoveUpUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := DM.List.RecordCount > 1;
end;
procedure TGalleryListForm.MoveUpExecute(Sender: TObject);
begin
{ TODO : }
end;
procedure TGalleryListForm.MoveDownExecute(Sender: TObject);
begin
{ TODO : }
end;
procedure TGalleryListForm.FormCreate(Sender: TObject);
begin
cxGrid1DBTableView1.DataController.DataSource := DM.dsList;
end;
end.
|
unit Vectors;
interface
uses
Math;
type
P3DVector = ^T3DVector;
T3DVector = record
X, Y, Z : Single;
end;
// Arithmetic Functions
function Vector( x, y, z : Single ) : T3DVector;
function VectorAdd( var v1, v2 : T3DVector ) : T3DVector;
function VectorDivide( var v1, v2 : T3DVector ) : T3DVector;
function VectorMultiply( var v1, v2 : T3DVector ) : T3DVector;
function VectorSubtract( var v1, v2 : T3DVector ) : T3DVector;
// Transformation functions
procedure VectorRotateAroundX( ang : Single; var dest : T3DVector );
procedure VectorRotateAroundY( ang : Single; var dest : T3DVector );
procedure VectorRotateAroundZ( ang : Single; var dest : T3DVector );
function VectorNormalize( v : T3DVector ): T3DVector;
function VectorLength( v : T3DVector ) : Single;
function VectorScale( v : T3DVector; val : Single ) : T3DVector;
function VectorCrossProduct( v1, v2 : T3DVector ) : T3DVector;
function VectorDotProduct( v1, v2 : T3DVector ) : single;
function VectorInterpolate( V1, V2 : T3DVector; Amt : Single ) : T3DVector;
function RandomRange( lo, hi : Single ) : Single;
implementation
{ -- Vectors Math ------------------------------------------------------------- }
function Vector( x, y, z : Single ) : T3DVector;
begin
result.X := x;
result.Y := y;
result.Z := z;
end;
function VectorAdd( var v1, v2 : T3DVector ) : T3DVector;
begin
result.X := v1.X + v2.X;
result.Y := v1.Y + v2.Y;
result.Z := v1.Z + v2.Z;
end;
function VectorSubtract( var v1, v2 : T3DVector ) : T3DVector;
begin
result.X := v1.X - v2.X;
result.Y := v1.Y - v2.Y;
result.Z := v1.Z - v2.Z;
end;
function VectorMultiply( var v1, v2 : T3DVector ) : T3DVector;
begin
result.X := v1.X * v2.X;
result.Y := v1.Y * v2.Y;
result.Z := v1.Z * v2.Z;
end;
function VectorDivide( var v1, v2 : T3DVector ) : T3DVector;
begin
result.X := v1.X / v2.X;
result.Y := v1.Y / v2.Y;
result.Z := v1.Z / v2.Z;
end;
procedure VectorRotateAroundX( ang : Single; var dest : T3DVector );
var
y0, z0 : Single;
radAng : Single;
begin
y0 := dest.Y;
z0 := dest.Z;
radAng := DegToRad( ang );
dest.Y := ( y0 * cos( radAng ) ) - ( z0 * sin( radAng ) );
dest.Z := ( y0 * sin( radAng ) ) + ( z0 * cos( radAng ) );
end;
procedure VectorRotateAroundY( ang : Single; var dest : T3DVector );
var
x0, z0 : Single;
radAng : Single;
begin
x0 := dest.X;
z0 := dest.Z;
radAng := DegToRad( ang );
dest.X := ( x0 * cos( radAng ) ) + ( z0 * sin( radAng ) );
dest.Z := ( z0 * cos( radAng ) ) - ( x0 * sin( radAng ) );
end;
procedure VectorRotateAroundZ( ang : Single; var dest : T3DVector );
var
x0, y0 : Single;
radAng : Single;
begin
x0 := dest.X;
y0 := dest.Y;
radAng := DegToRad( ang );
dest.X := ( x0 * cos( radAng ) ) - ( y0 * sin( radAng ) );
dest.Y := ( y0 * cos( radAng ) ) + ( x0 * sin( radAng ) );
end;
function VectorNormalize( v : T3DVector ) : T3DVector;
var
Scale, Len : Single;
begin
Len := VectorLength( v );
if Len = 0.0 then
Exit;
scale := 1.0 / Len;
Result.X := v.X * Scale;
Result.Y := v.Y * Scale;
Result.Z := v.Z * Scale;
end;
function VectorLength( v : T3DVector ) : Single;
var
size : real;
begin
size := sqr( v.X ) + sqr( v.Y ) + sqr( v.Z );
result := sqrt( size );
end;
function VectorScale( v : T3DVector; val : Single ) : T3DVector;
begin
Result.X := v.X * val;
Result.Y := v.Y * val;
Result.Z := v.Z * val;
end;
function VectorCrossProduct( v1, v2 : T3DVector ) : T3DVector;
begin
Result.x := v1.y * v2.z - v2.y * v1.z;
Result.y := v1.z * v2.x - v2.z * v1.x;
Result.z := v1.x * v2.y - v2.x * v1.y;
end;
function VectorDotProduct( v1, v2 : T3DVector ) : single;
begin
result := v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
end;
function VectorInterpolate( V1, V2 : T3DVector; Amt : Single ) : T3DVector;
begin
Result.X := V1.X + ( V2.X - V1.X ) * Amt;
Result.Y := V1.Y + ( V2.Y - V1.Y ) * Amt;
Result.Z := V1.Z + ( V2.Z - V1.Z ) * Amt;
end;
function RandomRange( lo, hi : Single ) : Single;
begin
result := ( random * ( hi - lo ) + lo );
end;
end.
|
program SquareEquation;
{
Решение квадратного уравнения по заданным коэффициентам A, B, C
}
var
A, B, C, D, X1, X2: Real;
begin
WriteLn('Введите значения коэффициентов');
Write('A: '); ReadLn(A);
if A = 0 then
begin
// Код внутри данного блока begin-end
// будет выполнен только если A = 0
WriteLn('A = 0');
ReadLn;
Exit; // Команда выхода из программы
end;
Write('B: '); ReadLn(B);
Write('C: '); ReadLn(C);
D := Sqr(B) - 4 * A * C; // Вычисление дискриминанта
if D < 0 then
begin
// Этот код выполнится только если дискриминант будет меньше нуля
WriteLn('Корни мнимые');
end
else
begin
// Этот блок выполнится если дискриминант не меньше 0 (больше, либо равен)
if D = 0 then
begin
X1 := -B / (2 * A);
WriteLn('Один корень, X = ', X1:0:2);
end
else
begin
X1 := (-B + Sqrt(D)) / 2 / A;
X2 := (-B - Sqrt(D)) / 2 / A;
WriteLn('X1 = ', X1:0:2, ', X2 = ', X2:0:2);
end;
end;
ReadLn;
end.
|
unit NovusShell;
interface
Uses NovusUtilities, ShellAPI, Windows, Forms, AnsiStrings, Classes, comobj, variants,
SysUtils, NovusWindows;
type
TAceHeader = packed record
AceType: Byte;
AceFlags: Byte;
AceSize: Word;
end;
TAccessAllowedAce = packed record
Header: TAceHeader;
Mask: ACCESS_MASK;
SidStart: DWORD;
end;
tNovusShell = class(tNovusUtilities)
protected
function WindowsCaptureExecute(aCommandline: String;
var aOutput: String): Integer;
function WindowsShellExecute(const aOperation: String;
const aCommandLine: string;
const aDirectory: string;
const aParameters: String;
const aShow: Integer): Integer;
public
constructor Create; virtual;
destructor Destroy; override;
function RunCaptureCommand(const aCommandLine: string;
var aOutput: string): Integer;
function RunCommandSilent(const aCommandLine: string;
const aDirectory: string;
const aParameters: String ): Integer;
function RunCommand(const aCommandLine: string;
const aDirectory: string;
const aParameters: String): Integer;
end;
function WTSQueryUserToken(SessionId: DWORD; phToken: THandle):bool;stdcall;external 'wtsapi32.dll';
implementation
constructor tNovusShell.Create;
begin
inherited Create;
end;
destructor tNovusShell.Destroy;
begin
inherited;
end;
function tNovusShell.RunCaptureCommand(const aCommandLine: string;
var aOutput: String): Integer;
begin
result := WindowsCaptureExecute(aCommandLine,
aOutput);
end;
function tNovusShell.RunCommandSilent(const aCommandLine: string;
const aDirectory: string;
const aParameters: String): Integer;
begin
Result := WindowsShellExecute('open',
aCommandLine,
aDirectory,
aParameters,
SW_HIDE);
end;
function tNovusShell.RunCommand(const aCommandLine: String;
const aDirectory: string;
const aParameters: String): Integer;
begin
Result := WindowsShellExecute('open',
aCommandLine,
aDirectory,
aParameters,
SW_SHOWNORMAL);
end;
function tNovusShell.WindowsCaptureExecute(aCommandline: String;
var aOutput: String): Integer;
const
CReadBuffer = 2400;
SECURITY_WORLD_SID_AUTHORITY: TSidIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 1));
HEAP_ZERO_MEMORY = $00000008;
ACL_REVISION = 2;
SECURITY_WORLD_RID = $00000000;
FILE_READ_DATA = $0001; // file & pipe
FILE_LIST_DIRECTORY = $0001; // directory
FILE_WRITE_DATA = $0002; // file & pipe
FILE_ADD_FILE = $0002; // directory
FILE_APPEND_DATA = $0004; // file
FILE_ADD_SUBDIRECTORY = $0004; // directory
FILE_CREATE_PIPE_INSTANCE = $0004; // named pipe
FILE_READ_EA = $0008; // file & directory
FILE_WRITE_EA = $0010; // file & directory
FILE_EXECUTE = $0020; // file
FILE_TRAVERSE = $0020; // directory
FILE_DELETE_CHILD = $0040; // directory
FILE_READ_ATTRIBUTES = $0080; // all
FILE_WRITE_ATTRIBUTES = $0100; // all
FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or Windows.SYNCHRONIZE or $1FF);
FILE_GENERIC_READ = (STANDARD_RIGHTS_READ or FILE_READ_DATA or
FILE_READ_ATTRIBUTES or FILE_READ_EA or Windows.SYNCHRONIZE);
FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE or FILE_WRITE_DATA or
FILE_WRITE_ATTRIBUTES or FILE_WRITE_EA or FILE_APPEND_DATA or Windows.SYNCHRONIZE);
FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE or FILE_READ_ATTRIBUTES or
FILE_EXECUTE or Windows.SYNCHRONIZE);
var
FSecurityAttributes: TSecurityAttributes;
hRead: THandle;
hWrite: THandle;
FStartupInfo: TStartupInfo;
FProcessInformation: TProcessInformation;
pBuffer:array[0..CReadBuffer] of AnsiChar;
dBuffer:array[0.. CReadBuffer] of AnsiChar;
dRead: DWORD;
dRunning: DWORD;
dAvailable: DWORD;
liExitCode: Integer;
pSD: PSecurityDescriptor;
psidEveryone: PSID;
sidAuth: TSidIdentifierAuthority;
lSDSize, lACLSize: Cardinal;
lpACL: PACL;
ConnSessID: Cardinal;
Token: THandle;
hProcess: THandle;
pEnv: Pointer;
begin
liExitCode := -1;
FSecurityAttributes.nLength := SizeOf(TSecurityAttributes);
FSecurityAttributes.bInheritHandle :=true;
FSecurityAttributes.lpSecurityDescriptor := nil;
sidAuth := SECURITY_WORLD_SID_AUTHORITY;
if not AllocateAndInitializeSid(sidAuth, 1, SECURITY_WORLD_RID, 0, 0, 0, 0,
0, 0, 0, psidEveryone) then Exit;
lSDSize := SizeOf(TSecurityDescriptor);
lACLSize := GetLengthSID(psidEveryone) + SizeOf(TAccessAllowedACE) + SizeOf(TACL);
pSD := HeapAlloc(GetProcessHeap, HEAP_ZERO_MEMORY, lSDSize + lACLSize);
if pSD = nil then Exit;
if not InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION) then Exit;
lpACL := PACL(PChar(pSD) + lSDSize);
if not InitializeAcl(lpACL^, lACLSize, ACL_REVISION) then Exit;
if not AddAccessAllowedAce(lpACL^, ACL_REVISION, FILE_ALL_ACCESS, psidEveryone) then Exit;
if not SetSecurityDescriptorDacl(pSD, True, lpACL, False) then Exit;
FSecurityAttributes.lpSecurityDescriptor := pSD;
if CreatePipe(hRead, hWrite, @FSecurityAttributes,0) then
try
FillChar(FStartupInfo, SizeOf(TStartupInfo), #0);
FStartupInfo.cb := SizeOf(TStartupInfo);
FStartupInfo.hStdInput := hRead;
FStartupInfo.hStdOutput := hWrite;
FStartupInfo.hStdError := hWrite;
FStartupInfo.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
FStartupInfo.wShowWindow := SW_HIDE;
FStartupInfo.lpDesktop := NIL;
if CreateProcess(nil,PChar(aCommandline), nil, nil,True,
CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS,
nil, nil, FStartupInfo, FProcessInformation) then
try
repeat
dRunning := WaitForSingleObject(FProcessInformation.hProcess, INFINITE);
PeekNamedPipe(hRead,nil,0,nil, @dAvailable,nil);
if (dAvailable > 0 ) then
repeat
dRead := 0;
ReadFile(hRead, pBuffer[0], CReadBuffer, dRead,nil);
pBuffer[dRead] := #0;
OemToCharA(pBuffer, dBuffer);
aOutput := aOutput+ dBuffer;
until (dRead < CReadBuffer);
Application.ProcessMessages;
until (dRunning <> WAIT_TIMEOUT);
if not GetExitCodeProcess(FProcessInformation.hProcess, DWORD(liExitcode)) then
liExitcode := -1;
finally
CloseHandle(FProcessInformation.hProcess);
CloseHandle(FProcessInformation.hThread);
end;
finally
CloseHandle(hRead);
CloseHandle(hWrite);
end;
Result := liExitCode;
end;
function tNovusShell.WindowsShellExecute(const aOperation: String;
const aCommandLine: string;
const aDirectory: string;
const aParameters: String;
const aShow: Integer): Integer;
var
ShellInfo: TShellExecuteInfo;
liExitcode: Integer;
fbOK: LongBool;
Msg: tagMSG;
fok: Boolean;
begin
Result := 0;
liExitcode :=0;
FillChar(ShellInfo, SizeOf(ShellInfo), Chr(0));
ShellInfo.cbSize := SizeOf(ShellInfo);
ShellInfo.fMask := SEE_MASK_DOENVSUBST or SEE_MASK_FLAG_NO_UI or SEE_MASK_NOCLOSEPROCESS or
SEE_MASK_FLAG_DDEWAIT;
ShellInfo.lpFile := PChar(aCommandLine);
ShellInfo.lpParameters := Pointer(aParameters);
ShellInfo.lpVerb := Pointer(aOperation);
ShellInfo.nShow := aShow;
fOK := ShellExecuteEx(@ShellInfo);
if fok then
begin
WaitForInputIdle(ShellInfo.hProcess, INFINITE);
while WaitForSingleObject(ShellInfo.hProcess, 10) = WAIT_TIMEOUT do
repeat
Msg.hwnd := 0;
fbOK := PeekMessage(Msg, ShellInfo.Wnd, 0, 0, PM_REMOVE);
if fbOK then
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
until not fbOK;
If NOt GetExitCodeProcess(ShellInfo.hProcess, DWORD(liExitcode)) then
liExitcode := 0;
CloseHandle(ShellInfo.hProcess);
end
else
liExitcode := -1;
Result := liExitcode;
end;
end.
|
{* http://www.mozilla.org/MPL/ *}
{* *}
{* Software distributed under the License is distributed on an "AS IS" basis, *}
{* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License *}
{* for the specific language governing rights and limitations under the *}
{* License. *}
{* *}
{* The Original Code is TurboPower Orpheus *}
{* *}
{* The Initial Developer of the Original Code is Roman Kassebaum *}
{* *}
{* *}
{* Contributor(s): *}
{* Roman Kassebaum *}
{* *}
{* ***** END LICENSE BLOCK ***** *}
unit TestOVCEditU;
interface
uses
TestFramework, OvcEditU;
type
TestOvcEditUClass = class(TTestCase)
published
procedure TestedScanToEnd;
end;
implementation
{ TestOvcEditUClass }
procedure TestOvcEditUClass.TestedScanToEnd;
const
cSomeString = 'Orpheus';
var
sString: string;
iScan: Word;
begin
sString := cSomeString;
iScan := edScanToEnd(PChar(sString), Length(sString));
Check(iScan = Length(sString));
end;
initialization
RegisterTest(TestOvcEditUClass.Suite);
end.
|
unit playerwithhealth;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, gl,glext,glu, globals, gameobject, renderobject, graphics,
gameobjectwithhealth, healthbar;
type
TPlayerWithHealth=class(TGameObjectWithHealth)
private
instances: integer; static;
ftexture: integer; static;
ftextureEnemy: integer; static;
ftextureEnemyCharged: integer; static;
fwidth: single; static;
fheight: single; static;
fEnemyCharged: boolean;
isenemy: boolean; //just to make it easier for people who want to hack this
protected
function getWidth:single; override;
function getHeight:single; override;
function getTexture: integer; override;
public
property enemycharged: boolean read fEnemyCharged write fEnemyCharged ;
constructor create(enemy: boolean);
destructor destroy; override;
end;
implementation
function TPlayerWithHealth.getWidth:single;
begin
result:=0.2; //fwidth;
end;
function TPlayerWithHealth.getHeight:single;
begin
result:=0.2*1.52; //height
end;
function TPlayerWithHealth.getTexture: integer;
begin
if isenemy then
begin
if fEnemyCharged then
result:=ftextureEnemyCharged
else
result:=ftextureEnemy;
end
else
result:=ftexture;
end;
constructor TPlayerWithHealth.create(enemy: boolean);
var img: tpicture;
pp: pointer;
begin
inherited create;
isenemy:=enemy;
if instances=0 then
begin
glGenTextures(1, @ftexture);
img:=tpicture.Create;
img.LoadFromFile(assetsfolder+'xxx.png');
glBindTexture(GL_TEXTURE_2D, ftexture);
glActiveTexture(GL_TEXTURE0);
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, @pixels[0]);
pp:=img.BITMAP.RawImage.Data;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.Width, img.height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pp);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
img.free;
glGenTextures(1, @ftextureEnemy);
img:=tpicture.Create;
img.LoadFromFile(assetsfolder+'xxx2.png');
glBindTexture(GL_TEXTURE_2D, ftextureEnemy);
glActiveTexture(GL_TEXTURE0);
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, @pixels[0]);
pp:=img.BITMAP.RawImage.Data;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.Width, img.height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pp);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
img.free;
glGenTextures(1, @ftextureEnemyCharged);
img:=tpicture.Create;
img.LoadFromFile(assetsfolder+'xxx3.png');
glBindTexture(GL_TEXTURE_2D, ftextureEnemyCharged);
glActiveTexture(GL_TEXTURE0);
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, @pixels[0]);
pp:=img.BITMAP.RawImage.Data;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.Width, img.height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pp);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
img.free;
end;
inc(instances);
ShowHealthbar:=isenemy;
end;
destructor TPlayerWithHealth.destroy;
begin
dec(instances);
if instances=0 then //destroy the textures
begin
glDeleteTextures(1,@ftexture);
glDeleteTextures(1,@ftextureEnemy);
glDeleteTextures(1,@ftextureEnemyCharged);
end;
inherited destroy;
end;
end.
|
Program HelloWorld;
Function MDC( a, b : Integer; teste : Real ): Integer;
Begin
If a Mod b = 0 Then
Result := b
Else
Result := MDC( b, a Mod b, 1.0 );
End;
Begin
WriteLn( MDC( 48, 32, 1.0 ) );
End.
|
{
***************************************************************************
* *
* This file is part of Lazarus DBF Designer *
* *
* Copyright (C) 2012 Vadim Vitomsky *
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************}
unit uftype;
{$mode objfpc}{$H+}
interface
uses
LResources, Forms, Dialogs, StdCtrls,
Spin, Buttons, urstrrings;
type
{ TFormFT }
TFormFT = class(TForm)
CancelBitBtn: TBitBtn;
CreateBitBtn: TBitBtn;
NameEdit: TEdit;
ftComboBox: TComboBox;
FieldTypeLabel: TLabel;
SizeLabel: TLabel;
PrecisionLabel: TLabel;
FieldNameLabel: TLabel;
SizeSpinEdit: TSpinEdit;
PreSpinEdit: TSpinEdit;
procedure CancelBitBtnClick(Sender: TObject);
procedure CreateBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure ftComboBoxKeyPress(Sender: TObject; var Key: char);
procedure NameEditKeyPress(Sender: TObject; var Key: char);
procedure PreSpinEditKeyPress(Sender: TObject; var Key: char);
procedure SizeSpinEditKeyPress(Sender: TObject; var Key: char);
private
{ private declarations }
public
{ public declarations }
end;
var
FormFT: TFormFT;
appendfield : Boolean;
ft : String;
implementation
{ TFormFT }
procedure TFormFT.CreateBitBtnClick(Sender: TObject);
begin
ft := ftComboBox.Text;
if NameEdit.Text='' then begin
ShowMessage(rsNeedFieldNam);
NameEdit.SetFocus; //is need there?
Exit;
end;
NameEdit.SetFocus; //is need there?
appendfield := true;
Close;
end;
procedure TFormFT.FormCreate(Sender: TObject);
begin
Caption:=rsFieldType;
FieldNameLabel.Caption:=rsFieldName;
FieldTypeLabel.Caption:=rsFieldType;
SizeLabel.Caption:=rsSize;
PrecisionLabel.Caption:=rsPrecision;
CreateBitBtn.Caption:=rsCreate;
CancelBitBtn.Caption:=rsCancel;
end;
procedure TFormFT.CancelBitBtnClick(Sender: TObject);
begin
appendfield:=false;
Close;
end;
procedure TFormFT.FormKeyPress(Sender: TObject; var Key: char);
begin
if Key=#27 then Close;//on Esc
end;
procedure TFormFT.ftComboBoxKeyPress(Sender: TObject; var Key: char);
begin
if Key=#13 then SizeSpinEdit.SetFocus;
end;
procedure TFormFT.NameEditKeyPress(Sender: TObject; var Key: char);
begin
case Key of
#8:;//Backspace
#13: ftComboBox.SetFocus;//enter
#48..#57:if NameEdit.Text='' then Key := #0;//0..9 if not first char
#65..#90:;//A..Z
#95:; //_
#97..#122:;//a..z
else Key := #0;
end;//case
end;
procedure TFormFT.PreSpinEditKeyPress(Sender: TObject; var Key: char);
begin
if Key=#13 then CreateBitBtn.SetFocus;
end;
procedure TFormFT.SizeSpinEditKeyPress(Sender: TObject; var Key: char);
begin
if Key=#13 then PreSpinEdit.SetFocus;
end;
initialization
{$I uftype.lrs}
end.
|
unit FormMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.StdCtrls, Vcl.Buttons,
HttpClient, RSSParser, RSSModel;
type
TfmMain = class(TForm)
pnlRCC: TPanel;
pnlButtons: TPanel;
btnShowNews: TBitBtn;
lvRCC: TListView;
procedure btnShowNewsClick(Sender: TObject);
private
FClient: IHttpClient;
FParser: IRSSParser;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
var
fmMain: TfmMain;
implementation
uses
NetHttpClient, XMLDocRssParser;
{$R *.dfm}
procedure TfmMain.btnShowNewsClick(Sender: TObject);
var
xml: string;
feed: TRSSFeed;
i: Integer;
listItem: TListItem;
begin
xml := FClient.GetPageByURL(RSS_URL);
feed := FParser.ParseRSSFeed(xml);
for i := 0 to feed.Items.Count - 1 do
begin
lvRCC.Items.BeginUpdate;
try
listItem := lvRCC.Items.Add;
listItem.Caption :=
DateToStr(feed.Items[i].PubDate) + sLineBreak +
feed.Items[i].Title + sLineBreak +
feed.Items[i].Description;
finally
lvRCC.Items.EndUpdate;
end;
end;
end;
constructor TfmMain.Create(AOwner: TComponent);
begin
inherited;
FClient := TOwnNetHttpClient.Create;
FParser := TXmlDocParser.Create;
end;
destructor TfmMain.Destroy;
begin
FParser := nil;
FClient := nil;
inherited;
end;
end.
|
unit RTF_ListaObszarow;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,
JvUIB, JvUIBLib,
RT_Tools;
type
TFrmListaObszarow = class(TForm)
LblQuickSearch: TLabel;
LblListaObszarow: TLabel;
EdtQuickSearch: TEdit;
BtnZamknij: TButton;
BtnNowy: TBitBtn;
BtnPopraw: TBitBtn;
BtnUsun: TBitBtn;
LbxListaObszarow: TListBox;
BtnAnuluj: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure LbxListaObszarowClick(Sender: TObject);
procedure EdtQuickSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure EdtQuickSearchChange(Sender: TObject);
procedure BtnNowyClick(Sender: TObject);
procedure BtnPoprawClick(Sender: TObject);
procedure BtnUsunClick(Sender: TObject);
procedure LbxListaObszarowDblClick(Sender: TObject);
procedure LbxListaObszarowDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
private
{ Private declarations }
DialogKind: TDialogKind;
Obszary: TJvUIBQuery;
procedure DisplayObszary;
public
{ Public declarations }
procedure SetupAsSelector;
procedure SetupAsEditor;
end;
implementation
uses
RT_SQL, RTF_EdytorObszaru;
{$R *.dfm}
{ TFrmListaObszarow }
{ Private declarations }
procedure TFrmListaObszarow.DisplayObszary;
begin
LbxListaObszarow.Items.BeginUpdate;
LbxListaObszarow.Clear;
Obszary.Close(etmRollback);
Obszary.Open;
while not Obszary.Eof do
begin
LbxListaObszarow.AddItem(Obszary.Fields.ByNameAsString['NAZWA'], nil);
Obszary.Next;
end;
LbxListaObszarow.ItemIndex := -1;
LbxListaObszarow.Items.EndUpdate;
end;
{ Public declarations }
procedure TFrmListaObszarow.SetupAsSelector;
begin
DialogKind := dkSelector;
Caption := 'Wybierz obszar';
BtnZamknij.Caption := '&OK';
BtnZamknij.Default := True;
BtnAnuluj.Visible := True;
BtnAnuluj.Cancel := True;
BtnNowy.Visible := False;
BtnPopraw.Visible := False;
BtnUsun.Visible := False;
end;
procedure TFrmListaObszarow.SetupAsEditor;
begin
DialogKind := dkEditor;
Caption := 'Edytor obszarów';
BtnZamknij.Caption := '&Zamknij';
BtnZamknij.Cancel := True;
BtnAnuluj.Visible := False;
BtnNowy.Visible := True;
BtnPopraw.Visible := True;
BtnPopraw.Default := True;
BtnUsun.Visible := True;
end;
{ Event handlers }
procedure TFrmListaObszarow.FormCreate(Sender: TObject);
begin
Obszary := TSQL.Instance.CreateQuery;
Obszary.SQL.Text := 'SELECT * FROM OBSZAR ORDER BY NAZWA;';
end;
procedure TFrmListaObszarow.FormDestroy(Sender: TObject);
begin
Obszary.Free;
end;
procedure TFrmListaObszarow.FormShow(Sender: TObject);
begin
DisplayObszary;
EdtQuickSearch.SetFocus;
EdtQuickSearch.SelectAll;
end;
procedure TFrmListaObszarow.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if (DialogKind = dkSelector) and (LbxListaObszarow.ItemIndex = -1) and (ModalResult <> mrCancel) then
begin
CanClose := False;
EdtQuickSearch.SetFocus;
EdtQuickSearch.SelectAll;
end;
end;
procedure TFrmListaObszarow.LbxListaObszarowClick(Sender: TObject);
var
Temp: TNotifyEvent;
begin
Temp := EdtQuickSearch.OnChange;
EdtQuickSearch.OnChange := nil;
if LbxListaObszarow.ItemIndex >= 0 then
EdtQuickSearch.Text := LbxListaObszarow.Items[LbxListaObszarow.ItemIndex]
else
EdtQuickSearch.Text := '';
EdtQuickSearch.SetFocus;
EdtQuickSearch.SelectAll;
EdtQuickSearch.OnChange := Temp;
end;
procedure TFrmListaObszarow.EdtQuickSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (Key = VK_DOWN) or (Key = VK_UP) or (Key = VK_PRIOR) or (Key = VK_NEXT) or (Key = VK_HOME) or (Key = VK_END) then
begin
SendMessage(LbxListaObszarow.Handle, WM_KEYDOWN, Key, 0);
Key := 0;
end;
end;
procedure TFrmListaObszarow.EdtQuickSearchChange(Sender: TObject);
var
I: Integer;
S: String;
begin
for I := 0 to LbxListaObszarow.Items.Count - 1 do
begin
S := Copy(LbxListaObszarow.Items[I], 1, Length(EdtQuickSearch.Text));
if AnsiCompareText(EdtQuickSearch.Text, S) <= 0 then
begin
LbxListaObszarow.ItemIndex := I;
Break;
end;
end;
end;
procedure TFrmListaObszarow.BtnNowyClick(Sender: TObject);
begin
with TFrmEdytorObszaru.Create(nil) do
try
if ShowModal = mrOk then
DisplayObszary;
finally
Free;
end;
EdtQuickSearch.SetFocus;
EdtQuickSearch.SelectAll;
end;
procedure TFrmListaObszarow.BtnPoprawClick(Sender: TObject);
begin
if LbxListaObszarow.ItemIndex = -1 then
Exit;
with TFrmEdytorObszaru.Create(nil) do
try
Obszary.Fields.GetRecord(LbxListaObszarow.ItemIndex);
SetData(Obszary.Fields);
if ShowModal = mrOK then
DisplayObszary;
finally
Free;
end;
end;
procedure TFrmListaObszarow.BtnUsunClick(Sender: TObject);
begin
if LbxListaObszarow.ItemIndex = -1 then
Exit;
if MessageDlg('Czy na pewno chcesz usun¹ę ten obszar ?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
Obszary.Fields.GetRecord(LbxListaObszarow.ItemIndex);
with TSQL.Instance.CreateQuery do
try
SQL.Text := Format('EXECUTE PROCEDURE DELETE_OBSZAR %d', [
Obszary.Fields.ByNameAsInteger['ID']
]);
Execute;
Transaction.Commit;
finally
Free;
end;
DisplayObszary;
LbxListaObszarowClick(Sender);
EdtQuickSearch.Text := '';
EdtQuickSearch.SetFocus;
end;
EdtQuickSearch.SetFocus;
EdtQuickSearch.SelectAll;
end;
procedure TFrmListaObszarow.LbxListaObszarowDblClick(Sender: TObject);
begin
if DialogKind = dkEditor then
BtnPopraw.Click
else
BtnZamknij.Click;
end;
procedure TFrmListaObszarow.LbxListaObszarowDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
Rest: Integer;
begin
TListBox(Control).Canvas.FillRect(Rect);
Obszary.Fields.GetRecord(Index);
Rest := Rect.Right - 220;
Rect.Right := Rect.Left + 220;
TListBox(Control).Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top, TListBox(Control).Items[Index]);
Rect.Right := 220 + Rest;
Rect.Left := 220;
TListBox(Control).Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top, Obszary.Fields.ByNameAsString['SKROT']);
end;
end.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.