GH Freebrary is a general purpose class library for modern versions of Delphi. This is a beta version, all units compile in Delphi XE7.
Pascal
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
GHF.ClassList.pas
GHF.Component.pas
GHF.ControlledObserver.pas
GHF.CustomAttr.pas
GHF.CustomEnumerator.pas
GHF.CustomRetrieve.pas
GHF.Design.PersistentListCountProp.pas
GHF.Design.PersistentListDesigner.pas
GHF.Design.PersistentListItemProp.pas
GHF.Design.PersistentListProp.pas
GHF.Design.pas
GHF.Design.res
GHF.Dic.pas
GHF.ENLang.pas
GHF.FDConnection.pas
GHF.Form.pas
GHF.InterfacedObj.pas
GHF.InterfacedSingleton.pas
GHF.KeyRetrieve.pas
GHF.Lang.pas
GHF.LatinScriptLang.pas
GHF.List.pas
GHF.ListDic.pas
GHF.MutableObjExt.pas
GHF.ObjExt.pas
GHF.ObjList.pas
GHF.Obs.pas
GHF.ObsEx.pas
GHF.Observer.pas
GHF.OpenXMLPart.pas
GHF.OpenXMLRels.pas
GHF.OpenXMLSpreadsheet.pas
GHF.OpenXMLSpreadsheetStrs.pas
GHF.OwnedCollection.pas
GHF.Persistent.pas
GHF.PersistentList.pas
GHF.RTTI.pas
GHF.RTTIInstanceType.pas
GHF.SQL.pas
GHF.Singleton.pas
GHF.StrList.pas
GHF.Sys.pas
GHF.SysEx.pas
GHF.TypeListDic.pas
GHF.VCL.pas
GHF.VCLObjList.pas
GHF.Win.pas
GHF.XMLDoc.pas
License.txt
README.md

README.md

GH Freebrary

GH Freebrary is a general purpose class library for modern versions of Delphi. This is a beta release, all units compile in Delphi XE7.

Compare the following two code blocks (the first one borrowed from stackoverflow.com).

(1) A method to get a hypothetical DisplayLabel RTTI attribute of a given class, NOT using GH Freebrary:

implementation

uses
  Rtti;

class function TArtifactInspector.DisplayLabelFor(AClass: TClass): string;
var
  RttiContext: TRttiContext;
  RttiType: TRttiType;
  Attribute: TCustomAttribute;
begin
  RttiContext := TRttiContext.Create;
  try
    RttiType := RttiContext.GetType(AClass);
    for Attribute in RttiType.GetAttributes do
      if Attribute is DisplayLabelAttribute then
        Exit(DisplayLabelAttribute(Attribute).Text);
    Result := '';
  finally
    RttiContext.Free;
  end;
end;

(2) Same method using GH Freebrary:

implementation

uses
  GHF.SysEx, GHF.RTTI;

class function TArtifactInspector.DisplayLabelFor(AClass: TClass): string;
var
  Attribute: DisplayLabelAttribute;
begin
  if AClass.ghClassInfo.ghGetAttr<DisplayLabelAttribute>(Attribute) then
    Result := Attribute.Text
  else
    Result := '';
end;

When I was 16 years old, Professor De Lira revealed to me that in Turbo Pascal there was a file type called unit. Since then I write .pas code that aims to make life easier. And I still feel the same emotion when I see the results!

Use GHF if you agree that most of the code written for a complex software solution should be located below the layer that such a solution represents, not inside it.

Any suggestions or contributions will be greatly appreciated.

Al Gonzalez.