{"id":21027974,"url":"https://github.com/jcmoraisjr/jcore","last_synced_at":"2025-10-10T22:17:07.009Z","repository":{"id":6169685,"uuid":"7399502","full_name":"jcmoraisjr/jcore","owner":"jcmoraisjr","description":"Some FPC classes and frameworks I have implemented so far","archived":false,"fork":false,"pushed_at":"2018-11-24T19:19:28.000Z","size":726,"stargazers_count":28,"open_issues_count":2,"forks_count":5,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-10T22:17:02.790Z","etag":null,"topics":["freepascal"],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcmoraisjr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license/LGPL.2.1.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-01T22:09:18.000Z","updated_at":"2025-09-04T19:12:02.000Z","dependencies_parsed_at":"2022-09-16T07:21:34.731Z","dependency_job_id":null,"html_url":"https://github.com/jcmoraisjr/jcore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jcmoraisjr/jcore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmoraisjr%2Fjcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmoraisjr%2Fjcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmoraisjr%2Fjcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmoraisjr%2Fjcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcmoraisjr","download_url":"https://codeload.github.com/jcmoraisjr/jcore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmoraisjr%2Fjcore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005466,"owners_count":26083900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freepascal"],"created_at":"2024-11-19T11:53:17.576Z","updated_at":"2025-10-10T22:17:06.977Z","avatar_url":"https://github.com/jcmoraisjr.png","language":"Pascal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JCore\n\nSome classes and frameworks I have implemented so far.\n\n* OPF\n* Dependency Injection Container\n* Expression Parser\n\n## OPF\n\nFeatures being implemented:\n\n* Entities inherits from TObject and declares native data types\n* Support of any data type, registering new data mediators for unsupported PTypeInfos\n* Auto and manual mapping (object \u003c-\u003e storage mechanism)\n* Auto and manual model (class infos; metadata)\n* Native drivers -- mapping straight to database: no mediators or conversions\n* Bulk retrieve -- instantiate lots of objects with one query\n* Lazy loading -- load objects or attributes only on demand\n* TDD -- test driven development\n* Lazarus wizards for manual mappings, manual model and persistence configuration\n* API docs\n\nThere are some docs [here](http://pressobjects.github.io/jcore-api/docs/api/0.4/).\n\nSome missing pieces before stabilize 0.4:\n\n* Support of native data types\n* Manual transactions\n* Criteria improvement\n\n## Dependency Injection Container\n\nClasses which help you separate specifications from implementations, as well as give you the hability to override default implementation from a framework with your own classes.\n\n* Declare your specification using interfaces\n* Register at least one implementation\n* Inject an implementation\n* Support of qualifiers\n\nSamples:\n\n    TJCoreDIC.Register(IYourIntf, TYourImpl, jdsApplication);\n    ...\n    TJCoreDIC.Locate(IYourIntf, VAnIntfVar);\n\nUsing qualifier:\n\n    TJCoreDIC.Register(IPayment, ‘cash’, TCashPayment, jdsApplication);\n    TJCoreDIC.Register(IPayment, ‘plastic’, TPlasticPayment, jdsApplication);\n    TJCoreDIC.Register(IPayment, ‘paypal’, TPaypalPayment, jdsApplication);\n    ...\n    TJCoreDIC.Locate(IPayment, ‘paypal’, VPayment);\n\n## Expression Parser\n\nAn expression parser with an extensible function and operation library as well as support to variables.\n\nThe library is as fast as it can be: when the formula is changed, it is parsed in order to create an array with all operations, in the correct order. All results are referenced and reused without moves and copies. Point to pointers.\n\nA simple calc:\n\n    VExpression := TJCoreExpression.Create('2+2');\n    try\n      writeln(VExpression.VarValue);\n    finally\n      FreeAndNil(VExpression);\n    end;\n\nUsing vars:\n\n    VExpression := TJCoreExpression.Create;\n    try\n      VExpression.Vars.Variable['x'] := 2;\n      VExpression.ParseExpression('2+x');\n      writeln(VExpression.VarValue);\n      VExpression.Vars.Variable['x'] := 4;\n      writeln(VExpression.VarValue);\n    finally\n      FreeAndNil(VExpression);\n    end;\n\nUser defined function:\n\n    TSinFunction = class(TJCoreExpressionFunction)\n    public\n      function MaxParams: Integer; override;\n      function MinParams: Integer; override;\n      class function Name: string; override;\n      procedure VarCalc; override;\n    end;\n\n    function TSinFunction.MaxParams: Integer;\n    begin\n      Result := 1;\n    end;\n\n    function TSinFunction.MinParams: Integer;\n    begin\n      Result := 1;\n    end;\n\n    class function TSinFunction.Name: string;\n    begin\n      Result := 'sin';\n    end;\n\n    procedure TSinFunction.VarCalc;\n    begin\n      Res^ := Sin(Params[0]^);\n    end;\n\n    begin\n      JCoreExpressionLibrary.RegisterFunctions([TSinFunction]);\n      VExpression := TJCoreExpression.Create('sin(30)');\n      try\n        writeln(VExpression.VarValue);\n      finally\n        FreeAndNil(VExpression);\n      end;\n    end;\n\nUser defined operation:\n\n    TModOperation = class(TJCoreExpressionOperation)\n    protected\n      class function InternalOperatorToken: string; override;\n    public\n      function Priority: Byte; override;\n      procedure VarCalc; override;\n    end;\n\n    class function TModOperation.InternalOperatorToken: string;\n    begin\n      Result := 'mod';\n    end;\n\n    function TModOperation.Priority: Byte;\n    begin\n      Result := 15;\n    end;\n\n    procedure TModOperation.VarCalc;\n    begin\n      Res^ := Val1^ mod Val2^;\n    end;\n\n    begin\n      JCoreExpressionLibrary.RegisterOperations([TModOperation]);\n      VExpression := TJCoreExpression.Create('3 mod 1');\n      try\n        writeln(VExpression.VarValue);\n      finally\n        FreeAndNil(VExpression);\n      end;\n    end;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcmoraisjr%2Fjcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcmoraisjr%2Fjcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcmoraisjr%2Fjcore/lists"}