Frequently Asked Questions

Discussion related to the Cross Codebot open source framework
sysrpl
Posts: 108
Joined: Thu Feb 05, 2015 6:31 pm

Frequently Asked Questions

Postby sysrpl » Thu Mar 26, 2015 8:15 pm


What is Cross Codebot?
What version of Free Pascal do I need to use Cross Codebot?
How can I get Free Pascal version 3 or greater?
Can you provide an example of the types in Cross Codebot which require Free Pascal version 3?
Are there other types like TRectI in Cross Codebot?
Okay so what does Cross Codebot actually do?
What about visual stuff?
What about networking stuff?
What about XML stuff?
What else?
Okay how do I get the Cross Codebot sources?
How do I add Cross Codebot to my projects?

What is Cross Codebot?

A: Cross Codebot is a LGPL collection of Free Pascal cross platform routines, classes, components, and controls. It uses makes prodigious of the newer Free Pascal language features, including: generics, generic interfaces, class/record helpers, records with methods, and both implicit and explicit conversion methods.

What version of Free Pascal do I need to use Cross Codebot?

A: Because Cross Codebot makes heavy use generics and class/record helps, it requires Free Pascal Compiler version 3.0 or above. Although FPC 3.0 is not yet officially released you can obtain a workable copy of it using SVN sources.

How can I get Free Pascal version 3 or greater?

A: On this page of the getlazarus.org website we provide easy to install SVN trunk versions of FPC and Lazarus. Just follow the instructions on the page to setup a preconfigured trunk versions of FPC and Lazarus for Windows, Macintosh, or Linux.

http://www.getlazarus.org/setup/

Can you provide an example of the types in Cross Codebot which require Free Pascal version 3?

A: Yes, take the Cross Codebot "TRectI" record (an Integer based record) as an example.

{ TRectI }

TRectI = record
private
function GetEmpty: Boolean;
procedure SetTop(Value: Integer);
procedure SetLeft(Value: Integer);
function GetRight: Integer;
procedure SetRight(Value: Integer);
function GetBottom: Integer;
procedure SetBottom(Value: Integer);
function GetSize: TPointI;
function GetTopLeft: TPointI;
function GetBottomLeft: TPointI;
function GetBottomRight: TPointI;
function GetTopRight: TPointI;
function GetMidPoint: TPointI;
public
X, Y, Width, Height: Integer;
class operator Implicit(const Value: TRectI): TRect;
class operator Implicit(const Value: TRect): TRectI;
class operator Equal(const A, B: TRectI): Boolean;
class operator NotEqual(const A, B: TRectI): Boolean;
class function Create: TRectI; overload; static;
class function Create(Size: TPointI): TRectI; overload; static;
class function Create(W, H: Integer): TRectI; overload; static;
class function Create(X, Y, W, H: Integer): TRectI; overload; static;
function Equals(const Value: TRectI): Boolean;
function Contains(X, Y: Integer): Boolean; overload;
function Contains(const P: TPointI): Boolean; overload;
procedure Center(X, Y: Integer); overload;
procedure Center(const P: TPointI); overload;
procedure Inflate(X, Y: Integer); overload;
procedure Inflate(const P: TPointI); overload;
procedure Offset(X, Y: Integer); overload;
procedure Offset(const P: TPointI); overload;
property Empty: Boolean read GetEmpty;
property Left: Integer read X write SetLeft;
property Top: Integer read Y write SetTop;
property Right: Integer read GetRight write SetRight;
property Bottom: Integer read GetBottom write SetBottom;
property Size: TPointI read GetSize;
property TopLeft: TPointI read GetTopLeft;
property BottomLeft: TPointI read GetBottomLeft;
property BottomRight: TPointI read GetBottomRight;
property TopRight: TPointI read GetTopRight;
property MidPoint: TPointI read GetMidPoint;
end;
PRectI = ^TRectI;


TRectI can be used in any place you might normally use a TRect. It differs in that you can change the x,y location without changing the dimensions. Additionally it can be inflated, offset, moved, or centered on a TPointI. You can retrieve any of its four corners or midpoint as a TPointI, it can be hit tested/empty tested, and it can be implicitly converted to a TRectF record (a Float based record).

Are there other types like TRectI in Cross Codebot?

A: Yes, types like TRectI are pervasive in Cross Codebot. Here is a partial listing of other types which make programming with Pascal a heck of a lot easier:

TRectF
TPointI
TPointF
TColorB
TColorF
THSL (Hue, Saturation, Lightness)
TArray<T>
TArrayList<T>
TNamedValues<T>
TCompare<T>
TConvert<T, TResult>
TDelegate<T> (See http://www.codebot.org/delphi/?doc=9568)
IDelegate<T>
ICloneable<T>
StringHelper = record helper for String
IntegerHelper = record helper for Integer
FloatHelper = record helper for Float
TDateTimeHelper = record helper for TDateTime
TColorHelper = record helper for TColor
TControlHelper = class helper for TControl

And so on.

Okay so what does Cross Codebot actually do?

A: Here's an example as previously mentioned in the Free Pascal mailing list. The Cross Codebot string handling routines are blazingly fast. My TextOfMobyDick.Replace('whale', 'moby', True) string replace extension method is more than 40x faster than the built in string replacement routines.

What about visual stuff?

A: Cross Codebot implements a new advanced hardware accelerated drawing API based on a ISurface interface. This interfaces greatly simplifies access to advanced drawing techiniques.

See this link for the drawing interfaces interfaces defined:
http://www.getlazarus.org/videos/crossgraphics/

See this link for an example of the drawing interfaces at work:
http://www.getlazarus.org/forums/viewtopic.php?f=18&t=40/

What about networking stuff?

A: Cross Codebot implements new Socket networking classes, providing access to basic sockets with ssl an blocking/non-blocking modes, native http client implementation, native ftp client implementation, and native cloud storage client implementation (not currently rolled in entirely yet, but working in a side projects).

What about XML stuff?

A: Cross Codebot is a library which provides a new unified XML API based on an IDocument interface. The IFiler interface is particularly useful (See this link http://www.getlazarus.org/interfaces/xml/)

What else?

A: I haven't even mentioned mention the animations units, geometry units, cryptography units. There is a bunch more Cross Codebot does, it is a port of my old, but popular until I removed it, Delphi control library previously located here: http://www.codebot.org/delphi/

The old library contains nearly 180 controls now, and I plan to slowly port many of them to this new Cross Codebot library (minus the ones which are hopelessly tied to Win32).

Okay how do I get the Cross Codebot sources?

A: The Cross Codebot sources are hosted on github in this repository.

How do I add Cross Codebot to my projects?

A: The easiest way is to drop a codebot component on a form, but if you want to add a codebot reference manually follow these steps. Add the codebot package to your program requirements using the project inspector.



Then add any codebot units to your uses clauses. For example you can add Codebot.Graphics, Codebot.Graphics.Types to your uses.

Return to “Cross Codebot”

Who is online

Users browsing this forum: No registered users and 2 guests

cron