OSDN Git Service

・コンストラクタやデストラクタといった細かいところの調整。
authoryoffy <yoffy>
Thu, 27 Nov 2003 13:04:18 +0000 (13:04 +0000)
committeryoffy <yoffy>
Thu, 27 Nov 2003 13:04:18 +0000 (13:04 +0000)
AddressHistory.pas
BoardGroup.pas
ExternalBoardPlugInMain.pas
Giko.pas
GikoXMLDoc.pas
Option.dfm
Option.pas

index 061a33c..567e6ef 100644 (file)
@@ -57,21 +57,25 @@ begin
        if FileExists(FileName) then begin
                try
                        XMLDoc := LoadXMLDocument(FileName);
-                       XMLNode := XMLDoc.DocumentElement;
-
-                       if XMLNode.NodeName = 'address' then begin
-                               for i := 0 to XMLNode.ChildNodes.Count - 1 do begin
-                                       HistoryNode := XMLNode.ChildNodes[i];
-                                       if HistoryNode.NodeName = 'history' then begin
-                                               if FReadCount >= sl.Count then begin
-                                                       s := Trim(HistoryNode.Attributes['url']);
-                                                       if s <> '' then
-                                                               sl.Add(s);
-                                                               //sl.Add(HttpDecode(s));
-                                               end;
-                                       end;
-                               end;
-                       end;
+      try
+        XMLNode := XMLDoc.DocumentElement;
+
+        if XMLNode.NodeName = 'address' then begin
+          for i := 0 to XMLNode.ChildNodes.Count - 1 do begin
+            HistoryNode := XMLNode.ChildNodes[i];
+            if HistoryNode.NodeName = 'history' then begin
+              if FReadCount >= sl.Count then begin
+                s := Trim(HistoryNode.Attributes['url']);
+                if s <> '' then
+                  sl.Add(s);
+                  //sl.Add(HttpDecode(s));
+              end;
+            end;
+          end;
+        end;
+      finally
+        XMLDoc.Free;
+      end;
                except
                end;
        end;
index e8f4227..6164205 100644 (file)
@@ -181,9 +181,9 @@ type
                procedure SetUnRead(i: Integer);
                procedure SetKotehanName(s: string);
                procedure SetKotehanMail(s: string);
-               procedure Create; overload;
+               procedure Init;
        public
-               constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;
+               constructor Create( inPlugIn : TBoardPlugIn; inURL : string );
                destructor Destroy; override;
 
                property Context: DWORD read FContext write FContext;
@@ -284,9 +284,9 @@ type
                procedure SetKokomade(i: Integer);
                procedure SetUnRead(b: Boolean);
                procedure SetScrollTop(i: Integer);
-               procedure Create; overload;
+               procedure Init;
        public
-               constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;
+               constructor Create( inPlugIn : TBoardPlugIn; inURL : string );
                destructor Destroy; override;
 
                function GetDatURL: string;
@@ -453,6 +453,7 @@ end;
  *************************************************************************)
 constructor TBBS.Create(LogFolder: string);
 begin
+       inherited Create;
        Title := BBS2CH_NAME;
        FLogFolder := LogFolder;
 end;
@@ -610,6 +611,7 @@ end;}
 //===================
 constructor TCategory.Create;
 begin
+       inherited;
 end;
 
 destructor TCategory.Destroy;
@@ -752,7 +754,7 @@ end;}
 //===================
 //TBoard
 //===================
-procedure TBoard.Create;
+procedure TBoard.Init;
 begin
        FNo := 0;
        FTitle := '';
@@ -768,8 +770,6 @@ begin
 //     FItemNoVisible := True;
 
        FUpdate := True;
-
-       FBoardPlugIn := nil;
 end;
 
 // *************************************************************************
@@ -784,7 +784,8 @@ var
        BBSID                   : string;
 begin
 
-       Create;
+       inherited Create;
+       Init;
 
        FBoardPlugIn    := inPlugIn;
        URL                                             := inURL;
@@ -1135,23 +1136,23 @@ var
        i: Integer;
 begin
        Result := 0;
