Changeset 4 for ObjectBaseTypes
- Timestamp:
- Jul 27, 2009, 3:19:14 PM (15 years ago)
- Location:
- ObjectBaseTypes
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
ObjectBaseTypes
- Property svn:ignore
-
old new 3 3 TestApplication.res 4 4 *.dcu 5 *.~dsk
-
- Property svn:ignore
-
ObjectBaseTypes/TestApplication.bdsproj
r3 r4 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <BorlandProject> 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 3 <PersonalityInfo> 4 <Option> 5 <Option Name="Personality">Delphi.Personality</Option> 6 <Option Name="ProjectType"></Option> 7 <Option Name="Version">1.0</Option> 8 <Option Name="GUID">{1EE19F66-8842-4091-BF31-E9295482A00F}</Option> 9 </Option> 10 </PersonalityInfo> 11 <Delphi.Personality> 12 <Source> 13 <Source Name="MainSource">TestApplication.dpr</Source> 14 </Source> 15 <FileVersion> 16 <FileVersion Name="Version">7.0</FileVersion> 17 </FileVersion> 18 <Compiler> 19 <Compiler Name="A">8</Compiler> 20 <Compiler Name="B">0</Compiler> 21 <Compiler Name="C">1</Compiler> 22 <Compiler Name="D">1</Compiler> 23 <Compiler Name="E">0</Compiler> 24 <Compiler Name="F">0</Compiler> 25 <Compiler Name="G">1</Compiler> 26 <Compiler Name="H">1</Compiler> 27 <Compiler Name="I">1</Compiler> 28 <Compiler Name="J">0</Compiler> 29 <Compiler Name="K">0</Compiler> 30 <Compiler Name="L">1</Compiler> 31 <Compiler Name="M">0</Compiler> 32 <Compiler Name="N">1</Compiler> 33 <Compiler Name="O">1</Compiler> 34 <Compiler Name="P">1</Compiler> 35 <Compiler Name="Q">0</Compiler> 36 <Compiler Name="R">0</Compiler> 37 <Compiler Name="S">0</Compiler> 38 <Compiler Name="T">0</Compiler> 39 <Compiler Name="U">0</Compiler> 40 <Compiler Name="V">1</Compiler> 41 <Compiler Name="W">0</Compiler> 42 <Compiler Name="X">1</Compiler> 43 <Compiler Name="Y">1</Compiler> 44 <Compiler Name="Z">1</Compiler> 45 <Compiler Name="ShowHints">True</Compiler> 46 <Compiler Name="ShowWarnings">True</Compiler> 47 <Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler> 48 <Compiler Name="NamespacePrefix"></Compiler> 49 <Compiler Name="GenerateDocumentation">False</Compiler> 50 <Compiler Name="DefaultNamespace"></Compiler> 51 <Compiler Name="SymbolDeprecated">True</Compiler> 52 <Compiler Name="SymbolLibrary">True</Compiler> 53 <Compiler Name="SymbolPlatform">True</Compiler> 54 <Compiler Name="SymbolExperimental">True</Compiler> 55 <Compiler Name="UnitLibrary">True</Compiler> 56 <Compiler Name="UnitPlatform">True</Compiler> 57 <Compiler Name="UnitDeprecated">True</Compiler> 58 <Compiler Name="UnitExperimental">True</Compiler> 59 <Compiler Name="HResultCompat">True</Compiler> 60 <Compiler Name="HidingMember">True</Compiler> 61 <Compiler Name="HiddenVirtual">True</Compiler> 62 <Compiler Name="Garbage">True</Compiler> 63 <Compiler Name="BoundsError">True</Compiler> 64 <Compiler Name="ZeroNilCompat">True</Compiler> 65 <Compiler Name="StringConstTruncated">True</Compiler> 66 <Compiler Name="ForLoopVarVarPar">True</Compiler> 67 <Compiler Name="TypedConstVarPar">True</Compiler> 68 <Compiler Name="AsgToTypedConst">True</Compiler> 69 <Compiler Name="CaseLabelRange">True</Compiler> 70 <Compiler Name="ForVariable">True</Compiler> 71 <Compiler Name="ConstructingAbstract">True</Compiler> 72 <Compiler Name="ComparisonFalse">True</Compiler> 73 <Compiler Name="ComparisonTrue">True</Compiler> 74 <Compiler Name="ComparingSignedUnsigned">True</Compiler> 75 <Compiler Name="CombiningSignedUnsigned">True</Compiler> 76 <Compiler Name="UnsupportedConstruct">True</Compiler> 77 <Compiler Name="FileOpen">True</Compiler> 78 <Compiler Name="FileOpenUnitSrc">True</Compiler> 79 <Compiler Name="BadGlobalSymbol">True</Compiler> 80 <Compiler Name="DuplicateConstructorDestructor">True</Compiler> 81 <Compiler Name="InvalidDirective">True</Compiler> 82 <Compiler Name="PackageNoLink">True</Compiler> 83 <Compiler Name="PackageThreadVar">True</Compiler> 84 <Compiler Name="ImplicitImport">True</Compiler> 85 <Compiler Name="HPPEMITIgnored">True</Compiler> 86 <Compiler Name="NoRetVal">True</Compiler> 87 <Compiler Name="UseBeforeDef">True</Compiler> 88 <Compiler Name="ForLoopVarUndef">True</Compiler> 89 <Compiler Name="UnitNameMismatch">True</Compiler> 90 <Compiler Name="NoCFGFileFound">True</Compiler> 91 <Compiler Name="ImplicitVariants">True</Compiler> 92 <Compiler Name="UnicodeToLocale">True</Compiler> 93 <Compiler Name="LocaleToUnicode">True</Compiler> 94 <Compiler Name="ImagebaseMultiple">True</Compiler> 95 <Compiler Name="SuspiciousTypecast">True</Compiler> 96 <Compiler Name="PrivatePropAccessor">True</Compiler> 97 <Compiler Name="UnsafeType">False</Compiler> 98 <Compiler Name="UnsafeCode">False</Compiler> 99 <Compiler Name="UnsafeCast">False</Compiler> 100 <Compiler Name="OptionTruncated">True</Compiler> 101 <Compiler Name="WideCharReduced">True</Compiler> 102 <Compiler Name="DuplicatesIgnored">True</Compiler> 103 <Compiler Name="UnitInitSeq">True</Compiler> 104 <Compiler Name="LocalPInvoke">True</Compiler> 105 <Compiler Name="MessageDirective">True</Compiler> 106 <Compiler Name="CodePage"></Compiler> 107 </Compiler> 108 <Linker> 109 <Linker Name="MapFile">0</Linker> 110 <Linker Name="OutputObjs">0</Linker> 111 <Linker Name="GenerateHpps">False</Linker> 112 <Linker Name="ConsoleApp">1</Linker> 113 <Linker Name="DebugInfo">False</Linker> 114 <Linker Name="RemoteSymbols">False</Linker> 115 <Linker Name="GenerateDRC">False</Linker> 116 <Linker Name="MinStackSize">16384</Linker> 117 <Linker Name="MaxStackSize">1048576</Linker> 118 <Linker Name="ImageBase">4194304</Linker> 119 <Linker Name="ExeDescription"></Linker> 120 </Linker> 121 <Directories> 122 <Directories Name="OutputDir"></Directories> 123 <Directories Name="UnitOutputDir"></Directories> 124 <Directories Name="PackageDLLOutputDir"></Directories> 125 <Directories Name="PackageDCPOutputDir"></Directories> 126 <Directories Name="SearchPath"></Directories> 127 <Directories Name="Packages"></Directories> 128 <Directories Name="Conditionals"></Directories> 129 <Directories Name="DebugSourceDirs"></Directories> 130 <Directories Name="UsePackages">False</Directories> 131 </Directories> 132 <Parameters> 133 <Parameters Name="RunParams"></Parameters> 134 <Parameters Name="HostApplication"></Parameters> 135 <Parameters Name="Launcher"></Parameters> 136 <Parameters Name="UseLauncher">False</Parameters> 137 <Parameters Name="DebugCWD"></Parameters> 138 <Parameters Name="Debug Symbols Search Path"></Parameters> 139 <Parameters Name="LoadAllSymbols">True</Parameters> 140 <Parameters Name="LoadUnspecifiedSymbols">False</Parameters> 141 </Parameters> 142 <VersionInfo> 143 <VersionInfo Name="IncludeVerInfo">False</VersionInfo> 144 <VersionInfo Name="AutoIncBuild">False</VersionInfo> 145 <VersionInfo Name="MajorVer">1</VersionInfo> 146 <VersionInfo Name="MinorVer">0</VersionInfo> 147 <VersionInfo Name="Release">0</VersionInfo> 148 <VersionInfo Name="Build">0</VersionInfo> 149 <VersionInfo Name="Debug">False</VersionInfo> 150 <VersionInfo Name="PreRelease">False</VersionInfo> 151 <VersionInfo Name="Special">False</VersionInfo> 152 <VersionInfo Name="Private">False</VersionInfo> 153 <VersionInfo Name="DLL">False</VersionInfo> 154 <VersionInfo Name="Locale">1029</VersionInfo> 155 <VersionInfo Name="CodePage">1250</VersionInfo> 156 </VersionInfo> 157 <VersionInfoKeys> 158 <VersionInfoKeys Name="CompanyName"></VersionInfoKeys> 159 <VersionInfoKeys Name="FileDescription"></VersionInfoKeys> 160 <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys> 161 <VersionInfoKeys Name="InternalName"></VersionInfoKeys> 162 <VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys> 163 <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys> 164 <VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys> 165 <VersionInfoKeys Name="ProductName"></VersionInfoKeys> 166 <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> 167 <VersionInfoKeys Name="Comments"></VersionInfoKeys> 168 </VersionInfoKeys> 169 </Delphi.Personality> 170 170 </BorlandProject> -
ObjectBaseTypes/TestApplication.dpr
r3 r4 10 10 UObjectByte in 'UObjectByte.pas', 11 11 UInterfacedBits in 'UInterfacedBits.pas', 12 UObjectDouble in 'UObjectDouble.pas'; 12 UObjectDouble in 'UObjectDouble.pas', 13 UObjectPoint in 'UObjectPoint.pas', 14 UObjectNumber in 'UObjectNumber.pas'; 13 15 14 16 {$R *.res} -
ObjectBaseTypes/UMainForm.pas
r3 r4 57 57 Add(BoolToStr(Result.Value) + ' := ' + BoolToStr(Operand1.Value)); 58 58 59 // Ordinal60 Result.Value := False;61 Int := TInteger(Result.Ordinal);62 Add(IntToStr(Int.Value) + ' := ordinal ' + BoolToStr(Result.Value));63 64 Result.Value := True;65 Int := TInteger(Result.Ordinal);66 Add(IntToStr(Int.Value) + ' := ordinal ' + BoolToStr(Result.Value));67 68 59 // OrTo 69 60 Result.Value := True; … … 98 89 Bool := Result.EqualTo(Operand1); 99 90 Add(BoolToStr(Bool.Value) + ' := ' + Result.Value + '.EqualTo(' + Operand1.Value + ')'); 91 92 // Length 93 Result.Value := 'ABCD'; 94 Int := Result.Length; 95 Add(IntToStr(Int.Value) + ' := ' + Result.Value + '.Length'); 96 97 // Reverse 98 Operand1.Value := 'ABCD'; 99 Result.Assign(Operand1); 100 Result.Reverse; 101 Add(Result.Value + ' := ' + Operand1.Value + '.Reverse'); 100 102 end; 101 103 end; -
ObjectBaseTypes/UObjectBoolean.pas
r3 r4 11 11 IComparable = interface 12 12 function EqualTo(Operand: TInterfacedObject): TBoolean; 13 function HigherThen(Operand: TInterfacedObject): TBoolean;14 function LowerThan(Operand: TInterfacedObject): TBoolean;15 13 end; 16 14 17 TBoolean = class(TInterfacedObject, I Assignable, IComparable, IOrdinal)15 TBoolean = class(TInterfacedObject, IComparable, IAssignable) 18 16 Value: Boolean; 19 function Ordinal: IOrdinal;20 function Predecessor: IOrdinal;21 function Successor: IOrdinal;22 function Low: IOrdinal;23 function High: IOrdinal;24 17 procedure Invert; 25 18 function EqualTo(Operand: TInterfacedObject): TBoolean; … … 61 54 end; 62 55 63 function TBoolean.High: IOrdinal;64 begin65 Result := TBoolean.Create;66 TBoolean(Result).Value := True;67 end;68 69 56 function TBoolean.HigherThen(Operand: TInterfacedObject): TBoolean; 70 57 begin … … 80 67 end; 81 68 82 function TBoolean.Low: IOrdinal;83 begin84 Result := TBoolean.Create;85 TBoolean(Result).Value := False;86 end;87 88 69 function TBoolean.LowerThan(Operand: TInterfacedObject): TBoolean; 89 70 begin … … 92 73 Result.Value := Value < TBoolean(Operand).Value; 93 74 end else raise EInvalidCast.Create('Typecast error'); 94 end;95 96 function TBoolean.Ordinal: IOrdinal;97 begin98 Result := TInteger.Create;99 TInteger(Result).Value := Integer(Value);100 75 end; 101 76 … … 108 83 end; 109 84 110 function TBoolean.Predecessor: IOrdinal;111 begin112 raise ENotImplemented.Create('Not implemented');113 end;114 115 function TBoolean.Successor: IOrdinal;116 begin117 118 end;119 85 120 86 end. -
ObjectBaseTypes/UObjectByte.pas
r3 r4 4 4 5 5 uses 6 Classes, SysUtils, UObjectTypeBase, UInterfacedBits ;6 Classes, SysUtils, UObjectTypeBase, UInterfacedBits, UObjectNumber, UObjectBoolean; 7 7 8 8 type 9 TByte = class(TInterfacedObject, IAssignable )9 TByte = class(TInterfacedObject, IAssignable, IOrderable) 10 10 private 11 11 function GetAsBits: TInterfacedBits; … … 14 14 Value: Byte; 15 15 procedure Assign(Source: TInterfacedObject); 16 function HigherThen(Operand: IOrderable): TBoolean; 17 function LowerThan(Operand: IOrderable): TBoolean; 18 function Max(Operand1, Operand2: IOrderable): IOrderable; 19 function Min(Operand1, Operand2: IOrderable): IOrderable; 16 20 property AsBits: TInterfacedBits read GetAsBits write SetAsBits; 17 21 end; … … 37 41 end; 38 42 43 function TByte.HigherThen(Operand: IOrderable): TBoolean; 44 begin 45 46 end; 47 48 function TByte.LowerThan(Operand: IOrderable): TBoolean; 49 begin 50 51 end; 52 53 function TByte.Max(Operand1, Operand2: IOrderable): IOrderable; 54 begin 55 56 end; 57 58 function TByte.Min(Operand1, Operand2: IOrderable): IOrderable; 59 begin 60 61 end; 62 39 63 procedure TByte.SetAsBits(const Value: TInterfacedBits); 40 64 var -
ObjectBaseTypes/UObjectDouble.pas
r3 r4 3 3 interface 4 4 5 uses 6 UObjectNumber, UObjectTypeBase, UObjectBoolean; 7 8 type 9 TDouble = class(TInterfacedObject, IAssignable, IOrderable) 10 procedure Assign(Source: TInterfacedObject); 11 function HigherThen(Operand: IOrderable): TBoolean; 12 function LowerThan(Operand: IOrderable): TBoolean; 13 function Max(Operand1, Operand2: IOrderable): IOrderable; 14 function Min(Operand1, Operand2: IOrderable): IOrderable; 15 end; 16 5 17 implementation 6 18 19 { TDouble } 20 21 procedure TDouble.Assign(Source: TInterfacedObject); 22 begin 23 24 end; 25 26 function TDouble.HigherThen(Operand: IOrderable): TBoolean; 27 begin 28 29 end; 30 31 function TDouble.LowerThan(Operand: IOrderable): TBoolean; 32 begin 33 34 end; 35 36 function TDouble.Max(Operand1, Operand2: IOrderable): IOrderable; 37 begin 38 39 end; 40 41 function TDouble.Min(Operand1, Operand2: IOrderable): IOrderable; 42 begin 43 44 end; 45 7 46 end. -
ObjectBaseTypes/UObjectInteger.pas
r3 r4 4 4 5 5 uses 6 SysUtils, Classes, UObjectTypeBase, UObjectBoolean ;6 SysUtils, Classes, UObjectTypeBase, UObjectBoolean, UObjectNumber; 7 7 8 8 type 9 TInteger = class(TInterfacedObject, IAssignable, I Comparable, IOrdinal)9 TInteger = class(TInterfacedObject, IAssignable, IOrdinal) 10 10 private 11 11 public -
ObjectBaseTypes/UObjectString.pas
r3 r4 4 4 5 5 uses 6 SysUtils, UObjectTypeBase, UObjectBoolean, UObjectInteger ;6 SysUtils, UObjectTypeBase, UObjectBoolean, UObjectInteger, StrUtils; 7 7 8 8 type … … 19 19 procedure Insert(Index: TInteger; SubString: TString); 20 20 function Pos(SubString: TString): TInteger; 21 procedure Reverse; 22 function LeftString(Count: TInteger): TString; 23 function RightString(Count: TInteger): TString; 21 24 end; 22 25 … … 53 56 end; 54 57 58 function TString.LeftString(Count: TInteger): TString; 59 begin 60 Result := TString.Create; 61 Result.Value := StrUtils.LeftStr(Value, Count.Value); 62 end; 63 55 64 function TString.Length: TInteger; 56 65 begin … … 70 79 function TString.Pos(SubString: TString): TInteger; 71 80 begin 81 Result := TInteger.Create; 72 82 Result.Value := System.Pos(SubString.Value, Value); 83 end; 84 85 procedure TString.Reverse; 86 begin 87 Value := StrUtils.ReverseString(Value); 88 end; 89 90 function TString.RightString(Count: TInteger): TString; 91 begin 92 Result := TString.Create; 93 Result.Value := StrUtils.RightStr(Value, Count.Value); 73 94 end; 74 95 -
ObjectBaseTypes/UObjectTypeBase.pas
r3 r4 13 13 end; 14 14 15 IOrdinal = interface 16 function Ordinal: IOrdinal; 17 function Predecessor: IOrdinal; 18 function Successor: IOrdinal; 19 function Low: IOrdinal; 20 function High: IOrdinal; 15 ISortable = interface 16 procedure Sort; 17 end; 18 19 IStreamable = interface 20 function GetStream: TStream; 21 procedure SetStrem(Stream: TStream); 21 22 end; 22 23
Note:
See TracChangeset
for help on using the changeset viewer.