Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2008.07.06;
Скачать: CL | DM;

Вниз

Что за программа так оформляет код?   Найти похожие ветки 

 
DVM ©   (2008-05-25 20:59) [0]

К примеру в приведенном ниже коде сделаны вставки. Явно сделаны автоматически. Что за программа делает их?


{ ##
 @FILE                     UPrintMgr.pas
 @COMMENTS                 Implements a class that manages printing of a
                           document providing information about a routine.
 @PROJECT_NAME             CodeSnip
 @PROJECT_DESC             Offline viewer for routines from the online
                           DelphiDabbler CodeSnip database.
 @DEPENDENCIES             None
 @HISTORY(
   @REVISION(
     @VERSION              1.0
     @DATE                 07/09/2007
     @COMMENTS             Original version.
   )
 )
}

{
* ***** 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 UPrintMgr.pas
*
* The Initial Developer of the Original Code is Peter Johnson
* (http://www.delphidabbler.com/).
*
* Portions created by the Initial Developer are Copyright (C) 2007 Peter
* Johnson. All Rights Reserved.
*
* Contributor(s): None
*
* ***** END LICENSE BLOCK *****
}

unit UPrintMgr;

interface

uses
 // Delphi
 Classes,
 // Project
 UPrintInfo, USnippets, UView;

type

 {
 TPrintMgr:
   Class that manages printing of a document providing information about a
   routine. It generates a RTF formatted document and passes it to the print
   engine for printing.
 }
 TPrintMgr = class(TObject)
 private
   fRoutine: TRoutine;
     {Reference to routine whose information is to be printed}
   procedure GeneratePrintDocument(const Stm: TStream);
     {Generates document suitable for printing by print engine.
       @param Stm [in] Stream to receive generated document.
     }
 public
   constructor Create(const ViewItem: TViewItem);
     {Class constructor. Sets up object.
       @param ViewItem [in] View item containing routine for which information
         is to be printed.
     }
   procedure Print;
     {Prints routine information document using print engine.
     }
 end;

implementation

uses
 // Delphi
 SysUtils,
 // Project
 UPrintEngine, UPrintDocuments;

{ TPrintMgr }

constructor TPrintMgr.Create(const ViewItem: TViewItem);
 {Class constructor. Sets up object.
   @param ViewItem [in] View item containing routine for which information is
     to be printed.
 }
begin
 Assert(Assigned(ViewItem),                               // ** do not localise
   "TPrintMgr.Create: ViewItem is nil");
 Assert(ViewItem.Kind = vkRoutine,                        // ** do not localise
   "TPrintMgr.Create: ViewItem is not a routine");
 inherited Create;
 fRoutine := ViewItem.Routine;
end;

procedure TPrintMgr.GeneratePrintDocument(const Stm: TStream);
 {Generates document suitable for printing by print engine.
   @param Stm [in] Stream to receive generated document.
 }
var
 PrintDoc: IPrintDocument;   // generates print document
begin
 PrintDoc := TRoutinePrintDocument.Create(fRoutine);
 PrintDoc.Generate(Stm);
 Stm.Position := 0;
end;

procedure TPrintMgr.Print;
 {Prints routine information document using print engine.
 }
var
 PrintEngine: TPrintEngine;  // object that prints the print document
 DocStm: TStream;            // stream containing generated print document
begin
 PrintEngine := TPrintEngine.Create;
 try
   PrintEngine.Title := fRoutine.Name;
   DocStm := TMemoryStream.Create;
   try
     GeneratePrintDocument(DocStm);
     PrintEngine.Print(DocStm);
   finally
     FreeAndNil(DocStm);
   end;
 finally
   FreeAndNil(PrintEngine);
 end;
end;

end.



 
TIF ©   (2008-05-25 21:02) [1]

Удалено модератором


 
DVM ©   (2008-05-25 21:04) [2]


> Может, программист щепетильный, сам всё прописывает... imho

В программе под сотню модулей, везде абсолютно везде все подписано с точностью до пробела, подписаны методы, классы и т.д.

Это надо быть очень, очень педантичным. Не, это не человек.


 
Real ©   (2008-05-25 21:55) [3]

Может неизвестный программист написал ее для себя сам?


 
TIF ©   (2008-05-25 21:58) [4]

> Portions created by the Initial Developer
Мне вот как-то это место кажется подозрительным, не знаю почему...


> Может неизвестный программист написал ее для себя сам?

Судя по тому, что комментарии написаны логически правильно, я предполгаю, что эта самя программа просто помогала ему в нужные места кода вставлять текст, который он уже набирал сам... Но, возможно, ачсть мелких комментариев прога вставляла и сама...


 
Virgo_Style ©   (2008-05-25 22:00) [5]

TIF ©   (25.05.08 21:58) [4]
Но, возможно, ачсть мелких комментариев прога вставляла и сама...


Нужен ли комментарий, который программа может вставить сама? %-)


 
TIF ©   (2008-05-25 22:03) [6]

Удалено модератором


 
DVM ©   (2008-05-25 22:08) [7]


> Может неизвестный программист написал ее для себя сам?

вобщем не исключено.


> я предполгаю, что эта самя программа просто помогала ему
> в нужные места кода вставлять текст, который он уже набирал
> сам...

Ну так и есть, не сама же программа текст придумывала.


> Но, возможно, ачсть мелких комментариев прога вставляла
> и сама...

Она вставляет какие то заглушки там где нет авторского текста. По всей видимости потом эти комментарии используются как-то для построения хэлпа по модулю.


 
Torry ©   (2008-05-26 00:27) [8]

Похоже на Doc-o-Matic


 
Джо ©   (2008-05-26 00:29) [9]


> Torry ©   (26.05.08 00:27) [8]
> Похоже на Doc-o-Matic

Угу, сам когда-то так оформлял комментарии, такое уж было требование. Или Delphi-Doc? В общем, что-то такое похожее...


 
Eraser ©   (2008-05-26 00:37) [10]

> [8] Torry ©   (26.05.08 00:27)

это что то вроде доп. эксперта к делфи?

вообще интересовался этим вопросам как-то, вроде ничего не нашел.

очень удобно было бы, чтобы как в Zend"e, набираешь перед функцией/классом/полем /**, жмешь итер и появляется что то вроде
/**
* Enter description here...
*
* @param unknown_type $param1
* @param unknown_type $param2
* @param unknown_type $param3
*/
function my_function($param1, $param2, $param3)
{

}


 
Eraser ©   (2008-05-26 00:38) [11]

потом это все обрабатывешь php-doc"ом и документация к API готова )



Страницы: 1 вся ветка

Текущий архив: 2008.07.06;
Скачать: CL | DM;

Наверх




Память: 0.5 MB
Время: 0.022 c
15-1211723694
ProgRAMmer Dimonych
2008-05-25 17:54
2008.07.06
Как лучше?


15-1211280109
TStas
2008-05-20 14:41
2008.07.06
Ф-ция, возвращающая указатель на СОМ-сервер


4-1192480485
Magedon
2007-10-16 00:34
2008.07.06
Ассоциация файлов


15-1211457004
Дмитрий С
2008-05-22 15:50
2008.07.06
На каком это языке?


15-1211301539
Kostafey
2008-05-20 20:38
2008.07.06
Распределенные сетевые задачи