├── test ├── ROTests.res ├── uTEmailAddressTest.pas ├── uTIfTest.pas ├── uTDateTest.pas ├── uTZipStringTest.pas ├── uTClipboardTest.pas ├── uTMBReferenceTest.pas ├── uTRandomKeyTest.pas ├── uTTripletTest.pas ├── uTStringMaskTest.pas ├── uTCheckedValueTest.pas ├── uTIntegerListTest.pas ├── uTNextAlphaNumberTest.pas ├── uTBase64Test.pas ├── uTAES128Test.pas ├── uPTVATNumberTest.pas ├── uTCSVStringTest.pas ├── uTByteSequenceTest.pas ├── ROFMXTests.dpr ├── uTCryptStringTest.pas ├── uTXPathTest.pas ├── uTGeoCoordinateTest.pas └── uTCaseTest.pas ├── src ├── Intf │ ├── RO.IMaybe.pas │ ├── RO.VCL.IColor.pas │ ├── RO.IIf.pas │ ├── RO.IZDate.pas │ ├── RO.IRandomKey.pas │ ├── RO.ISMS.pas │ ├── RO.IMBReference.pas │ ├── RO.IStringMask.pas │ ├── RO.ISoapRequest.pas │ ├── RO.IURL.pas │ ├── RO.IPostalCode.pas │ ├── RO.IVATNumber.pas │ ├── RO.VCL.IIcon.pas │ ├── RO.IEmailAddress.pas │ ├── RO.IClipboard.pas │ ├── RO.IRSASignature.pas │ ├── RO.VCL.IBitmap.pas │ ├── RO.IShiftKeys.pas │ ├── RO.ICSVString.pas │ ├── RO.ITimer.pas │ ├── RO.ICryptString.pas │ ├── RO.ICheckedValue.pas │ ├── RO.IByteSequence.pas │ ├── RO.IDate.pas │ ├── RO.IGeoCoordinate.pas │ ├── RO.ISNTPTime.pas │ ├── RO.IHideable.pas │ ├── RO.IXPath.pas │ ├── RO.ICertificate.pas │ ├── RO.INetworkNode.pas │ ├── RO.ICurrency.pas │ ├── RO.IResource.pas │ ├── RO.IStringList.pas │ ├── RO.ICOMPort.pas │ ├── RO.IMatrix.pas │ ├── RO.IScale.pas │ ├── RO.ICase.pas │ ├── RO.IFile.pas │ ├── RO.IDataStream.pas │ ├── RO.IStringStat.pas │ ├── RO.IPostalAddress.pas │ ├── RO.IDisplay.pas │ ├── RO.IRange.pas │ ├── RO.IShell.pas │ ├── RO.IPrinters.pas │ ├── RO.IFactory.pas │ ├── RO.ISliderMenu.pas │ ├── RO.IEnum.pas │ ├── RO.Android.ISMSReport.pas │ └── RO.IValue.pas ├── Factory │ ├── RO.Factory.THexColor.pas │ ├── RO.Factory.TCSVString.pas │ ├── RO.Factory.DBUniImpl.pas │ ├── RO.Factory.TCryptString.pas │ └── RO.Factory.DBGenericImpl.pas ├── SSI │ ├── RO.TUUID.pas │ ├── RO.TMaybe.pas │ ├── RO.TBase64File.pas │ ├── RO.TTriplet.pas │ ├── RO.Helpers.pas │ └── RO.TIf.pas ├── VCL │ ├── RO.VCL.THexColor.pas │ └── RO.VCL.Ext.TPanel.pas └── FMX │ ├── RO.FMX.TLightBox.pas │ └── RO.FMX.TClipboard.pas ├── pkg ├── ReusableAndroidObjects.dpk ├── ReusableFMXObjects.dpk ├── ReusableDBObjects.dpk └── ReusableVCLObjects.dpk ├── .gitignore └── UnitDisclaimer.txt /test/ROTests.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nunopicado/Reusable-Objects/HEAD/test/ROTests.res -------------------------------------------------------------------------------- /test/uTEmailAddressTest.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nunopicado/Reusable-Objects/HEAD/test/uTEmailAddressTest.pas -------------------------------------------------------------------------------- /src/Intf/RO.IMaybe.pas: -------------------------------------------------------------------------------- 1 | unit RO.IMaybe; 2 | 3 | interface 4 | 5 | type 6 | IMaybe = interface(IInvokable) 7 | ['{C584761B-78F3-42CC-86AF-DA3EC4978D6E}'] 8 | function Value: T; 9 | function IsSet: Boolean; 10 | end; 11 | 12 | implementation 13 | 14 | end. 15 | -------------------------------------------------------------------------------- /src/Intf/RO.VCL.IColor.pas: -------------------------------------------------------------------------------- 1 | unit RO.VCL.IColor; 2 | 3 | interface 4 | 5 | uses 6 | Graphics 7 | ; 8 | 9 | type 10 | IColor = interface(IInvokable) 11 | ['{D7B2C6A2-C54B-4E6C-9291-072D9AEFA5F8}'] 12 | function AsTColor: TColor; 13 | end; 14 | 15 | implementation 16 | 17 | end. 18 | -------------------------------------------------------------------------------- /src/Factory/RO.Factory.THexColor.pas: -------------------------------------------------------------------------------- 1 | unit RO.Factory.THexColor; 2 | 3 | interface 4 | 5 | uses 6 | RO.VCL.IColor 7 | ; 8 | 9 | type 10 | IHexColorFactory = interface(IInvokable) 11 | ['{027D050D-2D9C-460E-BAC6-B4B8E0BB8F21}'] 12 | function New(const Color: string): IColor; 13 | end; 14 | 15 | implementation 16 | 17 | uses 18 | RO.VCL.THexColor 19 | , Spring.Container 20 | ; 21 | 22 | initialization 23 | GlobalContainer 24 | .RegisterType('THexColor') 25 | .Implements; 26 | GlobalContainer 27 | .RegisterType 28 | .AsFactory; 29 | 30 | end. 31 | -------------------------------------------------------------------------------- /src/Factory/RO.Factory.TCSVString.pas: -------------------------------------------------------------------------------- 1 | unit RO.Factory.TCSVString; 2 | 3 | interface 4 | 5 | uses 6 | RO.ICSVString 7 | ; 8 | 9 | type 10 | ICSVStringFactory = interface(IInvokable) 11 | ['{4B0630D1-1F19-4F32-BB4E-1CC6B56600C2}'] 12 | function New(const CSVString: string; const Delimiter: Char): ICSVString; overload; 13 | function New(const CSVString: string): ICSVString; overload; 14 | end; 15 | 16 | implementation 17 | 18 | uses 19 | RO.TCSVString 20 | , Spring.Container 21 | ; 22 | 23 | initialization 24 | GlobalContainer 25 | .RegisterType('TCSVString') 26 | .Implements; 27 | GlobalContainer 28 | .RegisterType 29 | .AsFactory; 30 | 31 | end. 32 | -------------------------------------------------------------------------------- /src/Factory/RO.Factory.DBUniImpl.pas: -------------------------------------------------------------------------------- 1 | unit RO.Factory.DBUniImpl; 2 | 3 | interface 4 | 5 | uses 6 | RO.DBConnectionIntf 7 | ; 8 | 9 | type 10 | IDatabaseFactory = interface(IInvokable) 11 | ['{E3813801-C68F-4F80-8081-ACC658A26A3B}'] 12 | function New(const ServerInfo: IServerInfo): IDatabase; 13 | end; 14 | 15 | implementation 16 | 17 | uses 18 | RO.DBUniImpl 19 | , Spring.Container 20 | ; 21 | 22 | initialization 23 | GlobalContainer 24 | .RegisterType('TDatabase') 25 | .Implements 26 | .AsSingletonPerThread; 27 | GlobalContainer 28 | .RegisterType 29 | .AsFactory; 30 | 31 | finalization 32 | GlobalContainer 33 | .Resolve.Disconnect; 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /src/Factory/RO.Factory.TCryptString.pas: -------------------------------------------------------------------------------- 1 | unit RO.Factory.TCryptString; 2 | 3 | interface 4 | 5 | uses 6 | RO.ICryptString 7 | , RO.IValue 8 | ; 9 | 10 | type 11 | ICryptStringFactory = interface(IInvokable) 12 | ['{7700A319-F560-42CC-B10F-E703BB791E89}'] 13 | function New(const Text: IAnsiString): ICryptString; overload; 14 | function New(const Text, Password: IAnsiString): ICryptString; overload; 15 | end; 16 | 17 | implementation 18 | 19 | uses 20 | RO.TCryptString 21 | , Spring.Container 22 | ; 23 | 24 | initialization 25 | GlobalContainer 26 | .RegisterType('TCryptString') 27 | .Implements; 28 | GlobalContainer 29 | .RegisterType 30 | .AsFactory; 31 | 32 | end. 33 | -------------------------------------------------------------------------------- /test/uTIfTest.pas: -------------------------------------------------------------------------------- 1 | unit uTIfTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TIfTest = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('True 1','True,1,1,1')] 13 | [TestCase('False 1','False,1,2,2')] 14 | procedure EvalTest(const Condition: Boolean; const v1, v2, Expected: Integer); 15 | end; 16 | 17 | implementation 18 | 19 | uses 20 | RO.TIf 21 | ; 22 | 23 | { TIfTest } 24 | 25 | procedure TIfTest.EvalTest(const Condition: Boolean; const v1, v2, Expected: Integer); 26 | begin 27 | Assert.AreEqual( 28 | Expected, 29 | TIf.New( 30 | Condition, 31 | v1, 32 | v2 33 | ).Eval 34 | ); 35 | end; 36 | 37 | initialization 38 | TDUnitX.RegisterTestFixture(TIfTest); 39 | end. 40 | -------------------------------------------------------------------------------- /test/uTDateTest.pas: -------------------------------------------------------------------------------- 1 | unit uTDateTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TFullDateTimeTest = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('FullDateTimeAsString 1', '2018-01-02 12:10:15')] 13 | [TestCase('FullDateTimeAsString 2', '2018-01-02 12:23:48')] 14 | procedure FullDateTimeAsStringTest(const FullDate: string); 15 | end; 16 | 17 | implementation 18 | 19 | uses 20 | RO.TDate 21 | ; 22 | 23 | { TFullDateTimeTest } 24 | 25 | procedure TFullDateTimeTest.FullDateTimeAsStringTest(const FullDate: string); 26 | begin 27 | Assert.AreEqual( 28 | FullDate, 29 | TFullDateTime.New( 30 | TDate.New(FullDate) 31 | ).AsString 32 | ); 33 | end; 34 | 35 | initialization 36 | TDUnitX.RegisterTestFixture(TFullDateTimeTest); 37 | end. 38 | 39 | 40 | -------------------------------------------------------------------------------- /test/uTZipStringTest.pas: -------------------------------------------------------------------------------- 1 | unit uTZipStringTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TZipStringTest = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('ZipString 1','AAAA')] 13 | [TestCase('ZipString 2','1234')] 14 | procedure ZipStringTest(const AString: string); 15 | end; 16 | 17 | implementation 18 | 19 | uses 20 | RO.TZipString 21 | , RO.TValue 22 | ; 23 | 24 | { TZipStringTest } 25 | 26 | procedure TZipStringTest.ZipStringTest(const AString: string); 27 | begin 28 | Assert.AreEqual( 29 | AString, 30 | TUnzipString.New( 31 | TString.New( 32 | TZipString.New( 33 | TString.New(AString) 34 | ).Value 35 | ) 36 | ).Value 37 | ); 38 | end; 39 | 40 | initialization 41 | TDUnitX.RegisterTestFixture(TZipStringTest); 42 | end. 43 | -------------------------------------------------------------------------------- /test/uTClipboardTest.pas: -------------------------------------------------------------------------------- 1 | unit uTClipboardTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework, 6 | RO.FMX.TClipboard; 7 | 8 | type 9 | [TestFixture] 10 | TClipboardTest = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('Valid 1','123456,123456,True')] 14 | [TestCase('Valid 2','ABCDEF,ABCDEF,True')] 15 | [TestCase('Invalid 1','123456,654321,False')] 16 | [TestCase('Invalid 2','ABCDEF,FEDCBA,False')] 17 | procedure Validation(const Copied, Pasted: string; const Expected: Boolean); 18 | end; 19 | 20 | implementation 21 | 22 | { TPTVATNumberTest } 23 | 24 | procedure TClipboardTest.Validation(const Copied, Pasted: string; const Expected: Boolean); 25 | begin 26 | Assert.AreEqual( 27 | Expected, 28 | Pasted = TClipboard.New.Copy(Copied).Paste 29 | ); 30 | end; 31 | 32 | initialization 33 | TDUnitX.RegisterTestFixture(TClipboardTest); 34 | end. 35 | -------------------------------------------------------------------------------- /test/uTMBReferenceTest.pas: -------------------------------------------------------------------------------- 1 | unit uTMBReferenceTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework 6 | , RO.TMBReference 7 | ; 8 | 9 | type 10 | [TestFixture] 11 | TMBReferenceTest = class(TObject) 12 | public 13 | [Test] 14 | [TestCase('Test1','999123490,11604,9991234,25.86')] 15 | [TestCase('Test2','760564966,11364,7605649,51.92')] 16 | procedure AsStringTest(const Expected: string; const Entity: Integer; const ID: Int64; const Value: Currency); 17 | end; 18 | 19 | implementation 20 | 21 | uses 22 | RO.TValue 23 | ; 24 | 25 | procedure TMBReferenceTest.AsStringTest(const Expected: string; const Entity: Integer; const ID: Int64; const Value: Currency); 26 | begin 27 | Assert.AreEqual( 28 | Expected, 29 | TMBReference.New( 30 | Entity, 31 | ID, 32 | Value 33 | ).AsString 34 | ); 35 | end; 36 | 37 | initialization 38 | TDUnitX.RegisterTestFixture(TMBReferenceTest); 39 | end. 40 | -------------------------------------------------------------------------------- /test/uTRandomKeyTest.pas: -------------------------------------------------------------------------------- 1 | unit uTRandomKeyTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TRandomKeyTest = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('Random Key 1','1')] 13 | [TestCase('Random Key 2','2')] 14 | [TestCase('Random Key 4','4')] 15 | [TestCase('Random Key 8','8')] 16 | [TestCase('Random Key 16','16')] 17 | [TestCase('Random Key 32','32')] 18 | [TestCase('Random Key 64','64')] 19 | [TestCase('Random Key 128','128')] 20 | procedure RandomKeyTest(const KeySize: Byte); 21 | end; 22 | 23 | implementation 24 | 25 | uses 26 | RO.TRandomKey 27 | ; 28 | 29 | { TRandomKeyTest } 30 | 31 | procedure TRandomKeyTest.RandomKeyTest(const KeySize: Byte); 32 | begin 33 | Assert.AreEqual( 34 | KeySize, 35 | Length(TRandomKey.New(KeySize).AsString) 36 | ); 37 | end; 38 | 39 | initialization 40 | TDUnitX.RegisterTestFixture(TRandomKeyTest); 41 | end. 42 | -------------------------------------------------------------------------------- /test/uTTripletTest.pas: -------------------------------------------------------------------------------- 1 | unit uTTripletTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | 9 | [TestFixture] 10 | TTripletTest = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('TTriplet 1', 'False,False,False')] 14 | [TestCase('TTriplet 2', 'True,False,False')] 15 | [TestCase('TTriplet 3', 'False,True,False')] 16 | [TestCase('TTriplet 4', 'True,True,True')] 17 | procedure TripletTest(const Key, Value, Flag: Boolean); 18 | end; 19 | 20 | implementation 21 | 22 | uses 23 | RO.TTriplet 24 | ; 25 | 26 | { TTripletTest } 27 | 28 | procedure TTripletTest.TripletTest(const Key, Value, Flag: Boolean); 29 | var 30 | Triplet: TTriplet; 31 | begin 32 | Triplet := TTriplet.Create(Key, Value, Flag); 33 | Assert.AreEqual( 34 | Triplet.Flag, 35 | Triplet.Key and Triplet.Value 36 | ); 37 | end; 38 | 39 | initialization 40 | TDUnitX.RegisterTestFixture(TTripletTest); 41 | end. 42 | -------------------------------------------------------------------------------- /pkg/ReusableAndroidObjects.dpk: -------------------------------------------------------------------------------- 1 | package ReusableAndroidObjects; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$IMPLICITBUILD ON} 29 | 30 | requires 31 | rtl; 32 | 33 | contains 34 | RO.ISMS in '..\src\Intf\RO.ISMS.pas', 35 | RO.Android.TSMS in '..\src\Android\RO.Android.TSMS.pas', 36 | RO.Android.ISMSReport in '..\src\Intf\RO.Android.ISMSReport.pas', 37 | RO.Android.TSMSReport in '..\src\Android\RO.Android.TSMSReport.pas'; 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /test/uTStringMaskTest.pas: -------------------------------------------------------------------------------- 1 | unit uTStringMaskTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework 6 | , RO.TStringMask 7 | ; 8 | 9 | type 10 | [TestFixture] 11 | TStringMaskTest = class(TObject) 12 | public 13 | [Test] 14 | [TestCase('TStringMask 1', 'XX##X##X,12345678,3467')] 15 | [TestCase('TStringMask 2', '***--,ABCDE,ABC')] 16 | [TestCase('TStringMask 3', 'YNYNYN,ABCDEF,ACE')] 17 | [TestCase('TStringMask 4', '--++++--,12345678,3456')] 18 | [TestCase('TStringMask 5', '+++++,ABCDEFGHIH,ABCDE')] 19 | [TestCase('TStringMask 6', '--,ABCDE,')] 20 | procedure ParseTest(const Mask, Str, Expected: string); 21 | end; 22 | 23 | implementation 24 | 25 | 26 | { TStringMaskTest } 27 | 28 | procedure TStringMaskTest.ParseTest(const Mask, Str, Expected: string); 29 | begin 30 | Assert.AreEqual( 31 | Expected, 32 | TStringMask.New(Mask) 33 | .Parse(Str) 34 | ); 35 | end; 36 | 37 | initialization 38 | TDUnitX.RegisterTestFixture(TStringMaskTest); 39 | end. 40 | -------------------------------------------------------------------------------- /src/SSI/RO.TUUID.pas: -------------------------------------------------------------------------------- 1 | unit RO.TUUID; 2 | 3 | interface 4 | 5 | uses 6 | RO.IValue 7 | , SysUtils 8 | ; 9 | 10 | type 11 | TUUID = class(TInterfacedObject, IString) 12 | private 13 | FGUID: IValue; 14 | public 15 | constructor Create; reintroduce; 16 | class function New: IString; 17 | function Value: string; 18 | function Refresh: IString; 19 | end; 20 | 21 | implementation 22 | 23 | uses 24 | RO.TValue 25 | ; 26 | 27 | { TUUID } 28 | 29 | constructor TUUID.Create; 30 | begin 31 | FGUID := TValue.New( 32 | function : TGUID 33 | begin 34 | CreateGUID(Result); 35 | end 36 | ); 37 | end; 38 | 39 | class function TUUID.New: IString; 40 | begin 41 | Result := Create; 42 | end; 43 | 44 | function TUUID.Refresh: IString; 45 | begin 46 | Result := Self; 47 | FGUID.Refresh; 48 | end; 49 | 50 | function TUUID.Value: string; 51 | begin 52 | Result := 53 | GUIDToString(FGUID.Value) 54 | .Replace('{', '') 55 | .Replace('}', ''); 56 | end; 57 | 58 | end. 59 | -------------------------------------------------------------------------------- /test/uTCheckedValueTest.pas: -------------------------------------------------------------------------------- 1 | unit uTCheckedValueTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TCheckedValueTest = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('Checked 1','Checked,True')] 13 | [TestCase('Checked 2','Unchecked,False')] 14 | procedure CheckedTest(const Value: string; const Checked: Boolean); 15 | [Swap] 16 | [TestCase('Checked 1','Unchecked,True')] 17 | [TestCase('Checked 2','Checked,False')] 18 | procedure SwapTest(const Value: string; const Checked: Boolean); 19 | end; 20 | 21 | implementation 22 | 23 | uses 24 | RO.TCheckedValue 25 | ; 26 | 27 | { TCheckedValueTest } 28 | 29 | procedure TCheckedValueTest.CheckedTest(const Value: string; 30 | const Checked: Boolean); 31 | begin 32 | Assert.AreEqual( 33 | Checked, 34 | TCheckedValue.New( 35 | Value, 36 | Checked 37 | ) 38 | .Checked 39 | ); 40 | end; 41 | 42 | procedure TCheckedValueTest.SwapTest(const Value: string; 43 | const Checked: Boolean); 44 | begin 45 | Assert.AreEqual( 46 | not Checked, 47 | TCheckedValue.New( 48 | Value, 49 | Checked 50 | ) 51 | .Swap 52 | .Checked 53 | ); 54 | end; 55 | 56 | initialization 57 | TDUnitX.RegisterTestFixture(TCheckedValueTest); 58 | end. 59 | -------------------------------------------------------------------------------- /pkg/ReusableFMXObjects.dpk: -------------------------------------------------------------------------------- 1 | package ReusableFMXObjects; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$IMPLICITBUILD ON} 29 | 30 | requires 31 | rtl, 32 | fmx; 33 | 34 | contains 35 | FMX.Ani.Ext in '..\src\FMX\FMX.Ani.Ext.pas', 36 | FMX.StdCtrls.Ext in '..\src\FMX\FMX.StdCtrls.Ext.pas', 37 | RO.FMX.TClipboard in '..\src\FMX\RO.FMX.TClipboard.pas', 38 | RO.FMX.TLightBox in '..\src\FMX\RO.FMX.TLightBox.pas', 39 | RO.FMX.TShadowRectangle in '..\src\FMX\RO.FMX.TShadowRectangle.pas', 40 | RO.FMX.TSliderMsg in '..\src\FMX\RO.FMX.TSliderMsg.pas', 41 | RO.IClipboard in '..\src\Intf\RO.IClipboard.pas', 42 | RO.IHideable in '..\src\Intf\RO.IHideable.pas', 43 | RO.FMX.TSliderMenu in '..\src\FMX\RO.FMX.TSliderMenu.pas', 44 | RO.ISliderMenu in '..\src\Intf\RO.ISliderMenu.pas'; 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/SSI/RO.TMaybe.pas: -------------------------------------------------------------------------------- 1 | unit RO.TMaybe; 2 | 3 | interface 4 | 5 | uses 6 | RO.IMaybe 7 | , RO.IValue 8 | ; 9 | 10 | type 11 | TMaybe = class(TInterfacedObject, IMaybe) 12 | private 13 | FValue : T; 14 | FSet : Boolean; 15 | public 16 | constructor Create; overload; 17 | constructor Create(const Value: T; const Condition: Boolean = True); overload; 18 | class function New: IMaybe; overload; 19 | class function New(const Value: T; const Condition: Boolean = True): IMaybe; overload; 20 | function IsSet: Boolean; 21 | function Value: T; 22 | end; 23 | 24 | implementation 25 | 26 | uses 27 | RO.TValue 28 | ; 29 | 30 | { TMaybe } 31 | 32 | constructor TMaybe.Create; 33 | begin 34 | FSet := False; 35 | end; 36 | 37 | constructor TMaybe.Create(const Value: T; const Condition: Boolean = True); 38 | begin 39 | FSet := Condition; 40 | if FSet 41 | then FValue := Value; 42 | end; 43 | 44 | function TMaybe.IsSet: Boolean; 45 | begin 46 | Result := FSet; 47 | end; 48 | 49 | class function TMaybe.New: IMaybe; 50 | begin 51 | Result := Create; 52 | end; 53 | 54 | class function TMaybe.New(const Value: T; const Condition: Boolean): IMaybe; 55 | begin 56 | Result := Create(Value, Condition); 57 | end; 58 | 59 | function TMaybe.Value: T; 60 | begin 61 | Result := FValue; 62 | end; 63 | 64 | end. 65 | -------------------------------------------------------------------------------- /test/uTIntegerListTest.pas: -------------------------------------------------------------------------------- 1 | unit uTIntegerListTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | 9 | [TestFixture] 10 | TIntegerListTest = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('IntegerList 1', '1,2,10,10')] 14 | [TestCase('IntegerList 2', '1,3,10,19')] 15 | procedure IntegerListStepXTest(const FirstValue, SecondValue, ElementCount, LastValue: Integer); 16 | [Test] 17 | [TestCase('IntegerList 3', '1,10,10')] 18 | procedure IntegerListStep1Test(const FirstValue, ElementCount, LastValue: Integer); 19 | end; 20 | 21 | implementation 22 | 23 | uses 24 | RO.TIntegerList 25 | ; 26 | 27 | { TIntegerListTest } 28 | 29 | procedure TIntegerListTest.IntegerListStep1Test(const FirstValue, ElementCount, LastValue: Integer); 30 | begin 31 | Assert.AreEqual( 32 | LastValue, 33 | TIntegerList.New( 34 | FirstValue, 35 | ElementCount 36 | ) 37 | .Last 38 | ); 39 | end; 40 | 41 | procedure TIntegerListTest.IntegerListStepXTest(const FirstValue, SecondValue, ElementCount, LastValue: Integer); 42 | begin 43 | Assert.AreEqual( 44 | LastValue, 45 | TIntegerList.New( 46 | FirstValue, 47 | SecondValue, 48 | ElementCount 49 | ) 50 | .Last 51 | ); 52 | end; 53 | 54 | initialization 55 | TDUnitX.RegisterTestFixture(TIntegerListTest); 56 | end. 57 | -------------------------------------------------------------------------------- /src/VCL/RO.VCL.THexColor.pas: -------------------------------------------------------------------------------- 1 | unit RO.VCL.THexColor; 2 | 3 | interface 4 | 5 | uses 6 | RO.VCL.IColor 7 | , RO.IValue 8 | , Graphics 9 | ; 10 | 11 | type 12 | THexColor = class(TInterfacedObject, IColor) 13 | private 14 | FColor: IValue; 15 | public 16 | constructor Create(const Color: string); 17 | class function New(const Color: string): IColor; 18 | function AsTColor: TColor; 19 | end; 20 | 21 | implementation 22 | 23 | uses 24 | Windows 25 | , SysUtils 26 | , RO.TValue 27 | ; 28 | 29 | { TColor } 30 | 31 | function THexColor.AsTColor: TColor; 32 | begin 33 | Result := FColor.Value; 34 | end; 35 | 36 | constructor THexColor.Create(const Color: string); 37 | begin 38 | FColor := TValue.New( 39 | function : TColor 40 | function ExtractHexValue(const HexValue: string; const Index: Byte): Integer; inline; 41 | const 42 | PartValueSize = 2; 43 | begin 44 | Result := Format('$%s', [Copy(HexValue, Index * PartValueSize - 1, PartValueSize)]).ToInteger; 45 | end; 46 | begin 47 | Result := RGB( 48 | ExtractHexValue(Color, 1), 49 | ExtractHexValue(Color, 2), 50 | ExtractHexValue(Color, 3) 51 | ); 52 | end 53 | ); 54 | end; 55 | 56 | class function THexColor.New(const Color: string): IColor; 57 | begin 58 | Result := Create(Color); 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /src/Factory/RO.Factory.DBGenericImpl.pas: -------------------------------------------------------------------------------- 1 | unit RO.Factory.DBGenericImpl; 2 | 3 | interface 4 | 5 | uses 6 | RO.DBConnectionIntf 7 | ; 8 | 9 | type 10 | ISQLStatementFactory = interface(IInvokable) 11 | ['{50297042-E69D-4AEA-B590-BF4EED66F711}'] 12 | function New(const Statement: string; const Params: TVariantArray): ISQLStatement; overload; 13 | function New(const Statement: string): ISQLStatement; overload; 14 | end; 15 | 16 | IServerInfoFactory = interface(IInvokable) 17 | ['{1068C1DE-80BE-4D8E-A690-0B78B0E4EC90}'] 18 | function New(const HostName: string; const Port: Word; const Username, Password: string; const ServerType: TServerType): IServerInfo; overload; 19 | function New(const HostName: string; const Port: Word; const Username, Password: string; const ServerType: TServerType; const Database, BinPath, UpdatePath: string): IServerInfo; overload; 20 | end; 21 | 22 | implementation 23 | 24 | uses 25 | RO.DBGenericImpl 26 | , Spring.Container 27 | ; 28 | 29 | initialization 30 | GlobalContainer 31 | .RegisterType('TSQLStatement') 32 | .Implements; 33 | GlobalContainer 34 | .RegisterType 35 | .AsFactory; 36 | GlobalContainer 37 | .RegisterType('TServerInfo') 38 | .Implements; 39 | GlobalContainer 40 | .RegisterType 41 | .AsFactory; 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /pkg/ReusableDBObjects.dpk: -------------------------------------------------------------------------------- 1 | package ReusableDBObjects; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$IMPLICITBUILD ON} 29 | 30 | requires 31 | rtl, 32 | dbrtl, 33 | ZComponent, 34 | ZDbc, 35 | ZPlain, 36 | ZCore, 37 | ZParseSql, 38 | dac230, 39 | unidac230; 40 | 41 | contains 42 | RO.DBConnectionIntf in '..\src\DB\RO.DBConnectionIntf.pas', 43 | RO.DBGenericImpl in '..\src\DB\RO.DBGenericImpl.pas', 44 | RO.DBUniImpl in '..\src\DB\RO.DBUniImpl.pas', 45 | RO.DBZImpl in '..\src\DB\RO.DBZImpl.pas', 46 | RO.IIf in '..\src\Intf\RO.IIf.pas', 47 | RO.IValue in '..\src\Intf\RO.IValue.pas', 48 | RO.TIf in '..\src\SSI\RO.TIf.pas', 49 | RO.TValue in '..\src\SSI\RO.TValue.pas', 50 | RO.Factory.DBGenericImpl in '..\src\Factory\RO.Factory.DBGenericImpl.pas', 51 | RO.Factory.DBUniImpl in '..\src\Factory\RO.Factory.DBUniImpl.pas'; 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /test/uTNextAlphaNumberTest.pas: -------------------------------------------------------------------------------- 1 | unit uTNextAlphaNumberTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | 9 | [TestFixture] 10 | TNextAlphaNumberTest = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('TNextAlphaNumber Value 1','A,B')] 14 | [TestCase('TNextAlphaNumber Value 2','C,D')] 15 | [TestCase('TNextAlphaNumber Value 3','Z,AA')] 16 | [TestCase('TNextAlphaNumber Value 4','AZ,BA')] 17 | [TestCase('TNextAlphaNumber Value 5','ZH,ZI')] 18 | [TestCase('TNextAlphaNumber Value 6','ZZ,AAA')] 19 | [TestCase('TNextAlphaNumber Value 7','AAZ,ABA')] 20 | [TestCase('TNextAlphaNumber Value 8','ZZY,ZZZ')] 21 | [TestCase('TNextAlphaNumber Value 9','ZZZ,AAAA')] 22 | procedure TNextAlphaNumberValueTest(const Current, Next: string); 23 | end; 24 | 25 | implementation 26 | 27 | uses 28 | RO.TNextAlphaNumber 29 | , RO.IValue 30 | , Delphi.Mocks 31 | , SysUtils 32 | ; 33 | 34 | { TNextAlphaNumberTest } 35 | 36 | procedure TNextAlphaNumberTest.TNextAlphaNumberValueTest(const Current, Next: string); 37 | var 38 | MockValue: TMock; 39 | begin 40 | MockValue := TMock.Create; 41 | MockValue.Setup.WillReturn(Current).When.Value; 42 | Assert.AreEqual( 43 | Next, 44 | TNextAlphaNumber.New( 45 | MockValue 46 | ).Value 47 | ); 48 | end; 49 | 50 | initialization 51 | TDUnitX.RegisterTestFixture(TNextAlphaNumberTest); 52 | end. 53 | -------------------------------------------------------------------------------- /test/uTBase64Test.pas: -------------------------------------------------------------------------------- 1 | unit uTBase64Test; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TBase64Test = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('TBase64 1', 'xpto,eHB0bw==')] 13 | [TestCase('TBase64 2', '1234,MTIzNA==')] 14 | [TestCase('TBase64 3', ',')] 15 | procedure TBase64ValueTest(const AValue, AResult: AnsiString); 16 | end; 17 | 18 | [TestFixture] 19 | TUnBase64Test = class(TObject) 20 | public 21 | [Test] 22 | [TestCase('TUnBase64 1', 'eHB0bw==,xpto')] 23 | [TestCase('TUnBase64 2', 'MTIzNA==,1234')] 24 | [TestCase('TUnBase64 3', ',')] 25 | procedure TUnBase64ValueTest(const AValue, AResult: AnsiString); 26 | end; 27 | 28 | implementation 29 | 30 | uses 31 | RO.TBase64 32 | , RO.TValue 33 | ; 34 | 35 | { TBase64Test } 36 | 37 | procedure TBase64Test.TBase64ValueTest(const AValue, AResult: AnsiString); 38 | begin 39 | Assert.AreEqual( 40 | AResult, 41 | TBase64.New( 42 | TValue.New( 43 | AValue 44 | ) 45 | ).Value 46 | ); 47 | end; 48 | 49 | { TUnBase64Test } 50 | 51 | procedure TUnBase64Test.TUnBase64ValueTest(const AValue, AResult: AnsiString); 52 | begin 53 | Assert.AreEqual( 54 | AResult, 55 | TUnBase64.New( 56 | TValue.New( 57 | AValue 58 | ) 59 | ).Value 60 | ); 61 | end; 62 | 63 | initialization 64 | TDUnitX.RegisterTestFixture(TBase64Test); 65 | end. 66 | -------------------------------------------------------------------------------- /src/SSI/RO.TBase64File.pas: -------------------------------------------------------------------------------- 1 | unit RO.TBase64File; 2 | 3 | interface 4 | 5 | uses 6 | RO.IValue 7 | ; 8 | 9 | type 10 | TBase64File = class(TInterfacedObject, IString) 11 | private 12 | FBase64: IString; 13 | public 14 | constructor Create(const FileName: string); 15 | class function New(const FileName: string): IString; 16 | function Value: string; 17 | function Refresh: IString; 18 | end; 19 | 20 | implementation 21 | 22 | uses 23 | RO.TValue 24 | , Classes 25 | , SysUtils 26 | , NetEncoding 27 | ; 28 | 29 | { TBase64File } 30 | 31 | constructor TBase64File.Create(const FileName: string); 32 | begin 33 | FBase64 := TString.New( 34 | function : string 35 | var 36 | Source: TFileStream; 37 | Target: TStringStream; 38 | begin 39 | Source := TFileStream.Create(FileName, fmOpenRead); 40 | try 41 | Target := TStringStream.Create; 42 | try 43 | TNetEncoding.Base64.Encode(Source, Target); 44 | Result := Target.DataString; 45 | finally 46 | Target.Free; 47 | end; 48 | finally 49 | Source.Free; 50 | end; 51 | end 52 | ); 53 | end; 54 | 55 | class function TBase64File.New(const FileName: string): IString; 56 | begin 57 | Result := Create(FileName); 58 | end; 59 | 60 | function TBase64File.Refresh: IString; 61 | begin 62 | Result := Self; 63 | FBase64.Refresh; 64 | end; 65 | 66 | function TBase64File.Value: string; 67 | begin 68 | Result := FBase64.Value; 69 | end; 70 | 71 | end. 72 | -------------------------------------------------------------------------------- /test/uTAES128Test.pas: -------------------------------------------------------------------------------- 1 | unit uTAES128Test; 2 | 3 | interface 4 | 5 | uses 6 | DUnitX.TestFramework; 7 | 8 | type 9 | [TestFixture] 10 | TAES128Test = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('AES128 1','1234,sbpCAISFpLu6Y7vSfAtDUg==,4798233419457937')] 14 | [TestCase('AES128 2','xpto,ta7XiWpy5Ao6rmO9kxPC8w==,5757486374927324')] 15 | procedure AES128Test(const AString, AnEncryptedString, Key: string); 16 | [Test] 17 | [TestCase('AES128 Fail 1','1234,sbpCAISFpLu6Y7vSfAtDUg==,1111,Invalid key size')] 18 | [TestCase('AES128 Fail 2',',sbpCAISFpLu6Y7vSfAtDUg==,5757486374927324,Data must not be empty')] 19 | procedure AES128FailTest(const AString, AnEncryptedString, Key, ErrorMsg: string); 20 | end; 21 | 22 | implementation 23 | 24 | uses 25 | RO.TAES128 26 | , RO.TValue 27 | , SysUtils 28 | ; 29 | 30 | { TAES128Test } 31 | 32 | procedure TAES128Test.AES128FailTest(const AString, AnEncryptedString, 33 | Key, ErrorMsg: string); 34 | begin 35 | Assert.WillRaise( 36 | procedure 37 | begin 38 | TAES128.New( 39 | TString.New(AString), 40 | Key 41 | ).Value 42 | end, 43 | Exception, 44 | ErrorMsg 45 | ); 46 | end; 47 | 48 | procedure TAES128Test.AES128Test(const AString, AnEncryptedString, Key: string); 49 | begin 50 | Assert.AreEqual( 51 | AnEncryptedString, 52 | TAES128.New( 53 | TString.New(AString), 54 | Key 55 | ).Value 56 | ); 57 | end; 58 | 59 | initialization 60 | TDUnitX.RegisterTestFixture(TAES128Test); 61 | end. 62 | -------------------------------------------------------------------------------- /test/uPTVATNumberTest.pas: -------------------------------------------------------------------------------- 1 | unit uPTVATNumberTest; 2 | 3 | interface 4 | 5 | uses 6 | DUnitX.TestFramework; 7 | 8 | type 9 | [TestFixture] 10 | TPTVATNumberTest = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('Valid 1','555555550,True')] 14 | [TestCase('Valid 2','999999990,True')] 15 | [TestCase('Valid 3','123456789,True')] 16 | [TestCase('Invalid 1','111111111,False')] 17 | [TestCase('Invalid 2','123,False')] 18 | [TestCase('Invalid 3',',False')] 19 | procedure IsValidTest(const VATNumber: string; const Expected: Boolean); 20 | [Test] 21 | [TestCase('Valid 1','555555550,555555550,True')] 22 | [TestCase('Valid 2','999999990,999999990,True')] 23 | [TestCase('Valid 3','123456789,123456789,True')] 24 | [TestCase('Invalid 1','111111111,222222222,False')] 25 | [TestCase('Invalid 2','123,321,False')] 26 | [TestCase('Invalid 3','123,abc,False')] 27 | procedure AsStringTest(const VATNumberIn, VATNumberOut: string; const Expected: Boolean); 28 | end; 29 | 30 | implementation 31 | 32 | uses 33 | RO.TPTVATNumber 34 | ; 35 | 36 | { TPTVATNumberTest } 37 | 38 | procedure TPTVATNumberTest.IsValidTest(const VATNumber: string; const Expected: Boolean); 39 | begin 40 | Assert.AreEqual( 41 | Expected, 42 | TPTVATNumber.New(VATNumber).IsValid 43 | ); 44 | end; 45 | 46 | procedure TPTVATNumberTest.AsStringTest(const VATNumberIn, VATNumberOut: string; const Expected: Boolean); 47 | begin 48 | Assert.AreEqual( 49 | Expected, 50 | VATNumberOut = TPTVATNumber.New(VATNumberIn).AsString 51 | ); 52 | end; 53 | 54 | initialization 55 | TDUnitX.RegisterTestFixture(TPTVATNumberTest); 56 | end. 57 | -------------------------------------------------------------------------------- /test/uTCSVStringTest.pas: -------------------------------------------------------------------------------- 1 | unit uTCSVStringTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | 9 | [TestFixture] 10 | TCSVStringTest = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('TCSVString.Count 1', 'A;B;C;D,4')] 14 | [TestCase('TCSVString.Count 2', 'A;B;,3')] 15 | procedure CountTest(const CSVString: string; const Count: Byte); 16 | [Test] 17 | [TestCase('TCSVString.Field 1', 'A;B;C;D,4,D')] 18 | [TestCase('TCSVString.Field 2', 'A;B;,3,')] 19 | [TestCase('TCSVString.Field 3', 'A;B;,1,A')] 20 | procedure FieldTest(const CSVString: string; const Index: Byte; const Expected: string); 21 | [Test] 22 | [TestCase('TCSVString.FieldDefault 1', 'A;;C;D,2,B')] 23 | [TestCase('TCSVString.FieldDefault 2', 'A;B;,3,C')] 24 | [TestCase('TCSVString.FieldDefault 3', 'A;B,6,F')] 25 | procedure DefaultTest(const CSVString: string; const Index: Byte; const Expected: string); 26 | end; 27 | 28 | implementation 29 | 30 | uses 31 | RO.TCSVString 32 | ; 33 | 34 | { TCSVStringTest } 35 | 36 | procedure TCSVStringTest.CountTest(const CSVString: string; const Count: Byte); 37 | begin 38 | Assert.AreEqual( 39 | Count, 40 | TCSVString.New(CSVString, ';') 41 | .Count 42 | ); 43 | end; 44 | 45 | procedure TCSVStringTest.DefaultTest(const CSVString: string; const Index: Byte; 46 | const Expected: string); 47 | begin 48 | Assert.AreEqual( 49 | Expected, 50 | TCSVString.New(CSVString, ';') 51 | .Field(Index, Expected) 52 | ); 53 | end; 54 | 55 | procedure TCSVStringTest.FieldTest(const CSVString: string; const Index: Byte; 56 | const Expected: string); 57 | begin 58 | Assert.AreEqual( 59 | Expected, 60 | TCSVString.New(CSVString, ';') 61 | .Field(Index) 62 | ); 63 | end; 64 | 65 | initialization 66 | TDUnitX.RegisterTestFixture(TCSVStringTest); 67 | end. 68 | -------------------------------------------------------------------------------- /test/uTByteSequenceTest.pas: -------------------------------------------------------------------------------- 1 | unit uTByteSequenceTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework 6 | , RO.TByteSequence 7 | ; 8 | 9 | type 10 | [TestFixture] 11 | TByteSequenceTest = class(TObject) 12 | public 13 | [Test] 14 | [TestCase('NewFromString 1','ABC,0,65')] 15 | [TestCase('NewFromString 2','ABC,1,66')] 16 | [TestCase('NewFromString 3','ABC,2,67')] 17 | procedure NewFromStringTest(const Sequence: AnsiString; const Index, Expected: Byte); 18 | [Test] 19 | [TestCase('NewFromDecimal 1','065066067,0,65')] 20 | [TestCase('NewFromDecimal 2','065066067,1,66')] 21 | [TestCase('NewFromDecimal 3','065066067,2,67')] 22 | procedure NewTest(const Sequence: AnsiString; const Index, Expected: Byte); 23 | [Test] 24 | [TestCase('AsString 1','065066067,ABC')] 25 | [TestCase('AsString 2','065066067049050051,ABC123')] 26 | procedure AsStringTest(const Sequence: AnsiString; const Expected: AnsiString); 27 | end; 28 | 29 | implementation 30 | 31 | 32 | { TByteSequenceTest } 33 | 34 | procedure TByteSequenceTest.AsStringTest(const Sequence, Expected: AnsiString); 35 | begin 36 | Assert.AreEqual( 37 | Expected, 38 | TByteSequence.NewFromDecimal( 39 | Sequence 40 | ).AsString 41 | ); 42 | end; 43 | 44 | procedure TByteSequenceTest.NewFromStringTest(const Sequence: AnsiString; const Index, Expected: Byte); 45 | begin 46 | Assert.AreEqual( 47 | Expected, 48 | TByteSequence.NewFromString(Sequence) 49 | .AsEnumerable 50 | .ElementAt(Index) 51 | ); 52 | end; 53 | 54 | procedure TByteSequenceTest.NewTest(const Sequence: AnsiString; const Index, Expected: Byte); 55 | begin 56 | Assert.AreEqual( 57 | Expected, 58 | TByteSequence.NewFromDecimal(Sequence) 59 | .AsEnumerable 60 | .ElementAt(Index) 61 | ); 62 | end; 63 | 64 | initialization 65 | TDUnitX.RegisterTestFixture(TByteSequenceTest); 66 | end. 67 | -------------------------------------------------------------------------------- /test/ROFMXTests.dpr: -------------------------------------------------------------------------------- 1 | program ROFMXTests; 2 | 3 | {$IFNDEF TESTINSIGHT} 4 | {$APPTYPE CONSOLE} 5 | {$ENDIF}{$STRONGLINKTYPES ON} 6 | uses 7 | SysUtils, 8 | {$IFDEF TESTINSIGHT} 9 | TestInsight.DUnitX, 10 | {$ENDIF } 11 | DUnitX.Loggers.Console, 12 | DUnitX.Loggers.Xml.NUnit, 13 | DUnitX.TestFramework, 14 | uTClipboardTest in 'uTClipboardTest.pas', 15 | RO.FMX.TClipboard in '..\src\FMX\RO.FMX.TClipboard.pas', 16 | RO.IClipboard in '..\src\Intf\RO.IClipboard.pas'; 17 | 18 | var 19 | runner : ITestRunner; 20 | results : IRunResults; 21 | logger : ITestLogger; 22 | nunitLogger : ITestLogger; 23 | begin 24 | {$IFDEF TESTINSIGHT} 25 | TestInsight.DUnitX.RunRegisteredTests; 26 | exit; 27 | {$ENDIF} 28 | try 29 | //Check command line options, will exit if invalid 30 | TDUnitX.CheckCommandLine; 31 | //Create the test runner 32 | runner := TDUnitX.CreateRunner; 33 | //Tell the runner to use RTTI to find Fixtures 34 | runner.UseRTTI := True; 35 | //tell the runner how we will log things 36 | //Log to the console window 37 | logger := TDUnitXConsoleLogger.Create(true); 38 | runner.AddLogger(logger); 39 | //Generate an NUnit compatible XML File 40 | nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile); 41 | runner.AddLogger(nunitLogger); 42 | runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests; 43 | 44 | //Run tests 45 | results := runner.Execute; 46 | if not results.AllPassed then 47 | System.ExitCode := EXIT_ERRORS; 48 | 49 | {$IFNDEF CI} 50 | //We don't want this happening when running under CI. 51 | if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then 52 | begin 53 | System.Write('Done.. press key to quit.'); 54 | System.Readln; 55 | end; 56 | {$ENDIF} 57 | except 58 | on E: Exception do 59 | System.Writeln(E.ClassName, ': ', E.Message); 60 | end; 61 | end. 62 | -------------------------------------------------------------------------------- /pkg/ReusableVCLObjects.dpk: -------------------------------------------------------------------------------- 1 | package ReusableVCLObjects; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$IMPLICITBUILD ON} 29 | 30 | requires 31 | rtl, 32 | vcl, 33 | vclimg, 34 | CPortLibDXE, 35 | Spring.Base, 36 | dbrtl, 37 | vcldb; 38 | 39 | contains 40 | RO.VCL.TCOMPort in '..\src\VCL\RO.VCL.TCOMPort.pas', 41 | RO.VCL.TPrinters in '..\src\VCL\RO.VCL.TPrinters.pas', 42 | RO.VCL.TTimer in '..\src\VCL\RO.VCL.TTimer.pas', 43 | RO.IIf in '..\src\Intf\RO.IIf.pas', 44 | RO.IValue in '..\src\Intf\RO.IValue.pas', 45 | RO.TIf in '..\src\SSI\RO.TIf.pas', 46 | RO.TValue in '..\src\SSI\RO.TValue.pas', 47 | RO.ICOMPort in '..\src\Intf\RO.ICOMPort.pas', 48 | RO.IPrinters in '..\src\Intf\RO.IPrinters.pas', 49 | RO.ITimer in '..\src\Intf\RO.ITimer.pas', 50 | RO.VCL.IColor in '..\src\Intf\RO.VCL.IColor.pas', 51 | RO.VCL.THexColor in '..\src\VCL\RO.VCL.THexColor.pas', 52 | RO.Factory.THexColor in '..\src\Factory\RO.Factory.THexColor.pas', 53 | RO.VCL.IBitmap in '..\src\Intf\RO.VCL.IBitmap.pas', 54 | RO.VCL.IIcon in '..\src\Intf\RO.VCL.IIcon.pas', 55 | RO.VCL.TBitmapFromFile in '..\src\VCL\RO.VCL.TBitmapFromFile.pas', 56 | RO.VCL.TIconFromBitmap in '..\src\VCL\RO.VCL.TIconFromBitmap.pas', 57 | RO.VCL.Ext.TPanel in '..\src\VCL\RO.VCL.Ext.TPanel.pas', 58 | RO.VCL.TActionClipboard in '..\src\VCL\RO.VCL.TActionClipboard.pas', 59 | RO.VCL.TMsgClipboard in '..\src\VCL\RO.VCL.TMsgClipboard.pas', 60 | RO.VCL.TRichEditText in '..\src\VCL\RO.VCL.TRichEditText.pas'; 61 | 62 | end. 63 | -------------------------------------------------------------------------------- /test/uTCryptStringTest.pas: -------------------------------------------------------------------------------- 1 | unit uTCryptStringTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TCryptStringTest = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('Encrypt Default 1','1234,HZO4ig==')] 13 | [TestCase('Encrypt Default 2','xpto,VNH/0Q==')] 14 | [TestCase('Encrypt Default 3',',')] 15 | procedure EncryptDefaultTest(const AValue, AResult: AnsiString); 16 | [Test] 17 | [TestCase('Encrypt 1','1234,bAqiPw==,abcd')] 18 | [TestCase('Encrypt 2','xpto,JUjlZA==,abcd')] 19 | [TestCase('Encrypt 3',',,abcd')] 20 | procedure EncryptTest(const AValue, AResult, AKey: AnsiString); 21 | [Test] 22 | [TestCase('Decrypt Default 1','HZO4ig==,1234')] 23 | [TestCase('Decrypt Default 2','VNH/0Q==,xpto')] 24 | [TestCase('Decrypt Default 3',',')] 25 | procedure DecryptDefaultTest(const AValue, AResult: AnsiString); 26 | [Test] 27 | [TestCase('Decrypt 1','bAqiPw==,1234,abcd')] 28 | [TestCase('Decrypt 2','JUjlZA==,xpto,abcd')] 29 | [TestCase('Decrypt 3',',')] 30 | procedure DecryptTest(const AValue, AResult, AKey: AnsiString); 31 | end; 32 | 33 | implementation 34 | 35 | uses 36 | RO.TCryptString 37 | ; 38 | 39 | { TCryptStringTest } 40 | 41 | procedure TCryptStringTest.DecryptDefaultTest(const AValue, AResult: AnsiString); 42 | begin 43 | Assert.AreEqual( 44 | AResult, 45 | TCryptString.New(AValue).Decrypt 46 | ); 47 | end; 48 | 49 | procedure TCryptStringTest.DecryptTest(const AValue, AResult, AKey: AnsiString); 50 | begin 51 | Assert.AreEqual( 52 | AResult, 53 | TCryptString.New( 54 | AValue, 55 | AKey 56 | ).Decrypt 57 | ); 58 | end; 59 | 60 | procedure TCryptStringTest.EncryptDefaultTest(const AValue, 61 | AResult: AnsiString); 62 | begin 63 | Assert.AreEqual( 64 | AResult, 65 | TCryptString.New(AValue).Crypt 66 | ); 67 | end; 68 | 69 | procedure TCryptStringTest.EncryptTest(const AValue, AResult, AKey: AnsiString); 70 | begin 71 | Assert.AreEqual( 72 | AResult, 73 | TCryptString.New( 74 | AValue, 75 | AKey 76 | ).Crypt 77 | ); 78 | end; 79 | 80 | initialization 81 | TDUnitX.RegisterTestFixture(TCryptStringTest); 82 | end. 83 | -------------------------------------------------------------------------------- /test/uTXPathTest.pas: -------------------------------------------------------------------------------- 1 | unit uTXPathTest; 2 | 3 | interface 4 | 5 | uses 6 | DUnitX.TestFramework; 7 | 8 | const 9 | XML = 10 | ' ' + 11 | ' ' + 12 | ' Harry Potter ' + 13 | ' ' + 14 | ' ' + 15 | ' Learning XML ' + 16 | ' Aprendendo XML ' + 17 | ' ' + 18 | ' ' + 19 | ' Z OmniXML v lepso prihodnost ' + 20 | ' 2006 ' + 21 | ' ' + 22 | ' ' + 23 | ' Kwe sona standwa sam ' + 24 | ' ' + 25 | ' '; 26 | 27 | type 28 | [TestFixture] 29 | TXPathTest = class(TObject) 30 | public 31 | [Test] 32 | [TestCase('XPath SelectNode 1','/bookstore/book[2]/title[1],Learning XML')] 33 | [TestCase('XPath SelectNode 2','/bookstore/book[3]/year,2006')] 34 | procedure SelectNodeTest(const NodePath, Expected: string); 35 | [Test] 36 | [TestCase('XPath SelectNode Attr 1','/bookstore/book[2]/title[1],lang,eng')] 37 | [TestCase('XPath SelectNode Attr 2','/bookstore/book[2]/title[2],lang,por')] 38 | procedure SelectNodeAttrTest(const NodePath, Attr, Expected: string); 39 | [Test] 40 | [TestCase('XPath SelectNodes 1','/bookstore,1')] 41 | [TestCase('XPath SelectNodes 2','/bookstore/book,4')] 42 | [TestCase('XPath SelectNodes 2','/bookstore/book[2]/title,2')] 43 | procedure SelectNodesTest(const NodePath: string; const Count: Integer); 44 | end; 45 | 46 | implementation 47 | 48 | uses 49 | RO.TXPath 50 | ; 51 | 52 | { TXPathTest } 53 | 54 | procedure TXPathTest.SelectNodeAttrTest(const NodePath, Attr, Expected: string); 55 | begin 56 | Assert.AreEqual( 57 | Expected, 58 | TXPath.New(XML) 59 | .SelectNode(NodePath) 60 | .Attributes[Attr] 61 | ); 62 | end; 63 | 64 | procedure TXPathTest.SelectNodesTest(const NodePath: string; const Count: Integer); 65 | begin 66 | Assert.AreEqual( 67 | Count, 68 | TXPath.New(XML) 69 | .SelectNodes(NodePath) 70 | .Count 71 | ); 72 | end; 73 | 74 | procedure TXPathTest.SelectNodeTest(const NodePath, Expected: string); 75 | begin 76 | Assert.AreEqual( 77 | Expected, 78 | TXPath.New(XML) 79 | .SelectNode(NodePath) 80 | .Text 81 | ); 82 | end; 83 | 84 | initialization 85 | TDUnitX.RegisterTestFixture(TXPathTest); 86 | end. 87 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *. 2 | !*.* 3 | 4 | # Uncomment these types if you want even more clean repository. But be careful. 5 | # It can make harm to an existing project source. Read explanations below. 6 | # 7 | # Resource files are binaries containing manifest, project icon and version info. 8 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 9 | #*.res 10 | # 11 | # Type library file (binary). In old Delphi versions it should be stored. 12 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 13 | #*.tlb 14 | # 15 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 16 | # Uncomment this if you are not using diagrams or use newer Delphi version. 17 | #*.ddp 18 | # 19 | # Visual LiveBindings file. Added in Delphi XE2. 20 | # Uncomment this if you are not using LiveBindings Designer. 21 | #*.vlb 22 | # 23 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 24 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 25 | #*.deployproj 26 | # 27 | 28 | # Delphi compiler-generated binaries (safe to delete) 29 | *.exe 30 | *.dll 31 | *.bpl 32 | *.bpi 33 | *.dcp 34 | *.so 35 | *.apk 36 | *.drc 37 | *.map 38 | *.dres 39 | *.rsm 40 | *.tds 41 | *.dcu 42 | *.lib 43 | *.com 44 | *.class 45 | *.o 46 | 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *Resource.rc 51 | 52 | # Delphi local files (user-specific info) 53 | *.local 54 | *.identcache 55 | *.projdata 56 | *.tvsconfig 57 | *.dsk 58 | 59 | # Delphi history and backups 60 | __history/ 61 | *.~* 62 | 63 | # Castalia statistics file 64 | *.stat 65 | 66 | # Packages # 67 | ############ 68 | # it's better to unpack these files and commit the raw source 69 | # git has its own built in compression methods 70 | *.7z 71 | *.dmg 72 | *.gz 73 | *.iso 74 | *.jar 75 | *.rar 76 | *.tar 77 | *.zip 78 | 79 | 80 | 81 | 82 | # Logs and databases # 83 | ###################### 84 | *.log 85 | *.sql 86 | *.sqlite 87 | 88 | # OS generated files # 89 | ###################### 90 | .DS_Store 91 | .DS_Store? 92 | ._* 93 | .Spotlight-V100 94 | .Trashes 95 | ehthumbs.db 96 | Thumbs.db 97 | 98 | 99 | 100 | Device.ini 101 | *.tmp 102 | *.dSYM 103 | bin 104 | iOSDevice32 105 | iOSDevice64 106 | iOSSimulator 107 | Linux 108 | OSX32 109 | Win32 110 | Win64 111 | *.res 112 | *.skincfg 113 | src/ThirdParty/ 114 | *.dproj 115 | src/Intf/__recovery/ 116 | 117 | pkg/AndroidManifest\.template\.xml 118 | -------------------------------------------------------------------------------- /UnitDisclaimer.txt: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | -------------------------------------------------------------------------------- /test/uTGeoCoordinateTest.pas: -------------------------------------------------------------------------------- 1 | unit uTGeoCoordinateTest; 2 | 3 | interface 4 | uses 5 | DUnitX.TestFramework; 6 | 7 | type 8 | [TestFixture] 9 | TGeoCoordinateTest = class(TObject) 10 | public 11 | [Test] 12 | [TestCase('Coordinate as double 1','0,0')] 13 | [TestCase('Coordinate as double 2','90,90')] 14 | [TestCase('Coordinate as double 3','180,180')] 15 | [TestCase('Coordinate as double 4','-90,-90')] 16 | [TestCase('Coordinate as double 5','-180,-180')] 17 | procedure CoordinateToDoubleTest(const ValueIn, ValueOut: Double); 18 | [Test] 19 | [TestCase('Coordinate as string 1','0,0')] 20 | [TestCase('Coordinate as string 2','90,90')] 21 | [TestCase('Coordinate as string 3','180,180')] 22 | [TestCase('Coordinate as string 4','-90,-90')] 23 | [TestCase('Coordinate as string 5','-180,-180')] 24 | procedure CoordinateToStringTest(const ValueIn: Double; const ValueOut: string); 25 | [Test] 26 | [TestCase('Coordinate latitude validation 1','-91')] 27 | [TestCase('Coordinate latitude validation 2','91')] 28 | procedure CoordinateLatitudeTest(const ValueIn: Double); 29 | [Test] 30 | [TestCase('Coordinate longitude validation 1','-181')] 31 | [TestCase('Coordinate longitude validation 2','181')] 32 | procedure CoordinateLongitudeTest(const ValueIn: Double); 33 | end; 34 | 35 | implementation 36 | 37 | uses 38 | RO.IGeoCoordinate 39 | , RO.TGeoCoordinate 40 | ; 41 | 42 | { TGeoCoordinateTest } 43 | 44 | procedure TGeoCoordinateTest.CoordinateLatitudeTest(const ValueIn: Double); 45 | begin 46 | Assert.WillRaise( 47 | procedure 48 | begin 49 | TGeoCoordinate.New( 50 | TGeoCoordinateType.gcLatitude, 51 | ValueIn 52 | ) 53 | end 54 | ); 55 | end; 56 | 57 | procedure TGeoCoordinateTest.CoordinateLongitudeTest(const ValueIn: Double); 58 | begin 59 | Assert.WillRaise( 60 | procedure 61 | begin 62 | TGeoCoordinate.New( 63 | TGeoCoordinateType.gcLongitude, 64 | ValueIn 65 | ) 66 | end 67 | ); 68 | end; 69 | 70 | procedure TGeoCoordinateTest.CoordinateToDoubleTest(const ValueIn, ValueOut: Double); 71 | begin 72 | Assert.AreEqual( 73 | ValueOut, 74 | TGeoCoordinate.New( 75 | TGeoCoordinateType.gcLongitude, 76 | ValueIn 77 | ).AsDouble 78 | ); 79 | end; 80 | 81 | procedure TGeoCoordinateTest.CoordinateToStringTest(const ValueIn: Double; const ValueOut: string); 82 | begin 83 | Assert.AreEqual( 84 | ValueOut, 85 | TGeoCoordinate.New( 86 | TGeoCoordinateType.gcLongitude, 87 | ValueIn 88 | ).AsString 89 | ); 90 | end; 91 | 92 | initialization 93 | TDUnitX.RegisterTestFixture(TGeoCoordinateTest); 94 | end. 95 | -------------------------------------------------------------------------------- /test/uTCaseTest.pas: -------------------------------------------------------------------------------- 1 | unit uTCaseTest; 2 | 3 | interface 4 | 5 | uses 6 | DUnitX.TestFramework; 7 | 8 | type 9 | [TestFixture] 10 | TCaseTest = class(TObject) 11 | public 12 | [Test] 13 | [TestCase('Case String 1', 'AAA,AAA,BBB,CCC,1')] 14 | [TestCase('Case String 2', 'BBB,AAA,BBB,CCC,2')] 15 | [TestCase('Case String 3', 'CCC,AAA,BBB,CCC,3')] 16 | procedure TestCaseString(const ARefValue, Action1, Action2, Action3: string; const ReturnValue: Integer); 17 | [Test] 18 | [TestCase('Else String 1', 'ELSE,AAA,0')] 19 | procedure TestElseString(const ARefValue, Action: string; const ElseValue: Integer); 20 | [Test] 21 | procedure TestDuplicate; 22 | end; 23 | 24 | implementation 25 | 26 | uses 27 | RO.TCase 28 | ; 29 | 30 | procedure TCaseTest.TestCaseString(const ARefValue, Action1, Action2, Action3: string; const ReturnValue: Integer); 31 | var 32 | RValue: Integer; 33 | begin 34 | TCase 35 | .New(ARefValue) 36 | .AddCase( 37 | Action1, 38 | procedure (Value: string) 39 | begin 40 | RValue := ReturnValue; 41 | end 42 | ) 43 | .AddCase( 44 | Action2, 45 | procedure (Value: string) 46 | begin 47 | RValue := ReturnValue; 48 | end 49 | ) 50 | .AddCase( 51 | Action3, 52 | procedure (Value: string) 53 | begin 54 | RValue := ReturnValue; 55 | end 56 | ) 57 | .Perform; 58 | Assert.AreEqual( 59 | ReturnValue, 60 | RValue 61 | ); 62 | end; 63 | 64 | procedure TCaseTest.TestDuplicate; 65 | begin 66 | Assert.WillRaise( 67 | procedure 68 | begin 69 | TCase 70 | .New('Ref') 71 | .AddCase( 72 | 'V1', 73 | procedure (Value: string) 74 | begin 75 | end 76 | ) 77 | .AddCase( 78 | 'V1', 79 | procedure (Value: string) 80 | begin 81 | 82 | end 83 | ) 84 | end 85 | ); 86 | end; 87 | 88 | procedure TCaseTest.TestElseString(const ARefValue, Action: string; const ElseValue: Integer); 89 | var 90 | RValue: Integer; 91 | begin 92 | TCase 93 | .New(ARefValue) 94 | .AddCase( 95 | Action, 96 | procedure (Value: string) 97 | begin 98 | end 99 | ) 100 | .AddElse( 101 | procedure (Value: string) 102 | begin 103 | RValue := ElseValue; 104 | end 105 | ) 106 | .Perform; 107 | Assert.AreEqual( 108 | ElseValue, 109 | RValue 110 | ); 111 | end; 112 | 113 | initialization 114 | TDUnitX.RegisterTestFixture(TCaseTest); 115 | end. 116 | -------------------------------------------------------------------------------- /src/Intf/RO.IIf.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IIf **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IIf, IIfFactory **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Allows using an IF statement inside an expression **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IIf; 35 | 36 | interface 37 | 38 | type 39 | IIf = interface(IInvokable) 40 | ['{4EC97D4A-BF07-4309-BE24-784424D12529}'] 41 | function Eval: T; 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/Intf/RO.IZDate.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IZDate **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IZDate **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Returns a XML ready date (ZDate) **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IZDate; 35 | 36 | interface 37 | 38 | type 39 | IZDate = interface 40 | ['{205B9E59-2034-41AD-A56C-06B7DEA9B19E}'] 41 | function AsString: string; 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/Intf/RO.IRandomKey.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IRandomKey **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IRandomKey **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Generates a ransom key with a determined number of bits **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IRandomKey; 35 | 36 | interface 37 | 38 | type 39 | IRandomKey = interface 40 | ['{183457D8-6CD9-433C-BFAB-1E052C875E8A}'] 41 | function AsString: string; 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/Intf/RO.ISMS.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ISMS **) 4 | (** Framework : FMX **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ISMS **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles sending SMS **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ISMS; 35 | 36 | interface 37 | 38 | type 39 | ISMS = interface(IInvokable) 40 | ['{FF4999F0-7DA3-4793-9A3A-506B6A795772}'] 41 | function Send(const Destination: string): ISMS; 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/Intf/RO.IMBReference.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IMBReference **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IMBReference **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Generates MB (Portuguese ATM) payment references **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IMBReference; 35 | 36 | interface 37 | 38 | type 39 | IMBReference = interface(IInvokable) 40 | ['{9D22DEC3-42A7-4D7D-A1E5-76F13D77938F}'] 41 | function AsString: string; 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/Intf/RO.IStringMask.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IStringMask **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IStringMask **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : A Mask to apply to any string and parse it accordingly **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IStringMask; 35 | 36 | interface 37 | 38 | type 39 | IStringMask = interface 40 | ['{529D20E8-F7AD-4DB0-8BD2-988B97BA04C8}'] 41 | function Parse(const Str: string): string; 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/Intf/RO.ISoapRequest.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ISoapRequest **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ISoapRequest **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles a SOAP request, and its resposnse **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ISoapRequest; 35 | 36 | interface 37 | 38 | type 39 | ISoapRequest = interface 40 | ['{FC51FD4C-35C2-4270-A2A3-8434EBA49DA5}'] 41 | function Send(RequestXML: string): string; 42 | end; 43 | 44 | implementation 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /src/Intf/RO.IURL.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IURL **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IURL **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Checks if an URL is valid and active **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IURL; 35 | 36 | interface 37 | 38 | type 39 | IURL = interface(IInvokable) 40 | ['{27179FC6-C4F0-4860-82D7-CD1036CF30C6}'] 41 | function IsValid: Boolean; 42 | function AsString: string; 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /src/Intf/RO.IPostalCode.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IPTPostalCode **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IPostalCode **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles portuguese postal codes **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IPostalCode; 35 | 36 | interface 37 | 38 | type 39 | IPostalCode = interface(IInvokable) 40 | ['{111CB5A3-8EFD-463E-AADF-74F7999B92F0}'] 41 | function AsString: string; 42 | function IsValid: Boolean; 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /src/Intf/RO.IVATNumber.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IVATNumber **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IVATNumber **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Validates a string to be a valid Portuguese VAT Number **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IVATNumber; 35 | 36 | interface 37 | 38 | type 39 | IVATNumber = interface(IInvokable) 40 | ['{60BEF117-FF0B-4F36-A69E-A8CB147EF87C}'] 41 | function IsValid: Boolean; 42 | function AsString: string; 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /src/Intf/RO.VCL.IIcon.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IIcon **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IIcon **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : VCL **) 20 | (******************************************************************************) 21 | (** Description : Represents a VCL-based Icon **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.VCL.IIcon; 35 | 36 | interface 37 | 38 | uses 39 | Vcl.Graphics 40 | ; 41 | 42 | type 43 | IIcon = interface(IUnknown) 44 | ['{DAD3B0BE-90A7-4E63-831E-EEA9E0719519}'] 45 | function AsIcon: TIcon; 46 | end; 47 | 48 | implementation 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /src/Intf/RO.IEmailAddress.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IEmailAddress **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IEmailAddress **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles email address string values **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IEmailAddress; 35 | 36 | interface 37 | 38 | type 39 | IEmailAddress = interface(IInvokable) 40 | ['{C3F80B3B-D3F0-47B7-BE90-B6EBD0505E8C}'] 41 | function Value: string; 42 | function IsValid: Boolean; 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /src/Intf/RO.IClipboard.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IClipboard **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IClipboard **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles clipboard value copying and pasting **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IClipboard; 35 | 36 | interface 37 | 38 | type 39 | IClipboard = interface(IInvokable) 40 | ['{A047D2F2-A1CD-4611-8503-73C536AB5D47}'] 41 | function Copy(Value: string): IClipboard; 42 | function Paste: string; 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /src/Intf/RO.IRSASignature.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IRSASignature **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IRSASignature **) 8 | (******************************************************************************) 9 | (** Enumerators : TPubKeySource **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Signs a string with RSA protocol **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IRSASignature; 35 | 36 | interface 37 | 38 | type 39 | TPubKeySource = (pksFile, pksString); 40 | 41 | IRSASignature = interface 42 | ['{39ABD6BE-F243-48AC-9793-A2599F9C9307}'] 43 | function AsString: string; 44 | end; 45 | 46 | implementation 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /src/Intf/RO.VCL.IBitmap.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IBitmap **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IBitmap **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : VCL **) 20 | (******************************************************************************) 21 | (** Description : Represents a VCL Bitmap **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.VCL.IBitmap; 35 | 36 | interface 37 | 38 | uses 39 | Vcl.Graphics 40 | ; 41 | 42 | type 43 | IBitmap = interface(IUnknown) 44 | ['{32F983D3-3F1A-4BF5-9296-B9B20969A409}'] 45 | function AsBitmap: TBitmap; 46 | end; 47 | 48 | implementation 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /src/Intf/RO.IShiftKeys.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IShiftKeys **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IShiftKeys **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Represents the current state of the computer shift keys **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IShiftKeys; 35 | 36 | interface 37 | 38 | type 39 | IShiftKeys = interface(IInvokable) 40 | ['{EE22F6F7-43CF-4873-BC62-B7765FFC24E6}'] 41 | function ShiftDown: Boolean; 42 | function CtrlDown: Boolean; 43 | function AltDown: Boolean; 44 | end; 45 | 46 | implementation 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /src/Intf/RO.ICSVString.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ICSVString **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ICSVString **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Represents a comma delimited string **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ICSVString; 35 | 36 | interface 37 | 38 | type 39 | ICSVString = interface(IInvokable) 40 | ['{3995FCE9-5ED4-49EB-A4BB-6CB6A787CC1A}'] 41 | function Count: Byte; 42 | function Field(const FieldNumber: Byte; const Default: string = ''): string; 43 | end; 44 | 45 | implementation 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /src/Intf/RO.ITimer.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ITimer **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ITimer **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Runs an action repeatedly in a timer **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ITimer; 35 | 36 | interface 37 | 38 | uses 39 | SysUtils 40 | ; 41 | 42 | type 43 | ITimer = interface(IInvokable) 44 | ['{1C06BCF6-1C6D-473E-993F-2B231B17D4F5}'] 45 | function Start(const Action: TProc): ITimer; 46 | function Stop: ITimer; 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /src/Intf/RO.ICryptString.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ICryptString **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ICryptString, ICryptStringFactory **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles Currency values and calculations **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ICryptString; 35 | 36 | interface 37 | 38 | uses 39 | RO.IValue 40 | ; 41 | 42 | type 43 | ICryptString = interface(IInvokable) 44 | ['{98C9E3C7-230A-4718-9BB8-0E0B1B40BBE5}'] 45 | function Crypt: AnsiString; 46 | function Decrypt: AnsiString; 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /src/Intf/RO.ICheckedValue.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ICheckedValue **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ICheckedValue **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : An IValue extension with an aggregated boolean field **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ICheckedValue; 35 | 36 | interface 37 | 38 | uses 39 | RO.IValue 40 | ; 41 | 42 | type 43 | ICheckedValue = interface(IValue) 44 | ['{61B2114B-989B-4A38-890C-F022699C6B93}'] 45 | function Checked: Boolean; 46 | function Swap: ICheckedValue; 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /src/Intf/RO.IByteSequence.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IByteSequence **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IByteSequence **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : Spring **) 20 | (******************************************************************************) 21 | (** Description : Creates a list of bytes from a string or decimal sequence**) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IByteSequence; 35 | 36 | interface 37 | 38 | uses 39 | Spring.Collections 40 | ; 41 | 42 | type 43 | IByteSequence = interface 44 | ['{96AAB705-984B-420A-AAAE-186CC1F45633}'] 45 | function AsEnumerable: IEnumerable; 46 | function AsString: AnsiString; 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /src/Intf/RO.IDate.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IDate **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IDate **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Represents a date **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IDate; 35 | 36 | interface 37 | 38 | uses 39 | RO.IValue 40 | ; 41 | 42 | type 43 | IDate = interface(IInvokable) 44 | ['{26A4BD5E-9220-4687-B246-87A8060A277E}'] 45 | function Value : TDateTime; 46 | function AsString : string; 47 | function Age : Integer; 48 | end; 49 | 50 | implementation 51 | 52 | end. 53 | -------------------------------------------------------------------------------- /src/Intf/RO.IGeoCoordinate.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IGeoCoordinates **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IGeoCoordinate **) 8 | (******************************************************************************) 9 | (** Enumerators : TGeoCoordinateType **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles Geo Coordinates **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IGeoCoordinate; 35 | 36 | interface 37 | 38 | type 39 | TGeoCoordinateType = (gcLatitude, gcLongitude); 40 | 41 | IGeoCoordinate = interface(IInvokable) 42 | ['{6D48CC57-3187-47B3-A8F1-E1C7CFCFB237}'] 43 | function AsString: string; 44 | function AsDouble: Double; 45 | end; 46 | 47 | implementation 48 | 49 | end. 50 | -------------------------------------------------------------------------------- /src/Intf/RO.ISNTPTime.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ISNTPTime **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ISNTPTime **) 8 | (******************************************************************************) 9 | (** Enumerators : TSPBehavior **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Retrieves a date and time from a NTP Server **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ISNTPTime; 35 | 36 | interface 37 | 38 | uses 39 | RO.IDate 40 | ; 41 | 42 | type 43 | TSPBehavior = (spThrowException, spReturnCurrentDate); 44 | 45 | ISNTPTime = interface(IInvokable) 46 | ['{BFE1C861-89E5-4F8C-B0B1-3CEA18845737}'] 47 | function Now: TDateTime; 48 | end; 49 | 50 | implementation 51 | 52 | end. 53 | -------------------------------------------------------------------------------- /src/Intf/RO.IHideable.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IHideable **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IHideable **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Represents an hideable object, to be used with any **) 22 | (** visual component **) 23 | (******************************************************************************) 24 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 25 | (** Contributions : You can create pull request for all your desired **) 26 | (** contributions as long as they comply with the guidelines **) 27 | (** you can find in the readme.md file in the main directory **) 28 | (** of the Reusable Objects repository **) 29 | (** Disclaimer : The licence agreement applies to the code in this unit **) 30 | (** and not to any of its dependencies, which have their own **) 31 | (** licence agreement and to which you must comply in their **) 32 | (** terms **) 33 | (******************************************************************************) 34 | 35 | unit RO.IHideable; 36 | 37 | interface 38 | 39 | type 40 | IHideable = interface(IInvokable) 41 | ['{FE0C3FD7-CCC4-4B48-88AD-90286B4E0BBA}'] 42 | function Show: IHideable; 43 | function Hide: IHideable; 44 | end; 45 | 46 | implementation 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /src/Intf/RO.IXPath.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IXPath **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado, based on original code by Tor Helland **) 6 | (******************************************************************************) 7 | (** Interfaces : IXPath **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : MSXML **) 20 | (******************************************************************************) 21 | (** Description : Allows XML node finding using XPath **) 22 | (******************************************************************************) 23 | (** Licence : MPL v1.1 (https://www.mozilla.org/en-US/MPL/1.1/) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IXPath; 35 | 36 | interface 37 | 38 | uses 39 | XMLIntf 40 | ; 41 | 42 | type 43 | IXPath = interface(IInvokable) 44 | ['{22B6E31E-869C-478A-9325-E6365EFC6B53}'] 45 | function SelectNode(const NodePath: WideString): IXMLNode; 46 | function SelectNodes(const NodePath: WideString): IXMLNodeList; 47 | end; 48 | 49 | implementation 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /src/Intf/RO.ICertificate.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ICertificate **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ICertificate **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles PFX certificate files **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ICertificate; 35 | 36 | interface 37 | 38 | type 39 | ICertificate = interface 40 | ['{A90214F2-64DE-49C2-8611-3B235812330A}'] 41 | function AsPCCert_Context: Pointer; 42 | function ContextSize: Cardinal; 43 | function IsValid: Boolean; 44 | function SerialNumber: string; 45 | function NotAfter: TDateTime; 46 | end; 47 | 48 | implementation 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /src/Intf/RO.INetworkNode.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : INetworkNode **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : INetworkNode **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles network nodes **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.INetworkNode; 35 | 36 | interface 37 | 38 | type 39 | INetworkNode = interface(IInvokable) 40 | ['{AF8E8BF2-426E-4FF2-86FE-F577F3B3442D}'] 41 | function IsIPv4Address: Boolean; 42 | function AsIPv4Address: AnsiString; 43 | function AsHostname: AnsiString; 44 | function IsPortOpen(const Port: Word): Boolean; 45 | end; 46 | 47 | implementation 48 | 49 | end. 50 | -------------------------------------------------------------------------------- /src/Intf/RO.ICurrency.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ICurrency **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ICurrency **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles Currency values and calculations **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ICurrency; 35 | 36 | interface 37 | 38 | type 39 | ICurrency = interface(IInvokable) 40 | ['{EF61CB53-7281-4645-B3C5-C5EE860FC2C5}'] 41 | function Value: Currency; 42 | function AsString: string; 43 | function Add(const Value: Currency): ICurrency; 44 | function Sub(const Value: Currency): ICurrency; 45 | function Reset: ICurrency; 46 | end; 47 | 48 | implementation 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /src/Intf/RO.IResource.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IString **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IResource **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Represents a resource embeeded in the current module **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IResource; 35 | 36 | interface 37 | 38 | uses 39 | Classes 40 | ; 41 | 42 | type 43 | IResource = interface(IInvokable) 44 | ['{536B8F2E-C97E-426C-9D83-D9ACDD2EA9F3}'] 45 | function Exists: Boolean; 46 | function Extract(const FileName: string): IResource; overload; 47 | function Extract(const Stream: TStream): IResource; overload; 48 | end; 49 | 50 | implementation 51 | 52 | end. 53 | -------------------------------------------------------------------------------- /src/Intf/RO.IStringList.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IStringList **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IStringList **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : Spring4D **) 20 | (******************************************************************************) 21 | (** Description : A string list based on Spring Enumerable **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IStringList; 35 | 36 | interface 37 | 38 | uses 39 | Spring.Collections 40 | , Classes 41 | ; 42 | 43 | type 44 | IStringList = interface(IInvokable) 45 | function Items: IEnumerable; 46 | function Add(const Item: string): IStringList; 47 | function Assign(const Strings: TStrings): IStringList; 48 | function Text: string; 49 | end; 50 | 51 | implementation 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /src/Intf/RO.ICOMPort.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ICOMPort **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ICOMPort **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Sends and receives strings from a COM port **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ICOMPort; 35 | 36 | interface 37 | 38 | uses 39 | SysUtils 40 | ; 41 | 42 | type 43 | ICOMPort = interface(IInvokable) 44 | ['{9FA1E781-A5E4-43F2-AF56-1C957C4D33F6}'] 45 | function Open: Boolean; 46 | function Close: ICOMPort; 47 | function ReadStr(const Action: TProc): ICOMPort; 48 | function WriteStr(const Str: string): ICOMPort; 49 | end; 50 | 51 | implementation 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /src/VCL/RO.VCL.Ext.TPanel.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Framework : VCL **) 4 | (** Developed by : Nuno Picado **) 5 | (******************************************************************************) 6 | (** Interfaces : **) 7 | (******************************************************************************) 8 | (** Enumerators : **) 9 | (******************************************************************************) 10 | (** Classes : THPanel **) 11 | (******************************************************************************) 12 | (** Decorators : **) 13 | (******************************************************************************) 14 | (** Extensions : VCL.TPanel **) 15 | (******************************************************************************) 16 | (** Other types : **) 17 | (******************************************************************************) 18 | (** Dependencies : VCL **) 19 | (******************************************************************************) 20 | (** Description : A VCL TPanel Helper which adds capability to center the **) 21 | (** panel on its parent area **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.VCL.Ext.TPanel; 35 | 36 | interface 37 | 38 | uses 39 | VCL.ExtCtrls 40 | ; 41 | 42 | type 43 | THPanel = class Helper for TPanel 44 | public 45 | procedure CenterOnParent; 46 | end; 47 | 48 | implementation 49 | 50 | { THPanel } 51 | 52 | procedure THPanel.CenterOnParent; 53 | begin 54 | Left := (Parent.Width div 2) - (Width div 2); 55 | Top := (Parent.Height div 2) - (Height div 2); 56 | end; 57 | 58 | end. 59 | 60 | -------------------------------------------------------------------------------- /src/Intf/RO.IMatrix.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IMatrix **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IMatrix **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Generic Bidimensional List of items **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IMatrix; 35 | 36 | interface 37 | 38 | type 39 | IMatrix = interface(IInvokable) 40 | ['{3769B3FE-376D-4430-9652-48E6BF85A9CA}'] 41 | function Cell(const Col, Row: LongInt): T; 42 | function Edit(const Col, Row: LongInt; const Value: T): IMatrix; 43 | function ColCount: Integer; 44 | function RowCount: Integer; 45 | function Resize(const ColCount, RowCount: LongInt): IMatrix; 46 | end; 47 | 48 | implementation 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /src/Intf/RO.IScale.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IScale **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IScale, IScaleOutput **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles communication with a serial scale **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IScale; 35 | 36 | interface 37 | 38 | type 39 | IScaleOutput = interface(IInvokable) 40 | ['{474D91FE-D458-4272-A61A-22552AF14874}'] 41 | function ReportWeight(const Weight: Double): IScaleOutput; 42 | end; 43 | 44 | IScale = interface(IInvokable) 45 | ['{F9C0CC9D-4070-49D7-8047-D5E424B564E7}'] 46 | function Connect: IScale; 47 | function Disconnect: IScale; 48 | function Request: IScale; 49 | end; 50 | 51 | implementation 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /src/Intf/RO.ICase.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ICase **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ICase **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : Spring **) 20 | (******************************************************************************) 21 | (** Description : Represents a Case statement for any given type **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ICase; 35 | 36 | interface 37 | 38 | uses 39 | SysUtils 40 | ; 41 | 42 | type 43 | ICase = interface(IInvokable) 44 | ['{10889F44-8366-4E01-BB17-42745E4CEF76}'] 45 | function SetupReferenceValue(const ReferenceValue: T): ICase; 46 | function AddCase(const Value: T; const Action: TProc): ICase; 47 | function AddElse(const DefaultAction: TProc): ICase; 48 | function Perform: ICase; 49 | end; 50 | 51 | implementation 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /src/Intf/RO.IFile.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IFile **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IFile **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Opens a file for reading, gets its content and info **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IFile; 35 | 36 | interface 37 | 38 | uses 39 | RO.IDataStream 40 | ; 41 | 42 | type 43 | IFile = interface(IInvokable) 44 | ['{22841154-9E5C-4D64-8780-5FA2C29B4988}'] 45 | function Name: string; 46 | function Size: Int64; 47 | function Created: TDateTime; 48 | function Modified: TDateTime; 49 | function Accessed: TDateTime; 50 | function Version(const Full: Boolean = True): string; 51 | function AsDataStream: IDataStream; 52 | end; 53 | 54 | implementation 55 | 56 | end. 57 | -------------------------------------------------------------------------------- /src/SSI/RO.TTriplet.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : TTriplet **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : A generic 3 value record **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.TTriplet; 35 | 36 | interface 37 | 38 | type 39 | TTriplet = record 40 | Key : TKey; 41 | Value : TValue; 42 | Flag : TFlag; 43 | constructor Create(const aKey: TKey; const aValue: TValue; const aFlag: TFlag); 44 | end; 45 | 46 | implementation 47 | 48 | { TTriplet } 49 | 50 | constructor TTriplet.Create(const aKey: TKey; const aValue: TValue; const aFlag: TFlag); 51 | begin 52 | Key := aKey; 53 | Value := aValue; 54 | Flag := aFlag; 55 | end; 56 | 57 | end. 58 | -------------------------------------------------------------------------------- /src/Intf/RO.IDataStream.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IDataStream **) 4 | (** Framework : **) 5 | (** Developed by : Marcos Douglas Santos, mild adaptation by Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IDataStream **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Holds a datastream, created from and saved to various **) 22 | (** formats **) 23 | (******************************************************************************) 24 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 25 | (** Contributions : You can create pull request for all your desired **) 26 | (** contributions as long as they comply with the guidelines **) 27 | (** you can find in the readme.md file in the main directory **) 28 | (** of the Reusable Objects repository **) 29 | (** Disclaimer : The licence agreement applies to the code in this unit **) 30 | (** and not to any of its dependencies, which have their own **) 31 | (** licence agreement and to which you must comply in their **) 32 | (** terms **) 33 | (******************************************************************************) 34 | 35 | unit RO.IDataStream; 36 | 37 | interface 38 | 39 | uses 40 | Classes 41 | ; 42 | 43 | type 44 | IDataStream = interface(IInvokable) 45 | ['{1ED9FBE5-56F3-45BD-8A84-EA5F4A54CED9}'] 46 | function Save(const Stream: TStream): IDataStream; overload; 47 | function Save(const Strings: TStrings): IDataStream; overload; 48 | function Save(const FileName: string): IDataStream; overload; 49 | function AsString: string; 50 | function Size: Int64; 51 | end; 52 | 53 | implementation 54 | 55 | end. 56 | -------------------------------------------------------------------------------- /src/Intf/RO.IStringStat.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IStringStat **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IStringStat **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : TCharSet **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : An object that returns some stats and functionality for **) 22 | (** strings **) 23 | (******************************************************************************) 24 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 25 | (** Contributions : You can create pull request for all your desired **) 26 | (** contributions as long as they comply with the guidelines **) 27 | (** you can find in the readme.md file in the main directory **) 28 | (** of the Reusable Objects repository **) 29 | (** Disclaimer : The licence agreement applies to the code in this unit **) 30 | (** and not to any of its dependencies, which have their own **) 31 | (** licence agreement and to which you must comply in their **) 32 | (** terms **) 33 | (******************************************************************************) 34 | 35 | unit RO.IStringStat; 36 | 37 | interface 38 | 39 | type 40 | TCharSet = set of Char; 41 | 42 | IStringStat = interface(IInvokable) 43 | ['{31A932DC-C98B-4C9F-B608-111EA84C7BAA}'] 44 | function OccurrenciesOf(const Ch: Char): Word; 45 | function ciPos(const SubStr: string): Word; 46 | function Compare(const OtherString: string): Byte; 47 | function AdvSearch(SearchTerms: string): Boolean; 48 | function ContainsOnly(const CharList: TCharSet): Boolean; 49 | end; 50 | 51 | implementation 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /src/Intf/RO.IPostalAddress.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IPostalAddress **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IPostalAddress **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles postal address values **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IPostalAddress; 35 | 36 | interface 37 | 38 | uses 39 | RO.IPostalCode 40 | , RO.IGeoCoordinate 41 | ; 42 | 43 | type 44 | IPostalAddress = interface(IInvokable) 45 | ['{28E88EB6-F313-4D5D-9974-22C14F073D2C}'] 46 | function AsString: string; 47 | function Address1: string; 48 | function Address2: string; 49 | function PostalCode: IPostalCode; 50 | function City: string; 51 | function Region: string; 52 | function Country: string; 53 | function Latitude: IGeoCoordinate; 54 | function Longitude: IGeoCoordinate; 55 | end; 56 | 57 | implementation 58 | 59 | end. 60 | -------------------------------------------------------------------------------- /src/Intf/RO.IDisplay.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IDisplay **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IDisplay **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles communication with a Client Display **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IDisplay; 35 | 36 | interface 37 | 38 | uses 39 | Classes 40 | ; 41 | 42 | type 43 | IDisplay = interface(IInvokable) 44 | ['{9C8A4084-9E07-47D6-8755-9F415A7BED91}'] 45 | function Connect: IDisplay; 46 | function ClrScr: IDisplay; 47 | function ClrLine(const Y: Byte): IDisplay; 48 | function Write(const Text: string): IDisplay; overload; 49 | function Write(const Text: string; const Alignment: TAlignment; const Y: Byte): IDisplay; overload; 50 | function Write(const Text: string; const X, Y: Byte): IDisplay; overload; 51 | function GotoXY(const X, Y: Byte): IDisplay; 52 | end; 53 | 54 | implementation 55 | 56 | end. 57 | -------------------------------------------------------------------------------- /src/Intf/RO.IRange.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IIntegerRange, IFloatRange, ICharRange **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IRange **) 8 | (** IIntegerRange, IFloatRange, ICharRange **) 9 | (******************************************************************************) 10 | (** Enumerators : **) 11 | (******************************************************************************) 12 | (** Classes : **) 13 | (******************************************************************************) 14 | (** Decorators : **) 15 | (******************************************************************************) 16 | (** Extensions : **) 17 | (******************************************************************************) 18 | (** Other types : **) 19 | (******************************************************************************) 20 | (** Dependencies : **) 21 | (******************************************************************************) 22 | (** Description : Represents an ordinal value range (Integer, Float or **) 23 | (** char, and allows questioning the range about the **) 24 | (** existence or inexistence of a value inside that range **) 25 | (******************************************************************************) 26 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 27 | (** Contributions : You can create pull request for all your desired **) 28 | (** contributions as long as they comply with the guidelines **) 29 | (** you can find in the readme.md file in the main directory **) 30 | (** of the Reusable Objects repository **) 31 | (** Disclaimer : The licence agreement applies to the code in this unit **) 32 | (** and not to any of its dependencies, which have their own **) 33 | (** licence agreement and to which you must comply in their **) 34 | (** terms **) 35 | (******************************************************************************) 36 | 37 | unit RO.IRange; 38 | 39 | interface 40 | 41 | type 42 | IRange = interface(IInvokable) 43 | ['{5FE5BB8E-F241-4A84-BFF7-555BA9320A2D}'] 44 | function Includes(const Value: T): Boolean; 45 | function Excludes(const Value: T): Boolean; 46 | end; 47 | 48 | IIntegerRange = IRange; 49 | IFloatRange = IRange; 50 | ICharRange = IRange; 51 | 52 | implementation 53 | 54 | end. 55 | -------------------------------------------------------------------------------- /src/Intf/RO.IShell.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IShell **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IShell, IShellOutput **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : Spring4D **) 20 | (******************************************************************************) 21 | (** Description : Represents a shell session, where commands can be **) 22 | (** executed **) 23 | (******************************************************************************) 24 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 25 | (** Contributions : You can create pull request for all your desired **) 26 | (** contributions as long as they comply with the guidelines **) 27 | (** you can find in the readme.md file in the main directory **) 28 | (** of the Reusable Objects repository **) 29 | (** Disclaimer : The licence agreement applies to the code in this unit **) 30 | (** and not to any of its dependencies, which have their own **) 31 | (** licence agreement and to which you must comply in their **) 32 | (** terms **) 33 | (******************************************************************************) 34 | 35 | unit RO.IShell; 36 | 37 | interface 38 | 39 | uses 40 | Spring.Collections 41 | , RO.TTriplet 42 | , Windows 43 | ; 44 | 45 | type 46 | IShellOutput = interface(IInvokable) 47 | ['{1036C914-48E2-4409-9DBE-40E7ED99B0DF}'] 48 | function WriteLn(const Line: string): IShellOutput; 49 | end; 50 | 51 | IShell = interface(IInvokable) 52 | ['{F09FA6EF-24C8-4D5A-880B-E7EB7045EE15}'] 53 | function Run(const Command: string; const Params: string = ''): Boolean; 54 | function History: IEnumerable>; 55 | end; 56 | 57 | implementation 58 | 59 | end. 60 | -------------------------------------------------------------------------------- /src/Intf/RO.IPrinters.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IPrinters **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IPrinters **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : Spring4D **) 20 | (******************************************************************************) 21 | (** Description : Represents the list of printers registered in the **) 22 | (** Windows Spooler. Can send direct escape sequences to a **) 23 | (** printer **) 24 | (******************************************************************************) 25 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 26 | (** Contributions : You can create pull request for all your desired **) 27 | (** contributions as long as they comply with the guidelines **) 28 | (** you can find in the readme.md file in the main directory **) 29 | (** of the Reusable Objects repository **) 30 | (** Disclaimer : The licence agreement applies to the code in this unit **) 31 | (** and not to any of its dependencies, which have their own **) 32 | (** licence agreement and to which you must comply in their **) 33 | (** terms **) 34 | (******************************************************************************) 35 | 36 | unit RO.IPrinters; 37 | 38 | interface 39 | 40 | uses 41 | RO.IValue 42 | , RO.IByteSequence 43 | , Spring.Collections 44 | ; 45 | 46 | type 47 | IPrinters = interface(IInvokable) 48 | ['{AD15718B-BFAD-4094-87A5-440C430A5709}'] 49 | function SendSequence(const Sequence: IByteSequence): IPrinters; 50 | function AsList: IEnumerable; 51 | function Exists(const Name: string): Boolean; 52 | function Select(const Name: string): IPrinters; 53 | function Default: string; 54 | end; 55 | 56 | implementation 57 | 58 | end. 59 | -------------------------------------------------------------------------------- /src/Intf/RO.IFactory.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IFactory **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IFactory **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : TCreationMethod **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Implements a generic object factory **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.IFactory; 35 | 36 | interface 37 | 38 | type 39 | TCreationMethod = Reference to function: IBaseClass; 40 | 41 | IFactory = interface(IInvokable) 42 | ['{3EE4C61C-4345-4ED1-94E8-CCB43FC0F9C4}'] 43 | function RegClass (const Key: TKey; const CreationMethod: TCreationMethod) : IFactory; 44 | function UnRegClass (const Key: TKey) : IFactory; 45 | function GetInstance (const Key: TKey) : TCreationMethod; 46 | function IsRegistered (const Key: TKey) : Boolean; 47 | function InstanceCount (const Key: TKey) : Word; 48 | function Count : Word; 49 | end; 50 | 51 | implementation 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /src/Intf/RO.ISliderMenu.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ISliderMenu **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ISliderMenu, ISliderMenuItem **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : A menu that slides from offscreen and back **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.ISliderMenu; 35 | 36 | interface 37 | 38 | uses 39 | SysUtils 40 | ; 41 | 42 | type 43 | ISliderMenuItem = interface(IInvokable) 44 | ['{8760AD2B-B91C-429E-AF6E-5DAE45FB88F5}'] 45 | function Id: Byte; 46 | function Text: string; 47 | function SubText: string; 48 | function ImageIndex: Integer; 49 | function Action: TProc; 50 | end; 51 | 52 | ISliderMenu = interface(IInvokable) 53 | ['{8A852B3D-54C8-47B0-9E51-285447A5B93F}'] 54 | function Show: ISliderMenu; 55 | function Hide: ISliderMenu; 56 | function Toogle: ISliderMenu; 57 | function Add(const Item: ISliderMenuItem = nil): ISliderMenu; 58 | function Resize(const aWidth: Single): ISliderMenu; 59 | function IsVisible: Boolean; 60 | end; 61 | 62 | implementation 63 | 64 | end. 65 | -------------------------------------------------------------------------------- /src/SSI/RO.Helpers.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : String, Integer **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : TStringHelper, TIntegerHelper **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Adds a record helper to the string type, to be used in **) 22 | (** versions where a native helper is not yet available **) 23 | (******************************************************************************) 24 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 25 | (** Contributions : You can create pull request for all your desired **) 26 | (** contributions as long as they comply with the guidelines **) 27 | (** you can find in the readme.md file in the main directory **) 28 | (** of the Reusable Objects repository **) 29 | (** Disclaimer : The licence agreement applies to the code in this unit **) 30 | (** and not to any of its dependencies, which have their own **) 31 | (** licence agreement and to which you must comply in their **) 32 | (** terms **) 33 | (******************************************************************************) 34 | 35 | unit RO.Helpers; 36 | 37 | interface 38 | 39 | type 40 | TStringHelper = record Helper for string 41 | function ToInteger: Integer; 42 | function Length: Integer; 43 | end; 44 | 45 | TIntegerHelper = record Helper for Integer 46 | function ToString: string; 47 | end; 48 | 49 | implementation 50 | 51 | uses 52 | SysUtils 53 | ; 54 | 55 | { TStringHelper } 56 | 57 | function TStringHelper.Length: Integer; 58 | begin 59 | Result := System.Length(Self); 60 | end; 61 | 62 | function TStringHelper.ToInteger: Integer; 63 | begin 64 | Result := StrToInt(Self); 65 | end; 66 | 67 | { TIntegerHelper } 68 | 69 | function TIntegerHelper.ToString: string; 70 | begin 71 | Result := IntToStr(Self); 72 | end; 73 | 74 | end. 75 | -------------------------------------------------------------------------------- /src/Intf/RO.IEnum.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IEnum **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IEnum **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Allows retrieving an enumerated value to and from any of **) 22 | (** its possible representations (EnumeratedValue, String or **) 23 | (** Integer **) 24 | (** Limitations : Numbered enumerators don't have runtime type information **) 25 | (** which is the required for returning an enumerator as a **) 26 | (** string value. This means the AsString method can not be **) 27 | (** used with numbered enumerators **) 28 | (******************************************************************************) 29 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 30 | (** Contributions : You can create pull request for all your desired **) 31 | (** contributions as long as they comply with the guidelines **) 32 | (** you can find in the readme.md file in the main directory **) 33 | (** of the Reusable Objects repository **) 34 | (** Disclaimer : The licence agreement applies to the code in this unit **) 35 | (** and not to any of its dependencies, which have their own **) 36 | (** licence agreement and to which you must comply in their **) 37 | (** terms **) 38 | (******************************************************************************) 39 | 40 | unit RO.IEnum; 41 | 42 | interface 43 | 44 | type 45 | IEnum = interface(IInvokable) 46 | ['{81A660A7-744C-4BA2-A2C5-113EC5C8D976}'] 47 | function AsString : string; 48 | function AsInteger : Integer; 49 | function AsEnum : TEnumerator; 50 | end; 51 | 52 | implementation 53 | 54 | end. 55 | -------------------------------------------------------------------------------- /src/FMX/RO.FMX.TLightBox.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Framework : FMX **) 4 | (** Developed by : Nuno Picado **) 5 | (******************************************************************************) 6 | (** Interfaces : **) 7 | (******************************************************************************) 8 | (** Enumerators : **) 9 | (******************************************************************************) 10 | (** Classes : TLightBox **) 11 | (******************************************************************************) 12 | (** Decorators : **) 13 | (******************************************************************************) 14 | (** Extensions : **) 15 | (******************************************************************************) 16 | (** Other types : **) 17 | (******************************************************************************) 18 | (** Dependencies : FMX **) 19 | (******************************************************************************) 20 | (** Description : An FMX TRectangle descendant that creates a LightBox **) 21 | (** effect **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.FMX.TLightBox; 35 | 36 | interface 37 | 38 | uses 39 | FMX.Objects 40 | , FMX.Forms 41 | ; 42 | 43 | type 44 | TLightBox = class(TRectangle) 45 | public 46 | constructor Create(const AParent: TCustomForm; const Opacity: Single = 0.8); overload; 47 | end; 48 | 49 | implementation 50 | 51 | uses 52 | FMX.Graphics 53 | , System.UITypes 54 | ; 55 | 56 | { TLightBox } 57 | 58 | constructor TLightBox.Create(const AParent: TCustomForm; const Opacity: Single = 0.8); 59 | begin 60 | inherited Create(AParent); 61 | Self.Parent := AParent; 62 | Self.Width := AParent.Width; 63 | Self.Height := AParent.Height; 64 | Self.Opacity := Opacity; 65 | Self.Fill.Kind := TBrushKind.Solid; 66 | Self.Fill.Color := TAlphaColors.Black; 67 | Self.Stroke.Kind := TBrushKind.None; 68 | end; 69 | 70 | 71 | end. 72 | -------------------------------------------------------------------------------- /src/Intf/RO.Android.ISMSReport.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : ISMSReport **) 4 | (** Framework : FMX **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : ISMSReport, ISMSReportOutput **) 8 | (******************************************************************************) 9 | (** Enumerators : TSMSSentResultCode, TSMSDeliveredResultCode **) 10 | (******************************************************************************) 11 | (** Classes : TSMSReport **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Handles sent and delivery report for ISMS **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.Android.ISMSReport; 35 | 36 | interface 37 | 38 | uses 39 | Androidapi.JNI.App 40 | ; 41 | 42 | type 43 | TSMSSentResultCode = (srcSent, srcUnknown, srcGenericFailure, srcRadioOff, srcNullPDU, srcNoService); 44 | TSMSDeliveredResultCode = (drcDelivered, drcCanceled); 45 | 46 | ISMSReportOutput = interface(IInvokable) 47 | ['{BF6D6705-5DCD-4B6E-839B-D9FA24B06406}'] 48 | function Sent(const Destination: string; const ResultCode: TSMSSentResultCode): ISMSReportOutput; 49 | function Delivered(const Destination: string; const ResultCode: TSMSDeliveredResultCode): ISMSReportOutput; 50 | end; 51 | 52 | ISMSReport = interface(IInvokable) 53 | ['{B726CD3F-0A2C-44AA-8530-CFEE6A731B4C}'] 54 | function PendingSentIntent: JPendingIntent; 55 | function PendingDeliveredIntent: JPendingIntent; 56 | function Destination(const aDestination: string): string; 57 | end; 58 | 59 | implementation 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /src/SSI/RO.TIf.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IIf **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : **) 8 | (******************************************************************************) 9 | (** Enumerators : **) 10 | (******************************************************************************) 11 | (** Classes : TIf **) 12 | (******************************************************************************) 13 | (** Decorators : **) 14 | (******************************************************************************) 15 | (** Extensions : **) 16 | (******************************************************************************) 17 | (** Other types : **) 18 | (******************************************************************************) 19 | (** Dependencies : **) 20 | (******************************************************************************) 21 | (** Description : Allows using an IF statement inside an expression **) 22 | (******************************************************************************) 23 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 24 | (** Contributions : You can create pull request for all your desired **) 25 | (** contributions as long as they comply with the guidelines **) 26 | (** you can find in the readme.md file in the main directory **) 27 | (** of the Reusable Objects repository **) 28 | (** Disclaimer : The licence agreement applies to the code in this unit **) 29 | (** and not to any of its dependencies, which have their own **) 30 | (** licence agreement and to which you must comply in their **) 31 | (** terms **) 32 | (******************************************************************************) 33 | 34 | unit RO.TIf; 35 | 36 | interface 37 | 38 | uses 39 | RO.IIf 40 | ; 41 | 42 | type 43 | TIf = class(TInterfacedObject, IIf) 44 | strict private 45 | FValue: T; 46 | constructor Create(const Condition: Boolean; const ValueIfTrue, ValueIfFalse: T); 47 | public 48 | class function New(const Condition: Boolean; const ValueIfTrue, ValueIfFalse: T): IIf; 49 | function Eval: T; 50 | end; 51 | 52 | implementation 53 | 54 | { TIf } 55 | 56 | constructor TIf.Create(const Condition: Boolean; const ValueIfTrue, ValueIfFalse: T); 57 | begin 58 | if Condition 59 | then FValue := ValueIfTrue 60 | else FValue := ValueIfFalse; 61 | end; 62 | 63 | function TIf.Eval: T; 64 | begin 65 | Result := FValue; 66 | end; 67 | 68 | class function TIf.New(const Condition: Boolean; const ValueIfTrue, ValueIfFalse: T): IIf; 69 | begin 70 | Result := Create( 71 | Condition, 72 | ValueIfTrue, 73 | ValueIfFalse 74 | ); 75 | end; 76 | 77 | end. 78 | -------------------------------------------------------------------------------- /src/Intf/RO.IValue.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Object : IValue **) 4 | (** Framework : **) 5 | (** Developed by : Nuno Picado **) 6 | (******************************************************************************) 7 | (** Interfaces : IValue **) 8 | (** IBoolean, IChar, IString, IByte, IWord, ILongWord, **) 9 | (** IInteger, IInt64, IReal, ISingle, IDouble **) 10 | (******************************************************************************) 11 | (** Enumerators : **) 12 | (******************************************************************************) 13 | (** Classes : **) 14 | (******************************************************************************) 15 | (** Decorators : **) 16 | (******************************************************************************) 17 | (** Extensions : **) 18 | (******************************************************************************) 19 | (** Other types : **) 20 | (******************************************************************************) 21 | (** Dependencies : **) 22 | (******************************************************************************) 23 | (** Description : Represents a value that will be defined at the moment it **) 24 | (** is first called upon **) 25 | (******************************************************************************) 26 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 27 | (** Contributions : You can create pull request for all your desired **) 28 | (** contributions as long as they comply with the guidelines **) 29 | (** you can find in the readme.md file in the main directory **) 30 | (** of the Reusable Objects repository **) 31 | (** Disclaimer : The licence agreement applies to the code in this unit **) 32 | (** and not to any of its dependencies, which have their own **) 33 | (** licence agreement and to which you must comply in their **) 34 | (** terms **) 35 | (******************************************************************************) 36 | 37 | unit RO.IValue; 38 | 39 | interface 40 | 41 | type 42 | IValue = interface(IInvokable) 43 | ['{21E1AA41-099A-49FA-8C9B-2CA3A37BAD25}'] 44 | function Value: T; 45 | function Refresh: IValue; 46 | end; 47 | 48 | IBoolean = IValue; 49 | IChar = IValue; 50 | IString = IValue; 51 | IByte = IValue; 52 | IWord = IValue; 53 | ILongWord = IValue; 54 | IInteger = IValue; 55 | IInt64 = IValue; 56 | IReal = IValue; 57 | ISingle = IValue; 58 | IDouble = IValue; 59 | ICurrency = IValue; 60 | 61 | {$IFDEF MSWINDOWS} 62 | IAnsiString = IValue; 63 | {$ENDIF} 64 | 65 | implementation 66 | 67 | end. 68 | -------------------------------------------------------------------------------- /src/FMX/RO.FMX.TClipboard.pas: -------------------------------------------------------------------------------- 1 | (******************************************************************************) 2 | (** Suite : Reusable Objects **) 3 | (** Framework : **) 4 | (** Developed by : Nuno Picado **) 5 | (******************************************************************************) 6 | (** Interfaces : **) 7 | (******************************************************************************) 8 | (** Enumerators : **) 9 | (******************************************************************************) 10 | (** Classes : TClipboard **) 11 | (******************************************************************************) 12 | (** Decorators : **) 13 | (******************************************************************************) 14 | (** Extensions : **) 15 | (******************************************************************************) 16 | (** Other types : **) 17 | (******************************************************************************) 18 | (** Dependencies : FMX **) 19 | (******************************************************************************) 20 | (** Description : Handles clipboard value copying and pasting **) 21 | (******************************************************************************) 22 | (** Licence : GNU LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.html) **) 23 | (** Contributions : You can create pull request for all your desired **) 24 | (** contributions as long as they comply with the guidelines **) 25 | (** you can find in the readme.md file in the main directory **) 26 | (** of the Reusable Objects repository **) 27 | (** Disclaimer : The licence agreement applies to the code in this unit **) 28 | (** and not to any of its dependencies, which have their own **) 29 | (** licence agreement and to which you must comply in their **) 30 | (** terms **) 31 | (******************************************************************************) 32 | 33 | unit RO.FMX.TClipboard; 34 | 35 | interface 36 | 37 | uses 38 | FMX.Platform 39 | , RO.IClipboard 40 | ; 41 | 42 | type 43 | TClipboard = class(TInterfacedObject, IClipboard) 44 | private 45 | FClipboard: IFMXClipboardService; 46 | constructor Create; 47 | public 48 | class function New: IClipboard; 49 | function Copy(Value: String): IClipboard; 50 | function Paste: String; 51 | end; 52 | 53 | implementation 54 | 55 | uses 56 | SysUtils 57 | ; 58 | 59 | { TClipboard } 60 | 61 | constructor TClipboard.Create; 62 | begin 63 | if not TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService, IInterface(FClipboard)) 64 | then raise Exception.Create('Clipboard could not be accessed.'); 65 | end; 66 | 67 | class function TClipboard.New: IClipboard; 68 | begin 69 | Result := Create; 70 | end; 71 | 72 | function TClipboard.Paste: String; 73 | begin 74 | Result := FClipboard.GetClipboard.ToString; 75 | end; 76 | 77 | function TClipboard.Copy(Value: String): IClipboard; 78 | begin 79 | Result := Self; 80 | FClipboard.SetClipboard(Value); 81 | end; 82 | 83 | end. 84 | --------------------------------------------------------------------------------