objects.xml 84 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264
  1. <?xml version="1.0" encoding="ISO8859-1"?>
  2. <fpdoc-descriptions>
  3. <!--
  4. $Id$
  5. This file is part of the FPC documentation.
  6. Copyright (C) 1997, by Michael Van Canneyt
  7. The FPC documentation is free text; you can redistribute it and/or
  8. modify it under the terms of the GNU Library General Public License as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version.
  11. The FPC Documentation is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Library General Public License for more details.
  15. You should have received a copy of the GNU Library General Public
  16. License along with the FPC documentation; see the file COPYING.LIB. If not,
  17. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. Boston, MA 02111-1307, USA.
  19. -->
  20. <package name="rtl">
  21. <module name="objects">
  22. <short>TP-Compatible basic Objects.</short>
  23. <!-- \FPCexampledir{objectex} -->
  24. <descr>
  25. <p>
  26. This document documents the <file>objects</file> unit. The unit was implemented by
  27. many people, and was mainly taken from the FreeVision sources. It has been
  28. ported to all supported platforms.
  29. </p>
  30. <p>
  31. The methods and fields that are in a <var>Private</var> part of an object
  32. declaration have been left out of this documentation.
  33. </p>
  34. </descr>
  35. <element name="stOk">
  36. <short>Stream error codes: No error</short>
  37. </element>
  38. <element name="stError">
  39. <short>Stream error codes: Access error</short>
  40. </element>
  41. <element name="stInitError">
  42. <short>Stream error codes: Initialize error</short>
  43. </element>
  44. <element name="stReadError">
  45. <short>Stream error codes: Stream read error</short>
  46. </element>
  47. <element name="stWriteError">
  48. <short>Stream error codes: Stream write error</short>
  49. </element>
  50. <element name="stGetError">
  51. <short>Stream error codes: Get object error</short>
  52. </element>
  53. <element name="stPutError">
  54. <short>Stream error codes: Put object error</short>
  55. </element>
  56. <element name="stSeekError">
  57. <short>Stream error codes: Seek error in stream</short>
  58. </element>
  59. <element name="stOpenError">
  60. <short>Stream error codes: Error opening stream</short>
  61. </element>
  62. <element name="stCreate">
  63. <short>Stream initialization mode: Create new file</short>
  64. </element>
  65. <element name="stOpenRead">
  66. <short>Stream initialization mode: Read access only</short>
  67. </element>
  68. <element name="stOpenWrite">
  69. <short>Stream initialization mode: Write access only</short>
  70. </element>
  71. <element name="stOpen">
  72. <short>Stream initialization mode: Read/write access</short>
  73. </element>
  74. <element name="coIndexError">
  75. <short>Collection list error: Index out of range</short>
  76. </element>
  77. <element name="coOverflow">
  78. <short>Collection list error: Overflow</short>
  79. </element>
  80. <element name="MaxBytes">
  81. <short>Maximum data size (in bytes)</short>
  82. </element>
  83. <element name="MaxWords">
  84. <short>Maximum data size (in words)</short>
  85. </element>
  86. <element name="MaxPtrs">
  87. <short>Maximum data size (in pointers)</short>
  88. </element>
  89. <element name="MaxReadBytes">
  90. <short>Maximum data that can be read from a stream (not used)</short>
  91. </element>
  92. <element name="MaxCollectionSize">
  93. <short>Maximum collection size (in items)</short>
  94. </element>
  95. <element name="DefaulTPCompatible">
  96. <short>Is the default stream content TP compatible</short>
  97. <descr>
  98. This variable determines whether the default stream is filled or read in a
  99. TP compatible way. The <var>TPCompatible</var> field can be set on a
  100. per-stream basis, and is initialized with the <var>DefaulTPCompatible</var>
  101. value.
  102. </descr>
  103. </element>
  104. <element name="RCollection">
  105. <short>Default stream record for the <link id="TCollection"/> object.</short>
  106. </element>
  107. <element name="RStrCollection">
  108. <short>Default stream record for the <link id="TStrCollection"/> object.</short>
  109. </element>
  110. <element name="RStringCollection">
  111. <short>Default stream record for the <link id="TStringCollection"/> object.</short>
  112. </element>
  113. <element name="RStringList">
  114. <short>Default stream record for the <link id="TStringList"/> object.</short>
  115. </element>
  116. <element name="RStrListMaker">
  117. <short>Default stream record for the <link id="TStrListMaker"/> object.</short>
  118. </element>
  119. <element name="StreamError">
  120. <short>Pointer to default stream error handler.</short>
  121. </element>
  122. <element name="vmtHeaderSize">
  123. <short>Size of the VMT header in an object (not used).</short>
  124. </element>
  125. <element name="MaxTPCompatibleCollectionSize">
  126. <short>Maximum collection size (in items, same value as in TP)</short>
  127. </element>
  128. <element name="TCharSet">
  129. <short>Generic set of characters type.</short>
  130. </element>
  131. <element name="PCharSet">
  132. <short>Pointer to <link id="TCharSet"/>.</short>
  133. </element>
  134. <element name="TByteArray">
  135. <short>Array with maxmimum allowed number of bytes.</short>
  136. </element>
  137. <element name="PByteArray">
  138. <short>Pointer to <link id="TByteArray"/></short>
  139. </element>
  140. <element name="TWordArray">
  141. <short>Array with maxmimum allowed number of words.</short>
  142. </element>
  143. <element name="PWordArray">
  144. <short>Pointer to <link id="TWordArray"/></short>
  145. </element>
  146. <element name="TPointerArray">
  147. <short>Array with maxmimum allowed number of pointers</short>
  148. </element>
  149. <element name="PPointerArray">
  150. <short>Pointer to <link id="TPointerArray"/></short>
  151. </element>
  152. <element name="PString">
  153. <short>Pointer to a shortstring.</short>
  154. </element>
  155. <element name="AsciiZ">
  156. <short>Filename - null terminated array of characters.</short>
  157. </element>
  158. <element name="FNameStr">
  159. <short>Filename - shortstring version.</short>
  160. </element>
  161. <element name="Sw_Word">
  162. <short>Alias for Cardinal</short>
  163. </element>
  164. <element name="Sw_Integer">
  165. <short>Alias for longint</short>
  166. </element>
  167. <element name="WordRec">
  168. <short>Record describing a Word (in bytes)</short>
  169. </element>
  170. <element name="WordRec.Hi">
  171. <short>High byte of a word</short>
  172. </element>
  173. <element name="WordRec.Lo">
  174. <short>Low byte of a word</short>
  175. </element>
  176. <element name="LongRec">
  177. <short>Record describing a longint (in Words)</short>
  178. </element>
  179. <element name="LongRec.Lo">
  180. <short>Lower word of longint</short>
  181. </element>
  182. <element name="LongRec.Hi">
  183. <short>High word of longint</short>
  184. </element>
  185. <element name="PtrRec">
  186. <short>Record describing a pointer to a memory location.</short>
  187. </element>
  188. <element name="PtrRec.Ofs">
  189. <short>Pointer offset</short>
  190. </element>
  191. <element name="PtrRec.Seg">
  192. <short>Pointer segment</short>
  193. </element>
  194. <element name="PStreamRec">
  195. <short>Pointer to <link id="TStreamRec"/></short>
  196. </element>
  197. <element name="TStreamRec">
  198. <short>Record used in streaming mechanism. </short>
  199. <descr>
  200. <var>TSreamRec</var> is used by the <file>Objects</file> unit streaming
  201. mechanism: when an object is registered, a <var>TStreamRec</var> record is
  202. added to a list of records. This list is used when objects need to be
  203. streamed from/streamed to a stream. It contains all the information needed
  204. to stream the object.
  205. </descr>
  206. </element>
  207. <element name="TStreamRec.ObjType">
  208. <short>Unique identifier for this object type.</short>
  209. </element>
  210. <element name="TStreamRec.VmtLink">
  211. <short>Pointer to object VMT</short>
  212. </element>
  213. <element name="TStreamRec.Load">
  214. <short>Procedure to call when object must be loaded from a stream</short>
  215. </element>
  216. <element name="TStreamRec.Store">
  217. <short>Procedure to call when object must be stored in a stream.</short>
  218. </element>
  219. <element name="TStreamRec.Next">
  220. <short>Next item in list</short>
  221. </element>
  222. <element name="PPoint">
  223. <short>Pointer to <link id="TPoint"/> record.</short>
  224. </element>
  225. <element name="TPoint">
  226. <short>Record describing a point in a 2 dimensional plane.</short>
  227. </element>
  228. <element name="TPoint.X">
  229. <short>X coordinate</short>
  230. </element>
  231. <element name="TPoint.Y">
  232. <short>Y coordinate</short>
  233. </element>
  234. <element name="TItemList">
  235. <short>Pointer array type used in a <link id="TCollection"/></short>
  236. </element>
  237. <element name="TStrIndex">
  238. <short>Pointer array type used in a <link id="TStringList"/></short>
  239. </element>
  240. <element name="TStrIndexRec">
  241. <short>Record type used in a <link id="TStringList"/> to store the strings</short>
  242. </element>
  243. <element name="TStrIndexRec.Key">
  244. <short>String key value</short>
  245. </element>
  246. <element name="TStrIndexRec.Count">
  247. <short>String character count</short>
  248. </element>
  249. <element name="TStrIndexRec.Offset">
  250. <short>String offset in stream</short>
  251. </element>
  252. <element name="NewStr">
  253. <short>Allocate a copy of a shortstring on the heap.</short>
  254. <descr>
  255. <p>
  256. <var>NewStr</var> makes a copy of the string <var>S</var> on the heap,
  257. and returns a pointer to this copy. If the string is empty then
  258. <var>Nil</var> is returned.
  259. </p>
  260. <p>
  261. The allocated memory is not based on the declared size of the string passed
  262. to <var>NewStr</var>, but is baed on the actual length of the string.
  263. </p>
  264. </descr>
  265. <errors>
  266. If not enough memory is available, an 'out of memory' error will occur.
  267. </errors>
  268. <seealso>
  269. <link id="DisposeStr"/>
  270. <link id="SetStr"/>
  271. </seealso>
  272. <example file="objectex/ex40"/>
  273. </element>
  274. <element name="SetStr">
  275. <short>Allocate a copy of a shortstring on the heap.</short>
  276. <descr>
  277. <p>
  278. <var>SetStr</var> makes a copy of the string <var>S</var> on the heap and
  279. returns the pointer to this copy in <var>P</var>. If <var>P</var> pointed to
  280. another string (i.e. was not <var>Nil</var>, the memory is released first.
  281. Contrary to <link id="NewStr"/>, if the string is empty then a pointer to
  282. an empty string is returned.
  283. </p>
  284. <p>
  285. The allocated memory is not based on the declared size of the string passed
  286. to <var>NewStr</var>, but is based on the actual length of the string.
  287. </p>
  288. </descr>
  289. <errors>
  290. If not enough memory is available, an 'out of memory' error will occur.
  291. </errors>
  292. <seealso>
  293. <link id="DisposeStr"/>
  294. <link id="NewStr"/>
  295. </seealso>
  296. </element>
  297. <element name="DisposeStr">
  298. <short>Dispose of a shortstring which was allocated on the heap.</short>
  299. <descr>
  300. <p>
  301. <var>DisposeStr</var> removes a dynamically allocated string from the heap.
  302. </p>
  303. <p>
  304. For an example, see <link id="NewStr"/>.
  305. </p>
  306. </descr>
  307. <errors>
  308. None.
  309. </errors>
  310. <seealso>
  311. <link id="NewStr"/>
  312. <link id="SetStr"/>
  313. </seealso>
  314. </element>
  315. <element name="Abstract">
  316. <short>Abstract error handler.</short>
  317. <descr>
  318. <p>
  319. When implementing abstract methods, do not declare them as <var>abstract</var>.
  320. Instead, define them simply as <var>virtual</var>. In the implementation of such
  321. abstract methods, call the <var>Abstract</var> procedure. This allows explicit
  322. control of what happens when an abstract method is called.
  323. </p>
  324. <p>
  325. The current implementation of <var>Abstract</var> terminates the program with
  326. a run-time error 211.
  327. </p>
  328. </descr>
  329. <errors>
  330. None.
  331. </errors>
  332. </element>
  333. <element name="RegisterObjects">
  334. <short>Register standard objects.</short>
  335. <descr>
  336. <p>
  337. <var>RegisterObjects</var> registers the following objects for streaming:
  338. </p>
  339. <ol>
  340. <li> <var>TCollection</var>, see <link id="TCollection"/>.</li>
  341. <li> <var>TStringCollection</var>, see <link id="TStringCollection"/>.</li>
  342. <li> <var>TStrCollection</var>, see <link id="TStrCollection"/>.</li>
  343. </ol>
  344. </descr>
  345. <errors>
  346. None.
  347. </errors>
  348. <seealso>
  349. <link id="RegisterType"/>
  350. </seealso>
  351. </element>
  352. <element name="RegisterType">
  353. <short>Register new object for streaming.</short>
  354. <descr>
  355. <p>
  356. <var>RegisterType</var> registers a new type for streaming. An object cannot
  357. be streamed unless it has been registered first.
  358. The stream record <var>S</var> needs to have the following fields set:
  359. </p>
  360. <dl>
  361. <dt>ObjType: Sw_Word</dt>
  362. <dd> This should be a unique identifier. Each possible
  363. type should have it's own identifier.
  364. </dd>
  365. <dt>VmtLink: pointer</dt>
  366. <dd>This should contain a pointer to the VMT (Virtual
  367. Method Table) of the object you try to register.
  368. </dd>
  369. <dt>Load : Pointer</dt>
  370. <dd> is a pointer to a method that initializes an instance
  371. of that object, and reads the initial values from a stream. This method
  372. should accept as it's sole argument a <var>PStream</var> type variable.
  373. </dd>
  374. <dt>Store: Pointer</dt>
  375. <dd>is a pointer to a method that stores an instance of the
  376. object to a stream. This method should accept as it's sole argument
  377. a <var>PStream</var> type variable.
  378. </dd>
  379. </dl>
  380. <p>
  381. The VMT of the object can be retrieved with the
  382. following expression:
  383. </p>
  384. <code>
  385. VmtLink: Ofs(TypeOf(MyType)^);
  386. </code>
  387. </descr>
  388. <errors>
  389. In case of error (if a object with the same <var>ObjType</var>) is already
  390. registered), run-time error 212 occurs.
  391. </errors>
  392. <example file="objectex/myobject"/>
  393. </element>
  394. <element name="LongMul">
  395. <short>Overflow safe multiply.</short>
  396. <descr>
  397. <var>LongMul</var> multiplies <var>X</var> with <var>Y</var>. The result is of
  398. type <var>Longint</var>. This avoids possible overflow errors you would normally
  399. get when multiplying <var>X</var> and <var>Y</var> that are too big.
  400. </descr>
  401. <errors>
  402. None.
  403. </errors>
  404. <seealso>
  405. <link id="LongDiv"/>
  406. </seealso>
  407. </element>
  408. <element name="LongDiv">
  409. <short>Overflow safe divide</short>
  410. <descr>
  411. <var>LongDiv</var> divides <var>X</var> by <var>Y</var>. The result is of
  412. type <var>Integer</var> instead of type <var>Longint</var>, as you would get
  413. normally.
  414. </descr>
  415. <errors>
  416. If Y is zero, a run-time error will be generated.
  417. </errors>
  418. <seealso>
  419. <link id="LongMul"/>
  420. </seealso>
  421. </element>
  422. <element name="TRect">
  423. <short>Describes a rectangular region in a plane.</short>
  424. </element>
  425. <element name="TRect.A">
  426. <short>Top left corner of rectangle</short>
  427. </element>
  428. <element name="TRect.B">
  429. <short>Bottom right corner of rectangle</short>
  430. </element>
  431. <element name="TRect.Empty">
  432. <short>Is the surface of the rectangle zero</short>
  433. <descr>
  434. <var>Empty</var> returns <var>True</var> if the rectangle defined by the corner points
  435. <var>A</var>, <var>B</var> has zero or negative surface.
  436. </descr>
  437. <errors>
  438. None.
  439. </errors>
  440. <seealso>
  441. <link id="TRect.Equals"/>
  442. <link id="TRect.Contains"/>
  443. </seealso>
  444. <example file="objectex/ex1"/>
  445. </element>
  446. <element name="TRect.Equals">
  447. <short>Do the corners of the rectangles match</short>
  448. <descr>
  449. <p>
  450. <var>Equals</var> returns <var>True</var> if the rectangle has the
  451. same corner points <var>A,B</var> as the rectangle R, and <var>False</var>
  452. otherwise.
  453. </p>
  454. <p>
  455. For an example, see <link id="TRect.Empty"/>
  456. </p>
  457. </descr>
  458. <errors>
  459. None.
  460. </errors>
  461. <seealso>
  462. <link id="TRect.Empty"/>
  463. <link id="TRect.Contains"/>
  464. </seealso>
  465. </element>
  466. <element name="TRect.Contains">
  467. <short>Determine if a point is inside the rectangle</short>
  468. <descr>
  469. <var>Contains</var> returns <var>True</var> if the point <var>P</var> is contained
  470. in the rectangle (including borders), <var>False</var> otherwise.
  471. </descr>
  472. <errors>
  473. None.
  474. </errors>
  475. <seealso>
  476. <link id="TRect.Intersect"/>
  477. <link id="TRect.Equals"/>
  478. </seealso>
  479. </element>
  480. <element name="TRect.Copy">
  481. <short>Copy cornerpoints from another rectangle.</short>
  482. <descr>
  483. Assigns the rectangle R to the object. After the call to <var>Copy</var>, the
  484. rectangle R has been copied to the object that invoked <var>Copy</var>.
  485. </descr>
  486. <errors>
  487. None.
  488. </errors>
  489. <seealso>
  490. <link id="TRect.Assign"/>
  491. </seealso>
  492. <example file="objectex/ex2"/>
  493. </element>
  494. <element name="TRect.Union">
  495. <short>Enlarges rectangle to encompas another rectangle.</short>
  496. <descr>
  497. <var>Union</var> enlarges the current rectangle so that it becomes the union
  498. of the current rectangle with the rectangle <var>R</var>.
  499. </descr>
  500. <errors>
  501. None.
  502. </errors>
  503. <seealso>
  504. <link id="TRect.Intersect"/>
  505. </seealso>
  506. <example file="objectex/ex3"/>
  507. </element>
  508. <element name="TRect.Intersect">
  509. <short>Reduce rectangle to intersection with another rectangle</short>
  510. <descr>
  511. <var>Intersect</var> makes the intersection of the current rectangle with
  512. <var>R</var>. If the intersection is empty, then the rectangle is set to the empty
  513. rectangle at coordinate (0,0).
  514. </descr>
  515. <errors>
  516. None.
  517. </errors>
  518. <seealso>
  519. <link id="TRect.Union"/>
  520. </seealso>
  521. <example file="objectex/ex4"/>
  522. </element>
  523. <element name="TRect.Move">
  524. <short>Move rectangle along a vector.</short>
  525. <descr>
  526. <var>Move</var> moves the current rectangle along a vector with components
  527. <var>(ADX,ADY)</var>. It adds <var>ADX</var> to the X-coordinate of both corner
  528. points, and <var>ADY</var> to both end points.
  529. </descr>
  530. <errors>
  531. None.
  532. </errors>
  533. <seealso>
  534. <link id="TRect.Grow"/>
  535. </seealso>
  536. <example file="objectex/ex5"/>
  537. </element>
  538. <element name="TRect.Grow">
  539. <short>Expand rectangle with certain size.</short>
  540. <descr>
  541. <p>
  542. <var>Grow</var> expands the rectangle with an amount <var>ADX</var> in the <var>X</var>
  543. direction (both on the left and right side of the rectangle, thus adding a
  544. length 2*ADX to the width of the rectangle), and an amount <var>ADY</var> in
  545. the <var>Y</var> direction (both on the top and the bottom side of the rectangle,
  546. adding a length 2*ADY to the height of the rectangle.
  547. </p>
  548. <p>
  549. <var>ADX</var> and <var>ADY</var> can be negative. If the resulting rectangle is empty, it is set
  550. to the empty rectangle at <var>(0,0)</var>.
  551. </p>
  552. </descr>
  553. <errors>
  554. None.
  555. </errors>
  556. <seealso>
  557. <link id="TRect.Move"/>
  558. </seealso>
  559. <example file="objectex/ex6"/>
  560. </element>
  561. <element name="TRect.Assign">
  562. <short>Set rectangle corners.</short>
  563. <descr>
  564. <p>
  565. <var>Assign</var> sets the corner points of the rectangle to <var>(XA,YA)</var> and
  566. <var>(Xb,Yb)</var>.
  567. </p>
  568. <p>
  569. For an example, see <link id="TRect.Copy"/>.
  570. </p>
  571. </descr>
  572. <errors>
  573. None.
  574. </errors>
  575. <seealso>
  576. <link id="TRect.Copy"/>
  577. </seealso>
  578. </element>
  579. <element name="TObject">
  580. <short>Basis of all objects</short>
  581. <descr>
  582. This type serves as the basic object for all other objects in the
  583. <file>Objects</file> unit.
  584. </descr>
  585. </element>
  586. <element name="TObject.Init">
  587. <short>Construct (initialize) a new object</short>
  588. <descr>
  589. <p>
  590. Instantiates a new object of type <var>TObject</var>. It fills the instance up
  591. with Zero bytes.
  592. </p>
  593. <p>
  594. For an example, see <link id="TObject.Free">Free</link>
  595. </p>
  596. </descr>
  597. <errors>
  598. None.
  599. </errors>
  600. <seealso>
  601. <link id="TObject.Free"/>
  602. <link id="TObject.Done"/>
  603. </seealso>
  604. </element>
  605. <element name="TObject.Free">
  606. <short>Destroy an object and release all memory.</short>
  607. <descr>
  608. <var>Free</var> calls the destructor of the object, and releases the memory
  609. occupied by the instance of the object.
  610. </descr>
  611. <errors>
  612. No checking is performed to see whether <var>self</var> is <var>nil</var> and whether
  613. the object is indeed allocated on the heap.
  614. </errors>
  615. <seealso>
  616. <link id="TObject.Init"/>
  617. <link id="TObject.Done"/>
  618. </seealso>
  619. <example file="objectex/ex7"/>
  620. </element>
  621. <element name="TObject.Done">
  622. <short>Destroy an object.</short>
  623. <descr>
  624. <p>
  625. <var>Done</var>, the destructor of <var>TObject</var> does nothing. It is mainly
  626. intended to be used in the <link id="TObject.Free"/> method.
  627. </p>
  628. <p>
  629. The destructore Done does not free the memory occupied by the object.
  630. </p>
  631. </descr>
  632. <errors>
  633. None.
  634. </errors>
  635. <seealso>
  636. <link id="TObject.Free"/>
  637. <link id="TObject.Init"/>
  638. </seealso>
  639. <example file="objectex/ex8"/>
  640. </element>
  641. <element name="TStream">
  642. <short>Base stream class</short>
  643. <descr>
  644. <p>
  645. The <var>TStream</var> object is the ancestor for all streaming objects, i.e.
  646. objects that have the capability to store and retrieve data.
  647. </p>
  648. <p>
  649. It defines a number of methods that are common to all objects that implement
  650. streaming, many of them are virtual, and are only implemented in the
  651. descendent types.
  652. </p>
  653. <p>
  654. Programs should not instantiate objects of type TStream directly, but
  655. instead instantiate a descendant type, such as <var>TDosStream</var>,
  656. <var>TMemoryStream</var>.
  657. </p>
  658. </descr>
  659. <seealso>
  660. <link id="PStream"/>
  661. <link id="TDosStream"/>
  662. <link id="TMemoryStream"/>
  663. </seealso>
  664. </element>
  665. <element name="PStream">
  666. <short>Pointer type to <link id="TStream"/></short>
  667. </element>
  668. <element name="TStream.Status">
  669. <short>Current stream status</short>
  670. </element>
  671. <element name="TStream.ErrorInfo">
  672. <short>Additional error info when there is an error.</short>
  673. </element>
  674. <element name="TStream.StreamSize">
  675. <short>Current size of the stream</short>
  676. </element>
  677. <element name="TStream.Position">
  678. <short>Current Stream position</short>
  679. </element>
  680. <element name="TStream.TPCompatible">
  681. <short>If set to <var>True</var> streamed data is written in a TP compatible format.</short>
  682. </element>
  683. <element name="TStream.Get">
  684. <short>Read an object definition from the stream.</short>
  685. <descr>
  686. <var>Get</var> reads an object definition from a stream, and returns
  687. a pointer to an instance of this object.
  688. </descr>
  689. <errors>
  690. On error, <link id="TStream.Status"/> is set, and <var>NIL</var> is returned.
  691. </errors>
  692. <seealso>
  693. <link id="TStream.Put"/>
  694. </seealso>
  695. <example file="objectex/ex9"/>
  696. </element>
  697. <element name="TStream.StrRead">
  698. <short>Read a null-terminated string from the stream.</short>
  699. <descr>
  700. <var>StrRead</var> reads a string from the stream, allocates memory
  701. for it, and returns a pointer to a null-terminated copy of the string
  702. on the heap.
  703. </descr>
  704. <errors>
  705. On error, <var>Nil</var> is returned.
  706. </errors>
  707. <seealso>
  708. <link id="TStream.StrWrite"/>
  709. <link id="TStream.ReadStr"/>
  710. </seealso>
  711. <example file="objectex/ex10"/>
  712. </element>
  713. <element name="TStream.GetPos">
  714. <short>Return current position in the stream</short>
  715. <descr>
  716. If the stream's status is <var>stOk</var>, <var>GetPos</var> returns the current
  717. position in the stream. Otherwise it returns <var>-1</var>
  718. </descr>
  719. <errors>
  720. <var>-1</var> is returned if the status is an error condition.
  721. </errors>
  722. <seealso>
  723. <link id="TStream.Seek"/>
  724. <link id="TStream.GetSize"/>
  725. </seealso>
  726. <example file="objectex/ex11"/>
  727. </element>
  728. <element name="TStream.GetSize">
  729. <short>Return the size of the stream.</short>
  730. <descr>
  731. If the stream's status is <var>stOk</var> then <var>GetSize</var> returns
  732. the size of the stream, otherwise it returns <var>-1</var>.
  733. </descr>
  734. <errors>
  735. <var>-1</var> is returned if the status is an error condition.
  736. </errors>
  737. <seealso>
  738. <link id="TStream.Seek"/>
  739. <link id="TStream.GetPos"/>
  740. </seealso>
  741. <example file="objectex/ex12"/>
  742. </element>
  743. <element name="TStream.ReadStr">
  744. <short>Read a shortstring from the stream.</short>
  745. <descr>
  746. <var>ReadStr</var> reads a string from the stream, copies it to the heap
  747. and returns a pointer to this copy. The string is saved as a pascal
  748. string, and hence is NOT null terminated.
  749. </descr>
  750. <errors>
  751. On error (e.g. not enough memory), <var>Nil</var> is returned.
  752. </errors>
  753. <seealso>
  754. <link id="TStream.StrRead"/>
  755. </seealso>
  756. <example file="objectex/ex13"/>
  757. </element>
  758. <element name="TStream.Open">
  759. <short>Open the stream</short>
  760. <descr>
  761. <p>
  762. <var>Open</var> is an abstract method, that should be overridden by descendent
  763. objects. Since opening a stream depends on the stream's type this is not
  764. surprising.
  765. </p>
  766. <p>
  767. For an example, see <link id="TDosStream.Open"/>.
  768. </p>
  769. </descr>
  770. <errors>
  771. None.
  772. </errors>
  773. <seealso>
  774. <link id="TStream.Close"/>
  775. <link id="TStream.Reset"/>
  776. </seealso>
  777. </element>
  778. <element name="TStream.Close">
  779. <short>Close the stream</short>
  780. <descr>
  781. <p>
  782. <var>Close</var> is an abstract method, that should be overridden by descendent
  783. objects. Since Closing a stream depends on the stream's type this is not
  784. surprising.
  785. </p>
  786. <p>
  787. for an example, see <link id="TDosStream.Open"/>.
  788. </p>
  789. </descr>
  790. <errors>
  791. None.
  792. </errors>
  793. <seealso>
  794. <link id="TStream.Open"/>
  795. <link id="TStream.Reset"/>
  796. </seealso>
  797. </element>
  798. <element name="TStream.Reset">
  799. <short>Reset the stream</short>
  800. <descr>
  801. <var>Reset</var> sets the stream's status to <var>0</var>, as well as the ErrorInfo
  802. </descr>
  803. <errors>
  804. None.
  805. </errors>
  806. <seealso>
  807. <link id="TStream.Open"/>
  808. <link id="TStream.Close"/>
  809. </seealso>
  810. </element>
  811. <element name="TStream.Flush">
  812. <short>Flush the stream data from the buffer, if any.</short>
  813. <descr>
  814. <p>
  815. <var>Flush</var> is an abstract method that should be overridden by descendent
  816. objects. It serves to enable the programmer to tell streams that implement
  817. a buffer to clear the buffer.
  818. </p>
  819. <p>
  820. for an example, see <link id="TBufStream.Flush"/>.
  821. </p>
  822. </descr>
  823. <errors>
  824. None.
  825. </errors>
  826. <seealso>
  827. <link id="TStream.Truncate"/>
  828. </seealso>
  829. </element>
  830. <element name="TStream.Truncate">
  831. <short>Truncate the stream size on current position.</short>
  832. <descr>
  833. <p>
  834. <var>Truncate</var> is an abstract procedure that should be overridden by
  835. descendent objects. It serves to enable the programmer to truncate the
  836. size of the stream to the current file position.
  837. </p>
  838. <p>
  839. For an example, see <link id="TDosStream.Truncate"/>.
  840. </p>
  841. </descr>
  842. <errors>
  843. None.
  844. </errors>
  845. <seealso>
  846. <link id="TStream.Seek"/>
  847. </seealso>
  848. </element>
  849. <element name="TStream.Put">
  850. <short>Write an object to the stream.</short>
  851. <descr>
  852. <p>
  853. <var>Put</var> writes the object pointed to by <var>P</var>. <var>P</var> should be
  854. non-nil. The object type must have been registered with <link id="RegisterType"/>.
  855. </p>
  856. <p>
  857. After the object has been written, it can be read again with <link id="TStream.Get">Get</link>.
  858. </p>
  859. <p>
  860. For an example, see <link id="TStream.Get"/>;
  861. </p>
  862. </descr>
  863. <errors>
  864. No check is done whether P is <var>Nil</var> or not. Passing <var>Nil</var> will cause
  865. a run-time error 216 to be generated. If the object has not been registered,
  866. the status of the stream will be set to <var>stPutError</var>.
  867. </errors>
  868. <seealso>
  869. <link id="TStream.Get"/>
  870. </seealso>
  871. </element>
  872. <element name="TStream.StrWrite">
  873. <short>Write a null-terminated string to the stream.</short>
  874. <descr>
  875. <p>
  876. <var>StrWrite</var> writes the null-terminated string <var>P</var> to the stream.
  877. <var>P</var> can only be 65355 bytes long.
  878. </p>
  879. <p>
  880. For an example, see <link id="TStream.StrRead"/>.
  881. </p>
  882. </descr>
  883. <errors>
  884. None.
  885. </errors>
  886. <seealso>
  887. <link id="TStream.WriteStr"/>
  888. <link id="TStream.StrRead"/>
  889. <link id="TStream.ReadStr"/>
  890. </seealso>
  891. </element>
  892. <element name="TStream.WriteStr">
  893. <short>Write a pascal string to the stream.</short>
  894. <descr>
  895. <p>
  896. <var>StrWrite</var> writes the pascal string pointed to by <var>P</var> to the stream.
  897. </p>
  898. <p>
  899. For an example, see <link id="TStream.ReadStr"/>.
  900. </p>
  901. </descr>
  902. <errors>
  903. None.
  904. </errors>
  905. <seealso>
  906. <link id="TStream.StrWrite"/>
  907. <link id="TStream.StrRead"/>
  908. <link id="TStream.ReadStr"/>
  909. </seealso>
  910. </element>
  911. <element name="TStream.Seek">
  912. <short>Set stream position.</short>
  913. <descr>
  914. <p>
  915. Seek sets the position to <var>Pos</var>. This position is counted
  916. from the beginning, and is zero based. (i.e. seeek(0) sets the position
  917. pointer on the first byte of the stream)
  918. </p>
  919. <p>
  920. For an example, see <link id="TDosStream.Seek"/>.
  921. </p>
  922. </descr>
  923. <errors>
  924. If <var>Pos</var> is larger than the stream size, <var>Status</var> is set to
  925. <var>StSeekError</var>.
  926. </errors>
  927. <seealso>
  928. <link id="TStream.GetPos"/>
  929. <link id="TStream.GetSize"/>
  930. </seealso>
  931. </element>
  932. <element name="TStream.Error">
  933. <short>Set stream status</short>
  934. <descr>
  935. <p>
  936. <var>Error</var> sets the stream's status to <var>Code</var> and <var>ErrorInfo</var>
  937. to <var>Info</var>. If the <var>StreamError</var> procedural variable is set,
  938. <var>Error</var> executes it, passing <var>Self</var> as an argument.
  939. </p>
  940. <p>
  941. This method should not be called directly from a program. It is intended to
  942. be used in descendent objects.
  943. </p>
  944. </descr>
  945. <errors>
  946. None.
  947. </errors>
  948. </element>
  949. <element name="TStream.Read">
  950. <short>Read data from stream to buffer.</short>
  951. <descr>
  952. <p>
  953. <var>Read</var> is an abstract method that should be overridden by descendent
  954. objects.
  955. </p>
  956. <p>
  957. <var>Read</var> reads <var>Count</var> bytes from the stream into <var>Buf</var>.
  958. It updates the position pointer, increasing it's value with <var>Count</var>.
  959. <var>Buf</var> must be large enough to contain <var>Count</var> bytes.
  960. </p>
  961. </descr>
  962. <errors>
  963. No checking is done to see if <var>Buf</var> is large enough to contain
  964. <var>Count</var> bytes.
  965. </errors>
  966. <seealso>
  967. <link id="TStream.Write"/>
  968. <link id="TStream.ReadStr"/>
  969. <link id="TStream.StrRead"/>
  970. </seealso>
  971. <example file="objectex/ex18"/>
  972. </element>
  973. <element name="TStream.Write">
  974. <short>Write a number of bytes to the stream.</short>
  975. <descr>
  976. <p>
  977. <var>Write</var> is an abstract method that should be overridden by descendent
  978. objects.
  979. </p>
  980. <p>
  981. <var>Write</var> writes <var>Count</var> bytes to the stream from <var>Buf</var>.
  982. It updates the position pointer, increasing it's value with <var>Count</var>.
  983. </p>
  984. <p>
  985. For an example, see <link id="TStream.Read"/>.
  986. </p>
  987. </descr>
  988. <errors>
  989. No checking is done to see if <var>Buf</var> actually contains <var>Count</var> bytes.
  990. </errors>
  991. <seealso>
  992. <link id="TStream.Read"/>
  993. <link id="TStream.WriteStr"/>
  994. <link id="TStream.StrWrite"/>
  995. </seealso>
  996. </element>
  997. <element name="TStream.CopyFrom">
  998. <short>Copy data from another stream. </short>
  999. <descr>
  1000. <var>CopyFrom</var> reads Count bytes from stream <var>S</var> and stores them
  1001. in the current stream. It uses the <link id="TStream.Read">Read</link> method
  1002. to read the data, and the <link id="TStream.Write">Write</link> method to
  1003. write in the current stream.
  1004. </descr>
  1005. <errors>
  1006. None.
  1007. </errors>
  1008. <seealso>
  1009. <link id="TStream.Read">Read</link>
  1010. <link id="TStream.Write">Write</link>
  1011. </seealso>
  1012. <example file="objectex/ex19"/>
  1013. </element>
  1014. <element name="TDosStream">
  1015. <short>DOS file stream</short>
  1016. <descr>
  1017. <p>
  1018. <var>TDosStream</var> is a stream that stores it's contents in a file.
  1019. it overrides a couple of methods of <link id="TStream"/> for this.
  1020. </p>
  1021. <p>
  1022. In addition to the fields inherited from <var>TStream</var> (see <link id="TStream"/>),
  1023. there are some extra fields, that describe the file. (mainly the name and
  1024. the OS file handle)
  1025. </p>
  1026. <p>
  1027. No buffering in memory is done when using <var>TDosStream</var>.
  1028. All data are written directly to the file. For a stream that buffers
  1029. in memory, see <link id="TBufStream"/>.
  1030. </p>
  1031. </descr>
  1032. </element>
  1033. <element name="TDosStream.Handle">
  1034. <short>OS file handle for stream</short>
  1035. </element>
  1036. <element name="TDosStream.FName">
  1037. <short>File name</short>
  1038. </element>
  1039. <element name="TDosStream.Init">
  1040. <short>Instantiate a new instance of TDosStream.</short>
  1041. <descr>
  1042. <p>
  1043. <var>Init</var> instantiates an instance of <var>TDosStream</var>. The name of the
  1044. file that contains (or will contain) the data of the stream is given in
  1045. <var>FileName</var>. The <var>Mode</var> parameter determines whether a new file
  1046. should be created and what access rights you have on the file.
  1047. It can be one of the following constants:
  1048. </p>
  1049. <dl>
  1050. <dt>stCreate</dt><dd> Creates a new file.</dd>
  1051. <dt>stOpenRead</dt><dd> Read access only.</dd>
  1052. <dt>stOpenWrite</dt><dd> Write access only.</dd>
  1053. <dt>stOpen</dt><dd> Read and write access.</dd>
  1054. </dl>
  1055. <p>
  1056. For an example, see <link id="TDosStream.Truncate"/>.
  1057. </p>
  1058. </descr>
  1059. <errors>
  1060. On error, <link id="TStream.Status">Status</link> is set to <var>stInitError</var>, and <var>ErrorInfo</var>
  1061. is set to the dos error code.
  1062. </errors>
  1063. <seealso>
  1064. <link id="TDosStream.Done"/>
  1065. </seealso>
  1066. </element>
  1067. <element name="TDosStream.Done">
  1068. <short>Closes the file and cleans up the instance.</short>
  1069. <descr>
  1070. <p>
  1071. <var>Done</var> closes the file if it was open and cleans up the
  1072. instance of <var>TDosStream</var>.
  1073. </p>
  1074. <p>
  1075. for an example, see e.g. <link id="TDosStream.Truncate"/>.
  1076. </p>
  1077. </descr>
  1078. <errors>
  1079. None.
  1080. </errors>
  1081. <seealso>
  1082. <link id="TDosStream.Init"/>
  1083. <link id="TDosStream.Close"/>
  1084. </seealso>
  1085. </element>
  1086. <element name="TDosStream.Close">
  1087. <short>Close the file.</short>
  1088. <descr>
  1089. <p>
  1090. <var>Close</var> closes the file if it was open, and sets <var>Handle</var> to -1.
  1091. Contrary to <link id="TDosStream.Done">Done</link> it does not clean up the instance
  1092. of <var>TDosStream</var>
  1093. </p>
  1094. <p>
  1095. For an example, see <link id="TDosStream.Open"/>.
  1096. </p>
  1097. </descr>
  1098. <errors>
  1099. None.
  1100. </errors>
  1101. <seealso>
  1102. <link id="TStream.Close"/>
  1103. <link id="TDosStream.Init"/>
  1104. <link id="TDosStream.Done"/>
  1105. </seealso>
  1106. </element>
  1107. <element name="TDosStream.Truncate">
  1108. <short>Truncate the file on the current position.</short>
  1109. <descr>
  1110. If the status of the stream is <var>stOK</var>, then <var>Truncate</var> tries to
  1111. truncate the stream size to the current file position.
  1112. </descr>
  1113. <errors>
  1114. If an error occurs, the stream's status is set to <var>stError</var> and
  1115. <var>ErrorInfo</var> is set to the OS error code.
  1116. </errors>
  1117. <seealso>
  1118. <link id="TStream.Truncate"/>
  1119. <link id="TStream.GetSize"/>
  1120. </seealso>
  1121. <example file="objectex/ex16"/>
  1122. </element>
  1123. <element name="TDosStream.Seek">
  1124. <short>Set file position.</short>
  1125. <descr>
  1126. If the stream's status is <var>stOK</var>, then <var>Seek</var> sets the
  1127. file position to <var>Pos</var>. <var>Pos</var> is a zero-based offset, counted from
  1128. the beginning of the file.
  1129. </descr>
  1130. <errors>
  1131. In case an error occurs, the stream's status is set to <var>stSeekError</var>,
  1132. and the OS error code is stored in <var>ErrorInfo</var>.
  1133. </errors>
  1134. <seealso>
  1135. <link id="TStream.Seek"/>
  1136. <link id="TStream.GetPos"/>
  1137. </seealso>
  1138. <example file="objectex/ex17"/>
  1139. </element>
  1140. <element name="TDosStream.Open">
  1141. <short>Open the file stream</short>
  1142. <descr>
  1143. If the stream's status is <var>stOK</var>, and the stream is closed then
  1144. <var>Open</var> re-opens the file stream with mode <var>OpenMode</var>.
  1145. This call can be used after a <link id="TDosStream.Close">Close</link> call.
  1146. </descr>
  1147. <errors>
  1148. If an error occurs when re-opening the file, then <var>Status</var> is set
  1149. to <var>stOpenError</var>, and the OS error code is stored in <var>ErrorInfo</var>
  1150. </errors>
  1151. <seealso>
  1152. <link id="TStream.Open"/>
  1153. <link id="TDosStream.Close"/>
  1154. </seealso>
  1155. <example file="objectex/ex14"/>
  1156. </element>
  1157. <element name="TDosStream.Read">
  1158. <short>Read data from the stream to a buffer.</short>
  1159. <descr>
  1160. <p>
  1161. If the Stream is open and the stream status is <var>stOK</var> then
  1162. <var>Read</var> will read <var>Count</var> bytes from the stream and place them
  1163. in <var>Buf</var>.
  1164. </p>
  1165. <p>
  1166. For an example, see <link id="TStream.Read"/>.
  1167. </p>
  1168. </descr>
  1169. <errors>
  1170. In case of an error, <var>Status</var> is set to <var>StReadError</var>, and
  1171. <var>ErrorInfo</var> gets the OS specific error, or 0 when an attempt was
  1172. made to read beyond the end of the stream.
  1173. </errors>
  1174. <seealso>
  1175. <link id="TStream.Read"/>
  1176. <link id="TDosStream.Write"/>
  1177. </seealso>
  1178. </element>
  1179. <element name="TDosStream.Write">
  1180. <short>Write data from a buffer to the stream.</short>
  1181. <descr>
  1182. <p>
  1183. If the Stream is open and the stream status is <var>stOK</var> then
  1184. <var>Write</var> will write <var>Count</var> bytes from <var>Buf</var> and place them
  1185. in the stream.
  1186. </p>
  1187. <p>
  1188. For an example, see <link id="TStream.Read"/>.
  1189. </p>
  1190. </descr>
  1191. <errors>
  1192. In case of an error, <var>Status</var> is set to <var>StWriteError</var>, and
  1193. <var>ErrorInfo</var> gets the OS specific error.
  1194. </errors>
  1195. <seealso>
  1196. <link id="TStream.Write"/>
  1197. <link id="TDosStream.Read"/>
  1198. </seealso>
  1199. </element>
  1200. <element name="PBufStream">
  1201. <short>Pointer to <link id="TBufStream"/> object.</short>
  1202. </element>
  1203. <element name="PDosStream">
  1204. <short>Pointer to <link id="TDosStream"/> object.</short>
  1205. </element>
  1206. <element name="PMemoryStream">
  1207. <short>Pointer to <link id="TMemoryStream"/> object.</short>
  1208. </element>
  1209. <element name="PCollection">
  1210. <short>Pointer to <link id="TCollection"/> object.</short>
  1211. </element>
  1212. <element name="PItemList">
  1213. <short>Pointer to <link id="TItemList"/> object.</short>
  1214. </element>
  1215. <element name="PObject">
  1216. <short>Pointer to <link id="TObject"/> object.</short>
  1217. </element>
  1218. <element name="PRect">
  1219. <short>Pointer to <link id="TRect"/> object.</short>
  1220. </element>
  1221. <element name="PResourceCollection">
  1222. <short>Pointer to <link id="TResourceCollection"/> object.</short>
  1223. </element>
  1224. <element name="PSortedCollection">
  1225. <short>Pointer to <link id="TSortedCollection"/> object.</short>
  1226. </element>
  1227. <element name="PSTrCollection">
  1228. <short>Pointer to <link id="TStrCollection"/> object.</short>
  1229. </element>
  1230. <element name="PSTrListMaker">
  1231. <short>Pointer to <link id="TStrListMaker"/> object.</short>
  1232. </element>
  1233. <element name="PStringCollection">
  1234. <short>Pointer to <link id="TStringCollection"/> object.</short>
  1235. </element>
  1236. <element name="PStringList">
  1237. <short>Pointer to <link id="TStringList"/> object.</short>
  1238. </element>
  1239. <element name="PUnsortedStrCollection">
  1240. <short>Pointer to <link id="TUnsortedStrCollection"/> object.</short>
  1241. </element>
  1242. <element name="PResourceFile">
  1243. <short>Pointer to <link id="TResourceFile"/> object.</short>
  1244. </element>
  1245. <element name="PStrIndex">
  1246. <short>Pointer to <link id="TStrIndex"/> array.</short>
  1247. </element>
  1248. <element name="PObject">
  1249. <short>Pointer to <link id="TObject"/> object.</short>
  1250. </element>
  1251. <element name="TBufStream">
  1252. <short>Buffered file stream</short>
  1253. <descr>
  1254. <p>
  1255. <var>Bufstream</var> implements a buffered file stream. That is, all data written
  1256. to the stream is written to memory first. Only when the buffer is full, or
  1257. on explicit request, the data is written to disk.
  1258. </p>
  1259. <p>
  1260. Also, when reading from the stream, first the buffer is checked if there is
  1261. any unread data in it. If so, this is read first. If not the buffer is
  1262. filled again, and then the data is read from the buffer.
  1263. </p>
  1264. <p>
  1265. The size of the buffer is fixed and is set when constructing the file.
  1266. </p>
  1267. <p>
  1268. This is useful if you need heavy throughput for your stream, because it
  1269. speeds up operations.
  1270. </p>
  1271. </descr>
  1272. <seealso>
  1273. link id
  1274. </seealso>
  1275. </element>
  1276. <element name="TBufStream.LastMode">
  1277. <short>Last file open mode</short>
  1278. </element>
  1279. <element name="TBufStream.BufSize">
  1280. <short>Size of buffer</short>
  1281. </element>
  1282. <element name="TBufStream.BufPtr">
  1283. <short>Pointer to current position in buffer</short>
  1284. </element>
  1285. <element name="TBufStream.Bufend">
  1286. <short>End of data in buffer.</short>
  1287. </element>
  1288. <element name="TBufStream.Buffer">
  1289. <short>Actual buffer</short>
  1290. </element>
  1291. <element name="TBufStream.Init">
  1292. <short>Initialize an instance of <var>TBufStream</var> and open the file.</short>
  1293. <descr>
  1294. <p>
  1295. <var>Init</var> instantiates an instance of <var>TBufStream</var>. The name of the
  1296. file that contains (or will contain) the data of the stream is given in
  1297. <var>FileName</var>. The <var>Mode</var> parameter determines whether a new file
  1298. should be created and what access rights you have on the file.
  1299. It can be one of the following constants:
  1300. </p>
  1301. <dl>
  1302. <dt>stCreate</dt><dd> Creates a new file.</dd>
  1303. <dt>stOpenRead</dt><dd> Read access only.</dd>
  1304. <dt>stOpenWrite</dt><dd> Write access only.</dd>
  1305. <dt>stOpen</dt><dd> Read and write access.</dd>
  1306. </dl>
  1307. <p>
  1308. The <var>Size</var> parameter determines the size of the buffer that will be
  1309. created. It should be different from zero.
  1310. </p>
  1311. <p>
  1312. For an example see <link id="TBufStream.Flush"/>.
  1313. </p>
  1314. </descr>
  1315. <errors>
  1316. On error, <var>Status</var> is set to <var>stInitError</var>, and <var>ErrorInfo</var>
  1317. is set to the dos error code.
  1318. </errors>
  1319. <seealso>
  1320. <link id="TDosStream.Init"/>
  1321. <link id="TBufStream.Done"/>
  1322. </seealso>
  1323. </element>
  1324. <element name="TBufStream.Done">
  1325. <short>Close the file and cleans up the instance.</short>
  1326. <descr>
  1327. <p>
  1328. <var>Done</var> flushes and closes the file if it was open and cleans up the
  1329. instance of <var>TBufStream</var>.
  1330. </p>
  1331. <p>
  1332. For an example see <link id="TBufStream.Flush"/>.
  1333. </p>
  1334. </descr>
  1335. <errors>
  1336. None.
  1337. </errors>
  1338. <seealso>
  1339. <link id="TDosStream.Done"/>
  1340. <link id="TBufStream.Init"/>
  1341. <link id="TBufStream.Close"/>
  1342. </seealso>
  1343. </element>
  1344. <element name="TBufStream.Close">
  1345. <short>Flush data and Close the file.</short>
  1346. <descr>
  1347. <p>
  1348. <var>Close</var> flushes and closes the file if it was open, and sets <var>Handle</var> to -1.
  1349. Contrary to <link id="TBufStream.Done">Done</link> it does not clean up the instance
  1350. of <var>TBufStream</var>
  1351. </p>
  1352. <p>
  1353. For an example see <link id="TBufStream.Flush"/>.
  1354. </p>
  1355. </descr>
  1356. <errors>
  1357. None.
  1358. </errors>
  1359. <seealso>
  1360. <link id="TStream.Close"/>
  1361. <link id="TBufStream.Init"/>
  1362. <link id="TBufStream.Done"/>
  1363. </seealso>
  1364. </element>
  1365. <element name="TBufStream.Flush">
  1366. <short>FLush data from buffer, and write it to stream.</short>
  1367. <descr>
  1368. When the stream is in write mode, the contents of the buffer are written to
  1369. disk, and the buffer position is set to zero.
  1370. When the stream is in read mode, the buffer position is set to zero.
  1371. </descr>
  1372. <errors>
  1373. Write errors may occur if the file was in write mode.
  1374. see <link id="TBufStream.Write">Write</link> for more info on the errors.
  1375. </errors>
  1376. <seealso>
  1377. <link id="TStream.Close"/>
  1378. <link id="TBufStream.Init"/>
  1379. <link id="TBufStream.Done"/>
  1380. </seealso>
  1381. <example file="objectex/ex15"/>
  1382. </element>
  1383. <element name="TBufStream.Truncate">
  1384. <short>Flush buffer, and truncate the file at current position.</short>
  1385. <descr>
  1386. <p>
  1387. If the status of the stream is <var>stOK</var>, then <var>Truncate</var> tries to
  1388. flush the buffer, and then truncates the stream size to the current
  1389. file position.
  1390. </p>
  1391. <p>
  1392. For an example, see <link id="TDosStream.Truncate"/>.
  1393. </p>
  1394. </descr>
  1395. <errors>
  1396. Errors can be those of <link id="TBufStream.Flush">Flush</link> or
  1397. <link id="TDosStream.Truncate"/>.
  1398. </errors>
  1399. <seealso>
  1400. <link id="TStream.Truncate"/>
  1401. <link id="TDosStream.Truncate"/>
  1402. <link id="TStream.GetSize"/>
  1403. </seealso>
  1404. </element>
  1405. <element name="TBufStream.Seek">
  1406. <short>Set current position in file.</short>
  1407. <descr>
  1408. <p>
  1409. If the stream's status is <var>stOK</var>, then <var>Seek</var> sets the
  1410. file position to <var>Pos</var>. <var>Pos</var> is a zero-based offset, counted from
  1411. the beginning of the file.
  1412. </p>
  1413. <p>
  1414. For an example, see <link id="TStream.Seek"/>;
  1415. </p>
  1416. </descr>
  1417. <errors>
  1418. In case an error occurs, the stream's status is set to <var>stSeekError</var>,
  1419. and the OS error code is stored in <var>ErrorInfo</var>.
  1420. </errors>
  1421. <seealso>
  1422. <link id="TStream.Seek"/>
  1423. <link id="TStream.GetPos"/>
  1424. </seealso>
  1425. </element>
  1426. <element name="TBufStream.Open">
  1427. <short>Open the file if it is closed.</short>
  1428. <descr>
  1429. <p>
  1430. If the stream's status is <var>stOK</var>, and the stream is closed then
  1431. <var>Open</var> re-opens the file stream with mode <var>OpenMode</var>.
  1432. This call can be used after a <link id="TBufStream.Close">Close</link> call.
  1433. </p>
  1434. <p>
  1435. For an example, see <link id="TDosStream.Open"/>.
  1436. </p>
  1437. </descr>
  1438. <errors>
  1439. If an error occurs when re-opening the file, then <var>Status</var> is set
  1440. to <var>stOpenError</var>, and the OS error code is stored in <var>ErrorInfo</var>
  1441. </errors>
  1442. <seealso>
  1443. <link id="TStream.Open"/>
  1444. <link id="TBufStream.Close"/>
  1445. </seealso>
  1446. </element>
  1447. <element name="TBufStream.Read">
  1448. <short>Read data from the file to a buffer in memory.</short>
  1449. <descr>
  1450. <p>
  1451. If the Stream is open and the stream status is <var>stOK</var> then
  1452. <var>Read</var> will read <var>Count</var> bytes from the stream and place them
  1453. in <var>Buf</var>.
  1454. </p>
  1455. <p>
  1456. <var>Read</var> will first try to read the data from the stream's internal
  1457. buffer. If insufficient data is available, the buffer will be filled before
  1458. contiunuing to read. This process is repeated until all needed data
  1459. has been read.
  1460. </p>
  1461. <p>
  1462. For an example, see <link id="TStream.Read"/>.
  1463. </p>
  1464. </descr>
  1465. <errors>
  1466. In case of an error, <var>Status</var> is set to <var>StReadError</var>, and
  1467. <var>ErrorInfo</var> gets the OS specific error, or 0 when an attempt was
  1468. made to read beyond the end of the stream.
  1469. </errors>
  1470. <seealso>
  1471. <link id="TStream.Read"/>
  1472. <link id="TBufStream.Write"/>
  1473. </seealso>
  1474. </element>
  1475. <element name="TBufStream.Write">
  1476. <short>Write data to the file from a buffer in memory.</short>
  1477. <descr>
  1478. <p>
  1479. If the Stream is open and the stream status is <var>stOK</var> then
  1480. <var>Write</var> will write <var>Count</var> bytes from <var>Buf</var> and place them
  1481. in the stream.
  1482. </p>
  1483. <p>
  1484. <var>Write</var> will first try to write the data to the stream's internal
  1485. buffer. When the internal buffer is full, then the contents will be written
  1486. to disk. This process is repeated until all data has been written.
  1487. </p>
  1488. <p>
  1489. For an example, see <link id="TStream.Read"/>.
  1490. </p>
  1491. </descr>
  1492. <errors>
  1493. In case of an error, <var>Status</var> is set to <var>StWriteError</var>, and
  1494. <var>ErrorInfo</var> gets the OS specific error.
  1495. </errors>
  1496. <seealso>
  1497. <link id="TStream.Write"/>
  1498. <link id="TBufStream.Read"/>
  1499. </seealso>
  1500. </element>
  1501. <element name="TMemoryStream">
  1502. <short>Stream which keeps data in memory.</short>
  1503. <descr>
  1504. <p>
  1505. The <var>TMemoryStream</var> object implements a stream that stores it's data
  1506. in memory. The data is stored on the heap, with the possibility to specify
  1507. the maximum amout of data, and the the size of the memory blocks being used.
  1508. </p>
  1509. </descr>
  1510. <seealso>
  1511. <link id="TStream"/>
  1512. </seealso>
  1513. </element>
  1514. <element name="TMemoryStream.BlkCount">
  1515. <short>Number of allocated memory blocks</short>
  1516. </element>
  1517. <element name="TMemoryStream.BlkSize">
  1518. <short>Size of one memory block</short>
  1519. </element>
  1520. <element name="TMemoryStream.MemSize">
  1521. <short>Total memory size</short>
  1522. </element>
  1523. <element name="TMemoryStream.BlkList">
  1524. <short>Pointer to list of allocated blocks.</short>
  1525. </element>
  1526. <element name="TMemoryStream.Init">
  1527. <short>Initialize memory stream, reserves memory for stream data.</short>
  1528. <descr>
  1529. <p>
  1530. <var>Init</var> instantiates a new <var>TMemoryStream</var> object. The
  1531. memorystreamobject will initially allocate at least <var>ALimit</var> bytes memory,
  1532. divided into memory blocks of size <var>ABlockSize</var>.
  1533. The number of blocks needed to get to <var>ALimit</var> bytes is rounded up.
  1534. </p>
  1535. <p>
  1536. By default, the number of blocks is 1, and the size of a block is 8192. This
  1537. is selected if you specify 0 as the blocksize.
  1538. </p>
  1539. <p>
  1540. For an example, see e.g <link id="TStream.CopyFrom"/>.
  1541. </p>
  1542. </descr>
  1543. <errors>
  1544. If the stream cannot allocate the initial memory needed for the memory blocks, then
  1545. the stream's status is set to <var>stInitError</var>.
  1546. </errors>
  1547. <seealso>
  1548. <link id="TMemoryStream.Done"/>
  1549. </seealso>
  1550. </element>
  1551. <element name="TMemoryStream.Done">
  1552. <short>Clean up memory and destroy the object instance.</short>
  1553. <descr>
  1554. <p>
  1555. <var>Done</var> releases the memory blocks used by the stream, and then cleans up
  1556. the memory used by the stream object itself.
  1557. </p>
  1558. <p>
  1559. For an example, see e.g <link id="TStream.CopyFrom"/>.
  1560. </p>
  1561. </descr>
  1562. <errors>
  1563. None.
  1564. </errors>
  1565. <seealso>
  1566. <link id="TMemoryStream.Init"/>
  1567. </seealso>
  1568. </element>
  1569. <element name="TMemoryStream.Truncate">
  1570. <short>Set the stream size to the current position.</short>
  1571. <descr>
  1572. <var>Truncate</var> sets the size of the memory stream equal to the current
  1573. position. It de-allocates any memory-blocks that are no longer needed, so
  1574. that the new size of the stream is the current position in the stream,
  1575. rounded up to the first multiple of the stream blocksize.
  1576. </descr>
  1577. <errors>
  1578. If an error occurs during memory de-allocation, the stream's status is set
  1579. to <var>stError</var>
  1580. </errors>
  1581. <seealso>
  1582. <link id="TStream.Truncate"/>
  1583. </seealso>
  1584. <example file="objectex/ex20"/>
  1585. </element>
  1586. <element name="TMemoryStream.Read">
  1587. <short>Read data from the stream to a location in memory.</short>
  1588. <descr>
  1589. <p>
  1590. <var>Read</var> reads <var>Count</var> bytes from the stream to <var>Buf</var>. It updates
  1591. the position of the stream.
  1592. </p>
  1593. <p>
  1594. For an example, see <link id="TStream.Read"/>.
  1595. </p>
  1596. </descr>
  1597. <errors>
  1598. If there is not enough data available, no data is read, and the stream's
  1599. status is set to <var>stReadError</var>.
  1600. </errors>
  1601. <seealso>
  1602. <link id="TStream.Read"/>
  1603. <link id="TMemoryStream.Write"/>
  1604. </seealso>
  1605. </element>
  1606. <element name="TMemoryStream.Write">
  1607. <short>Write data to the stream.</short>
  1608. <descr>
  1609. <p>
  1610. <var>Write</var> copies <var>Count</var> bytes from <var>Buf</var> to the stream. It
  1611. updates the position of the stream.
  1612. </p>
  1613. <p>
  1614. If not enough memory is available to hold the extra <var>Count</var> bytes,
  1615. then the stream will try to expand, by allocating as much blocks with
  1616. size <var>BlkSize</var> (as specified in the constuctor call
  1617. <link id="TMemoryStream.Init">Init</link>) as needed.
  1618. </p>
  1619. <p>
  1620. For an example, see <link id="TStream.Read"/>.
  1621. </p>
  1622. </descr>
  1623. <errors>
  1624. If the stream cannot allocate more memory, then the status is set to
  1625. <var>stWriteError</var>
  1626. </errors>
  1627. <seealso>
  1628. <link id="TStream.Write"/>
  1629. <link id="TMemoryStream.Read"/>
  1630. </seealso>
  1631. </element>
  1632. <element name="TCollection">
  1633. <short>Manage a collection of pointers of objects</short>
  1634. <descr>
  1635. <p>
  1636. The <var>TCollection</var> object manages a collection of pointers or objects.
  1637. It also provides a series of methods to manipulate these pointers or
  1638. objects.
  1639. </p>
  1640. <p>
  1641. Whether or not objects are used depends on the kind of calls you use.
  1642. All kinds come in 2 flavors, one for objects, one for pointers.
  1643. </p>
  1644. </descr>
  1645. </element>
  1646. <element name="TCollection.Items">
  1647. <short>Pointer to list of items.</short>
  1648. </element>
  1649. <element name="TCollection.Count">
  1650. <short>Current count of items</short>
  1651. </element>
  1652. <element name="TCollection.Limit">
  1653. <short>Max number of items</short>
  1654. </element>
  1655. <element name="TCollection.Delta">
  1656. <short>Number of pointers to allocate when adding items.</short>
  1657. </element>
  1658. <element name="TCollection.Init">
  1659. <short>Instantiate a new collection.</short>
  1660. <descr>
  1661. <p>
  1662. <var>Init</var> initializes a new instance of a collection. It sets the (initial) maximum number
  1663. of items in the collection to <var>ALimit</var>. <var>ADelta</var> is the increase
  1664. size : The number of memory places that will be allocatiod in case <var>ALimit</var> is reached,
  1665. and another element is added to the collection.
  1666. </p>
  1667. <p>
  1668. For an example, see <link id="TCollection.ForEach"/>.
  1669. </p>
  1670. </descr>
  1671. <errors>
  1672. None.
  1673. </errors>
  1674. <seealso>
  1675. <link id="TCollection.Load"/>
  1676. <link id="TCollection.Done"/>
  1677. </seealso>
  1678. </element>
  1679. <element name="TCollection.Load">
  1680. <short>Initialize a new collection and load collection from a stream.</short>
  1681. <descr>
  1682. <var>Load</var> initializes a new instance of a collection. It reads from stream
  1683. <var>S</var> the item count, the item limit count, and the increase size. After
  1684. that, it reads the specified number of items from the stream.
  1685. <!-- Do not call this method if you intend to use only pointers in your collection. -->
  1686. </descr>
  1687. <errors>
  1688. Errors returned can be those of <link id="TCollection.GetItem">GetItem</link>.
  1689. </errors>
  1690. <seealso>
  1691. <link id="TCollection.Init"/>
  1692. <link id="TCollection.GetItem"/>
  1693. <link id="TCollection.Done"/>
  1694. </seealso>
  1695. <example file="objectex/ex22"/>
  1696. </element>
  1697. <element name="TCollection.Done">
  1698. <short>Clean up collection, release all memory.</short>
  1699. <descr>
  1700. <p>
  1701. <var>Done</var> frees all objects in the collection, and then releases all memory
  1702. occupied by the instance.
  1703. </p>
  1704. <p>
  1705. For an example, see <link id="TCollection.ForEach"/>.
  1706. </p>
  1707. <!-- Do not call this method if you intend to use only pointers in your collection. -->
  1708. </descr>
  1709. <errors>
  1710. None.
  1711. </errors>
  1712. <seealso>
  1713. <link id="TCollection.Init"/>
  1714. <link id="TCollection.FreeAll"/>
  1715. </seealso>
  1716. </element>
  1717. <element name="TCollection.At">
  1718. <short>Return the item at a certain index.</short>
  1719. <descr>
  1720. <var>At</var> returns the item at position <var>Index</var>.
  1721. </descr>
  1722. <errors>
  1723. If <var>Index</var> is less than zero or larger than the number of items
  1724. in the collection, seepl{Error}{TCollection.Error} is called with
  1725. <var>coIndexError</var> and <var>Index</var> as arguments, resulting in a run-time
  1726. error.
  1727. </errors>
  1728. <seealso>
  1729. <link id="TCollection.Insert"/>
  1730. </seealso>
  1731. <example file="objectex/ex23"/>
  1732. </element>
  1733. <element name="TCollection.IndexOf">
  1734. <short>Find the position of a certain item.</short>
  1735. <descr>
  1736. <var>IndexOf</var> returns the index of <var>Item</var> in the collection.
  1737. If <var>Item</var> isn't present in the collection, -1 is returned.
  1738. </descr>
  1739. <errors>
  1740. If the item is not present, -1 is returned.
  1741. </errors>
  1742. <seealso>
  1743. <link id="TCollection.At"/>
  1744. <link id="TCollection.GetItem"/>
  1745. <link id="TCollection.Insert"/>
  1746. </seealso>
  1747. <example file="objectex/ex24"/>
  1748. </element>
  1749. <element name="TCollection.GetItem">
  1750. <short>Read one item off the stream.</short>
  1751. <descr>
  1752. <var>GetItem</var> reads a single item off the stream <var>S</var>, and
  1753. returns a pointer to this item. This method is used internally by the Load
  1754. method, and should not be used directly.
  1755. </descr>
  1756. <errors>
  1757. Possible errors are the ones from <link id="TStream.Get"/>.
  1758. </errors>
  1759. <seealso>
  1760. <link id="TStream.Get"/>,
  1761. <link id="TCollection.Store"/>
  1762. </seealso>
  1763. </element>
  1764. <element name="TCollection.LastThat">
  1765. <short>Return last item which matches a test.</short>
  1766. <descr>
  1767. This function returns the last item in the collection for which <var>Test</var>
  1768. returns a non-nil result. <var>Test</var> is a function that accepts 1 argument:
  1769. a pointer to an object, and that returns a pointer as a result.
  1770. </descr>
  1771. <errors>
  1772. None.
  1773. </errors>
  1774. <seealso>
  1775. <link id="TCollection.FirstThat"/>
  1776. </seealso>
  1777. <example file="objectex/ex25"/>
  1778. </element>
  1779. <element name="TCollection.FirstThat">
  1780. <short>Return first item which matches a test.</short>
  1781. <descr>
  1782. This function returns the first item in the collection for which <var>Test</var>
  1783. returns a non-nil result. <var>Test</var> is a function that accepts 1 argument:
  1784. a pointer to an object, and that returns a pointer as a result.
  1785. </descr>
  1786. <errors>
  1787. None.
  1788. </errors>
  1789. <seealso>
  1790. <link id="TCollection.LastThat"/>
  1791. </seealso>
  1792. <example file="objectex/ex26"/>
  1793. </element>
  1794. <element name="TCollection.Pack">
  1795. <short>Remove all <var>>Nil</var> pointers from the collection.</short>
  1796. <descr>
  1797. <var>Pack</var> removes all <var>Nil</var> pointers from the collection, and adjusts
  1798. <var>Count</var> to reflect this change. No memory is freed as a result of this
  1799. call. In order to free any memory, you can call <var>SetLimit</var> with an
  1800. argument of <var>Count</var> after a call to <var>Pack</var>.
  1801. </descr>
  1802. <errors>
  1803. None.
  1804. </errors>
  1805. <seealso>
  1806. <link id="TCollection.SetLimit"/>
  1807. </seealso>
  1808. <example file="objectex/ex26"/>
  1809. </element>
  1810. <element name="TCollection.FreeAll">
  1811. <short>Release all objects from the collection.</short>
  1812. <descr>
  1813. <var>FreeAll</var> calls the destructor of each object in the collection.
  1814. It doesn't release any memory occumpied by the collection itself, but it
  1815. does set <var>Count</var> to zero.
  1816. </descr>
  1817. <errors>
  1818. </errors>
  1819. <seealso>
  1820. <link id="TCollection.DeleteAll"/>
  1821. <link id="TCollection.FreeItem"/>
  1822. </seealso>
  1823. <example file="objectex/ex28"/>
  1824. </element>
  1825. <element name="TCollection.DeleteAll">
  1826. <short>Delete all elements from the collection. Objects are not destroyed.</short>
  1827. <descr>
  1828. <var>DeleteAll</var> deletes all elements from the collection. It just sets
  1829. the <var>Count</var> variable to zero. Contrary to
  1830. <link id="TCollection.FreeAll">FreeAll</link>, <var>DeletAll</var> doesn't call the
  1831. destructor of the objects.
  1832. </descr>
  1833. <errors>
  1834. None.
  1835. </errors>
  1836. <seealso>
  1837. <link id="TCollection.FreeAll"/>
  1838. <link id="TCollection.Delete"/>
  1839. </seealso>
  1840. <example file="objectex/ex29"/>
  1841. </element>
  1842. <element name="TCollection.Free">
  1843. <short>Free item from collection, calling it's destructor.</short>
  1844. <descr>
  1845. <var>Free</var> Deletes <var>Item</var> from the collection, and calls the destructor
  1846. <var>Done</var> of the object.
  1847. </descr>
  1848. <errors>
  1849. If the <var>Item</var> is not in the collection, <var>Error</var> will be called with
  1850. <var>coIndexError</var>.
  1851. </errors>
  1852. <seealso>
  1853. <link id="TCollection.FreeItem"/>
  1854. </seealso>
  1855. <example file="objectex/ex30"/>
  1856. </element>
  1857. <element name="TCollection.Insert">
  1858. <short>Insert a new item in the collection at the end.</short>
  1859. <descr>
  1860. <var>Insert</var> inserts <var>Item</var> in the collection. <var>TCollection</var>
  1861. inserts this item at the end, but descendent objects may insert it at
  1862. another place.
  1863. </descr>
  1864. <errors>
  1865. None.
  1866. </errors>
  1867. <seealso>
  1868. <link id="TCollection.AtInsert"/>
  1869. <link id="TCollection.AtPut"/>
  1870. </seealso>
  1871. </element>
  1872. <element name="TCollection.Delete">
  1873. <short>Delete an item from the collection, but does not destroy it.</short>
  1874. <descr>
  1875. <var>Delete</var> deletes <var>Item</var> from the collection. It doesn't call the
  1876. item's destructor, though. For this the <link id="TCollection.Free">Free</link>
  1877. call is provided.
  1878. </descr>
  1879. <errors>
  1880. If the <var>Item</var> is not in the collection, <var>Error</var> will be called with
  1881. <var>coIndexError</var>.
  1882. </errors>
  1883. <seealso>
  1884. <link id="TCollection.AtDelete"/>
  1885. <link id="TCollection.Free"/>
  1886. </seealso>
  1887. <example file="objectex/ex31"/>
  1888. </element>
  1889. <element name="TCollection.AtFree">
  1890. <short>Free an item at the indicates position, calling it's destructor.</short>
  1891. <descr>
  1892. <var>AtFree</var> deletes the item at position <var>Index</var> in the collection,
  1893. and calls the item's destructor if it is not <var>Nil</var>.
  1894. </descr>
  1895. <errors>
  1896. If <var>Index</var> isn't valid then <link id="TCollection.Error">Error</link> is called
  1897. with <var>CoIndexError</var>.
  1898. </errors>
  1899. <seealso>
  1900. <link id="TCollection.Free"/>
  1901. <link id="TCollection.AtDelete"/>
  1902. </seealso>
  1903. <example file="objectex/ex32"/>
  1904. </element>
  1905. <element name="TCollection.FreeItem">
  1906. <short>Destroy a non-nil item.</short>
  1907. <descr>
  1908. <p>
  1909. <var>FreeItem</var> calls the destructor of <var>Item</var> if it is not
  1910. nil.
  1911. </p>
  1912. <remark>
  1913. This function is used internally by the TCollection object, and should not be
  1914. called directly.
  1915. </remark>
  1916. </descr>
  1917. <errors>
  1918. None.
  1919. </errors>
  1920. <seealso>
  1921. <link id="TCollection.Free"/>
  1922. <link id="TCollection.AtFree"/>
  1923. </seealso>
  1924. </element>
  1925. <element name="TCollection.AtDelete">
  1926. <short>Delete item at certain position.</short>
  1927. <descr>
  1928. <var>AtDelete</var> deletes the pointer at position <var>Index</var> in the
  1929. collection. It doesn't call the object's destructor.
  1930. </descr>
  1931. <errors>
  1932. If <var>Index</var> isn't valid then <link id="TCollection.Error">Error</link> is called
  1933. with <var>CoIndexError</var>.
  1934. </errors>
  1935. <seealso>
  1936. <link id="TCollection.Delete"/>
  1937. </seealso>
  1938. <example file="objectex/ex33"/>
  1939. </element>
  1940. <element name="TCollection.ForEach">
  1941. <short>Execute procedure for each item in the list.</short>
  1942. <descr>
  1943. <p>
  1944. <var>ForEach</var> calls <var>Action</var> for each element in the collection,
  1945. and passes the element as an argument to <var>Action</var>.
  1946. </p>
  1947. <p>
  1948. <var>Action</var> is a procedural type variable that accepts a pointer as an
  1949. argument.
  1950. </p>
  1951. </descr>
  1952. <errors>
  1953. None.
  1954. </errors>
  1955. <seealso>
  1956. <link id="TCollection.FirstThat"/>
  1957. <link id="TCollection.LastThat"/>
  1958. </seealso>
  1959. <example file="objectex/ex21"/>
  1960. </element>
  1961. <element name="TCollection.SetLimit">
  1962. <short>Set maximum number of elements in the collection.</short>
  1963. <descr>
  1964. <p>
  1965. <var>SetLimit</var> sets the maximum number of elements in the collection.
  1966. <var>ALimit</var> must not be less than <var>Count</var>, and should not be larger
  1967. than <var>MaxCollectionSize</var>
  1968. </p>
  1969. <p>
  1970. For an example, see <link id="TCollection.Pack">Pack</link>.
  1971. </p>
  1972. </descr>
  1973. <errors>
  1974. None.
  1975. </errors>
  1976. <seealso>
  1977. <link id="TCollection.Init"/>
  1978. </seealso>
  1979. </element>
  1980. <element name="TCollection.Error">
  1981. <short>Set error code.</short>
  1982. <descr>
  1983. <p>
  1984. <var>Error</var> is called by the various <var>TCollection</var> methods
  1985. in case of an error condition. The default behaviour is to make
  1986. a call to <var>RunError</var> with an error of <var>212-Code</var>.
  1987. </p>
  1988. <p>
  1989. This method can be overridden by descendent objects to implement
  1990. a different error-handling.
  1991. </p>
  1992. </descr>
  1993. <errors>
  1994. </errors>
  1995. <seealso>
  1996. <link id="Abstract"/>
  1997. </seealso>
  1998. </element>
  1999. <element name="TCollection.AtPut">
  2000. <short>Set collection item, overwriting an existing value.</short>
  2001. <descr>
  2002. <p>
  2003. <var>AtPut</var> sets the element at position <var>Index</var> in the collection
  2004. to <var>Item</var>. Any previous value is overwritten.
  2005. </p>
  2006. <p>
  2007. For an example, see <link id="TCollection.Pack">Pack</link>.
  2008. </p>
  2009. </descr>
  2010. <errors>
  2011. If <var>Index</var> isn't valid then <link id="TCollection.Error">Error</link> is called
  2012. with <var>CoIndexError</var>.
  2013. </errors>
  2014. <seealso>
  2015. </seealso>
  2016. </element>
  2017. <element name="TCollection.AtInsert">
  2018. <short>Insert an element at a certain position in the collection.</short>
  2019. <descr>
  2020. <var>AtInsert</var> inserts <var>Item</var> in the collection at position <var>Index</var>,
  2021. shifting all elements by one position. In case the current limit is reached,
  2022. the collection will try to expand with a call to <var>SetLimit</var>
  2023. </descr>
  2024. <errors>
  2025. If <var>Index</var> isn't valid then <link id="TCollection.Error">Error</link> is called
  2026. with <var>CoIndexError</var>. If the collection fails to expand, then
  2027. <var>coOverFlow</var> is passd to <var>Error</var>.
  2028. </errors>
  2029. <seealso>
  2030. <link id="TCollection.Insert"/>
  2031. </seealso>
  2032. <example file="objectex/ex34"/>
  2033. </element>
  2034. <element name="TCollection.Store">
  2035. <short>Write collection to a stream.</short>
  2036. <descr>
  2037. <p>
  2038. <var>Store</var> writes the collection to the stream <var>S</var>. It does
  2039. this by writeing the current <var>Count</var>, <var>Limit</var> and <var>Delta</var>
  2040. to the stream, and then writing each item to the stream.
  2041. </p>
  2042. <p>
  2043. The contents of the stream are then suitable for instantiating another
  2044. collection with <link id="TCollection.Load">Load</link>.
  2045. </p>
  2046. <p>
  2047. For an example, see <link id="TCollection.Load"/>.
  2048. </p>
  2049. </descr>
  2050. <errors>
  2051. Errors returned are those by <link id="TStream.Put"/>.
  2052. </errors>
  2053. <seealso>
  2054. <link id="TCollection.Load"/>
  2055. <link id="TCollection.PutItem"/>
  2056. </seealso>
  2057. </element>
  2058. <element name="TCollection.PutItem">
  2059. <short>Put one item on the stream</short>
  2060. <descr>
  2061. <var>PutItem</var> writes <var>Item</var> to stream <var>S</var>. This method is used
  2062. internaly by the <var>TCollection</var> object, and should not be called
  2063. directly.
  2064. </descr>
  2065. <errors>
  2066. Errors are those returned by <link id="TStream.Put"/>.
  2067. </errors>
  2068. <seealso>
  2069. <link id="TCollection.Store">Store</link>
  2070. <link id="TCollection.GetItem">GetItem</link>
  2071. </seealso>
  2072. </element>
  2073. <element name="TSortedCollection">
  2074. <short>Abstract sorted collection.</short>
  2075. <descr>
  2076. <p>
  2077. <var>TSortedCollection</var> is an abstract class, implementing a sorted
  2078. collection. You should never use an instance of <var>TSortedCollection</var>
  2079. directly, instead you should declare a descendent type, and override the
  2080. <link id="TSortedCollection.Compare">Compare</link> method.
  2081. </p>
  2082. <p>
  2083. Because the collection is ordered, <var>TSortedCollection</var> overrides some
  2084. <var>TCollection</var> methods, to provide faster routines for lookup.
  2085. </p>
  2086. <p>
  2087. The <link id="TSortedCollection.Compare">Compare</link> method decides how elements
  2088. in the collection should be ordered. Since <var>TCollection</var> has no way
  2089. of knowing how to order pointers, you must override the compare method.
  2090. </p>
  2091. <p>
  2092. Additionally, <var>TCollection</var> provides a means to filter out duplicates.
  2093. if you set <var>Duplicates</var> to <var>False</var> (the default) then duplicates
  2094. will not be allowed.
  2095. </p>
  2096. <p>
  2097. The example below defines a descendent of <var>TSortedCollection</var> which
  2098. is used in the examples.
  2099. </p>
  2100. </descr>
  2101. <example file="objectex/mysortc"/>
  2102. </element>
  2103. <element name="TSortedCollection.Duplicates">
  2104. <short>If <var>True</var> duplicate strings are allowed in the collection.</short>
  2105. </element>
  2106. <element name="TSortedCollection.Init">
  2107. <short>Instantiates a new instance of a <var>TSortedCollection</var></short>
  2108. <descr>
  2109. <p>
  2110. <var>Init</var> calls the inherited constuctor (see <link id="TCollection.Init"/>) and
  2111. sets the <var>Duplicates</var> flag to false.
  2112. </p>
  2113. <p>
  2114. You should not call this method directly, since <var>TSortedCollection</var> is a
  2115. abstract class. Instead, the descendent classes should call it via the
  2116. <var>inherited</var> keyword.
  2117. </p>
  2118. </descr>
  2119. <errors>
  2120. None.
  2121. </errors>
  2122. <seealso>
  2123. <link id="TSortedCollection.Load"/>
  2124. <link id="TCollection.Done"/>
  2125. </seealso>
  2126. </element>
  2127. <element name="TSortedCollection.Load">
  2128. <short>Instantiates a new instance of a <var>TSortedCollection</var> and
  2129. loads it from stream.</short>
  2130. <descr>
  2131. <p>
  2132. <var>Load</var> calls the inherited constuctor (see <link id="TCollection.Load"/>) and
  2133. reads the <var>Duplicates</var> flag from the stream..
  2134. </p>
  2135. <p>
  2136. You should not call this method directly, since <var>TSortedCollection</var> is a
  2137. abstract class. Instead, the descendent classes should call it via the
  2138. <var>inherited</var> keyword.
  2139. </p>
  2140. <p>
  2141. For an example, see <link id="TCollection.Load"/>.
  2142. </p>
  2143. </descr>
  2144. <errors>
  2145. None.
  2146. </errors>
  2147. <seealso>
  2148. <link id="TSortedCollection.Init"/>
  2149. <link id="TCollection.Done"/>
  2150. </seealso>
  2151. </element>
  2152. <element name="TSortedCollection.KeyOf">
  2153. <short>Return the key of an item</short>
  2154. <descr>
  2155. <p>
  2156. <var>KeyOf</var> returns the key associated with <var>Item</var>.
  2157. <var>TSortedCollection</var> returns the item itself as the key, descendent
  2158. objects can override this method to calculate a (unique) key based on the
  2159. item passed (such as hash values).
  2160. </p>
  2161. <p>
  2162. <var>Keys</var> are used to sort the objects, they are used to search and sort
  2163. the items in the collection. If descendent types override this method then
  2164. it allows possibly for faster search/sort methods based on keys rather than
  2165. on the objects themselves.
  2166. </p>
  2167. </descr>
  2168. <errors>
  2169. None.
  2170. </errors>
  2171. <seealso>
  2172. <link id="TSortedCollection.IndexOf"/>
  2173. <link id="TSortedCollection.Compare"/>
  2174. </seealso>
  2175. </element>
  2176. <element name="TSortedCollection.IndexOf">
  2177. <short>Return index of an item in the collection.</short>
  2178. <descr>
  2179. <p>
  2180. <var>IndexOf</var> returns the index of <var>Item</var> in the collection. It searches
  2181. for the object based on it's key. If duplicates are allowed, then it returns
  2182. the index of last object that matches <var>Item</var>.
  2183. </p>
  2184. <p>
  2185. In case <var>Item</var> is not found in the collection, -1 is returned.
  2186. </p>
  2187. <p>
  2188. For an example, see <link id="TCollection.IndexOf"/>
  2189. </p>
  2190. </descr>
  2191. <errors>
  2192. None.
  2193. </errors>
  2194. <seealso>
  2195. <link id="TSortedCollection.Search"/>
  2196. <link id="TSortedCollection.Compare"/>
  2197. </seealso>
  2198. </element>
  2199. <element name="TSortedCollection.Compare">
  2200. <short>Compare two items in the collection.</short>
  2201. <descr>
  2202. <p>
  2203. <var>Compare</var> is an abstract method that should be overridden by descendent
  2204. objects in order to compare two items in the collection. This method is used
  2205. in the <link id="TSortedCollection.Search">Search</link> method and in the
  2206. <link id="TSortedCollection.Insert">Insert</link> method to determine the ordering of
  2207. the objects.
  2208. </p>
  2209. <p>
  2210. The function should compare the two keys of items and return the following
  2211. function results:
  2212. </p>
  2213. <dl>
  2214. <dt>Result &lt; 0</dt><dd>If <var>Key1</var> is logically before <var>Key2</var> (<var>Key1&lt;Key2</var>)</dd>
  2215. <dt>Result = 0</dt><dd> If <var>Key1</var> and <var>Key2</var> are equal. (<var>Key1=Key2</var>)</dd>
  2216. <dt>Result &gt; 0</dt><dd> If <var>Key1</var> is logically after <var>Key2</var> (<var>Key1&gt;Key2</var>)</dd>
  2217. </dl>
  2218. </descr>
  2219. <errors>
  2220. An 'abstract run-time error' will be generated if you call
  2221. <var>TSortedCollection.Compare</var> directly.
  2222. </errors>
  2223. <seealso>
  2224. <link id="TSortedCollection.IndexOf"/>
  2225. <link id="TSortedCollection.Search"/>
  2226. </seealso>
  2227. <example file="objectex/mysortc"/>
  2228. </element>
  2229. <element name="TSortedCollection.Search">
  2230. <short>Search for item with given key.</short>
  2231. <descr>
  2232. <p>
  2233. <var>Search</var> looks for the item with key <var>Key</var> and returns the position
  2234. of the item (if present) in the collection in <var>Index</var>.
  2235. </p>
  2236. <p>
  2237. Instead of a linear search as <var>TCollection</var> does, <var>TSortedCollection</var>
  2238. uses a binary search based on the keys of the objects. It uses the
  2239. <link id="TSortedCollection.Compare">Compare</link> function to implement this
  2240. search.
  2241. </p>
  2242. <p>
  2243. If the item is found, <var>Search</var> returns <var>True</var>, otherwise <var>False</var>
  2244. is returned.
  2245. </p>
  2246. </descr>
  2247. <errors>
  2248. None.
  2249. </errors>
  2250. <seealso>
  2251. <link id="TCollection.IndexOf"/>
  2252. </seealso>
  2253. <example file="objectex/ex36"/>
  2254. </element>
  2255. <element name="TSortedCollection.Insert">
  2256. <short>Insert new item in collection.</short>
  2257. <descr>
  2258. <p>
  2259. <var>Insert</var> inserts an item in the collection at the correct position, such
  2260. that the collection is ordered at all times. You should never use
  2261. <link id="TCollection.AtInsert">Atinsert</link>, since then the collection ordering
  2262. is not guaranteed.
  2263. </p>
  2264. <p>
  2265. If <var>Item</var> is already present in the collection, and <var>Duplicates</var> is
  2266. <var>False</var>, the item will not be inserted.
  2267. </p>
  2268. </descr>
  2269. <errors>
  2270. None.
  2271. </errors>
  2272. <seealso>
  2273. <link id="TCollection.AtInsert"/>
  2274. </seealso>
  2275. <example file="objectex/ex35"/>
  2276. </element>
  2277. <element name="TSortedCollection.Store">
  2278. <short>Write the collection to the stream.</short>
  2279. <descr>
  2280. <p>
  2281. <var>Store</var> writes the collection to the stream <var>S</var>. It does this by
  2282. calling the inherited <link id="TCollection.Store"/>, and then writing the
  2283. <var>Duplicates</var> flag to the stream.
  2284. </p>
  2285. <p>
  2286. After a <var>Store</var>, the collection can be loaded from the stream with the
  2287. constructor <link id="TSortedCollection.Load">Load</link>
  2288. </p>
  2289. <p>
  2290. For an example, see <link id="TCollection.Load"/>.
  2291. </p>
  2292. </descr>
  2293. <errors>
  2294. Errors can be those of <link id="TStream.Put"/>.
  2295. </errors>
  2296. <seealso>
  2297. <link id="TSortedCollection.Load"/>
  2298. </seealso>
  2299. </element>
  2300. <element name="TStringCollection">
  2301. <short>Collection of pascal strings.</short>
  2302. <descr>
  2303. <p>
  2304. The <var>TStringCollection</var> object manages a sorted collection of pascal
  2305. strings.
  2306. To this end, it overrides the <link id="TSortedCollection.Compare">Compare</link>
  2307. method of <var>TSortedCollection</var>, and it introduces methods to read/write
  2308. strings from a stream.
  2309. </p>
  2310. </descr>
  2311. </element>
  2312. <element name="TStringCollection.GetItem">
  2313. <short>Get string from the stream.</short>
  2314. <descr>
  2315. <p>
  2316. <var>GetItem</var> reads a string from the stream <var>S</var> and returns a pointer
  2317. to it. It doesn't insert the string in the collection.
  2318. </p>
  2319. <p>
  2320. This method is primarily introduced to be able to load and store the
  2321. collection from and to a stream.
  2322. </p>
  2323. </descr>
  2324. <errors>
  2325. The errors returned are those of <link id="TStream.ReadStr"/>.
  2326. </errors>
  2327. <seealso>
  2328. <link id="TStringCollection.PutItem"/>
  2329. </seealso>
  2330. </element>
  2331. <element name="TStringCollection.Compare">
  2332. <short>Compare two strings in the collection.</short>
  2333. <descr>
  2334. <p>
  2335. <var>TStringCollection</var> overrides the <var>Compare</var> function so it compares
  2336. the two keys as if they were pointers to strings. The compare is done case
  2337. sensitive. It returns the following results:
  2338. </p>
  2339. <dl>
  2340. <dt>-1</dt><dd> if the first string is alphabetically earlier than the second string.</dd>
  2341. <dt>0</dt><dd> if the two strings are equal.</dd>
  2342. <dt>1</dt><dd> if the first string is alphabetically later than the second string.</dd>
  2343. </dl>
  2344. </descr>
  2345. <errors>
  2346. None.
  2347. </errors>
  2348. <seealso>
  2349. <link id="TSortedCollection.Compare"/>
  2350. </seealso>
  2351. <example file="objectex/ex37"/>
  2352. </element>
  2353. <element name="TStringCollection.FreeItem">
  2354. <short>Dispose a string in the collection from memory.</short>
  2355. <descr>
  2356. <var>TStringCollection</var> overrides <var>FreeItem</var> so that the string pointed
  2357. to by <var>Item</var> is disposed from memory.
  2358. </descr>
  2359. <errors>
  2360. None.
  2361. </errors>
  2362. <seealso>
  2363. <link id="TCollection.FreeItem"/>
  2364. </seealso>
  2365. </element>
  2366. <element name="TStringCollection.PutItem">
  2367. <short>Write a string to the stream.</short>
  2368. <descr>
  2369. <p>
  2370. <var>PutItem</var> writes the string pointed to by <var>Item</var> to the stream
  2371. <var>S</var>.
  2372. </p>
  2373. <p>
  2374. This method is primarily used in the <var>Load</var> and <var>Store</var> methods,
  2375. and should not be used directly.
  2376. </p>
  2377. </descr>
  2378. <errors>
  2379. Errors are those of <link id="TStream.WriteStr"/>.
  2380. </errors>
  2381. <seealso>
  2382. <link id="TStringCollection.GetItem"/>
  2383. </seealso>
  2384. </element>
  2385. <element name="TStrCollection">
  2386. <short>Collection of null-terminated strings</short>
  2387. <descr>
  2388. <p>
  2389. The <var>TStrCollection</var> object manages a sorted collection
  2390. of null-terminated strings (pchar strings).
  2391. To this end, it overrides the <link id="TSortedCollection.Compare">Compare</link>
  2392. method of <var>TSortedCollection</var>, and it introduces methods to read/write
  2393. strings from a stream.
  2394. </p>
  2395. </descr>
  2396. </element>
  2397. <element name="TStrCollection.GetItem">
  2398. <short>Read a null-terminated string from the stream.</short>
  2399. <descr>
  2400. <p>
  2401. <var>GetItem</var> reads a null-terminated string from the stream <var>S</var>
  2402. and returns a pointer to it. It doesn't insert the string in the
  2403. collection.
  2404. </p>
  2405. <p>
  2406. This method is primarily introduced to be able to load and store the
  2407. collection from and to a stream.
  2408. </p>
  2409. </descr>
  2410. <errors>
  2411. The errors returned are those of <link id="TStream.StrRead"/>.
  2412. </errors>
  2413. <seealso>
  2414. <link id="TStrCollection.PutItem"/>
  2415. </seealso>
  2416. </element>
  2417. <element name="TStrCollection.Compare">
  2418. <short>Compare two strings in the collection.</short>
  2419. <descr>
  2420. <p>
  2421. <var>TStrCollection</var> overrides the <var>Compare</var> function so it compares
  2422. the two keys as if they were pointers to strings. The compare is done case
  2423. sensitive. It returns
  2424. </p>
  2425. <dl>
  2426. <dt>-1</dt><dd> if the first string is alphabetically earlier than the second string. </dd>
  2427. <dt>0</dt><dd> if the two strings are equal. </dd>
  2428. <dt>1</dt><dd> if the first string is alphabetically later than the second string.</dd>
  2429. </dl>
  2430. </descr>
  2431. <errors>
  2432. None.
  2433. </errors>
  2434. <seealso>
  2435. <link id="TSortedCollection.Compare"/>
  2436. </seealso>
  2437. <example file="objectex/ex38"/>
  2438. </element>
  2439. <element name="TStrCollection.FreeItem">
  2440. <short>Free null-terminated string from the collection.</short>
  2441. <descr>
  2442. <var>TStrCollection</var> overrides <var>FreeItem</var> so that the string pointed
  2443. to by <var>Item</var> is disposed from memory.
  2444. </descr>
  2445. <errors>
  2446. None.
  2447. </errors>
  2448. <seealso>
  2449. <link id="TCollection.FreeItem"/>
  2450. </seealso>
  2451. </element>
  2452. <element name="TStrCollection.PutItem">
  2453. <short>Write a null-terminated string to the stream.</short>
  2454. <descr>
  2455. <p>
  2456. <var>PutItem</var> writes the string pointed to by <var>Item</var> to the stream
  2457. <var>S</var>.
  2458. </p>
  2459. <p>
  2460. This method is primarily used in the <var>Load</var> and <var>Store</var> methods,
  2461. and should not be used directly.
  2462. </p>
  2463. </descr>
  2464. <errors>
  2465. Errors are those of <link id="TStream.StrWrite"/>.
  2466. </errors>
  2467. <seealso>
  2468. <link id="TStrCollection.GetItem"/>
  2469. </seealso>
  2470. </element>
  2471. <element name="TUnSortedStrCollection">
  2472. <short>Unsorted string collection</short>
  2473. <descr>
  2474. <p>
  2475. The <var>TUnSortedStrCollection</var> object manages an unsorted list of strings.
  2476. To this end, it overrides the <link id="TStringCollection.Insert"/> method to add
  2477. strings at the end of the collection, rather than in the alphabetically
  2478. correct position.
  2479. </p>
  2480. <p>
  2481. Take care, the <link id="TSortedCollection.Search">Search</link> and
  2482. <link id="TCollection.IndexOf">IndexOf</link> methods will not work on an unsorted
  2483. string collection.
  2484. </p>
  2485. </descr>
  2486. </element>
  2487. <element name="TUnSortedStrCollection.Insert">
  2488. <short>Insert a new string in the collection.</short>
  2489. <descr>
  2490. <var>Insert</var> inserts a string at the end of the collection, instead
  2491. of on it's alphabetical place, resulting in an unsorted collection of
  2492. strings.
  2493. </descr>
  2494. <errors>
  2495. None.
  2496. </errors>
  2497. <seealso>
  2498. <link id="TCollection.Insert"/>
  2499. </seealso>
  2500. <example file="objectex/ex39"/>
  2501. </element>
  2502. <element name="TResourceCollection">
  2503. <short>Collection of resource names</short>
  2504. <descr>
  2505. <p>
  2506. A <var>TResourceCollection</var> manages a collection of resource names.
  2507. It stores the position and the size of a resource, as well as the name of
  2508. the resource. It stores these items in records that look like this:
  2509. </p>
  2510. <code>
  2511. TYPE
  2512. TResourceItem = packed RECORD
  2513. Posn: LongInt;
  2514. Size: LongInt;
  2515. Key : String;
  2516. End;
  2517. PResourceItem = ^TResourceItem;
  2518. </code>
  2519. <p>
  2520. It overrides some methods of <var>TStringCollection</var> in order to accomplish
  2521. this.
  2522. </p>
  2523. <remark>
  2524. Remark that the <var>TResourceCollection</var> manages the names of the
  2525. resources and their assiciated positions and sizes, it doesn't manage
  2526. the resources themselves.
  2527. </remark>
  2528. </descr>
  2529. </element>
  2530. <element name="TResourceCollection.KeyOf">
  2531. <short>Return the key of an item in the collection.</short>
  2532. <descr>
  2533. <var>KeyOf</var> returns the key of an item in the collection. For resources, the
  2534. key is a pointer to the string with the resource name.
  2535. </descr>
  2536. <errors>
  2537. None.
  2538. </errors>
  2539. <seealso>
  2540. <link id="TStringCollection.Compare"/>
  2541. </seealso>
  2542. </element>
  2543. <element name="TResourceCollection.GetItem">
  2544. <short>Read an item from the stream.</short>
  2545. <descr>
  2546. <p>
  2547. <var>GetItem</var> reads a resource item from the stream <var>S</var>. It reads the
  2548. position, size and name from the stream, in that order. It DOES NOT read the
  2549. resource itself from the stream.
  2550. </p>
  2551. <p>
  2552. The resulting item is not inserted in the collection. This call is manly for
  2553. internal use by the <link id="TCollection.Load"/> method.
  2554. </p>
  2555. </descr>
  2556. <errors>
  2557. Errors returned are those by <link id="TStream.Read"/>
  2558. </errors>
  2559. <seealso>
  2560. <link id="TCollection.Load"/>
  2561. <link id="TStream.Read"/>
  2562. </seealso>
  2563. </element>
  2564. <element name="TResourceCollection.FreeItem">
  2565. <short>Release memory occupied by item.</short>
  2566. <descr>
  2567. <p>
  2568. <var>FreeItem</var> releases the memory occupied by <var>Item</var>. It de-allocates
  2569. the name, and then the resourceitem record.
  2570. </p>
  2571. <p>
  2572. It does NOT remove the item from the collection.
  2573. </p>
  2574. </descr>
  2575. <errors>
  2576. None.
  2577. </errors>
  2578. <seealso>
  2579. <link id="TCollection.FreeItem"/>
  2580. </seealso>
  2581. </element>
  2582. <element name="TResourceCollection.PutItem">
  2583. <short>Write an item to the stream.</short>
  2584. <descr>
  2585. <p>
  2586. <var>PutItem</var> writes <var>Item</var> to the stream <var>S</var>. It does this by
  2587. writing the position and size and name of the resource item to the stream.
  2588. </p>
  2589. <p>
  2590. This method is used primarily by the <link id="TCollection.Store">Store</link>
  2591. method.
  2592. </p>
  2593. </descr>
  2594. <errors>
  2595. Errors returned are those by <link id="TStream.Write"/>.
  2596. </errors>
  2597. <seealso>
  2598. <link id="TCollection.Store"/>
  2599. </seealso>
  2600. </element>
  2601. <element name="TResourceFile">
  2602. <short>Resource file</short>
  2603. <descr>
  2604. <link id="TResourceFile"/> represents the resources in a binary file image.
  2605. </descr>
  2606. </element>
  2607. <element name="TResourceFile.Stream">
  2608. <short>Actual file stream</short>
  2609. <descr>
  2610. contains the (file) stream that has the executable image and
  2611. the resources. It can be initialized by the <link id="TResourceFile.Init">Init</link>
  2612. constructor call.
  2613. </descr>
  2614. </element>
  2615. <element name="TResourceFile.Modified">
  2616. <short>Have resources changed ?</short>
  2617. <descr>
  2618. <var>Modified</var> is set to <var>True</var> if one of the resources has been changed.
  2619. It is set by the <link id="TResourceFile.Init">SwitchTo</link>,
  2620. <link id="TResourceFile.Delete">Delete</link> and <link id="TResourceFile.Put">Put</link>
  2621. methods. Calling <link id="TResourceFile.Flush">Flush</link> will clear the
  2622. <var>Modified</var> flag.
  2623. </descr>
  2624. </element>
  2625. <element name="TResourceFile.Init">
  2626. <short>Instantiate a new instance.</short>
  2627. <descr>
  2628. <p>
  2629. <var>Init</var> instantiates a new instance of a <var>TResourceFile</var> object.
  2630. If <var>AStream</var> is not nil then it is considered as a stream describing an
  2631. executable image on disk.
  2632. </p>
  2633. <p>
  2634. <var>Init</var> will try to position the stream on the start of the resources section,
  2635. and read all resources from the stream.
  2636. </p>
  2637. </descr>
  2638. <errors>
  2639. None.
  2640. </errors>
  2641. <seealso>
  2642. <link id="TResourceFile.Done"/>
  2643. </seealso>
  2644. </element>
  2645. <element name="TResourceFile.Done">
  2646. <short>Destroy the instance and remove it from memory.</short>
  2647. <descr>
  2648. <var>Done</var> cleans up the instance of the <var>TResourceFile</var> Object.
  2649. If <var>Stream</var> was specified at initialization, then <var>Stream</var> is
  2650. disposed of too.
  2651. </descr>
  2652. <errors>
  2653. None.
  2654. </errors>
  2655. <seealso>
  2656. <link id="TResourceFile.Init"/>
  2657. </seealso>
  2658. </element>
  2659. <element name="TResourceFile.Count">
  2660. <short>Number of resources in the file</short>
  2661. <descr>
  2662. <var>Count</var> returns the number of resources. If no resources were
  2663. read, zero is returned.
  2664. </descr>
  2665. <errors>
  2666. None.
  2667. </errors>
  2668. <seealso>
  2669. <link id="TResourceFile.Init"/>
  2670. </seealso>
  2671. </element>
  2672. <element name="TResourceFile.KeyAt">
  2673. <short>Return the key of the item at a certain position.</short>
  2674. <descr>
  2675. <var>KeyAt</var> returns the key (the name) of the <var>I</var>-th resource.
  2676. </descr>
  2677. <errors>
  2678. In case <var>I</var> is invalid, <var>TCollection.Error</var> will be executed.
  2679. </errors>
  2680. <seealso>
  2681. <link id="TResourceFile.Get"/>
  2682. </seealso>
  2683. </element>
  2684. <element name="TResourceFile.Get">
  2685. <short>Return a resource by key name.</short>
  2686. <descr>
  2687. <var>Get</var> returns a pointer to a instance of a resource identified by
  2688. <var>Key</var>. If <var>Key</var> cannot be found in the list of resources, then
  2689. <var>Nil</var> is returned.
  2690. </descr>
  2691. <errors>
  2692. Errors returned may be those by <var>TStream.Get</var>
  2693. </errors>
  2694. <seealso>
  2695. </seealso>
  2696. </element>
  2697. <element name="TResourceFile.SwitchTo">
  2698. <short>Write resources to a new stream.</short>
  2699. <descr>
  2700. <p>
  2701. <var>SwitchTo</var> switches to a new stream to hold the resources in.
  2702. <var>AStream</var> will be the new stream after the call to <var>SwitchTo</var>.
  2703. </p>
  2704. <p>
  2705. If <var>Pack</var> is true, then all the known resources will be copied from
  2706. the current stream to the new stream (<var>AStream</var>). If <var>Pack</var> is
  2707. <var>False</var>, then only the current resource is copied.
  2708. </p>
  2709. <p>
  2710. The return value is the value of the original stream: <var>Stream</var>.
  2711. </p>
  2712. <p>
  2713. The <var>Modified</var> flag is set as a consequence of this call.
  2714. </p>
  2715. </descr>
  2716. <errors>
  2717. Errors returned can be those of <link id="TStream.Read"/> and
  2718. <link id="TStream.Write"/>.
  2719. </errors>
  2720. <seealso>
  2721. <link id="TResourceFile.Flush"/>
  2722. </seealso>
  2723. </element>
  2724. <element name="TResourceFile.Flush">
  2725. <short>Writes the resources to the stream.</short>
  2726. <descr>
  2727. If the <var>Modified</var> flag is set to <var>True</var>, then <var>Flush</var>
  2728. writes the resources to the stream <var>Stream</var>. It sets the <var>Modified</var>
  2729. flag to true after that.
  2730. </descr>
  2731. <errors>
  2732. Errors can be those by <link id="TStream.Seek"/> and <link id="TStream.Write"/>.
  2733. </errors>
  2734. <seealso>
  2735. <link id="TResourceFile.SwitchTo"/>
  2736. </seealso>
  2737. </element>
  2738. <element name="TResourceFile.Delete">
  2739. <short>Delete a resource from the file</short>
  2740. <descr>
  2741. <var>Delete</var> deletes the resource identified by <var>Key</var> from the
  2742. collection. It sets the <var>Modified</var> flag to true.
  2743. </descr>
  2744. <errors>
  2745. None.
  2746. </errors>
  2747. <seealso>
  2748. <link id="TResourceFile.Flush"/>
  2749. </seealso>
  2750. </element>
  2751. <element name="TResourceFile.Put">
  2752. <short>Set a resource by key name.</short>
  2753. <descr>
  2754. <var>Put</var> sets the resource identified by <var>Key</var> to <var>Item</var>.
  2755. If no such resource exists, a new one is created. The item is written
  2756. to the stream.
  2757. </descr>
  2758. <errors>
  2759. Errors returned may be those by <link id="TStream.Put"/> and <var>TStream.Seek</var>
  2760. </errors>
  2761. <seealso>
  2762. <link id="TResourceFile.Get">Get</link>
  2763. </seealso>
  2764. </element>
  2765. <element name="TStringList">
  2766. <short>Collection of strings</short>
  2767. <descr>
  2768. <p>
  2769. A <var>TStringList</var> object can be used to read a collection of strings
  2770. stored in a stream. If you register this object with the <link id="RegisterType"/>
  2771. function, you cannot register the <var>TStrListMaker</var> object.
  2772. </p>
  2773. </descr>
  2774. </element>
  2775. <element name="TStringList.Load">
  2776. <short>Load stringlist from stream.</short>
  2777. <descr>
  2778. The <var>Load</var> constructor reads the <var>TStringList</var> object from the
  2779. stream <var>S</var>. It also reads the descriptions of the strings from the
  2780. stream. The string descriptions are stored as an array of
  2781. <var>TstrIndexrec</var> records, where each record describes a string on the
  2782. stream. These records are kept in memory.
  2783. </descr>
  2784. <errors>
  2785. If an error occurs, a stream error is triggered.
  2786. </errors>
  2787. <seealso>
  2788. <link id="TStringList.Done"/>
  2789. </seealso>
  2790. </element>
  2791. <element name="TStringList.Done">
  2792. <short>Clean up the instance</short>
  2793. <descr>
  2794. The <var>Done</var> destructor frees the memory occupied by the string
  2795. descriptions, and destroys the object.
  2796. </descr>
  2797. <errors>
  2798. None.
  2799. </errors>
  2800. <seealso>
  2801. <link id="TStringList.Load">Load</link>
  2802. <link id="TObject.Done"/>
  2803. </seealso>
  2804. </element>
  2805. <element name="TStringList.Get">
  2806. <short>Return a string by key name</short>
  2807. <descr>
  2808. <var>Get</var> reads the string with key <var>Key</var> from the list of strings on the
  2809. stream, and returns this string. If there is no string with such a key, an
  2810. empty string is returned.
  2811. </descr>
  2812. <errors>
  2813. If no string with key <var>Key</var> is found, an empty string is returned.
  2814. A stream error may result if the stream doesn't contain the needed strings.
  2815. </errors>
  2816. <seealso>
  2817. <link id="TStrListMaker.Put"/>
  2818. </seealso>
  2819. </element>
  2820. <element name="TStrListMaker">
  2821. <short>Generate a stream with strings, readable by <link id="TStringList"/></short>
  2822. <descr>
  2823. <p>
  2824. The <var>TStrListMaker</var> object can be used to generate a stream with
  2825. strings, which can be read with the <var>TStringList</var> object.
  2826. If you register this object with the <link id="RegisterType"/>
  2827. function, you cannot register the <var>TStringList</var> object.
  2828. </p>
  2829. </descr>
  2830. </element>
  2831. <element name="TStrListMaker.Init">
  2832. <short>Instantiate a new instance of <var>TStrListMaker</var></short>
  2833. <descr>
  2834. <p>
  2835. The <var>Init</var> constructor creates a new instance of the <var>TstrListMaker</var>
  2836. object. It allocates <var>AStrSize</var> bytes on the heap to hold all the
  2837. strings you wish to store. It also allocates enough room for
  2838. <var>AIndexSize</var> key description entries (of the type <var>TStrIndexrec</var>).
  2839. </p>
  2840. <p>
  2841. <var>AStrSize</var> must be large enough to contain all the strings you wish to
  2842. store. If not enough memory is allocated, other memory will be overwritten.
  2843. The same is true for <var>AIndexSize</var> : maximally <var>AIndexSize</var> strings
  2844. can be written to the stream.
  2845. </p>
  2846. </descr>
  2847. <errors>
  2848. None.
  2849. </errors>
  2850. <seealso>
  2851. <link id="TObject.Init"/>
  2852. <link id="TStrListMaker.Done"/>
  2853. </seealso>
  2854. </element>
  2855. <element name="TStrListMaker.Done">
  2856. <short>Clean up the instance and free all related memory.</short>
  2857. <descr>
  2858. The <var>Done</var> destructor de-allocates the memory for the index description
  2859. records and the string data, and then destroys the object.
  2860. </descr>
  2861. <errors>
  2862. None.
  2863. </errors>
  2864. <seealso>
  2865. <link id="TObject.Done"/>
  2866. <link id="TStrListMaker.Init"/>
  2867. </seealso>
  2868. </element>
  2869. <element name="TStrListMaker.Put">
  2870. <short>Add a new string to the list with associated key.</short>
  2871. <descr>
  2872. <var>Put</var> adds they string <var>S</var> with key <var>Key</var> to the collection of
  2873. strings. This action doesn't write the string to a stream. To write the
  2874. strings to the stream, see the <link id="TStrListMaker.Store">Store</link> method.
  2875. </descr>
  2876. <errors>
  2877. None.
  2878. </errors>
  2879. <seealso>
  2880. <link id="TStrListMaker.Store"/>
  2881. </seealso>
  2882. </element>
  2883. <element name="TStrListMaker.Store">
  2884. <short>Write the strings to the stream.</short>
  2885. <descr>
  2886. <var>Store</var> writes the collection of strings to the stream <var>S</var>.
  2887. The collection can then be read with the <var>TStringList</var> object.
  2888. </descr>
  2889. <errors>
  2890. A stream error may occur when writing the strings to the stream.
  2891. </errors>
  2892. <seealso>
  2893. <link id="TStringList.Load"/>
  2894. <link id="TStrListMaker.Put"/>
  2895. </seealso>
  2896. </element>
  2897. <element name="InvalidHandle">
  2898. <short>Value for invalid handle. Initial value for file stream handles or when the stream is closed.</short>
  2899. </element>
  2900. </module>
  2901. </package>
  2902. </fpdoc-descriptions>