WITSRecords.pas


 
{********************************************} 
{                                            } 
{              XML Data Binding              } 
{                                            } 
{         Generated on: 28.02.2008 12:17:03  } 
{       Generated from: C:\WITSRecords.xml   } 
{   Settings stored in: C:\WITSRecords.xdb   } 
{                                            } 
{********************************************} 
 
unit WITSRecords; 
 
interface 
 
uses xmldom, XMLDoc, XMLIntf; 
 
type 
 
{ Forward Decls } 
 
  IXMLWitsDefinitionType = interface; 
  IXMLRecordType = interface; 
  IXMLItemType = interface; 
 
{ IXMLWitsDefinitionType } 
 
  IXMLWitsDefinitionType = interface(IXMLNodeCollection) 
    ['{EB672799-309E-4CD6-9D9E-AEF83224BFDC}'] 
    { Property Accessors } 
    function Get_Record_(Index: Integer): IXMLRecordType; 
    { Methods & Properties } 
    function Add: IXMLRecordType; 
    function Insert(const Index: Integer): IXMLRecordType; 
    property Record_[Index: Integer]: IXMLRecordType read Get_Record_; default; 
  end; 
 
{ IXMLRecordType } 
 
  IXMLRecordType = interface(IXMLNodeCollection) 
    ['{98F96FA1-068B-4628-9AE5-7270EFBF6E4B}'] 
    { Property Accessors } 
    function Get_ID: Integer; 
    function Get_Item(Index: Integer): IXMLItemType; 
    procedure Set_ID(Value: Integer); 
    { Methods & Properties } 
    function Add: IXMLItemType; 
    function Insert(const Index: Integer): IXMLItemType; 
    property ID: Integer read Get_ID write Set_ID; 
    property Item[Index: Integer]: IXMLItemType read Get_Item; default; 
  end; 
 
{ IXMLItemType } 
 
  IXMLItemType = interface(IXMLNode) 
    ['{0AC518AB-5462-4466-B829-5C1852992048}'] 
    { Property Accessors } 
    function Get_Index: Integer; 
    function Get_Parameter: WideString; 
    function Get_Desc: WideString; 
    function Get_ShortParameter: WideString; 
    function Get_Type_: WideString; 
    function Get_NumBytes: Integer; 
    procedure Set_Index(Value: Integer); 
    procedure Set_Parameter(Value: WideString); 
    procedure Set_Desc(Value: WideString); 
    procedure Set_ShortParameter(Value: WideString); 
    procedure Set_Type_(Value: WideString); 
    procedure Set_NumBytes(Value: Integer); 
    { Methods & Properties } 
    property Index: Integer read Get_Index write Set_Index; 
    property Parameter: WideString read Get_Parameter write Set_Parameter; 
    property Desc: WideString read Get_Desc write Set_Desc; 
    property ShortParameter: WideString read Get_ShortParameter write Set_ShortParameter; 
    property Type_: WideString read Get_Type_ write Set_Type_; 
    property NumBytes: Integer read Get_NumBytes write Set_NumBytes; 
  end; 
 
{ Forward Decls } 
 
  TXMLWitsDefinitionType = class; 
  TXMLRecordType = class; 
  TXMLItemType = class; 
 
{ TXMLWitsDefinitionType } 
 
  TXMLWitsDefinitionType = class(TXMLNodeCollection, IXMLWitsDefinitionType) 
  protected 
    { IXMLWitsDefinitionType } 
    function Get_Record_(Index: Integer): IXMLRecordType; 
    function Add: IXMLRecordType; 
    function Insert(const Index: Integer): IXMLRecordType; 
  public 
    procedure AfterConstruction; override; 
  end; 
 
{ TXMLRecordType } 
 
  TXMLRecordType = class(TXMLNodeCollection, IXMLRecordType) 
  protected 
    { IXMLRecordType } 
    function Get_ID: Integer; 
    function Get_Item(Index: Integer): IXMLItemType; 
    procedure Set_ID(Value: Integer); 
    function Add: IXMLItemType; 
    function Insert(const Index: Integer): IXMLItemType; 
  public 
    procedure AfterConstruction; override; 
  end; 
 
{ TXMLItemType } 
 
  TXMLItemType = class(TXMLNode, IXMLItemType) 
  protected 
    { IXMLItemType } 
    function Get_Index: Integer; 
    function Get_Parameter: WideString; 
    function Get_Desc: WideString; 
    function Get_ShortParameter: WideString; 
    function Get_Type_: WideString; 
    function Get_NumBytes: Integer; 
    procedure Set_Index(Value: Integer); 
    procedure Set_Parameter(Value: WideString); 
    procedure Set_Desc(Value: WideString); 
    procedure Set_ShortParameter(Value: WideString); 
    procedure Set_Type_(Value: WideString); 
    procedure Set_NumBytes(Value: Integer); 
  end; 
 
{ Global Functions } 
 
function GetWitsDefinition(Doc: IXMLDocument): IXMLWitsDefinitionType; 
function LoadWitsDefinition(const FileName: WideString): IXMLWitsDefinitionType; 
function NewWitsDefinition: IXMLWitsDefinitionType; 
 
const 
  TargetNamespace = ''; 
 
implementation 
 
{ Global Functions } 
 
function GetWitsDefinition(Doc: IXMLDocument): IXMLWitsDefinitionType; 
begin 
  Result := Doc.GetDocBinding('WitsDefinition', TXMLWitsDefinitionType, TargetNamespace) as IXMLWitsDefinitionType; 
end; 
 
function LoadWitsDefinition(const FileName: WideString): IXMLWitsDefinitionType; 
begin 
  Result := LoadXMLDocument(FileName).GetDocBinding('WitsDefinition', TXMLWitsDefinitionType, TargetNamespace) as IXMLWitsDefinitionType; 
end; 
 
function NewWitsDefinition: IXMLWitsDefinitionType; 
begin 
  Result := NewXMLDocument.GetDocBinding('WitsDefinition', TXMLWitsDefinitionType, TargetNamespace) as IXMLWitsDefinitionType; 
end; 
 
{ TXMLWitsDefinitionType } 
 
procedure TXMLWitsDefinitionType.AfterConstruction; 
begin 
  RegisterChildNode('Record', TXMLRecordType); 
  ItemTag := 'Record'; 
  ItemInterface := IXMLRecordType; 
  inherited; 
end; 
 
function TXMLWitsDefinitionType.Get_Record_(Index: Integer): IXMLRecordType; 
begin 
  Result := List[Index] as IXMLRecordType; 
end; 
 
function TXMLWitsDefinitionType.Add: IXMLRecordType; 
begin 
  Result := AddItem(-1) as IXMLRecordType; 
end; 
 
function TXMLWitsDefinitionType.Insert(const Index: Integer): IXMLRecordType; 
begin 
  Result := AddItem(Index) as IXMLRecordType; 
end; 
 
{ TXMLRecordType } 
 
procedure TXMLRecordType.AfterConstruction; 
begin 
  RegisterChildNode('Item', TXMLItemType); 
  ItemTag := 'Item'; 
  ItemInterface := IXMLItemType; 
  inherited; 
end; 
 
function TXMLRecordType.Get_ID: Integer; 
begin 
  Result := AttributeNodes['ID'].NodeValue; 
end; 
 
procedure TXMLRecordType.Set_ID(Value: Integer); 
begin 
  SetAttribute('ID', Value); 
end; 
 
function TXMLRecordType.Get_Item(Index: Integer): IXMLItemType; 
begin 
  Result := List[Index] as IXMLItemType; 
end; 
 
function TXMLRecordType.Add: IXMLItemType; 
begin 
  Result := AddItem(-1) as IXMLItemType; 
end; 
 
function TXMLRecordType.Insert(const Index: Integer): IXMLItemType; 
begin 
  Result := AddItem(Index) as IXMLItemType; 
end; 
 
{ TXMLItemType } 
 
function TXMLItemType.Get_Index: Integer; 
begin 
  Result := ChildNodes['Index'].NodeValue; 
end; 
 
procedure TXMLItemType.Set_Index(Value: Integer); 
begin 
  ChildNodes['Index'].NodeValue := Value; 
end; 
 
function TXMLItemType.Get_Parameter: WideString; 
begin 
  Result := ChildNodes['Parameter'].Text; 
end; 
 
procedure TXMLItemType.Set_Parameter(Value: WideString); 
begin 
  ChildNodes['Parameter'].NodeValue := Value; 
end; 
 
function TXMLItemType.Get_Desc: WideString; 
begin 
  Result := ChildNodes['Desc'].Text; 
end; 
 
procedure TXMLItemType.Set_Desc(Value: WideString); 
begin 
  ChildNodes['Desc'].NodeValue := Value; 
end; 
 
function TXMLItemType.Get_ShortParameter: WideString; 
begin 
  Result := ChildNodes['ShortParameter'].Text; 
end; 
 
procedure TXMLItemType.Set_ShortParameter(Value: WideString); 
begin 
  ChildNodes['ShortParameter'].NodeValue := Value; 
end; 
 
function TXMLItemType.Get_Type_: WideString; 
begin 
  Result := ChildNodes['Type'].Text; 
end; 
 
procedure TXMLItemType.Set_Type_(Value: WideString); 
begin 
  ChildNodes['Type'].NodeValue := Value; 
end; 
 
function TXMLItemType.Get_NumBytes: Integer; 
begin 
  Result := ChildNodes['NumBytes'].NodeValue; 
end; 
 
procedure TXMLItemType.Set_NumBytes(Value: Integer); 
begin 
  ChildNodes['NumBytes'].NodeValue := Value; 
end; 
 
end.