-                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-                               begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].NewArrival then
-                                                       inc(Result);
-                                       end;
-                               end else begin
-                                       for i := 0 to Count - 1 do begin
-                                                                                               if Items[i].NewArrival then
-                                                                                               begin
-                                                                                                                               if Items[i].ShortTitle = '' then
-                                                                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
-                                                                                                                                                               inc(Result);
-                                                                                               end;
-                                       end;
-                               end;
+  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+  begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].NewArrival then
+             inc(Result);
+    end;
+  end else begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].NewArrival then
+      begin
+        if Items[i].ShortTitle = '' then
+               Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
+             inc(Result);
+      end;
+    end;
+  end;
 end;
 
 function TBoard.GetLogThreadCount: Integer;
@@ -1159,23 +1160,23 @@ var
        i: Integer;
 begin
        Result := 0;
-                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-                               begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].IsLogFile then
-                                                       inc(Result);
-                                       end;
-                               end else begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].IsLogFile then
-                                                                                               begin
-                                                                                                                               if Items[i].ShortTitle = '' then
-                                                                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
-                                                                                                                                                               inc(Result);
-                                                                                               end;
-                                       end;
-                               end;
+  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+  begin
+    for i := 0 to Count - 1 do begin
+           if Items[i].IsLogFile then
+                   inc(Result);
+    end;
+  end else begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].IsLogFile then
+      begin
+        if Items[i].ShortTitle = '' then
+               Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
+               inc(Result);
+      end;
+    end;
+  end;
 end;
 
 function TBoard.GetUserThreadCount: Integer;
@@ -1183,15 +1184,15 @@ var
        i: Integer;
 begin
        Result := 0;
-                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-                                                               Result := Count
-                               else
-       for i := 0 to Count - 1 do begin
-               if Items[i].ShortTitle = '' then
-                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
-                       inc(Result);
-       end;
+  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+         Result := Count
+  else
+    for i := 0 to Count - 1 do begin
+      if Items[i].ShortTitle = '' then
+        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+      if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
+        inc(Result);
+    end;
 end;
 
 function TBoard.GetNewThread(Index: Integer): TThreadItem;
@@ -1201,34 +1202,34 @@ var
 begin
        Result := nil;
        Cnt := 0;
-                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-                               begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].NewArrival then
-                                                                                               begin
-                                                       if Index = Cnt then begin
-                                                               Result := Items[i];
-                                                               Exit;
-                                                       end;
-                                                       inc(Cnt);
-                                               end;
-                                       end;
-                               end else begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].NewArrival then
-                                                                                               begin
-                                                                               if Items[i].ShortTitle = '' then
-                                                                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
-                                                                                       if Index = Cnt then begin
-                                                                                               Result := Items[i];
-                                                                                               Exit;
-                                                                                       end;
-                                                                                       inc(Cnt);
-                                                                                                                               end;
-                                                                                               end;
-                                       end;
-                               end;
+  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+  begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].NewArrival then
+                  begin
+        if Index = Cnt then begin
+          Result := Items[i];
+          Exit;
+        end;
+        inc(Cnt);
+      end;
+    end;
+  end else begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].NewArrival then
+      begin
+        if Items[i].ShortTitle = '' then
+          Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+          if Index = Cnt then begin
+            Result := Items[i];
+            Exit;
+          end;
+          inc(Cnt);
+        end;
+      end;
+    end;
+  end;
 end;
 
 function TBoard.GetLogThread(Index: Integer): TThreadItem;
@@ -1236,36 +1237,36 @@ var
        i: Integer;
        Cnt: Integer;
 begin
-                               Cnt := 0;
-                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-                               begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].IsLogFile then
-                                                                                               begin
-                                                       if Index = Cnt then begin
-                                                               Result := Items[i];
-                                                               Exit;
-                                                       end;
-                                                       inc(Cnt);
-                                               end;
-                                       end;
-                               end else begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].IsLogFile then
-                                                                                               begin
-                                                                               if Items[i].ShortTitle = '' then
-                                                                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
-                                                                                       if Index = Cnt then begin
-                                                                                               Result := Items[i];
-                                                                                               Exit;
-                                                                                       end;
-                                                                                       inc(Cnt);
-                                                                                                                               end;
-                                                                                               end;
-                                       end;
-                               end;
-                               Result := nil;
+  Cnt := 0;
+  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+  begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].IsLogFile then
+                  begin
+        if Index = Cnt then begin
+          Result := Items[i];
+          Exit;
+        end;
+        inc(Cnt);
+      end;
+    end;
+  end else begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].IsLogFile then
+        begin
+          if Items[i].ShortTitle = '' then
+            Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+          if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+            if Index = Cnt then begin
+              Result := Items[i];
+              Exit;
+          end;
+          inc(Cnt);
+        end;
+      end;
+         end;
+  end;
+  Result := nil;
 end;
 
 function TBoard.GetUserThread(Index: Integer): TThreadItem;
