⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ubasehtmldoc.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
📖 第 1 页 / 共 5 页
字号:

























{Gets the links to the generated files by ~[link WriteFileTreeFiles].
~result a text including (if possible) a link to the generated files in the
        format of the documentation }
function TBaseHTMLDoc.GetFileListFileLinks: String;
begin
 Result := '<div align=center class=filelistfiles>'; //center the links
 if GenerateXFigFiles then               //Xfig files have been generated?
  //generate a link to the Xfig file
  Result := Result + '<a href="' + FFileTreeFileBaseName +
            '.fig">' + Localize(dtDocumentationLinkXFigFiles) +
            '</a> - <a href="http://www.xfig.org/">' +
            Localize(dtDocumentationLinkGetXFig) + '</a>';
 if GenerateWMFFiles then                //WMF files have been generated?
  begin
   if GenerateXFigFiles then               //also Xfig files?
    Result := Result + '<br>';               //start a new line
   //generate a link to the WMF file
   Result := Result + '<a href="' + FFileTreeFileBaseName + '.wmf">' +
             Localize(dtDocumentationLinkWMFFiles) + '</a>';
  end;
 Result := Result + '</div>' + FNewLine; //end the centering and the line
end;

{Writes the list of files, the text is generated by ~[link GetFileListText].
~param Text the text of the list of files }
procedure TBaseHTMLDoc.WriteFileList(const Text: String);
var       F           :TextFile;           //the file to write the list to
begin         //create the file
 CreateFile(F, 'FileList', Localize(dtDocumentationFilesListTopic),
            Localize(dtKeyWordListFiles));
 try
   WriteLn(F, '<ul class=filelist>');        //start the list
   WriteLn(F, Text);                         //write the list
 finally
  EndFile(F);                                //end the file
 end;
end;




























{Gets the text of an indentation by the given depth.
~param Indent the depth of the class in the inheritance tree
~result an indentation by the given depth }
function TBaseHTMLDoc.ClassListIndent(Indent: Integer): String;
begin
 Result := '<li class=classtree>'; //always indent by an additonal depth of one
end;

{Write the links to the generated files by ~[link WriteClassesTreeFiles].
~param Kind the kind of the record-like types (record/class/interface/...)
~result a text including links to the generated files }
function TBaseHTMLDoc.ClassListFileLinks(Kind: TRecordKind): String;
begin
 Result := '<div align=center class=classtreefiles>'; //center the links
 if GenerateXFigFiles then            //Xfig files have been written?
  //return a link to the file
  Result := Result + '<a href="' + FClassTreeFileBaseName[Kind] +
            '.fig">' + Localize(dtDocumentationLinkXFigFiles) +
            '</a> - <a href="http://www.xfig.org/">' +
            Localize(dtDocumentationLinkGetXFig) + '</a>';
 if GenerateWMFFiles then             //WMF files have been written?
  begin
   if GenerateXFigFiles then            //Xfig files have also been written?
    Result := Result + '<br>';            //insert a separator between links
   //return a link to the file
   Result := Result + '<a href="' + FClassTreeFileBaseName[Kind] +
            '.wmf">' + Localize(dtDocumentationLinkWMFFiles) + '</a>';
  end;
 Result := Result + '</div>' + FNewLine; //end the centering of the text
end;

{Writes the hierarchy of the kind of the record-like types.
~param Kind the kind of the record-like types (record/class/interface/...)
~param Text the text (by ~[link GetClassListText]) of the tree of classes }
procedure TBaseHTMLDoc.WriteClassList(Kind: TRecordKind; const Text: String);
var       F           :TextFile;     //the file to write the hierarchy to
begin
 //create file for the hierarchy
 CreateFile(F, DescFilePreFix[Kind] + 'List',
            Localize(dtDocumentationClassListHeaderPrefix) +
            Localize(Plurals[Kind]),
            Localize(Plurals[Kind]) + '; ' + RecordKindNames[Kind]);
 try
   WriteLn(F, '<ul class=classtree>'); //start the list/tree of classes
   WriteLn(F, Text);                   //write the hierarchy tree
 finally
  EndFile(F);                          //close the file
 end;
end;



{Writes a part of the documentation of a class.
~param Ident the record-like type to write documentation about
~param F     the file to write the documentation into }
procedure TBaseHTMLDoc.WritePartOfClassDocumentation(Ident: TRecordType;
                                                     var F: TextFile);
var       S, S2       :String;          //general documentation strings
          i           :Integer;         //counter through using identifiers
          First       :Boolean;         //the first using record-like type?
          User        :TIdentifier;     //identifiers using this type
          Dummy       :String;          //not used/ignored
begin
 //get ancestor/hierarchy list of the record-like type
 WriteLn(F, GetAncestorList(Ident));

 //write the file the record-like type is declared in
 WriteLn(F, Localize(dtDocumentationClassDeclaredInFile),
            FileTypeNames[Ident.InFile.FileType], ' ',
            GetFileNameLink(Ident.InFile), '<br>');

 //if it has a GUID, write it
 if { (Ident.Kind in [rkInterface, rkDispInterface]) and }
    (Ident.GUID <> '') then
  WriteLn(F, Localize(dtDocumentationClassGUID), Ident.GUID, '<br>');

 //if it is a packed type, write it
 if Ident.IsPacked then
  WriteLn(F, Localize(dtDocumentationClassPackedPre), '<b>packed</b>',
             Localize(dtDocumentationClassPackedPost), '<br>');

 //if it is an abstract type, write it
 if Ident.IsAbstract then
  WriteLn(F, '<h2 class=class>', Localize(dtDocumentationClassAbstractPre),
             '<i>abstract</i>', Localize(dtDocumentationClassAbstractPost),
             '</h2>');

 if Ident.Kind = rkClass then             //if it is a class
  begin
   S := GetInterfaceLinks(Ident);           //get all implemented interfaces
   S2 := GetParentInterfaceLinks(Ident);    //and of the parent classes

   if (S <> '') or (S2 <> '') then          //implements some interfaces?
    begin
     WriteLn(F, '<h2 class=class>',
                Localize(dtDocumentationClassImplementedInterfaces),
                '</h2>');                     //write list
     if S <> '' then                          //implements some?
      WriteLn(F, S)                             //write them
     else
      WriteLn(F, '<i>',
                 Localize(dtDocumentationClassNoDirectImplementedInterfaces),
                 '</i>');
     if S2 <> '' then           //parent classes implements some interfaces?
      begin
       WriteLn(F, '<br>');
       WriteLn(F, Localize(dtDocumentationClassImplementedByAncestors), ': ',
                  S2);  //write them
      end;
    end;
  end; //if Ident.Kind = rkClass

 //if it can have descendants
 if Ident.Kind in RecordKindCanInherit then
  begin
   S := GetDirectDescendantList(Ident);      //get list of sub-classes
   if S <> '' then                           //does it have some?
    begin
     WriteLn(F, '<h2 class=class>',
                Localize(dtDocumentationClassDirectSubclasses), ':</h2>');
     WriteLn(F, S);                            //write list of sub-classes
    end
   else
    WriteLn(F, '<h2 class=class>',
               Localize(dtDocumentationClassNoSubclasses), '</h2>');
  end;


 //is an interface (can be implemented?)
 if Ident.Kind = rkInterface then
  begin
   //get list of all (documented) implementing classes
   S := GetImplementingClassesList(Ident);
   if S <> '' then                  //interface is implemented?
    begin
     WriteLn(F, '<h2 class=class>',
                Localize(dtDocumentationClassImplementingClasses), ':</h2>');
     WriteLn(F, S);                   //write list of implementing classes
    end
   else
    WriteLn(F, '<h2 class=class>',
               Localize(dtDocumentationClassNoImplementingClasses), '</h2>');
  end;


 //check, if it is used by some (documented) record-like type
 i := Ident.UsedByIdents.Count - 1;
 while (i >= 0) and
       (not (Ident.UsedByIdents[i] is TRecordType) or
        DoNotDocumentIdentifier(Ident.UsedByIdents[i])) do
  dec(i);
 if i >= 0 then                           //is used by a record-like type?
  begin                                     //write all types
   WriteLn(F, '<h2 class=class>',
              Localize(dtDocumentationClassUsedByClasses), ':</h2>');
   First := True;
   for i := 0 to i do                       //for each using identifier
    begin
     User := Ident.UsedByIdents[i];           //get it
     //is a record-like type and documented?
     if (User is TRecordType) and not DoNotDocumentIdentifier(User) then
      begin
       if First then                            //if not the first entry
        First := False
       else
        Write(F, ', ');                           //write a separator

       //write link to the record-like type
       Write(F, GetIdentNameLink(User));
      end;
    end; //for i := 0 to i
  end //if i >= 0
 else
  WriteLn(F, '<h2 class=class>',
             Localize(dtDocumentationClassNotUsedByClasses), '</h2>');

 //if it is an abstract type, write its abstract methods
 if Ident.IsAbstract then
  begin
   WriteLn(F, '<h2 class=class>',
              Localize(dtDocumentationClassAbstractMethods), ':</h2>');
   WriteLn(F, GetStillAbstractMethods(Ident));
  end;

 WriteLn(F, '<hr>');

 WriteLn(F, '<h2 class=classcomment>', Localize(dtCommentsClassComment),
            ':</h2>');

 Dummy := '';
 WriteLn(F, GetIdentComment(Dummy));     //get and write documentation
end;













































{Starts a list of exported identifiers.
~param TheFile  the file to write the list to (can be opened here)
~param AFile    the file whose exported identifiers are listed; nil for all
                exported identifiers
~param PreFirst if it is before the first file instead of the global list
~param First    the text before an entry is returned with this parameter
~param Second   the text between the identifier and the export index is
                returned with this parameter; ignored if in a file list
~param Third    the text between the export index and the export name is
                returned with this parameter; ignored if in a file list
~param Fourth   the text between the export name and the "resident"
                directive is returned with this parameter; ignored if in a
                file list
~param Fifth    the text between the "resident" directive and and the file
                exporting is returned with this parameter; ignored if in a
                file list
~param Sixth    the last entry after the file is returned with this
                parameter }
procedure TBaseHTMLDoc.StartExportsLists(var TheFile: TextFile;
                                         AFile: TPascalFile; PreFirst: Boolean;
                                         var First, Second, Third,
                                             Fourth, Fifth, Sixth: String);
begin
 if not assigned(AFile) then         //is a global file?
  if PreFirst then                     //before lists of identifiers by file
   begin
    //create the file for the list
    CreateFile(TheFile, 'ExportedByFile',
                        Localize(dtDocumentationExportedByFile),
                        Localize(dtKeyWordListExportedIdentifiers));
    //write the heading
    WriteLn(TheFile, '<h1 class=exported>',
                     Localize(dtDocumentationExportedByFile), '</h1>');
   end
  else                                 //list of identifiers in all files
   begin
    //create the file for the list
    CreateFile(TheFile, 'Exported', Localize(dtDocumentationExported),
                        Localize(dtKeyWordListExportedIdentifiers));
    //write the heading and start the table
    WriteLn(TheFile, '<h1 class=exported>',
                     Localize(dtDocumentationExported), '</h1>');
    WriteLn(TheFile, '<table class=exported><tr><th>',

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -