Sign in Join
Wiki copytemporary

FCL: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: FCL

OldNewLine
1+The *Free Component Library* (**FCL**) consists of a collection of units, providing components (mostly classes) for common tasks. You can also see the [[LCL Components]] available directly within Lazarus. The FCL intends to be compatible with Delphi's *Visual Component Library* (VCL), but the FCL is restricted to non-visual components. On the other hand, the FCL also goes beyond the VCL.
2+
3+See [Free Component Library](http://www.freepascal.org/fcl/fcl.var) for the current development status and an overview of the available components (though this seems inconsistent with [Reference for 'fcl'](http://lazarus-ccr.sourceforge.net/docs/fcl/index.html) in Lazarus). You can also check the [source repository](http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/packages/). Note that there are also some platform-specific files in the FCL.
4+
5+After the example, you can find a list of some FCL components.
6+
7+### Usage
8+
9+To use an FCL *component* you need to include the name of the [[Unit|unit]] which implemented it, in a **uses** clause in your program or unit (see example below). The default compiler [[Configuration file|configuration file]] is set up to search the FCL directories for such units. You can also set the appropriate search path with a command-line compiler option of the form -Fu\<path-to-fcl-units\>.
10+
11+### Subpackages
12+
13+The full list of subpackages of the FCL can be found here: [[Package List]]
14+
15+The fcl-prefixed subpackages are:
16+
17+- [[fcl-base]] The base units (including e.g. an [[How To Use TFPExpressionParser|expression parser]])
18+- [[fcl-async]] Asynchronous I/O (serial?)
19+- [[fcl-db]] Generic database support + prepackaged drivers
20+- [[fcl-fpcunit]] Unit testing framework
21+- [[fcl-image]] Raster Image reading and writing (aka fpimage)
22+- [[fcl-json]] Routines for javascript object streaming
23+- [[fcl-net]] Network related units
24+- [[fcl-passrc]] Pascal language parsing and transformation
25+- [[fcl-process]] Process controll
26+- [[fcl-registry]] Registry
27+- [[fcl-res]] Resource handling
28+- [[fcl-stl]] Generic container library (standard template library)
29+- [[fcl-web]] Helper for web development
30+- [[fcl-xml]] XML (DOM) unit and related units.
31+
32+### Documentation
33+
34+Currently, the FCL is not completely documented (feel free to contribute; also take a look at [[doc:fcl|Reference for 'fcl']]). For Delphi compatible units, you could consult the Delphi documentation. You can always take a look at the source files in the [source repository](http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/packages/).
35+
36+### Example
37+
38+The following program illustrates the use of the class TObjectList in the FCL unit Contnrs (providing various containers, including lists, stacks, and queues):
39+
40+``` pascal
41+ program TObjectListExample;
42+ {$mode ObjFPC}
43+ uses
44+ Classes, { from RTL for TObject }
45+ Contnrs; { from FCL for TObjectList }
46+
47+ type
48+ TMyObject = class(TObject) { just some application-specific class }
49+ private
50+ FName: String; { with a string field }
51+ public
52+ constructor Create(AName: String); { and a constructor to create it with a given name }
53+ property Name: String read FName; { and a property to read the name }
54+ end;
55+
56+ constructor TMyObject.Create(AName: String);
57+ begin
58+ inherited Create;
59+ FName := AName;
60+ end;
61+
62+ var
63+ VObjectList: TObjectList; { for a list of objects; it is a reference to such a list! }
64+
65+ begin
66+ VObjectList := TObjectList.Create; { create an empty list }
67+ with VObjectList do
68+ begin
69+ Add(TMyObject.Create('Thing One'));
70+ Writeln((Last as TMyObject).Name);
71+ Add(TMyObject.Create('Thing Two'));
72+ Writeln((Last as TMyObject).Name);
73+ end;
74+ end.
75+```
76+
77+This program must be compiled in an object-oriented mode, such as -Mobjfpc or -Mdelphi.
78+
79+### FCL Components
80+
81+This is not an exhaustive list (to avoid duplication of effort). It only mentions some important components, or components that are otherwise not easy to find.
82+
83+Classes
84+Base classes for Object Pascal extensions in Delphi mode
85+
86+Contnrs
87+Some common container classes
88+
89+[[fpcunit|FPCUnit]]
90+A Unit testing framework (based on Kent Beck's unit testing framework. See [JUnit](http://www.junit.org/)),[FPCUnit tutorial (pdf)](http://www.freepascal.org/~michael/articles/fpcunit/fpcunit.pdf)
91+
92+XMLRead, XMLWrite and DOM
93+Detailed at the [[XML Tutorial]]
94+
95+---
96+*From the Free Pascal wiki, page "FCL", as it stood on 2020-02-14 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history