Commit 91a2b7ae authored by Michael Van Canneyt's avatar Michael Van Canneyt
Browse files

* Support for generics

git-svn-id: trunk@19622 -
parent 5ea8e65e
......@@ -2828,6 +2828,22 @@ procedure THTMLWriter.CreateClassPageBody(AClass: TPasClassType;
AppendText(ParaEl, '] ');
end;
procedure AppendGenericTypes(CodeEl : TDomElement; AList : TList; isSpecialize : Boolean);
Var
I : integer;
begin
for I:=0 to AList.Count-1 do
begin
if I=0 then
AppendSym(CodeEl, '<')
else
AppendSym(CodeEl, ',');
AppendText(CodeEl,TPasGenericTemplateType(AList[i]).Name);
end;
AppendSym(CodeEl, '>');
end;
procedure CreateMainPage;
var
TableEl, TREl, TDEl, CodeEl: TDOMElement;
......@@ -2858,24 +2874,39 @@ procedure THTMLWriter.CreateClassPageBody(AClass: TPasClassType;
TDEl := CreateTD(TREl);
CodeEl := CreateCode(CreatePara(TDEl));
AppendKw(CodeEl, 'type');
if AClass.ObjKind=okGeneric then
AppendKw(CodeEl, ' generic ');
AppendText(CodeEl, ' ' + AClass.Name + ' ');
if AClass.ObjKind=okGeneric then
AppendGenericTypes(CodeEl,AClass.GenericTemplateTypes,false);
AppendSym(CodeEl, '=');
AppendText(CodeEl, ' ');
AppendKw(CodeEl, ObjKindNames[AClass.ObjKind]);
if AClass.ObjKind<>okSpecialize then
AppendKw(CodeEl, ObjKindNames[AClass.ObjKind])
else
AppendKw(CodeEl, ' specialize ');
if Assigned(AClass.AncestorType) then
begin
AppendSym(CodeEl, '(');
AppendHyperlink(CodeEl, AClass.AncestorType);
if AClass.Interfaces.count>0 Then
if AClass.ObjKind=okSpecialize then
begin
for i:=0 to AClass.interfaces.count-1 do
begin
AppendSym(CodeEl, ', ');
AppendHyperlink(CodeEl,TPasClassType(AClass.Interfaces[i]));
end;
AppendHyperlink(CodeEl, AClass.AncestorType);
AppendGenericTypes(CodeEl,AClass.GenericTemplateTypes,true)
end
else
begin
AppendSym(CodeEl, '(');
AppendHyperlink(CodeEl, AClass.AncestorType);
if AClass.Interfaces.count>0 Then
begin
for i:=0 to AClass.interfaces.count-1 do
begin
AppendSym(CodeEl, ', ');
AppendHyperlink(CodeEl,TPasClassType(AClass.Interfaces[i]));
end;
end;
AppendSym(CodeEl, ')');
end;
AppendSym(CodeEl, ')');
end;
if AClass.Members.Count > 0 then
......@@ -2965,7 +2996,8 @@ procedure THTMLWriter.CreateClassPageBody(AClass: TPasClassType;
end;
AppendText(CodeEl, ' '); // !!!: Dirty trick, necessary for current XML writer
AppendKw(CodeEl, 'end');
if not AClass.IsShortDefinition then
AppendKw(CodeEl, 'end');
AppendSym(CodeEl, ';');
......
......@@ -35,7 +35,7 @@
Const
RootNames : Array[TPasObjKind] of string
= ('Objects', 'Classes', 'Interfaces');
= ('Objects', 'Classes', 'Interfaces','Generics','Specializations');
type
......
......@@ -13,7 +13,6 @@
<Title Value="FPDoc Documentation generator"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
......@@ -60,7 +59,7 @@
<Unit3>
<Filename Value="dw_html.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_html"/>
<UnitName Value="dw_HTML"/>
</Unit3>
<Unit4>
<Filename Value="dw_ipflin.pas"/>
......@@ -70,7 +69,7 @@
<Unit5>
<Filename Value="dw_latex.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_latex"/>
<UnitName Value="dw_LaTeX"/>
</Unit5>
<Unit6>
<Filename Value="dwlinear.pp"/>
......@@ -80,7 +79,7 @@
<Unit7>
<Filename Value="dw_linrtf.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_linrtf"/>
<UnitName Value="dw_LinRTF"/>
</Unit7>
<Unit8>
<Filename Value="dw_man.pp"/>
......@@ -90,7 +89,7 @@
<Unit9>
<Filename Value="dwriter.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dwriter"/>
<UnitName Value="dWriter"/>
</Unit9>
<Unit10>
<Filename Value="dw_txt.pp"/>
......@@ -100,7 +99,7 @@
<Unit11>
<Filename Value="dw_xml.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dw_xml"/>
<UnitName Value="dw_XML"/>
</Unit11>
<Unit12>
<Filename Value="fpdocproj.pas"/>
......@@ -115,7 +114,7 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="9"/>
<Version Value="10"/>
<Target>
<Filename Value="fpdoc"/>
</Target>
......
......@@ -339,6 +339,7 @@ procedure TFPDocAplication.CreateDocumentation(APackage : TFPDocPackage; Options
end;
WriterClass:=GetWriterClass(Options.Backend);
Writer:=WriterClass.Create(Engine.Package,Engine);
Writeln('Writing doc');
With Writer do
Try
If Options.BackendOptions.Count>0 then
......
......@@ -40,7 +40,7 @@ interface
2 : (phi,Omega : Real);
end;
// TADeprecatedType = Integer deprecated;
TADeprecatedType = Integer deprecated;
Var
ASimpleVar : Integer;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment