Initial version - Not usable yet

This commit is contained in:
ocoursiere
2002-10-03 21:23:51 +00:00
parent de6b15b7b3
commit f421e353ce
3 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
This tool read XML description of BeAPIs and generate pascal and C/C++ source code
to access this API from pascal source code

View File

@@ -0,0 +1,87 @@
unit apireader;
interface
uses
xmlread, dom;
type
TNode = class(TObject)
private
FNode : TDOMNode;
public
constructor Create(Node : TDOMNode); virtual;
end;
TClassess = class(TNode)
private
protected
public
end;
TNamedItem = class(TNode)
private
protected
function GetName : string;
public
property Name : string read GetName;
end;
TClasse = class(TNamedItem)
private
protected
public
end;
TFunction = class(TNamedItem)
private
protected
public
function IsDestructor : boolean;
end;
TTypedItem = class(TNamedItem)
private
protected
function GetType : string;
public
property Typ : string read GetType;
end;
TParam = class(TTypedItem)
private
protected
public
end;
TResultType = class(TNode)
private
protected
function GetType : string;
public
property Typ : string read GetType;
end;
implementation
constructor TNode.Create(Node : TDOMNode);
begin
inherited Create;
FNode := Node;
end;
function TNamedItem.GetName : string;
begin
Result := FNode.Attributes.GetNamedItem('NAME').NodeValue;
end;
function TFunction.IsDestructor : boolean;
begin
Result := (Name[1] = '~');
end;
function TTypedItem.GetType : string;
begin
Result := FNode.Attributes.GetNamedItem('TYPE').NodeValue;
end;
function TResultType.GetType : string;
begin
Result := FNode.Attributes.GetNamedItem('TYPE').NodeValue;
end;
end.

View File

@@ -0,0 +1,20 @@
program codegen;
uses
dom, xmlread, apireader;
var
aDoc : TXMLDocument;
Classes : TClassess;
begin
if ParamCount > 0 then
begin
ReadXMLFile(aDoc, Paramstr(1));
Classes := TClassess.Create(aDoc);
try
finally
Classes.Free;
end;
end;
end.