~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/objpas/classes/intf.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Component Library (FCL)
 
3
    Copyright (c) 2002 by the Free Pascal development team
 
4
 
 
5
    See the file COPYING.FPC, included in this distribution,
 
6
    for details about the copyright.
 
7
 
 
8
    This program is distributed in the hope that it will be useful,
 
9
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
11
 
 
12
 **********************************************************************}
 
13
 
 
14
    constructor TInterfaceList.Create;
 
15
      begin
 
16
        inherited create;
 
17
        FList:=TThreadList.Create;
 
18
      end;
 
19
 
 
20
 
 
21
    destructor TInterfaceList.Destroy;
 
22
      begin
 
23
        Clear;
 
24
        FList.Free;
 
25
        inherited Destroy;
 
26
      end;
 
27
 
 
28
 
 
29
    function TInterfaceList.Get(i : Integer) : IUnknown;
 
30
      begin
 
31
        FList.Locklist;
 
32
        try
 
33
          if (i<0) or (i>=FList.FList.Count) then
 
34
            FList.FList.Error(SListIndexError,i);
 
35
          result:=IUnknown(FList.FList.List^[i]);
 
36
        finally
 
37
          FList.UnlockList;
 
38
        end;
 
39
      end;
 
40
 
 
41
 
 
42
    function TInterfaceList.GetCapacity : Integer;
 
43
      begin
 
44
        FList.Locklist;
 
45
        try
 
46
          result:=FList.FList.Capacity;
 
47
        finally
 
48
          FList.UnlockList;
 
49
        end;
 
50
      end;
 
51
 
 
52
 
 
53
    function TInterfaceList.GetCount : Integer;
 
54
      begin
 
55
        FList.Locklist;
 
56
        try
 
57
          result:=FList.FList.Count;
 
58
        finally
 
59
          FList.UnlockList;
 
60
        end;
 
61
      end;
 
62
 
 
63
 
 
64
    procedure TInterfaceList.Put(i : Integer;item : IUnknown);
 
65
      begin
 
66
        FList.Locklist;
 
67
        try
 
68
          if (i<0) or (i>=FList.FList.Count) then
 
69
            FList.FList.Error(SListIndexError,i);
 
70
          IUnknown(FList.FList.List^[i]):=item;
 
71
        finally
 
72
          FList.UnlockList;
 
73
        end;
 
74
      end;
 
75
 
 
76
 
 
77
    procedure TInterfaceList.SetCapacity(NewCapacity : Integer);
 
78
      begin
 
79
        FList.Locklist;
 
80
        try
 
81
          FList.FList.Capacity:=NewCapacity;
 
82
        finally
 
83
          FList.UnlockList;
 
84
        end;
 
85
      end;
 
86
 
 
87
 
 
88
    procedure TInterfaceList.SetCount(NewCount : Integer);
 
89
      begin
 
90
        FList.Locklist;
 
91
        try
 
92
          FList.FList.Count:=NewCount;
 
93
        finally
 
94
          FList.UnlockList;
 
95
        end;
 
96
      end;
 
97
 
 
98
 
 
99
    procedure TInterfaceList.Clear;
 
100
      var
 
101
        i : SizeInt;
 
102
      begin
 
103
        FList.Locklist;
 
104
        try
 
105
          for i:=0 to FList.FList.Count-1 do
 
106
            IUnknown(FList.FList.List^[i]):=nil;
 
107
          FList.Clear;
 
108
        finally
 
109
          FList.UnlockList;
 
110
        end;
 
111
      end;
 
112
 
 
113
 
 
114
    procedure TInterfaceList.Delete(index : Integer);
 
115
      begin
 
116
        FList.Locklist;
 
117
        try
 
118
          if (index<0) or (index>=FList.FList.Count) then
 
119
            FList.FList.Error(SListIndexError,index);
 
120
          IUnknown(FList.FList.List^[index]):=nil;
 
121
          FList.FList.Delete(index);
 
122
        finally
 
123
          FList.UnlockList;
 
124
        end;
 
125
      end;
 
126
 
 
127
 
 
128
    procedure TInterfaceList.Exchange(index1,index2 : Integer);
 
129
      begin
 
130
        FList.Locklist;
 
131
        try
 
132
          FList.FList.Exchange(index1,index2);
 
133
        finally
 
134
          FList.UnlockList;
 
135
        end;
 
136
      end;
 
137
 
 
138
 
 
139
    function TInterfaceList.First : IUnknown;
 
140
      begin
 
141
        result:=Get(0);
 
142
      end;
 
143
 
 
144
 
 
145
    function TInterfaceList.IndexOf(item : IUnknown) : Integer;
 
146
      begin
 
147
        FList.Locklist;
 
148
        try
 
149
          result:=FList.FList.IndexOf(Pointer(Item));
 
150
        finally
 
151
          FList.UnlockList;
 
152
        end;
 
153
      end;
 
154
 
 
155
 
 
156
    function TInterfaceList.Add(item : IUnknown) : Integer;
 
157
      begin
 
158
        FList.Locklist;
 
159
        try
 
160
          result:=FList.FList.Add(nil);
 
161
          IUnknown(FList.FList.List^[result]):=item;
 
162
        finally
 
163
          FList.UnlockList;
 
164
        end;
 
165
      end;
 
166
 
 
167
 
 
168
    procedure TInterfaceList.Insert(i : Integer;item : IUnknown);
 
169
      begin
 
170
        FList.Locklist;
 
171
        try
 
172
          FList.FList.Insert(i,nil);
 
173
          IUnknown(FList.FList.List^[i]):=item;
 
174
        finally
 
175
          FList.UnlockList;
 
176
        end;
 
177
      end;
 
178
 
 
179
 
 
180
    function TInterfaceList.Last : IUnknown;
 
181
      begin
 
182
        result:=Get(Count-1);
 
183
      end;
 
184
 
 
185
 
 
186
    function TInterfaceList.Remove(item : IUnknown): Integer;
 
187
      begin
 
188
        FList.Locklist;
 
189
        try
 
190
          result:=FList.FList.IndexOf(item);
 
191
          if result>=0 then
 
192
            begin
 
193
              IUnknown(FList.FList.List^[result]):=nil;
 
194
              FList.FList.Delete(result);
 
195
            end;
 
196
        finally
 
197
          FList.UnlockList;
 
198
        end;
 
199
      end;
 
200
 
 
201
 
 
202
    procedure TInterfaceList.Lock;
 
203
      begin
 
204
        FList.Locklist;
 
205
      end;
 
206
 
 
207
 
 
208
    procedure TInterfaceList.Unlock;
 
209
      begin
 
210
        FList.UnlockList;
 
211
      end;
 
212
 
 
213
 
 
214
    function TInterfaceList.Expand : TInterfaceList;
 
215
      begin
 
216
        FList.Locklist;
 
217
        try
 
218
          FList.FList.Expand;
 
219
          result:=self;
 
220
        finally
 
221
          FList.UnlockList;
 
222
        end;
 
223
      end;