ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/DataAccess/ConnectionManager.pas
(Generate patch)

Comparing oup/rewrite/DataAccess/ConnectionManager.pas (file contents):
Revision 93 by alloc, Thu Jan 18 17:15:59 2007 UTC vs.
Revision 97 by alloc, Mon Jan 22 23:05:45 2007 UTC

# Line 17 | Line 17 | type
17      function GetConnectionCount: Integer;
18      function GetConnection(ConnectionID: Integer): TDataAccess;
19      function GetConnectionByIndex(Index: Integer): TDataAccess;
20 +    function GetConnectionIndex(ConnectionID: Integer): Integer;
21      procedure RemoveConnection(ArrayIndex: Integer);
22    protected
23    public
24      property Count: Integer read GetConnectionCount;
25      property Connection[ConnectionID: Integer]: TDataAccess read GetConnection;
26      property ConnectionByIndex[Index: Integer]: TDataAccess read GetConnectionByIndex;
27 +    property ConnectionIndexByID[ConnectionID: Integer]: Integer read GetConnectionIndex;
28      property OnCoonnectionListChanged: TConnectionListChangedEvent read FConnectionListChanged write FConnectionListChanged;
29  
30      constructor Create;
# Line 36 | Line 38 | type
38    end;
39  
40  
41 + var
42 +  ConManager: TConnectionManager;
43 +
44 +
45   implementation
46   uses
47    SysUtils, Dialogs;
# Line 50 | Line 56 | begin
56    Result := Length(FConnections);
57   end;
58  
59 + function TConnectionManager.GetConnectionIndex(ConnectionID: Integer): Integer;
60 + var
61 +  i: Integer;
62 + begin
63 +  Result := -1;
64 +  if Count > 0 then
65 +    for i := 0 to Count - 1 do
66 +      if ConnectionByIndex[i].ConnectionID = ConnectionID then
67 +      begin
68 +        Result := i;
69 +        Break;
70 +      end;
71 + end;
72 +
73   function TConnectionManager.GetConnection(ConnectionID: Integer): TDataAccess;
74   var
75    i: Integer;
# Line 239 | Line 259 | begin
259   end;
260  
261  
262 + initialization
263 +  ConManager := TConnectionManager.Create;
264 + finalization
265 +  ConManager.Free;
266   end.

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)