@@ -1275,29 +1276,29 @@ var
 begin
        Result := nil;
        Cnt := 0;
-                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-                               begin
-                                                               for i := 0 to Count - 1 do begin
-                                                                                               if Index = Cnt then
-                                                                                               begin
-                                                                                                                               Result := Items[ i ];
-                                                                                                                               Exit;
-                                                                                               end;
-                                                                                               inc( Cnt );
-                                                               end;
-                               end else begin
-                                       for i := 0 to Count - 1 do begin
-                                               if Items[i].ShortTitle = '' then
-                                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
-                                                       if Index = Cnt then begin
-                                                               Result := Items[i];
-                                                               Exit;
-                                                       end;
-                                                       inc(Cnt);
-                                               end;
-                                       end;
-                               end;
+  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+  begin
+    for i := 0 to Count - 1 do begin
+      if Index = Cnt then
+      begin
+        Result := Items[ i ];
+        Exit;
+      end;
+      inc( Cnt );
+    end;
+  end else begin
+    for i := 0 to Count - 1 do begin
+      if Items[i].ShortTitle = '' then
+        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+      if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+        if Index = Cnt then begin
+          Result := Items[i];
+          Exit;
+        end;
+        inc(Cnt);
+      end;
+    end;
+       end;
 end;
 
 procedure TBoard.BeginUpdate;
@@ -1321,7 +1322,7 @@ begin
 end;}
 
 //constructor TThreadItem.Create(AOwner: TComponent);
-procedure TThreadItem.Create;
+procedure TThreadItem.Init;
 begin
        FNo := 0;
        FFileName := '';
@@ -1359,7 +1360,8 @@ const
        READ_PATH                                                       = '/test/read.cgi';
 begin
 
-       Create;
+       inherited Create;
+       Init;
 
        FBoardPlugIn    := inPlugIn;
        URL                                             := inURL;
index f891bd2..55cb1db 100644 (file)
@@ -358,7 +358,7 @@ function InternalAbon(
        inDatText : PChar;                      // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95tID<>\96{\95¶<>[\89ü\8ds] \82Å\8d\\90¬\82³\82ê\82½\83e\83L\83X\83g
        inDatPath       : PChar                         // dat \83t\83@\83C\83\8b\82Ì\83t\83\8b\83p\83X
 
-) : PChar; stdcall;                    // \82 \82Ú\81`\82ñ\8dÏ\82Ý\82Ì dat \8c`\8e®\83e\83L\83X\83g
+) : PChar; stdcall;                            // \82 \82Ú\81`\82ñ\8dÏ\82Ý\82Ì dat \8c`\8e®\83e\83L\83X\83g
 var
        datList : TStringList;
                FileName : String;
@@ -366,7 +366,7 @@ begin
 
        datList := TStringList.Create;
        datList.Text := string( inDatText );
-               FileName := string( inDatPath );
+       FileName := string( inDatPath );
        GikoSys.FAbon.IndividualAbon( datList, ChangeFileExt(FileName,'.NG'));
        GikoSys.FAbon.Execute( datList );
        GikoSys.FSelectResFilter.Execute( datList );
@@ -413,15 +413,18 @@ var
 begin
 
        // \83_\83~\81[\82Ì\83N\83\89\83X
-       board                           := TBoard.Create;
-       threadItem      := TThreadItem.Create;
-
+       board                           := TBoard.Create( nil, 'about://dummy/' );
+       threadItem      := TThreadItem.Create( nil, 'about://dummy/test/read.cgi/dummy/' );
        try
-               threadItem.ParentBoard := Board;
+               try
+                       board.Add( threadItem );
 
-               Result := ThreadItemDat2HTML( DWORD( threadItem ), inDatRes, inResNo, inIsNew );
-       except
-               Result := nil;
+                       Result := ThreadItemDat2HTML( DWORD( threadItem ), inDatRes, inResNo, inIsNew );
+               except
+                       Result := nil;
+               end;
+       finally
+               board.Free;
        end;
 
 end;
index fef977b..86ea1c5 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -3583,24 +3583,28 @@ begin
        if FileExists( fileName ) then begin
                try
                        XMLDoc := LoadXMLDocument(FileName);
-                       XMLNode := XMLDoc.DocumentElement;
-
-                       if XMLNode.NodeName = 'address' then begin
-                               bound := XMLNode.ChildNodes.Count - 1;
-                               for i := 0 to bound do begin
-                                       HistoryNode := XMLNode.ChildNodes[i];
-                                       if HistoryNode.NodeName = 'history' then begin
-                                               //if FReadCount >= sl.Count then begin
-                                                       s := Trim(HistoryNode.Attributes['url']);
-                                                       if s <> '' then begin
-                                                               favItem := TFavoriteThreadItem.Create(
-                                                                       s, HistoryNode.Attributes[ 'title' ] );
-                                                               AddHistory( favItem );
-                                                       end;
-                                               //end;
-                                       end;
-                               end;
-                       end;
+      try
+        XMLNode := XMLDoc.DocumentElement;
+
+        if XMLNode.NodeName = 'address' then begin
+          bound := XMLNode.ChildNodes.Count - 1;
+          for i := 0 to bound do begin
+            HistoryNode := XMLNode.ChildNodes[i];
+            if HistoryNode.NodeName = 'history' then begin
+              //if FReadCount >= sl.Count then begin
+                s := Trim(HistoryNode.Attributes['url']);
+                if s <> '' then begin
+                  favItem := TFavoriteThreadItem.Create(
+                    s, HistoryNode.Attributes[ 'title' ] );
+                  AddHistory( favItem );
+                end;
+              //end;
+            end;
+          end;
+        end;
+      finally
+        XMLDoc.Free;
+      end;
                except
                end;
        end;
@@ -4768,7 +4772,6 @@ end;
 procedure TGikoForm.ListViewDblClick(Sender: TObject);
 begin
        ListDoubleClick;
-    
 end;
 
 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
index ae3e00e..cae1b96 100644 (file)
@@ -34,7 +34,8 @@ type
                function GetAttribute( const Name : string ) : string;
                function GetNode( Index : Integer ) : IXMLNode;
        public
-               constructor Create;
+               constructor     Create;
+               destructor      Destroy; override;
 
                property NodeName : string read FNodeName write FNodeName;
                property Attributes[ const Name : string ] : string read GetAttribute;
@@ -83,13 +84,29 @@ implementation
 //==================================================
 
 // Constructor
-constructor IXMLNode.Create();
+constructor    IXMLNode.Create;
 begin
 
+       inherited;
+
        FCount := 0;
 
 end;
 
+// Destructor
+destructor     IXMLNode.Destroy;
+var
+       i : Integer;
+begin
+
+       for i := FCount - 1 downto 0 do
+               FNodes[ i ].Free;
+       FChildNodes.Free;
+
+       inherited;
+
+end;
+
 function IXMLNode.GetAttribute( const Name : string ) : string;
 var
        i : Integer;
index 40ea99f..0c36b2c 100644 (file)
@@ -660,7 +660,7 @@ object OptionDialog: TOptionDialog
           Top = 43
           Width = 417
           Height = 20
-          ItemHeight = 12
+          ItemHeight = 0
           TabOrder = 0
           Text = 'BoardURLComboBox'
         end
index cbeecf1..a4c1d3e 100644 (file)
@@ -1291,11 +1291,10 @@ begin
                end;
        end;
 
-       Board := TBoard.Create;
-       ThreadItem := TThreadItem.Create;
+       Board := TBoard.Create( nil, 'about://sample/' );
+       ThreadItem := TThreadItem.Create( nil, 'about://sample/test/read.cgi/sample/' );
 
        try
-               Board.URL := 'about://sample/';
                Board.Title := '\83T\83\93\83v\83\8b\94Â';
                ThreadItem.ParentBoard := Board;
                ThreadItem.AllResCount := High( Res );