QuickLib
Quick development library (AutoMapper, LinQ, IOC Dependency Injection, MemoryCache, Scheduled tasks, Json and Yml Config and Options pattern, Serializers, etc) with crossplatform support for Delphi/Firemonkey (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux).
Install / Use
/learn @exilon/QuickLibREADME

QuickLib is a delphi/Firemonkey(Windows, Linux, Android, OSX & IOS) and fpc(Windows & Linux) library containing interesting and quick to implement functions, created to simplify application development and crossplatform support and improve productivity. Delphi XE8 - Delphi 13 Florence supported.
Give it a star
Please "star" this project in GitHub! It costs nothing but helps to reference the code.

Star History
Support
If you find this project useful, please consider making a donation.
Testing
QuickLib includes a comprehensive DUnitX test suite covering all major units. Tests are located in the test/ folder and can be compiled and run with RAD Studio.
Tests Found: 917
Tests Passed: 917
Tests Failed: 0
Tests Errored: 0
To run the tests, open test/QuickLib.dproj in RAD Studio, build and run, or compile from the command line:
msbuild test\QuickLib.dproj /p:Config=Debug /p:Platform=Win64 /p:DCC_Define=CONSOLE_TESTRUNNER
test\Win64\Debug\QuickLib.exe
Areas of functionality:
- Mapping: Map fields from a class to other class, copy objects, etc..
- Config: Use your config as an object and load/save from/to file (Json/Yaml) or Windows Registry.
- Serialization: Serialize objects to/from json/Yaml.
- Scheduling: Schedule tasks launching as independent threads with retry policies.
- Threading: Simplify run and control of multithread background tasks, Thread-safe Lists, queues, etc
- Data: Flexible data interchange and storage, allowing several input-output types.
- Cloud: Simplify cloud Azure/Amazon file management, send emails and more.
- Querying: Indexed Lists, Searchable Lists and Linq query system for generic lists and arrays.
- Benchmark: Time elapsed control and benchmark functions.
- Filesystem: Process and Services control, file modify monitors and helpers, etc...
- FailControl: Fail and Retry policies.
- Caching: Cache string or objects to retrieve fast later.
- Templating: Simple string templating with dictionaries.
- Debugging: Utils to debug your code.
- Parameters: Work with commandline parameters.
Main units description:
- Quick.Commons: Functions frequently needed in the day to day of a developer.
- Quick.AppService: Allow a console app to run as console mode or service mode with same code simplifying debug tasks.
- Quick.Azure/Amazon: Simplifies blob interaction with Azure and Amazon Cloud Storage.
- Quick.Network: CIDR and IP Range functions.
- Quick.Chrono: Chronometer and Benchmark a piece of code is simple.
- Quick.Console: Write log messages to console with colors and more...
- Quick.Log: Log to disk or memory with verbose levels and daily or max space rotation.
- Quick.Config: Load/Save a config as Json or Yaml file or Windows Registry keys and manage it as an object.
- Quick.FileMonitor: Monitorizes a file for changes and throws events.
- Quick.JsonUtils: Utils for working with json objects.
- Quick.SMTP: Send email with two code lines.
- Quick.Threads: Thread safe classes, scheduling and backgrounds tasks with retry policies.
- Quick.Process: Manages windows processes.
- Quick.Services: Manages windows services.
- Quick.Format: String format.
- Quick.RTTI.Utils: Simplifies working with RTTI.
- Quick.JsonSerializer: Serializes an object from/to json text. You can define if public or published will be processed (only Delphi, fpc rtti only supports published properties)
- Quick.AutoMapper: Map fields from one class to another class. Allows custom mappings to match different fields and custom mapping procedure to cast/convert fields manually.
- Quick.JsonRecord: Used as a DTO class, with json serialize and mapping functions included.
- Quick.Lists: Improved lists with indexing or search features.
- Quick.Value FlexValue stores any data type and allow pass to other class with integrated operators and autofrees.
- Quick.Arrays: Improved arrays.
- Quick.YAML: Yaml object structure.
- Quick.YAML.Serializer: Serialize/Deserialize object from/to Yaml.
- Quick.Expression: Evaluate object properties using expressions.
- Quick.Linq: Makes Linq queries to any TObjectList<T>, TList<T>, TArray<T> and TXArray<T>, performing Select by complex Where like SQL syntax, update and order over your list.
- Quick.MemoryCache: Caches objects/info with an expiration time, to avoid generate this info everytime is needed (database queries, hard to calculate info, etc).
- Quick.Collections: Collections improvements like IList and IObjectList with Linq inherited.
- Quick.Pooling: Creation of object pool to avoid external resource consum exhausts and overheads.
- Quick.Template: String template replacing with dictionary or delegate.
- Quick.Debug.Utils: Simple debugging and code benchmark utils.
- Quick.Parameters: Work with commandline parameters like a class.
- Quick.Url.Utils: Simple url manipulation
- Quick.RegEx.Utils: Commonly used RegEx comparison (email verification, password complexity, etc)
- Quick.Conditions: Pre and postcondition validations in fluent style.
Updates:
- NEW: RAD Studio 13 Florence supported
- NEW: RAD Studio 12 Athens supported
- NEW: RAD Studio 11 supported
- NEW: Condition checks
- NEW: Commonly used RegEx validations
- NEW: Url manipulation utils
- NEW: QuickParameters to work with commandline arguments like a class.
- NEW: HttpServer custom and dynamic error pages.
- NEW: Debug utils
- NEW: String Template
- NEW: RAD Studio 10.4 supported
- NEW: Collections: IList and IObjectList with linQ support.
- NEW: Pooling: ObjectPool.
- NEW: Options file settings with sections.
- NEW: MemoryCache with expiration & object compression.
- NEW: Now included on RAD Studio GetIt package manager.
- NEW: Background & Scheduled task with retry policies
- NEW: RunTask, FaultControl
- NEW: Linq over generic lists and arrays.
- NEW: QuickConfig YAML provider.
- NEW: YAML Object and Serializer
- NEW: AutoMapper customapping path namespaces style.
- NEW: FlexArray, FlexPair & FlexPairArray.
- NEW: AutoMapper mapping procedures (see documentation below)
- NEW: JsonSerializer improved
- NEW: TXArray: array like TList
- NEW: Delphi Linux compatibility
- NEW: QuickConfigJson reload if config file changed
- NEW: First version with OSX/IOS partial support
- NEW: Delphinus-Support
Installation:
- From package managers:
- Search "QuickLib" on Delphinus or GetIt package managers and click Install
- From Github:
- Clone Github repository or download zip file and extract it.
- Add QuickLib folder to your path libraries on Delphi IDE.
Documentation:
Quick.AppService:
Allow a console app to run as console mode or service mode with same code simplifying debug tasks.
if not AppService.IsRunningAsService then
begin
...your code running as console
end
else
begin
AppService.ServiceName := 'MyService';
AppService.DisplayName := 'MyServicesvc';
//you can pass an anonymous method to events
AppService.OnStart := procedure
begin
...your start code
end;
AppService.OnExecute := YourExecuteFunction;
AppService.OnStop := YourStopFunction;
AppService.CheckParams;
end;
Quick.Azure/Amazon:
Simplifies blob interaction with Azure and Amazon Cloud Storage.
//connect to a Azure blobstorage
QuickAzure := TQuickAzure.Create(AzureAccountName,AzureAccountKey);
//download a blob file to a stream
done := QuickAzure.GetBlob('MyContainer','MyFile.jpg',ResponseInfo,MyStream);
//check if exists a folder
found := ExistFolder('MyContainer','/Public/Documents/Personal');
//list blobs starting with a pattern (recursively or not)
for azBlob in ListBlobs('MyContainer','/Public/Documents',Recursive,ResponseInfo) do
begin
if azBlob.Size > 1000 then Showmessage(azBlob.Name);
end;
Quick.Network:
CIDR and IP Range functions.
//convert ip string to integer
IPv4ToInt('192.168.1.10');
//get first and last ip of a subnet scope
GetIpRange('192.168.100.0','255.255.255.0',LowIp,HighIP);
Quick.Commons:
Functions frequently needed in the everyday of a developer.
//coverts UTC time TDateTime to Local date time
UTCToLocalTime(MyUTCTime);
//generate a 10 char length random password with alphanumeric and signs.
RandomPassword(10,[pfIncludeNumbers,pfIncludeSigns]);
//Capitalize every word of a phrase
CapitalizeAll('the grey fox'); //returns "The Grey Fox"
//Simple TCounter and TTimeCounter for loops
counter := TCounter;
counter.Init(200);
timecounter : TTimeCounter;
timecounter.Init(10000);
while true do
begin
Inc(n);
{your procedural process here}
//every 200 steps writes to console
if counter.Check then writeln(Format('Processed %d entries',[n]));
//every 10 seconds writes to console
if timecounter.Check then writeln('Im working...');
end;
Quick.Chrono:
Chronometer and Benchmark a piece of code is simple.
//get elapsed time execution of a code part
Chrono := TChronometer.Create(False);
Chrono.Start;
...code you need benchmark
Chrono.Stop;
//shows elapsed time in LongTime format (2 hour(s) and 10 minute(s))
Showmessage(Chrono.TimeElapsed(True));
//shows elapsed time in ShortTime format (02:10:00)
Showmessage(Chrono.TimeElapsed(False));
//get benchmak info of a process
Chrono := TChronoBenchMark.Create;
Chrono.TotalProcess := 100000;
for i := 1

