Changeset 30 for trunk/Components/TemplateGenerics
- Timestamp:
- Sep 8, 2012, 9:28:39 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 3 3 backup 4 4 tunneler.exe 5 heaptrclog.trc
-
- Property svn:ignore
-
trunk/Components/TemplateGenerics
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
trunk/Components/TemplateGenerics/Demo/Demo.lpi
r29 r30 33 33 <Item1> 34 34 <PackageName Value="TemplateGenerics"/> 35 <DefaultFilename Value="../TemplateGenerics.lpk" Prefer="True"/> 35 36 </Item1> 36 37 <Item2> … … 38 39 </Item2> 39 40 </RequiredPackages> 40 <Units Count=" 62">41 <Units Count="75"> 41 42 <Unit0> 42 43 <Filename Value="Demo.lpr"/> … … 57 58 <EditorIndex Value="0"/> 58 59 <WindowIndex Value="0"/> 59 <TopLine Value=" 232"/>60 <CursorPos X=" 19" Y="237"/>60 <TopLine Value="640"/> 61 <CursorPos X="20" Y="653"/> 61 62 <UsageCount Value="233"/> 62 63 <Bookmarks Count="1"> 63 <Item0 X="65" Y="2 24" ID="2"/>64 <Item0 X="65" Y="275" ID="2"/> 64 65 </Bookmarks> 65 66 <Loaded Value="True"/> … … 73 74 <TopLine Value="1"/> 74 75 <CursorPos X="1" Y="11"/> 75 <UsageCount Value=" 4"/>76 <UsageCount Value="3"/> 76 77 </Unit2> 77 78 <Unit3> 78 79 <Filename Value="../Specialized/SpecializedList.pas"/> 79 80 <UnitName Value="SpecializedList"/> 80 <EditorIndex Value=" 2"/>81 <WindowIndex Value="0"/> 82 <TopLine Value=" 3"/>83 <CursorPos X=" 43" Y="13"/>84 <UsageCount Value="1 0"/>81 <EditorIndex Value="3"/> 82 <WindowIndex Value="0"/> 83 <TopLine Value="47"/> 84 <CursorPos X="20" Y="60"/> 85 <UsageCount Value="15"/> 85 86 <Loaded Value="True"/> 86 87 </Unit3> … … 91 92 <TopLine Value="33"/> 92 93 <CursorPos X="12" Y="56"/> 93 <UsageCount Value=" 4"/>94 <UsageCount Value="3"/> 94 95 </Unit4> 95 96 <Unit5> … … 99 100 <TopLine Value="1"/> 100 101 <CursorPos X="23" Y="21"/> 101 <UsageCount Value=" 4"/>102 <UsageCount Value="3"/> 102 103 </Unit5> 103 104 <Unit6> … … 107 108 <TopLine Value="1"/> 108 109 <CursorPos X="23" Y="24"/> 109 <UsageCount Value=" 4"/>110 <UsageCount Value="3"/> 110 111 </Unit6> 111 112 <Unit7> … … 115 116 <TopLine Value="1"/> 116 117 <CursorPos X="23" Y="13"/> 117 <UsageCount Value=" 4"/>118 <UsageCount Value="3"/> 118 119 </Unit7> 119 120 <Unit8> … … 123 124 <TopLine Value="1"/> 124 125 <CursorPos X="23" Y="24"/> 125 <UsageCount Value=" 4"/>126 <UsageCount Value="3"/> 126 127 </Unit8> 127 128 <Unit9> … … 131 132 <TopLine Value="1"/> 132 133 <CursorPos X="31" Y="13"/> 133 <UsageCount Value=" 4"/>134 <UsageCount Value="3"/> 134 135 </Unit9> 135 136 <Unit10> … … 139 140 <TopLine Value="1"/> 140 141 <CursorPos X="29" Y="17"/> 141 <UsageCount Value=" 4"/>142 <UsageCount Value="3"/> 142 143 </Unit10> 143 144 <Unit11> … … 146 147 <TopLine Value="1"/> 147 148 <CursorPos X="1" Y="4"/> 148 <UsageCount Value=" 4"/>149 <UsageCount Value="3"/> 149 150 <DefaultSyntaxHighlighter Value="None"/> 150 151 </Unit11> … … 154 155 <TopLine Value="1"/> 155 156 <CursorPos X="21" Y="6"/> 156 <UsageCount Value=" 4"/>157 <UsageCount Value="3"/> 157 158 <DefaultSyntaxHighlighter Value="None"/> 158 159 </Unit12> … … 162 163 <TopLine Value="1"/> 163 164 <CursorPos X="1" Y="1"/> 164 <UsageCount Value=" 4"/>165 <UsageCount Value="3"/> 165 166 <DefaultSyntaxHighlighter Value="None"/> 166 167 </Unit13> … … 170 171 <TopLine Value="1"/> 171 172 <CursorPos X="25" Y="13"/> 172 <UsageCount Value=" 5"/>173 <UsageCount Value="4"/> 173 174 <DefaultSyntaxHighlighter Value="None"/> 174 175 </Unit14> … … 178 179 <TopLine Value="4"/> 179 180 <CursorPos X="3" Y="6"/> 180 <UsageCount Value=" 4"/>181 <UsageCount Value="3"/> 181 182 <DefaultSyntaxHighlighter Value="None"/> 182 183 </Unit15> … … 186 187 <TopLine Value="1"/> 187 188 <CursorPos X="14" Y="16"/> 188 <UsageCount Value=" 4"/>189 <UsageCount Value="3"/> 189 190 <DefaultSyntaxHighlighter Value="None"/> 190 191 </Unit16> … … 195 196 <TopLine Value="1"/> 196 197 <CursorPos X="32" Y="18"/> 197 <UsageCount Value=" 4"/>198 <UsageCount Value="3"/> 198 199 </Unit17> 199 200 <Unit18> … … 202 203 <TopLine Value="1"/> 203 204 <CursorPos X="20" Y="12"/> 204 <UsageCount Value=" 2"/>205 <UsageCount Value="1"/> 205 206 <DefaultSyntaxHighlighter Value="None"/> 206 207 </Unit18> … … 211 212 <TopLine Value="1"/> 212 213 <CursorPos X="1" Y="22"/> 213 <UsageCount Value=" 2"/>214 <UsageCount Value="1"/> 214 215 </Unit19> 215 216 <Unit20> … … 218 219 <TopLine Value="1"/> 219 220 <CursorPos X="1" Y="1"/> 220 <UsageCount Value=" 2"/>221 <UsageCount Value="1"/> 221 222 <DefaultSyntaxHighlighter Value="None"/> 222 223 </Unit20> … … 226 227 <TopLine Value="1"/> 227 228 <CursorPos X="1" Y="3"/> 228 <UsageCount Value=" 2"/>229 <UsageCount Value="1"/> 229 230 <DefaultSyntaxHighlighter Value="None"/> 230 231 </Unit21> … … 234 235 <TopLine Value="1"/> 235 236 <CursorPos X="1" Y="3"/> 236 <UsageCount Value=" 2"/>237 <UsageCount Value="1"/> 237 238 <DefaultSyntaxHighlighter Value="None"/> 238 239 </Unit22> … … 243 244 <TopLine Value="45"/> 244 245 <CursorPos X="9" Y="79"/> 245 <UsageCount Value="1 "/>246 <UsageCount Value="10"/> 246 247 </Unit23> 247 248 <Unit24> … … 250 251 <TopLine Value="1"/> 251 252 <CursorPos X="21" Y="4"/> 252 <UsageCount Value=" 6"/>253 <UsageCount Value="5"/> 253 254 <DefaultSyntaxHighlighter Value="None"/> 254 255 </Unit24> … … 259 260 <TopLine Value="1"/> 260 261 <CursorPos X="1" Y="25"/> 261 <UsageCount Value=" 6"/>262 <UsageCount Value="5"/> 262 263 </Unit25> 263 264 <Unit26> … … 266 267 <TopLine Value="1"/> 267 268 <CursorPos X="1" Y="3"/> 268 <UsageCount Value=" 6"/>269 <UsageCount Value="5"/> 269 270 <DefaultSyntaxHighlighter Value="None"/> 270 271 </Unit26> … … 274 275 <TopLine Value="1"/> 275 276 <CursorPos X="7" Y="4"/> 276 <UsageCount Value=" 6"/>277 <UsageCount Value="5"/> 277 278 <DefaultSyntaxHighlighter Value="None"/> 278 279 </Unit27> … … 283 284 <TopLine Value="1"/> 284 285 <CursorPos X="14" Y="15"/> 285 <UsageCount Value=" 6"/>286 <UsageCount Value="5"/> 286 287 </Unit28> 287 288 <Unit29> … … 290 291 <TopLine Value="1"/> 291 292 <CursorPos X="14" Y="18"/> 292 <UsageCount Value=" 6"/>293 <UsageCount Value="5"/> 293 294 <DefaultSyntaxHighlighter Value="None"/> 294 295 </Unit29> … … 299 300 <TopLine Value="2"/> 300 301 <CursorPos X="30" Y="8"/> 301 <UsageCount Value=" 6"/>302 <UsageCount Value="5"/> 302 303 </Unit30> 303 304 <Unit31> … … 307 308 <TopLine Value="13"/> 308 309 <CursorPos X="15" Y="12"/> 309 <UsageCount Value=" 8"/>310 <UsageCount Value="7"/> 310 311 <DefaultSyntaxHighlighter Value="Delphi"/> 311 312 </Unit31> 312 313 <Unit32> 313 314 <Filename Value="../Generic/GenericList.inc"/> 314 <IsVisibleTab Value="True"/> 315 <EditorIndex Value="6"/> 316 <WindowIndex Value="0"/> 317 <TopLine Value="462"/> 318 <CursorPos X="40" Y="470"/> 315 <EditorIndex Value="4"/> 316 <WindowIndex Value="0"/> 317 <TopLine Value="42"/> 318 <CursorPos X="15" Y="55"/> 319 319 <UsageCount Value="107"/> 320 320 <Loaded Value="True"/> … … 325 325 <TopLine Value="31"/> 326 326 <CursorPos X="44" Y="47"/> 327 <UsageCount Value="9 4"/>327 <UsageCount Value="93"/> 328 328 </Unit33> 329 329 <Unit34> … … 332 332 <TopLine Value="1"/> 333 333 <CursorPos X="36" Y="48"/> 334 <UsageCount Value="9 4"/>334 <UsageCount Value="93"/> 335 335 </Unit34> 336 336 <Unit35> … … 339 339 <TopLine Value="3"/> 340 340 <CursorPos X="1" Y="3"/> 341 <UsageCount Value="9 4"/>341 <UsageCount Value="93"/> 342 342 </Unit35> 343 343 <Unit36> … … 346 346 <TopLine Value="11"/> 347 347 <CursorPos X="42" Y="11"/> 348 <UsageCount Value="9 4"/>348 <UsageCount Value="93"/> 349 349 </Unit36> 350 350 <Unit37> … … 353 353 <TopLine Value="3"/> 354 354 <CursorPos X="1" Y="3"/> 355 <UsageCount Value="9 4"/>355 <UsageCount Value="93"/> 356 356 </Unit37> 357 357 <Unit38> … … 360 360 <TopLine Value="1"/> 361 361 <CursorPos X="22" Y="30"/> 362 <UsageCount Value="9 4"/>362 <UsageCount Value="93"/> 363 363 </Unit38> 364 364 <Unit39> … … 368 368 <TopLine Value="6"/> 369 369 <CursorPos X="56" Y="36"/> 370 <UsageCount Value="9 3"/>370 <UsageCount Value="92"/> 371 371 </Unit39> 372 372 <Unit40> … … 376 376 <TopLine Value="27"/> 377 377 <CursorPos X="50" Y="59"/> 378 <UsageCount Value="9 2"/>378 <UsageCount Value="91"/> 379 379 </Unit40> 380 380 <Unit41> … … 384 384 <TopLine Value="57"/> 385 385 <CursorPos X="48" Y="85"/> 386 <UsageCount Value="9 2"/>386 <UsageCount Value="91"/> 387 387 </Unit41> 388 388 <Unit42> … … 391 391 <TopLine Value="1"/> 392 392 <CursorPos X="33" Y="14"/> 393 <UsageCount Value="9 2"/>393 <UsageCount Value="91"/> 394 394 </Unit42> 395 395 <Unit43> … … 399 399 <TopLine Value="52"/> 400 400 <CursorPos X="1" Y="81"/> 401 <UsageCount Value="9 2"/>401 <UsageCount Value="91"/> 402 402 </Unit43> 403 403 <Unit44> … … 407 407 <TopLine Value="29"/> 408 408 <CursorPos X="1" Y="62"/> 409 <UsageCount Value="9 2"/>409 <UsageCount Value="91"/> 410 410 </Unit44> 411 411 <Unit45> … … 415 415 <TopLine Value="9"/> 416 416 <CursorPos X="60" Y="36"/> 417 <UsageCount Value="9 1"/>417 <UsageCount Value="90"/> 418 418 </Unit45> 419 419 <Unit46> 420 420 <Filename Value="../Generic/GenericMatrix.inc"/> 421 <EditorIndex Value="7"/> 422 <WindowIndex Value="0"/> 423 <TopLine Value="311"/> 424 <CursorPos X="48" Y="331"/> 425 <UsageCount Value="103"/> 426 <Loaded Value="True"/> 421 <WindowIndex Value="0"/> 422 <TopLine Value="9"/> 423 <CursorPos X="28" Y="23"/> 424 <UsageCount Value="102"/> 427 425 </Unit46> 428 426 <Unit47> 429 <Filename Value="../../../../ ../lazarus/trunk/lcl/graphics.pp"/>427 <Filename Value="../../../../lazarus/trunk/lcl/graphics.pp"/> 430 428 <UnitName Value="Graphics"/> 431 429 <WindowIndex Value="0"/> 432 430 <TopLine Value="2624"/> 433 431 <CursorPos X="37" Y="2636"/> 434 <UsageCount Value="90"/> 432 <UsageCount Value="89"/> 433 <DefaultSyntaxHighlighter Value="Delphi"/> 435 434 </Unit47> 436 435 <Unit48> 437 <Filename Value="../../../../ ../lazarus/trunk/lcl/interfaces/carbon/issues.xml"/>436 <Filename Value="../../../../lazarus/trunk/lcl/interfaces/carbon/issues.xml"/> 438 437 <WindowIndex Value="0"/> 439 438 <TopLine Value="94"/> 440 439 <CursorPos X="1" Y="1"/> 441 <UsageCount Value=" 6"/>440 <UsageCount Value="5"/> 442 441 <DefaultSyntaxHighlighter Value="XML"/> 443 442 </Unit48> … … 447 446 <TopLine Value="199"/> 448 447 <CursorPos X="14" Y="213"/> 449 <UsageCount Value="28"/> 448 <UsageCount Value="27"/> 449 <DefaultSyntaxHighlighter Value="Delphi"/> 450 450 </Unit49> 451 451 <Unit50> … … 454 454 <TopLine Value="199"/> 455 455 <CursorPos X="3" Y="201"/> 456 <UsageCount Value="28"/> 456 <UsageCount Value="27"/> 457 <DefaultSyntaxHighlighter Value="Delphi"/> 457 458 </Unit50> 458 459 <Unit51> 459 460 <Filename Value="../Generic/GenericListObject.inc"/> 460 <WindowIndex Value="0"/> 461 <TopLine Value="1"/> 462 <CursorPos X="21" Y="20"/> 463 <UsageCount Value="19"/> 461 <EditorIndex Value="5"/> 462 <WindowIndex Value="0"/> 463 <TopLine Value="11"/> 464 <CursorPos X="34" Y="24"/> 465 <UsageCount Value="21"/> 466 <Loaded Value="True"/> 464 467 </Unit51> 465 468 <Unit52> … … 469 472 <TopLine Value="1"/> 470 473 <CursorPos X="27" Y="26"/> 471 <UsageCount Value="28"/> 474 <UsageCount Value="27"/> 475 <DefaultSyntaxHighlighter Value="Delphi"/> 472 476 </Unit52> 473 477 <Unit53> … … 476 480 <TopLine Value="381"/> 477 481 <CursorPos X="3" Y="398"/> 478 <UsageCount Value="28"/> 482 <UsageCount Value="27"/> 483 <DefaultSyntaxHighlighter Value="Delphi"/> 479 484 </Unit53> 480 485 <Unit54> … … 483 488 <TopLine Value="475"/> 484 489 <CursorPos X="10" Y="503"/> 485 <UsageCount Value="7"/> 490 <UsageCount Value="6"/> 491 <DefaultSyntaxHighlighter Value="Delphi"/> 486 492 </Unit54> 487 493 <Unit55> 488 <Filename Value="../../../../ ../lazarus/trunk/lcl/include/control.inc"/>494 <Filename Value="../../../../lazarus/trunk/lcl/include/control.inc"/> 489 495 <WindowIndex Value="0"/> 490 496 <TopLine Value="2270"/> 491 497 <CursorPos X="22" Y="2273"/> 492 <UsageCount Value="19"/> 498 <UsageCount Value="18"/> 499 <DefaultSyntaxHighlighter Value="Delphi"/> 493 500 </Unit55> 494 501 <Unit56> 495 502 <Filename Value="../Specialized/SpecializedMatrix.pas"/> 496 503 <UnitName Value="SpecializedMatrix"/> 497 <EditorIndex Value="8"/> 498 <WindowIndex Value="0"/> 499 <TopLine Value="31"/> 500 <CursorPos X="38" Y="62"/> 504 <WindowIndex Value="0"/> 505 <TopLine Value="1"/> 506 <CursorPos X="25" Y="41"/> 501 507 <UsageCount Value="19"/> 502 <Loaded Value="True"/>503 508 </Unit56> 504 509 <Unit57> … … 507 512 <TopLine Value="1"/> 508 513 <CursorPos X="28" Y="10"/> 509 <UsageCount Value=" 9"/>514 <UsageCount Value="8"/> 510 515 <DefaultSyntaxHighlighter Value="None"/> 511 516 </Unit57> 512 517 <Unit58> 513 <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/dateutil.inc"/> 514 <EditorIndex Value="5"/> 518 <Filename Value="../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/dateutil.inc"/> 515 519 <WindowIndex Value="0"/> 516 520 <TopLine Value="38"/> 517 521 <CursorPos X="3" Y="50"/> 518 <UsageCount Value="1 1"/>519 < Loaded Value="True"/>522 <UsageCount Value="10"/> 523 <DefaultSyntaxHighlighter Value="Delphi"/> 520 524 </Unit58> 521 525 <Unit59> 522 <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/> 523 <EditorIndex Value="1"/> 526 <Filename Value="../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/> 524 527 <WindowIndex Value="0"/> 525 528 <TopLine Value="649"/> 526 529 <CursorPos X="38" Y="671"/> 527 <UsageCount Value=" 10"/>528 < Loaded Value="True"/>530 <UsageCount Value="9"/> 531 <DefaultSyntaxHighlighter Value="Delphi"/> 529 532 </Unit59> 530 533 <Unit60> 531 <Filename Value="../../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/stringl.inc"/> 532 <EditorIndex Value="4"/> 534 <Filename Value="../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/stringl.inc"/> 533 535 <WindowIndex Value="0"/> 534 536 <TopLine Value="1185"/> 535 537 <CursorPos X="22" Y="1196"/> 536 <UsageCount Value=" 10"/>537 < Loaded Value="True"/>538 <UsageCount Value="9"/> 539 <DefaultSyntaxHighlighter Value="Delphi"/> 538 540 </Unit60> 539 541 <Unit61> 540 <Filename Value="../../../../ ../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/types.pp"/>542 <Filename Value="../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/types.pp"/> 541 543 <UnitName Value="types"/> 542 <EditorIndex Value="3"/>543 544 <WindowIndex Value="0"/> 544 545 <TopLine Value="112"/> 545 546 <CursorPos X="3" Y="124"/> 547 <UsageCount Value="9"/> 548 <DefaultSyntaxHighlighter Value="Delphi"/> 549 </Unit61> 550 <Unit62> 551 <Filename Value="../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/objpas/sysutils/sysstrh.inc"/> 552 <WindowIndex Value="0"/> 553 <TopLine Value="71"/> 554 <CursorPos X="10" Y="84"/> 555 <UsageCount Value="9"/> 556 <DefaultSyntaxHighlighter Value="Delphi"/> 557 </Unit62> 558 <Unit63> 559 <Filename Value="../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/objpas/sysutils/sysstr.inc"/> 560 <WindowIndex Value="0"/> 561 <TopLine Value="148"/> 562 <CursorPos X="11" Y="169"/> 563 <UsageCount Value="9"/> 564 <DefaultSyntaxHighlighter Value="Delphi"/> 565 </Unit63> 566 <Unit64> 567 <Filename Value="../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/inc/systemh.inc"/> 568 <WindowIndex Value="0"/> 569 <TopLine Value="511"/> 570 <CursorPos X="11" Y="524"/> 571 <UsageCount Value="9"/> 572 <DefaultSyntaxHighlighter Value="Delphi"/> 573 </Unit64> 574 <Unit65> 575 <Filename Value="../../../../Projekty2/FreePascalManager/trunk/Instance/1/FPC/rtl/i386/i386.inc"/> 576 <WindowIndex Value="0"/> 577 <TopLine Value="411"/> 578 <CursorPos X="10" Y="424"/> 579 <UsageCount Value="9"/> 580 <DefaultSyntaxHighlighter Value="Delphi"/> 581 </Unit65> 582 <Unit66> 583 <Filename Value="../Specialized/SpecializedStream.pas"/> 584 <UnitName Value="SpecializedStream"/> 585 <EditorIndex Value="8"/> 586 <WindowIndex Value="0"/> 587 <TopLine Value="106"/> 588 <CursorPos X="48" Y="107"/> 589 <UsageCount Value="15"/> 590 <Loaded Value="True"/> 591 </Unit66> 592 <Unit67> 593 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/lcl/lclclasses.pp"/> 594 <UnitName Value="LCLClasses"/> 595 <WindowIndex Value="0"/> 596 <TopLine Value="25"/> 597 <CursorPos X="32" Y="40"/> 598 <UsageCount Value="9"/> 599 </Unit67> 600 <Unit68> 601 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/lcl/controls.pp"/> 602 <UnitName Value="Controls"/> 603 <WindowIndex Value="0"/> 604 <TopLine Value="1"/> 605 <CursorPos X="39" Y="11"/> 606 <UsageCount Value="9"/> 607 </Unit68> 608 <Unit69> 609 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/fpc/2.6.0/source/rtl/inc/objpash.inc"/> 610 <WindowIndex Value="0"/> 611 <TopLine Value="179"/> 612 <CursorPos X="23" Y="192"/> 546 613 <UsageCount Value="10"/> 614 </Unit69> 615 <Unit70> 616 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/fpc/2.6.0/source/rtl/inc/objpas.inc"/> 617 <WindowIndex Value="0"/> 618 <TopLine Value="265"/> 619 <CursorPos X="9" Y="267"/> 620 <UsageCount Value="10"/> 621 </Unit70> 622 <Unit71> 623 <Filename Value="../Generic/GenericStream.inc"/> 624 <IsVisibleTab Value="True"/> 625 <EditorIndex Value="7"/> 626 <WindowIndex Value="0"/> 627 <TopLine Value="40"/> 628 <CursorPos X="18" Y="20"/> 629 <UsageCount Value="15"/> 547 630 <Loaded Value="True"/> 548 </Unit61> 631 </Unit71> 632 <Unit72> 633 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/fpc/2.6.0/source/rtl/objpas/classes/classesh.inc"/> 634 <EditorIndex Value="1"/> 635 <WindowIndex Value="0"/> 636 <TopLine Value="891"/> 637 <CursorPos X="18" Y="908"/> 638 <UsageCount Value="13"/> 639 <Loaded Value="True"/> 640 </Unit72> 641 <Unit73> 642 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/fpc/2.6.0/source/rtl/objpas/classes/streams.inc"/> 643 <EditorIndex Value="2"/> 644 <WindowIndex Value="0"/> 645 <TopLine Value="739"/> 646 <CursorPos X="18" Y="750"/> 647 <UsageCount Value="13"/> 648 <Loaded Value="True"/> 649 </Unit73> 650 <Unit74> 651 <Filename Value="../Generic/GenericListString.inc"/> 652 <EditorIndex Value="6"/> 653 <WindowIndex Value="0"/> 654 <TopLine Value="8"/> 655 <CursorPos X="34" Y="21"/> 656 <UsageCount Value="12"/> 657 <Loaded Value="True"/> 658 </Unit74> 549 659 </Units> 550 <JumpHistory Count="30" HistoryIndex="2 7">660 <JumpHistory Count="30" HistoryIndex="28"> 551 661 <Position1> 552 662 <Filename Value="UMainForm.pas"/> 553 <Caret Line=" 42" Column="51" TopLine="20"/>663 <Caret Line="142" Column="1" TopLine="128"/> 554 664 </Position1> 555 665 <Position2> 556 666 <Filename Value="UMainForm.pas"/> 557 <Caret Line=" 458" Column="36" TopLine="440"/>667 <Caret Line="143" Column="1" TopLine="128"/> 558 668 </Position2> 559 669 <Position3> 560 <Filename Value=" UMainForm.pas"/>561 <Caret Line=" 7" Column="52" TopLine="1"/>670 <Filename Value="../Generic/GenericList.inc"/> 671 <Caret Line="161" Column="1" TopLine="148"/> 562 672 </Position3> 563 673 <Position4> 564 <Filename Value=" UMainForm.pas"/>565 <Caret Line=" 526" Column="1" TopLine="502"/>674 <Filename Value="../Specialized/SpecializedStream.pas"/> 675 <Caret Line="93" Column="21" TopLine="80"/> 566 676 </Position4> 567 677 <Position5> 568 678 <Filename Value="UMainForm.pas"/> 569 <Caret Line=" 32" Column="49" TopLine="27"/>679 <Caret Line="150" Column="22" TopLine="129"/> 570 680 </Position5> 571 681 <Position6> 572 <Filename Value=" UMainForm.pas"/>573 <Caret Line=" 416" Column="38" TopLine="312"/>682 <Filename Value="../Generic/GenericStream.inc"/> 683 <Caret Line="22" Column="12" TopLine="9"/> 574 684 </Position6> 575 685 <Position7> 576 <Filename Value=" UMainForm.pas"/>577 <Caret Line=" 417" Column="38" TopLine="393"/>686 <Filename Value="../Generic/GenericStream.inc"/> 687 <Caret Line="37" Column="18" TopLine="35"/> 578 688 </Position7> 579 689 <Position8> 580 690 <Filename Value="UMainForm.pas"/> 581 <Caret Line=" 418" Column="38" TopLine="394"/>691 <Caret Line="157" Column="79" TopLine="132"/> 582 692 </Position8> 583 693 <Position9> 584 <Filename Value=" UMainForm.pas"/>585 <Caret Line=" 241" Column="3" TopLine="234"/>694 <Filename Value="../Specialized/SpecializedStream.pas"/> 695 <Caret Line="58" Column="45" TopLine="46"/> 586 696 </Position9> 587 697 <Position10> 588 <Filename Value=" UMainForm.pas"/>589 <Caret Line=" 377" Column="1" TopLine="361"/>698 <Filename Value="../Specialized/SpecializedStream.pas"/> 699 <Caret Line="119" Column="12" TopLine="100"/> 590 700 </Position10> 591 701 <Position11> 592 <Filename Value=" UMainForm.pas"/>593 <Caret Line=" 617" Column="1" TopLine="593"/>702 <Filename Value="../Generic/GenericList.inc"/> 703 <Caret Line="197" Column="39" TopLine="182"/> 594 704 </Position11> 595 705 <Position12> 596 <Filename Value=" UMainForm.pas"/>597 <Caret Line=" 260" Column="25" TopLine="230"/>706 <Filename Value="../Specialized/SpecializedStream.pas"/> 707 <Caret Line="119" Column="12" TopLine="100"/> 598 708 </Position12> 599 709 <Position13> 600 <Filename Value=" UMainForm.pas"/>601 <Caret Line=" 246" Column="21" TopLine="233"/>710 <Filename Value="../Specialized/SpecializedStream.pas"/> 711 <Caret Line="61" Column="38" TopLine="48"/> 602 712 </Position13> 603 713 <Position14> 604 <Filename Value=" UMainForm.pas"/>605 <Caret Line=" 364" Column="25" TopLine="358"/>714 <Filename Value="../Specialized/SpecializedStream.pas"/> 715 <Caret Line="130" Column="15" TopLine="117"/> 606 716 </Position14> 607 717 <Position15> 608 <Filename Value=" UMainForm.pas"/>609 <Caret Line=" 596" Column="33" TopLine="586"/>718 <Filename Value="../Specialized/SpecializedStream.pas"/> 719 <Caret Line="64" Column="36" TopLine="51"/> 610 720 </Position15> 611 721 <Position16> 612 <Filename Value=" UMainForm.pas"/>613 <Caret Line=" 237" Column="19" TopLine="232"/>722 <Filename Value="../Specialized/SpecializedStream.pas"/> 723 <Caret Line="58" Column="29" TopLine="45"/> 614 724 </Position16> 615 725 <Position17> 616 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>617 <Caret Line="7 01" Column="36" TopLine="683"/>726 <Filename Value="../Specialized/SpecializedStream.pas"/> 727 <Caret Line="78" Column="45" TopLine="78"/> 618 728 </Position17> 619 729 <Position18> 620 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>621 <Caret Line="6 59" Column="27" TopLine="653"/>730 <Filename Value="../Specialized/SpecializedStream.pas"/> 731 <Caret Line="64" Column="64" TopLine="48"/> 622 732 </Position18> 623 733 <Position19> 624 <Filename Value="../ Generic/GenericList.inc"/>625 <Caret Line=" 468" Column="70" TopLine="462"/>734 <Filename Value="../Specialized/SpecializedStream.pas"/> 735 <Caret Line="82" Column="3" TopLine="68"/> 626 736 </Position19> 627 737 <Position20> 628 <Filename Value="../Generic/GenericList .inc"/>629 <Caret Line=" 469" Column="1" TopLine="462"/>738 <Filename Value="../Generic/GenericListObject.inc"/> 739 <Caret Line="20" Column="21" TopLine="1"/> 630 740 </Position20> 631 741 <Position21> 632 <Filename Value="../Generic/GenericList .inc"/>633 <Caret Line=" 470" Column="1" TopLine="462"/>742 <Filename Value="../Generic/GenericListObject.inc"/> 743 <Caret Line="24" Column="17" TopLine="11"/> 634 744 </Position21> 635 745 <Position22> 636 <Filename Value="../Generic/GenericList .inc"/>637 <Caret Line=" 471" Column="1" TopLine="462"/>746 <Filename Value="../Generic/GenericListString.inc"/> 747 <Caret Line="1" Column="1" TopLine="1"/> 638 748 </Position22> 639 749 <Position23> 640 <Filename Value=" ../Generic/GenericList.inc"/>641 <Caret Line="4 70" Column="5" TopLine="462"/>750 <Filename Value="UMainForm.pas"/> 751 <Caret Line="43" Column="15" TopLine="28"/> 642 752 </Position23> 643 753 <Position24> 644 <Filename Value=" UMainForm.pas"/>645 <Caret Line=" 237" Column="19" TopLine="232"/>754 <Filename Value="../Generic/GenericStream.inc"/> 755 <Caret Line="13" Column="1" TopLine="1"/> 646 756 </Position24> 647 757 <Position25> 648 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>649 <Caret Line=" 659" Column="26" TopLine="647"/>758 <Filename Value="../Specialized/SpecializedStream.pas"/> 759 <Caret Line="84" Column="35" TopLine="40"/> 650 760 </Position25> 651 761 <Position26> 652 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/stringl.inc"/>653 <Caret Line="1 193" Column="20" TopLine="1185"/>762 <Filename Value="../Specialized/SpecializedStream.pas"/> 763 <Caret Line="126" Column="39" TopLine="111"/> 654 764 </Position26> 655 765 <Position27> 656 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/stringl.inc"/>657 <Caret Line="1 196" Column="22" TopLine="1185"/>766 <Filename Value="../Specialized/SpecializedStream.pas"/> 767 <Caret Line="128" Column="1" TopLine="111"/> 658 768 </Position27> 659 769 <Position28> 660 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>661 <Caret Line="6 61" Column="23" TopLine="649"/>770 <Filename Value="../Specialized/SpecializedStream.pas"/> 771 <Caret Line="68" Column="32" TopLine="55"/> 662 772 </Position28> 663 773 <Position29> 664 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>665 <Caret Line=" 657" Column="48" TopLine="644"/>774 <Filename Value="../Specialized/SpecializedStream.pas"/> 775 <Caret Line="121" Column="1" TopLine="106"/> 666 776 </Position29> 667 777 <Position30> 668 <Filename Value="../ ../../../../Programy/Lazarus/fpc/2.4.3/source/rtl/objpas/classes/classesh.inc"/>669 <Caret Line=" 651" Column="3" TopLine="639"/>778 <Filename Value="../Generic/GenericList.inc"/> 779 <Caret Line="55" Column="15" TopLine="42"/> 670 780 </Position30> 671 781 </JumpHistory> 672 782 </ProjectOptions> 673 783 <CompilerOptions> 674 <Version Value=" 9"/>784 <Version Value="11"/> 675 785 <Target> 676 786 <Filename Value="Demo"/> … … 699 809 <Linking> 700 810 <Debugging> 701 < GenerateDebugInfo Value="True"/>811 <DebugInfoType Value="dsStabs"/> 702 812 <UseHeaptrc Value="True"/> 703 813 </Debugging> -
trunk/Components/TemplateGenerics/Demo/UMainForm.lfm
r29 r30 48 48 end 49 49 object ButtonCharList: TButton 50 Left = 750 Left = 8 51 51 Height = 25 52 52 Top = 134 53 Width = 12 953 Width = 128 54 54 Caption = 'TListChar(TString)' 55 55 OnClick = ButtonCharListClick … … 57 57 end 58 58 object ButtonBenchmarkListString: TButton 59 Left = 1059 Left = 8 60 60 Height = 24 61 61 Top = 456 … … 67 67 end 68 68 object ButtonListObject: TButton 69 Left = 769 Left = 8 70 70 Height = 25 71 71 Top = 163 72 Width = 12 972 Width = 128 73 73 Caption = 'TListObject' 74 74 OnClick = ButtonListObjectClick … … 76 76 end 77 77 object ButtonBenchmarkDictionary: TButton 78 Left = 1078 Left = 8 79 79 Height = 25 80 80 Top = 424 81 Width = 12 681 Width = 128 82 82 Anchors = [akLeft, akBottom] 83 83 Caption = 'TDictionaryStringString' … … 86 86 end 87 87 object ButtonMatrixInteger: TButton 88 Left = 788 Left = 8 89 89 Height = 25 90 90 Top = 192 91 Width = 12 991 Width = 128 92 92 Caption = 'TMatrixInteger' 93 93 OnClick = ButtonMatrixIntegerClick … … 107 107 item 108 108 Caption = 'Value' 109 Width = 3 16109 Width = 321 110 110 end> 111 111 ReadOnly = True … … 140 140 TabOrder = 10 141 141 end 142 object ButtonStreamByte: TButton 143 Left = 10 144 Height = 25 145 Top = 224 146 Width = 128 147 Caption = 'TMemoryStreamByte' 148 OnClick = ButtonStreamByteClick 149 TabOrder = 11 150 end 142 151 end -
trunk/Components/TemplateGenerics/Demo/UMainForm.pas
r29 r30 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 9 ComCtrls, SpecializedList, SpecializedDictionary, SpecializedQueue, 10 DateUtils, SpecializedMatrix ;10 DateUtils, SpecializedMatrix, SpecializedStream; 11 11 12 12 type … … 15 15 16 16 TMainForm = class(TForm) 17 ButtonStreamByte: TButton; 17 18 ButtonBenchmarkDictionary: TButton; 18 19 ButtonBenchmarkListPointer: TButton; … … 38 39 procedure ButtonQueueIntegerClick(Sender: TObject); 39 40 procedure ButtonStringListClick(Sender: TObject); 41 procedure ButtonStreamByteClick(Sender: TObject); 40 42 procedure FormCreate(Sender: TObject); 41 43 procedure FormDestroy(Sender: TObject); 42 private43 44 public 44 45 MeasureDuration: TDateTime; … … 65 66 var 66 67 List: TListInteger; 68 List2: TListInteger; 67 69 I: Integer; 68 70 begin … … 70 72 LabelTestName.Caption := 'TListInteger test'; 71 73 List := TListInteger.Create; 74 List2 := TListInteger.Create; 72 75 with List do try 73 76 AddArray([10, 20, 30, 40]); … … 86 89 Insert(5, 11); 87 90 WriteOutput('Insert(5, 11)', Implode(',', IntToStr)); 91 DeleteItems(0, 10); 92 WriteOutput('Delete(0, 10)', Implode(',', IntToStr)); 93 List2.SetArray([1, 0]); 94 WriteOutput('EqualTo([6, 11])', BoolToStr(EqualTo(List2))); 95 List2.SetArray([2, 0]); 96 WriteOutput('EqualTo([7, 11])', BoolToStr(EqualTo(List2))); 97 InsertCount(0, 3); 98 WriteOutput('InsertCount(0, 3)', Implode(',', IntToStr)); 99 Fill(0, 3, 9); 100 WriteOutput('Fill(0, 3, 9)', Implode(',', IntToStr)); 88 101 finally 89 102 Free; 103 List2.Free; 90 104 end; 91 105 end; … … 110 124 WriteOutput('Clear', '[' + Implode('; ', ', ', IntToStr) + ']'); 111 125 WriteOutput('Count [Y, X]', IntToStr(Count.Y) + ', ' + IntToStr(Count.X)); 126 finally 127 Free; 128 end; 129 end; 130 131 procedure TMainForm.ButtonStreamByteClick(Sender: TObject); 132 var 133 Stream: TMemoryStreamByte; 134 I: Integer; 135 ByteArray: array of Byte; 136 ByteArrayText: string; 137 begin 138 ListViewOutput.Clear; 139 LabelTestName.Caption := 'TStreamByte test'; 140 Stream := TMemoryStreamByte.Create; 141 with Stream do try 142 WriteOutput('Size := ', IntToStr(Stream.Size)); 143 Write(1); 144 WriteOutput('Write(1)', ''); 145 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 146 WriteArray([2, 3, 4]); 147 WriteOutput('WriteArray([2, 3, 4])', ''); 148 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 149 Position := 1; 150 WriteOutput('Position := 1', ''); 151 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 152 WriteOutput('Read', IntToStr(Read)); 153 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 154 ByteArray := ReadArray(2); 155 ByteArrayText := '['; 156 for I := 0 to Length(ByteArray) - 1 do begin 157 ByteArrayText := ByteArrayText + IntToStr(ByteArray[I]); 158 if I < Length(ByteArray) - 1 then ByteArrayText := ByteArrayText + ', '; 159 end; 160 ByteArrayText := ByteArrayText + ']'; 161 WriteOutput('ReadArray', ByteArrayText); 162 WriteOutput('Size, Position', IntToStr(Stream.Size) + ', ' + IntToStr(Stream.Position)); 112 163 finally 113 164 Free; … … 478 529 var 479 530 List: TListPointer; 480 List2: T List;531 List2: TFPList; 481 532 StartTime: TDateTime; 482 533 I: Integer; … … 484 535 SampleCount: Integer = 100000; 485 536 begin 486 LabelTestName.Caption := 'Generic specialized TListObject vs. classic non-generic T List benchmark';537 LabelTestName.Caption := 'Generic specialized TListObject vs. classic non-generic TFPList benchmark'; 487 538 ListViewOutput.Clear; 488 539 try 489 540 UpdateButtonState(False); 490 541 List := TListPointer.Create; 491 List2 := TList.Create; 492 493 StartTime := Now; 494 repeat 495 List.Add(1); 542 List2 := TFPList.Create; 543 544 WriteOutput('TListPointer.InstanceSize', IntToStr(TListPointer.InstanceSize) + ' bytes'); 545 WriteOutput('TFPList.InstanceSize', IntToStr(TFPList.InstanceSize) + ' bytes'); 546 547 StartTime := Now; 548 repeat 549 List.Add(Pointer(1)); 496 550 until (Now - StartTime) > MeasureDuration; 497 551 WriteOutput('TListPointer.Add', IntToStr(List.Count) + ' ops'); … … 501 555 StartTime := Now; 502 556 repeat 503 List2.Add( 1);504 until (Now - StartTime) > MeasureDuration; 505 WriteOutput('T List.Add', IntToStr(List2.Count) + ' ops');557 List2.Add(Pointer(1)); 558 until (Now - StartTime) > MeasureDuration; 559 WriteOutput('TFPList.Add', IntToStr(List2.Count) + ' ops'); 506 560 List2.Clear; 507 561 Application.ProcessMessages; … … 509 563 StartTime := Now; 510 564 repeat 511 List.Insert(0, 1);565 List.Insert(0, Pointer(1)); 512 566 until (Now - StartTime) > MeasureDuration; 513 567 WriteOutput('TListPointer.Insert', IntToStr(List.Count) + ' ops'); … … 517 571 StartTime := Now; 518 572 repeat 519 List2.Insert(0, 1);520 until (Now - StartTime) > MeasureDuration; 521 WriteOutput('T List.Insert', IntToStr(List2.Count) + ' ops');573 List2.Insert(0, Pointer(1)); 574 until (Now - StartTime) > MeasureDuration; 575 WriteOutput('TFPList.Insert', IntToStr(List2.Count) + ' ops'); 522 576 List2.Clear; 523 577 Application.ProcessMessages; 524 578 525 579 for I := 0 to SampleCount - 1 do 526 List.Add( 1);580 List.Add(Pointer(1)); 527 581 StartTime := Now; 528 582 I := 0; … … 536 590 537 591 for I := 0 to SampleCount - 1 do 538 List2.Add( 1);592 List2.Add(Pointer(1)); 539 593 StartTime := Now; 540 594 I := 0; … … 543 597 Inc(I); 544 598 until (Now - StartTime) > MeasureDuration; 545 WriteOutput('T List.Delete', IntToStr(I) + ' ops');546 Application.ProcessMessages; 547 548 for I := 0 to SampleCount - 1 do 549 List.Add( 1);599 WriteOutput('TFPList.Delete', IntToStr(I) + ' ops'); 600 Application.ProcessMessages; 601 602 for I := 0 to SampleCount - 1 do 603 List.Add(Pointer(1)); 550 604 StartTime := Now; 551 605 I := 0; … … 559 613 560 614 for I := 0 to SampleCount - 1 do 561 List2.Add( 1);615 List2.Add(Pointer(1)); 562 616 StartTime := Now; 563 617 I := 0; … … 566 620 Inc(I); 567 621 until (Now - StartTime) > MeasureDuration; 568 WriteOutput('T List.Move', IntToStr(I) + ' ops');569 Application.ProcessMessages; 570 571 for I := 0 to SampleCount - 1 do 572 List.Add( 1);622 WriteOutput('TFPList.Move', IntToStr(I) + ' ops'); 623 Application.ProcessMessages; 624 625 for I := 0 to SampleCount - 1 do 626 List.Add(Pointer(1)); 573 627 StartTime := Now; 574 628 I := 0; … … 582 636 583 637 for I := 0 to SampleCount - 1 do 584 List2.Add( 1);638 List2.Add(Pointer(1)); 585 639 StartTime := Now; 586 640 I := 0; … … 589 643 Inc(I); 590 644 until (Now - StartTime) > MeasureDuration; 591 WriteOutput('T List.Exchange', IntToStr(I) + ' ops');592 Application.ProcessMessages; 593 594 for I := 0 to SampleCount - 1 do 595 List.Add( 1);645 WriteOutput('TFPList.Exchange', IntToStr(I) + ' ops'); 646 Application.ProcessMessages; 647 648 for I := 0 to SampleCount - 1 do 649 List.Add(Pointer(1)); 596 650 StartTime := Now; 597 651 I := 0; … … 605 659 606 660 for I := 0 to SampleCount - 1 do 607 List2.Add( 1);661 List2.Add(Pointer(1)); 608 662 StartTime := Now; 609 663 I := 0; … … 612 666 Inc(I); 613 667 until (Now - StartTime) > MeasureDuration; 614 WriteOutput('TList.IndexOf', IntToStr(I) + ' ops'); 615 Application.ProcessMessages; 616 668 WriteOutput('TFPList.IndexOf', IntToStr(I) + ' ops'); 669 Application.ProcessMessages; 670 671 for I := 0 to SampleCount - 1 do 672 List.Add(Pointer(1)); 673 StartTime := Now; 674 I := 0; 675 repeat 676 List[I mod List.Count] := Pointer(1); 677 Inc(I); 678 until (Now - StartTime) > MeasureDuration; 679 WriteOutput('TListPointer[I] write', IntToStr(I) + ' ops'); 680 List.Clear; 681 Application.ProcessMessages; 682 683 for I := 0 to SampleCount - 1 do 684 List2.Add(Pointer(1)); 685 StartTime := Now; 686 I := 0; 687 repeat 688 List2[I mod List2.Count] := Pointer(1); 689 Inc(I); 690 until (Now - StartTime) > MeasureDuration; 691 WriteOutput('TFPList[I] write', IntToStr(I) + ' ops'); 692 Application.ProcessMessages; 693 694 for I := 0 to SampleCount - 1 do 695 List.Add(Pointer(1)); 696 StartTime := Now; 697 I := 0; 698 repeat 699 List[I mod List.Count]; 700 Inc(I); 701 until (Now - StartTime) > MeasureDuration; 702 WriteOutput('TListPointer[I] read', IntToStr(I) + ' ops'); 703 List.Clear; 704 Application.ProcessMessages; 705 706 for I := 0 to SampleCount - 1 do 707 List2.Add(Pointer(1)); 708 StartTime := Now; 709 I := 0; 710 repeat 711 List2[I mod List2.Count]; 712 Inc(I); 713 until (Now - StartTime) > MeasureDuration; 714 WriteOutput('TFPList[I] read', IntToStr(I) + ' ops'); 715 Application.ProcessMessages; 617 716 finally 618 717 UpdateButtonState(True); … … 645 744 MoveItems(2, 3, 3); 646 745 WriteOutput('Implode', Implode(',', StrToStr)); 746 InsertCount(0, 3); 747 WriteOutput('InsertCount(0, 3)', Implode(',', StrToStr)); 748 Fill(0, 3, 'Zero'); 749 WriteOutput('Fill(0, 3, ''Zero'')', Implode(',', StrToStr)); 647 750 finally 648 751 Free; -
trunk/Components/TemplateGenerics/Generic/GenericDictionary.inc
r29 r30 11 11 {$DEFINE TGListItem := TGPair} 12 12 {$DEFINE TGList := TGDictionaryList} 13 {$DEFINE TGListSortCompare := T DictionarySortCompare}14 {$DEFINE TGListToStringConverter := T DictionaryToStringConverter}15 {$DEFINE TGListFromStringConverter := T DictionaryFromStringConverter}16 {$DEFINE TGListItemArray := T DictionaryItemArray}13 {$DEFINE TGListSortCompare := TGDictionarySortCompare} 14 {$DEFINE TGListToStringConverter := TGDictionaryToStringConverter} 15 {$DEFINE TGListFromStringConverter := TGDictionaryFromStringConverter} 16 {$DEFINE TGListItemArray := TGDictionaryItemArray} 17 17 {$DEFINE INTERFACE} 18 18 {$I 'GenericList.inc'} … … 37 37 {$ENDIF} 38 38 39 40 {$IFDEF IMPLEMENTATION_USES} 41 {$I '..\Generic\GenericList.inc'} 42 {$UNDEF IMPLEMENTATION_USES} 43 {$ENDIF} 44 45 39 46 {$IFDEF IMPLEMENTATION} 40 41 {$UNDEF IMPLEMENTATION}42 {$DEFINE IMPLEMENTATION_USES}43 {$I '..\Generic\GenericList.inc'}44 47 45 48 {$DEFINE TGListIndex := TGDictionaryIndex} 46 49 {$DEFINE TGListItem := TGPair} 47 50 {$DEFINE TGList := TGDictionaryList} 48 {$DEFINE TGListSortCompare := T DictionarySortCompare}49 {$DEFINE TGListToStringConverter := T DictionaryToStringConverter}50 {$DEFINE TGListFromStringConverter := T DictionaryFromStringConverter}51 {$DEFINE TGListItemArray := T DictionaryItemArray}51 {$DEFINE TGListSortCompare := TGDictionarySortCompare} 52 {$DEFINE TGListToStringConverter := TGDictionaryToStringConverter} 53 {$DEFINE TGListFromStringConverter := TGDictionaryFromStringConverter} 54 {$DEFINE TGListItemArray := TGDictionaryItemArray} 52 55 {$DEFINE IMPLEMENTATION} 53 56 {$I 'GenericList.inc'} -
trunk/Components/TemplateGenerics/Generic/GenericList.inc
r29 r30 1 1 {$IFDEF INTERFACE} 2 3 // TGList implemented using templates 4 // - item operations (Add, Insert, ReplaceArray, Get, Set, IndexOf, 5 // Extract, Delete, Exchange) 6 // - item range operations (DeleteItems, InsertItems, ReplaceItems, 7 // Move, Fill) 8 // - other TGList operations (AddList, InsertList, 9 // ReplaceList, GetList, IndexOfList) 10 // - dynamic array operations (AddArray, InsertArray, 11 // ReplaceArray, GetArray, IndexOfArray) 12 // - all items operations (Clear, Reverse, Sort) 2 13 3 14 TGList = class; … … 13 24 FItems: array of TGListItem; 14 25 FCount: TGListIndex; 26 FUpdateCount: Integer; 27 FOnUpdate: TNotifyEvent; 15 28 function Get(Index: TGListIndex): TGListItem; 16 29 function GetCapacity: TGListIndex; … … 21 34 procedure SetLast(AValue: TGListItem); 22 35 procedure SetFirst(AValue: TGListItem); 36 procedure QuickSort(L, R : TGListIndex; Compare: TGListSortCompare); 37 protected 23 38 procedure Put(Index: TGListIndex; const AValue: TGListItem); virtual; 24 39 procedure SetCount(const AValue: TGListIndex); virtual; 25 procedure QuickSort(L, R : TGListIndex; Compare: TGListSortCompare);26 40 public 41 type 42 PItem = ^TGListItem; 43 function CompareMem(P1, P2: Pointer; Length: cardinal): Boolean; inline; 27 44 function Add(Item: TGListItem): TGListIndex; 28 45 procedure AddArray(Values: array of TGListItem); 29 46 procedure AddList(List: TGList); 47 procedure AddListPart(List: TGList; ItemIndex, ItemCount: TGListIndex); 30 48 procedure Assign(Source: TGList); virtual; 49 constructor Create; virtual; 31 50 procedure Clear; virtual; 32 51 procedure Delete(Index: TGListIndex); virtual; … … 38 57 property First: TGListItem read GetFirst write SetFirst; 39 58 procedure Fill(Start, Count: TGListIndex; Value: TGListItem); 40 function GetArray: TGListItemArray; 59 function GetArray(Index, ACount: TGListIndex): TGListItemArray; 60 procedure GetList(List: TGList; Index, ACount: TGListIndex); 61 procedure GetBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 41 62 function Implode(Separator: string; Converter: TGListToStringConverter): string; 42 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; 63 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; virtual; 43 64 function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex; 65 function IndexOfArray(Values: array of TGListItem; Start: TGListIndex = 0): TGListIndex; 44 66 procedure Insert(Index: TGListIndex; Item: TGListItem); 45 67 procedure InsertList(Index: TGListIndex; List: TGList); 46 68 procedure InsertArray(Index: TGListIndex; Values: array of TGListItem); 69 procedure InsertCount(Index: TGListIndex; ACount: TGListIndex); 47 70 procedure Move(CurIndex, NewIndex: TGListIndex); 48 71 procedure MoveItems(CurIndex, NewIndex, Count: TGListIndex); 49 72 function Remove(Item: TGListItem): TGListIndex; 50 73 procedure Reverse; 51 procedure Replace(Index: TGListIndex; Source: TGList); 74 procedure ReplaceArray(Index: TGListIndex; Values: array of TGListItem); 75 procedure ReplaceList(Index: TGListIndex; Source: TGList); 76 procedure ReplaceListPart(Index: TGListIndex; Source: TGList; 77 SourceIndex, SourceCount: TGListIndex); 78 procedure ReplaceBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 52 79 procedure Sort(Compare: TGListSortCompare); 53 procedure SetArray(Values: TGListItemArray); 80 procedure SetArray(Values: array of TGListItem); 81 procedure BeginUpdate; 82 procedure EndUpdate; 83 procedure Update; 54 84 property Count: TGListIndex read FCount write SetCount; 55 85 property Capacity: TGListIndex read GetCapacity write SetCapacity; 56 86 property Items[Index: TGListIndex]: TGListItem read Get write Put; default; 57 87 property Last: TGListItem read GetLast write SetLast; 88 property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate; 58 89 end; 59 90 … … 73 104 { TGList } 74 105 75 procedure TGList.Replace(Index: TGListIndex; Source: TGList); 106 constructor TGList.Create; 107 begin 108 FCount := 0; 109 end; 110 111 procedure TGList.GetBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 112 var 113 P: PItem; 114 I: TGListIndex; 115 begin 116 if (Index + Count) > FCount then 117 raise EListError.CreateFmt(SListIndexError, [Index + Count]); 118 P := PItem(@Buffer); 119 I := 0; 120 while I < Count do begin 121 P^ := Items[Index + I]; 122 Inc(P, 1); 123 I := I + 1; 124 end; 125 end; 126 127 procedure TGList.ReplaceBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 128 var 129 P: PItem; 130 I: TGListIndex; 131 begin 132 if (Index + Count) > FCount then 133 raise EListError.CreateFmt(SListIndexError, [Index + Count]); 134 P := PItem(@Buffer); 135 I := 0; 136 while I < Count do begin 137 Items[Index + I] := P^; 138 Inc(P, 1); 139 I := I + 1; 140 end; 141 end; 142 143 procedure TGList.ReplaceArray(Index: TGListIndex; Values: array of TGListItem); 144 var 145 I: TGListIndex; 146 begin 147 I := 0; 148 while I < Length(Values) do begin 149 Items[Index + I] := Values[I]; 150 I := I + 1; 151 end; 152 Update; 153 end; 154 155 procedure TGList.ReplaceList(Index: TGListIndex; Source: TGList); 76 156 var 77 157 I: TGListIndex; … … 82 162 I := I + 1; 83 163 end; 164 Update; 165 end; 166 167 procedure TGList.ReplaceListPart(Index: TGListIndex; Source: TGList; 168 SourceIndex, SourceCount: TGListIndex); 169 var 170 I: TGListIndex; 171 begin 172 I := 0; 173 while I < SourceCount do begin 174 Items[Index + I] := Source[SourceIndex + I]; 175 I := I + 1; 176 end; 177 Update; 84 178 end; 85 179 … … 143 237 end; 144 238 145 function TGList.GetArray : TGListItemArray;239 function TGList.GetArray(Index, ACount: TGListIndex): TGListItemArray; 146 240 var 147 241 I: Integer; 148 242 begin 149 SetLength(Result, Count); 150 I := 0; 151 while I < Count do begin 152 Result[I] := FItems[I]; 153 I := I + 1; 154 end; 243 SetLength(Result, ACount); 244 I := 0; 245 while I < Count do begin 246 Result[I] := FItems[Index + I]; 247 I := I + 1; 248 end; 249 end; 250 251 procedure TGList.GetList(List: TGList; Index, ACount: TGListIndex); 252 begin 253 List.Clear; 254 List.AddListPart(Self, Index, ACount); 155 255 end; 156 256 … … 194 294 I := I + 1; 195 295 end; 296 Update; 196 297 end; 197 298 … … 208 309 end; 209 310 311 function TGList.CompareMem(P1, P2: Pointer; Length: cardinal): Boolean; 312 var 313 I: Cardinal; 314 begin 315 Result := True; 316 I := 0; 317 if (P1) <> (P2) then 318 while Result and (I < Length) do 319 begin 320 Result := PByte(P1)^ = PByte(P2)^; 321 Inc(I); 322 Inc(pchar(P1)); 323 Inc(pchar(P2)); 324 end; 325 end; 326 210 327 function TGList.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex; 211 328 begin 212 329 Result := Start; 213 330 while (Result < FCount) and 214 not CompareMem(Addr(FItems[Result]), Addr(Item), SizeOf(TGListItem)) do 331 // not CompareMem(@FItems[Result], @Item, SizeOf(TGListItem)) do 332 not (CompareByte(FItems[Result], Item, SizeOf(TGListItem)) = 0) do 215 333 Result := Result + 1; 216 334 if Result = FCount then Result := -1; … … 219 337 procedure TGList.Insert(Index: TGListIndex; Item: TGListItem); 220 338 begin 221 if (Index < 0) or (Index > FCount 339 if (Index < 0) or (Index > FCount) then 222 340 raise EListError.CreateFmt(SListIndexError, [Index]); 223 if FCount = Capacity then SetCapacityOptimized(Capacity + 1); 341 InsertCount(Index, 1); 342 FItems[Index] := Item; 343 Update; 344 end; 345 346 procedure TGList.InsertList(Index: TGListIndex; List: TGList); 347 begin 348 if (Index < 0) or (Index > FCount) then 349 raise EListError.CreateFmt(SListIndexError, [Index]); 350 InsertCount(Index, List.Count); 351 ReplaceList(Index, List); 352 end; 353 354 procedure TGList.InsertArray(Index: TGListIndex; Values: array of TGListItem); 355 begin 356 if (Index < 0) or (Index > FCount) then 357 raise EListError.CreateFmt(SListIndexError, [Index]); 358 InsertCount(Index, Length(Values)); 359 ReplaceArray(Index, Values); 360 end; 361 362 procedure TGList.InsertCount(Index: TGListIndex; ACount: TGListIndex); 363 begin 364 if (Index < 0) or (Index > FCount) then 365 raise EListError.CreateFmt(SListIndexError, [Index]); 366 Count := Count + ACount; 224 367 if Index < FCount then 225 System.Move(FItems[Index], FItems[Index + 1], (FCount - Index) * SizeOf(TGListItem)); 226 FItems[Index] := Item; 227 FCount := FCount + 1; 228 end; 229 230 procedure TGList.InsertList(Index: TGListIndex; List: TGList); 231 var 232 I: TGListIndex; 233 begin 234 I := 0; 235 while (I < List.Count) do begin 236 Insert(Index + I, List[I]); 237 I := I + 1; 238 end; 368 System.Move(FItems[Index], FItems[Index + ACount], (FCount - ACount - Index) * SizeOf(TGListItem)); 369 Update; 239 370 end; 240 371 … … 258 389 end; 259 390 391 function TGList.IndexOfArray(Values: array of TGListItem; Start: TGListIndex): TGListIndex; 392 var 393 I: TGListIndex; 394 begin 395 if Length(Values) > 0 then begin 396 Result := IndexOf(Values[0], Start); 397 if Result <> -1 then begin 398 I := 1; 399 while I < Length(Values) do begin 400 if not CompareMem(Addr(FItems[Result + I]), Addr(Values[I]), SizeOf(TGListItem)) then begin 401 Result := -1; 402 Break; 403 end; 404 I := I + 1; 405 end; 406 end; 407 end else Result := -1; 408 end; 409 260 410 function TGList.GetLast: TGListItem; 261 411 begin … … 308 458 //Delete(CurIndex); 309 459 //Insert(NewIndex, Temp); 460 Update; 310 461 end; 311 462 … … 333 484 end; 334 485 end; 486 Update; 335 487 end; 336 488 … … 339 491 Result := IndexOf(Item); 340 492 if Result <> -1 then 341 Delete(Result); 493 Delete(Result) 494 else raise Exception.CreateFmt(SItemNotFound, [0]); 342 495 end; 343 496 … … 368 521 I := I + 1; 369 522 end; 523 Update; 370 524 end; 371 525 … … 374 528 if FCount > 1 then 375 529 QuickSort(0, FCount - 1, Compare); 530 Update; 376 531 end; 377 532 … … 385 540 I := I + 1; 386 541 end; 387 end; 388 389 procedure TGList.SetArray(Values: TGListItemArray); 542 Update; 543 end; 544 545 procedure TGList.SetArray(Values: array of TGListItem); 390 546 var 391 547 I: TGListIndex; … … 399 555 end; 400 556 401 procedure TGList.InsertArray(Index: TGListIndex; Values: array of TGListItem); 402 var 403 I: TGListIndex; 404 begin 405 I := 0; 406 while I <= High(Values) do begin 407 Insert(Index + I, Values[I]); 408 I := I + 1; 409 end; 557 procedure TGList.BeginUpdate; 558 begin 559 Inc(FUpdateCount); 560 end; 561 562 procedure TGList.EndUpdate; 563 begin 564 Dec(FUpdateCount); 565 Update; 566 end; 567 568 procedure TGList.Update; 569 begin 570 if Assigned(FOnUpdate) and (FUpdateCount = 0) then FOnUpdate(Self); 410 571 end; 411 572 … … 440 601 Result := FCount - 1; 441 602 FItems[Result] := Item; 603 Update; 442 604 end; 443 605 … … 445 607 var 446 608 I: TGListIndex; 447 begin 448 I := 0; 449 while I < List.Count do begin 450 Add(List[I]); 451 I := I + 1; 452 end; 609 J: TGListIndex; 610 begin 611 I := Count; 612 J := 0; 613 Count := Count + List.Count; 614 while I < Count do begin 615 Items[I] := List[J]; 616 I := I + 1; 617 J := J + 1; 618 end; 619 Update; 620 end; 621 622 procedure TGList.AddListPart(List: TGList; ItemIndex, ItemCount: TGListIndex); 623 var 624 I: TGListIndex; 625 J: TGListIndex; 626 begin 627 I := Count; 628 J := ItemIndex; 629 Count := Count + ItemCount; 630 while I < Count do begin 631 Items[I] := List[J]; 632 I := I + 1; 633 J := J + 1; 634 end; 635 Update; 453 636 end; 454 637 … … 466 649 System.Move(FItems[Index + 1], FItems[Index], (FCount - Index) * SizeOf(TGListItem)); 467 650 SetCapacityOptimized(Capacity - 1); 651 Update; 468 652 end; 469 653 … … 477 661 I := I + 1; 478 662 end; 663 Update; 479 664 end; 480 665 … … 488 673 I := I + 1; 489 674 end; 675 Update; 490 676 end; 491 677 … … 501 687 FItems[Index1] := FItems[Index2]; 502 688 FItems[Index2] := Temp; 689 Update; 503 690 end; 504 691 -
trunk/Components/TemplateGenerics/Generic/GenericListObject.inc
r29 r30 13 13 // TGListObject<TListObjectIndex, TListObjectItem> = class(TGList) 14 14 TGListObject = class(TGList) 15 pr ivate15 protected 16 16 procedure Put(Index: TGListIndex; const AValue: TGListItem); override; 17 procedure SetCount(const AValue: TGListIndex); override; 17 18 public 18 19 OwnsObjects: Boolean; 20 function AddNew(NewObject: TGListItem = nil): TGListItem; 21 function InsertNew(Index: TGListIndex; NewObject: TGListItem = nil): TGListItem; 19 22 procedure Delete(Index: TGListObjectIndex); override; 20 procedure Clear; override;21 23 procedure Assign(Source: TGList); override; 22 constructor Create; 24 constructor Create; override; 23 25 destructor Destroy; override; 24 26 end; … … 49 51 { TGListObject } 50 52 53 function TGListObject.AddNew(NewObject: TGListItem = nil): TGListItem; 54 begin 55 if Assigned(NewObject) then Result := NewObject 56 else Result := TGListItem.Create; 57 Add(Result); 58 end; 59 60 function TGListObject.InsertNew(Index: TGListIndex; 61 NewObject: TGListItem = nil): TGListItem; 62 begin 63 if Assigned(NewObject) then Result := NewObject 64 else Result := TGListItem.Create; 65 Insert(Index, Result); 66 end; 67 51 68 procedure TGListObject.Assign(Source: TGList); 52 69 begin … … 58 75 procedure TGListObject.Put(Index: TGListIndex; const AValue: TGListItem); 59 76 begin 60 if OwnsObjects then FItems[Index].Free;77 if OwnsObjects and (FItems[Index] <> AValue) then FItems[Index].Free; 61 78 inherited Put(Index, AValue); 62 79 end; … … 68 85 end; 69 86 70 procedure TGListObject. Clear;87 procedure TGListObject.SetCount(const AValue: TGListIndex); 71 88 var 72 89 I: TGListObjectIndex; 73 90 begin 74 91 if OwnsObjects then begin 75 I := 0;76 while I < Countdo begin92 I := FCount - 1; 93 while I >= AValue do begin 77 94 FItems[I].Free; 78 I := I +1;95 I := I - 1; 79 96 end; 80 97 end; 81 inherited Clear;98 inherited; 82 99 end; 83 100 -
trunk/Components/TemplateGenerics/Generic/GenericListString.inc
r29 r30 18 18 procedure Clear; override; 19 19 procedure Assign(Source: TGList); override; 20 constructor Create; 20 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; override; 21 constructor Create; override; 21 22 destructor Destroy; override; 22 23 end; … … 71 72 end; 72 73 74 function TGListString.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex; 75 begin 76 Result := Start; 77 while (Result < Count) and 78 (CompareStr(FItems[Result], Item) <> 0) do 79 Result := Result + 1; 80 if Result = FCount then Result := -1; 81 end; 82 73 83 constructor TGListString.Create; 74 84 begin -
trunk/Components/TemplateGenerics/Generic/GenericPoint.inc
r29 r30 1 1 {$IFDEF INTERFACE} 2 2 3 // TGPoint<TPointCoord, TPointType> = class 4 TGPoint = class 5 Coordinate: array[TGPointIndex] of TGPointType; 6 //procedure SetArray(Items: array[TGPointIndex] of TGPointType); 3 // TGPoint<TPointType> = class 4 TGPoint = record 5 X: TGPointType; 6 Y: TGPointType; 7 procedure Add(Point: TGPoint); 7 8 end; 8 9 … … 12 13 {$IFDEF IMPLEMENTATION} 13 14 15 procedure TGPoint.Add(Point: TGPoint); 16 begin 17 X := X + Point.X; 18 Y := Y + Point.Y; 19 end; 14 20 15 21 {$UNDEF IMPLEMENTATION} -
trunk/Components/TemplateGenerics/Generic/GenericQueue.inc
r29 r30 11 11 {$I 'GenericList.inc'} 12 12 13 // TGQueue<T SetIndex, TSetItem> = class(TGList)13 // TGQueue<TQueueIndex, TQueueItem> = class(TGList) 14 14 TGQueue = class 15 15 private 16 16 FList: TGList; 17 function GetCount: TGQueueIndex; 17 18 public 18 19 procedure Enqueue(Value: TGQueueItem); 20 procedure EnqueueArray(Values: array of TGQueueItem); 21 procedure EnqueueList(List: TGList); 19 22 function Dequeue: TGQueueItem; 20 23 function Peek: TGQueueItem; … … 22 25 destructor Destroy; override; 23 26 property List: TGList read FList; 27 property Count: TGQueueIndex read GetCount; 24 28 end; 25 29 … … 54 58 end; 55 59 60 procedure TGQueue.EnqueueArray(Values: array of TGQueueItem); 61 begin 62 FList.AddArray(Values); 63 end; 64 65 procedure TGQueue.EnqueueList(List: TGList); 66 begin 67 FList.AddList(List); 68 end; 69 56 70 function TGQueue.Peek: TGQueueItem; 57 71 begin … … 75 89 end; 76 90 91 function TGQueue.GetCount: TGQueueIndex; 92 begin 93 Result := FList.Count; 94 end; 95 77 96 {$UNDEF IMPLEMENTATION} 78 97 {$ENDIF} -
trunk/Components/TemplateGenerics/Specialized/SpecializedBitmap.pas
r29 r30 6 6 7 7 uses 8 Classes, SysUtils, Graphics; 8 Classes, SysUtils, 9 Graphics, FPImage; 9 10 10 11 type … … 26 27 {$I 'GenericBitmap.inc'} 27 28 29 // TBitmapTFPColor<Integer, Integer, TFPColor> 30 {$DEFINE TGBitmapIndexX := Integer} 31 {$DEFINE TGBitmapIndexY := Integer} 32 {$DEFINE TGBitmapItem := TFPColor} 33 {$DEFINE TGBitmapIndex := TBitmapTFPColorIndex} 34 {$DEFINE TGBitmapRow := TBitmapTFPColorRow} 35 {$DEFINE TGBitmapMatrix := TBitmapTFPColorMatrix} 36 {$DEFINE TGBitmap := TBitmapTFPColor} 37 {$DEFINE TGBitmapSortCompare := TBitmapTFPColorSortCompare} 38 {$DEFINE TGBitmapToStringConverter := TBitmapTFPColorToStringConverter} 39 {$DEFINE TGBitmapFromStringConverter := TBitmapTFPColorFromStringConverter} 40 {$DEFINE TGBitmapMerge := TBitmapTFPColorMerge} 41 {$DEFINE INTERFACE} 42 {$I 'GenericBitmap.inc'} 28 43 29 44 implementation … … 47 62 {$I 'GenericBitmap.inc'} 48 63 64 // TBitmapTFPColor<Integer, Integer, TFPColor> 65 {$DEFINE TGBitmapIndexX := Integer} 66 {$DEFINE TGBitmapIndexY := Integer} 67 {$DEFINE TGBitmapItem := TFPColor} 68 {$DEFINE TGBitmapIndex := TBitmapTFPColorIndex} 69 {$DEFINE TGBitmapRow := TBitmapTFPColorRow} 70 {$DEFINE TGBitmapMatrix := TBitmapTFPColorMatrix} 71 {$DEFINE TGBitmap := TBitmapTFPColor} 72 {$DEFINE TGBitmapSortCompare := TBitmapTFPColorSortCompare} 73 {$DEFINE TGBitmapToStringConverter := TBitmapTFPColorToStringConverter} 74 {$DEFINE TGBitmapFromStringConverter := TBitmapTFPColorFromStringConverter} 75 {$DEFINE TGBitmapMerge := TBitmapTFPColorMerge} 76 {$DEFINE IMPLEMENTATION} 77 {$I 'GenericBitmap.inc'} 78 49 79 end. 50 80 -
trunk/Components/TemplateGenerics/Specialized/SpecializedDictionary.pas
r29 r30 17 17 {$DEFINE TGPairValue := string} 18 18 {$DEFINE TGDictionary := TDictionaryStringString} 19 {$DEFINE TGDictionaryList := TDictionary List}20 {$DEFINE TGDictionarySortCompare := TDictionaryS ortCompareInteger}21 {$DEFINE TGDictionaryToStringConverter := TDictionary ToStringConverterInteger}22 {$DEFINE TGDictionaryFromStringConverter := TDictionary FromStringConverterInteger}23 {$DEFINE TGDictionaryItemArray := TDictionaryString ItemArray}19 {$DEFINE TGDictionaryList := TDictionaryStringStringList} 20 {$DEFINE TGDictionarySortCompare := TDictionaryStringStringSortCompare} 21 {$DEFINE TGDictionaryToStringConverter := TDictionaryStringStringToStringConverter} 22 {$DEFINE TGDictionaryFromStringConverter := TDictionaryStringStringFromStringConverter} 23 {$DEFINE TGDictionaryItemArray := TDictionaryStringStringItemArray} 24 24 {$DEFINE INTERFACE} 25 25 {$I 'GenericDictionary.inc'} 26 26 27 // TDictionaryIntegerString<Integer, TPair<Integer, string>> 28 {$DEFINE TGDictionaryIndex := Integer} 29 {$DEFINE TGPair := TPairIntegerString} 30 {$DEFINE TGPairKey := Integer} 31 {$DEFINE TGPairValue := string} 32 {$DEFINE TGDictionary := TDictionaryIntegerString} 33 {$DEFINE TGDictionaryList := TDictionaryIntegerStringList} 34 {$DEFINE TGDictionarySortCompare := TDictionaryIntegerStringSortCompare} 35 {$DEFINE TGDictionaryToStringConverter := TDictionaryIntegerStringToStringConverter} 36 {$DEFINE TGDictionaryFromStringConverter := TDictionaryIntegerStringFromStringConverter} 37 {$DEFINE TGDictionaryItemArray := TDictionaryIntegerStringItemArray} 38 {$DEFINE INTERFACE} 39 {$I 'GenericDictionary.inc'} 40 41 27 42 implementation 43 44 {$DEFINE IMPLEMENTATION_USES} 45 {$I '..\Generic\GenericDictionary.inc'} 46 28 47 29 48 // TDictionaryStringString<Integer, TPair<string, string>> … … 33 52 {$DEFINE TGPairValue := string} 34 53 {$DEFINE TGDictionary := TDictionaryStringString} 35 {$DEFINE TGDictionaryList := TDictionary List}36 {$DEFINE TGDictionarySortCompare := TDictionaryS ortCompareInteger}37 {$DEFINE TGDictionaryToStringConverter := TDictionary ToStringConverterInteger}38 {$DEFINE TGDictionaryFromStringConverter := TDictionary FromStringConverterInteger}39 {$DEFINE TGDictionaryItemArray := TDictionaryString ItemArray}54 {$DEFINE TGDictionaryList := TDictionaryStringStringList} 55 {$DEFINE TGDictionarySortCompare := TDictionaryStringStringSortCompare} 56 {$DEFINE TGDictionaryToStringConverter := TDictionaryStringStringToStringConverter} 57 {$DEFINE TGDictionaryFromStringConverter := TDictionaryStringStringFromStringConverter} 58 {$DEFINE TGDictionaryItemArray := TDictionaryStringStringItemArray} 40 59 {$DEFINE IMPLEMENTATION} 41 60 {$I 'GenericDictionary.inc'} 42 61 62 // TDictionaryIntegerString<Integer, TPair<Integer, string>> 63 {$DEFINE TGDictionaryIndex := Integer} 64 {$DEFINE TGPair := TPairIntegerString} 65 {$DEFINE TGPairKey := Integer} 66 {$DEFINE TGPairValue := string} 67 {$DEFINE TGDictionary := TDictionaryIntegerString} 68 {$DEFINE TGDictionaryList := TDictionaryIntegerStringList} 69 {$DEFINE TGDictionarySortCompare := TDictionaryIntegerStringSortCompare} 70 {$DEFINE TGDictionaryToStringConverter := TDictionaryIntegerStringToStringConverter} 71 {$DEFINE TGDictionaryFromStringConverter := TDictionaryIntegerStringFromStringConverter} 72 {$DEFINE TGDictionaryItemArray := TDictionaryIntegerStringItemArray} 73 {$DEFINE IMPLEMENTATION} 74 {$I 'GenericDictionary.inc'} 75 76 43 77 end. -
trunk/Components/TemplateGenerics/Specialized/SpecializedList.pas
r29 r30 80 80 {$DEFINE TGListIndex := Integer} 81 81 {$DEFINE TGListItem := Byte} 82 {$DEFINE TGList := TListByte }82 {$DEFINE TGList := TListByteBase} 83 83 {$DEFINE TGListSortCompare := TListByteSortCompare} 84 84 {$DEFINE TGListToStringConverter := TListByteToStringConverter} … … 87 87 {$DEFINE INTERFACE} 88 88 {$I 'GenericList.inc'} 89 90 TListByte = class(TListByteBase) 91 procedure WriteToStream(Stream: TStream); 92 procedure WriteToStreamPart(Stream: TStream; ItemIndex, ItemCount: TGListIndex); 93 procedure ReplaceStream(Stream: TStream); 94 procedure ReplaceStreamPart(Stream: TStream; ItemIndex, ItemCount: TGListIndex); 95 procedure AddStream(Stream: TStream); 96 procedure AddStreamPart(Stream: TStream; ItemCount: TGListIndex); 97 procedure WriteBuffer(var Buffer; Count: Integer); 98 procedure ReadBuffer(var Buffer; Count: Integer); 99 end; 89 100 90 101 // TListChar<Integer, Char> … … 137 148 TListMethod = class(TListMethodBase) 138 149 procedure CallAll; 139 procedure CallNotifyEvents(Sender: TObject); 140 end; 150 end; 151 152 // TListNotifyEventBase<Integer, TNotifyEvent> 153 {$DEFINE TGListIndex := Integer} 154 {$DEFINE TGListItem := TNotifyEvent} 155 {$DEFINE TGList := TListNotifyEventBase} 156 {$DEFINE TGListSortCompare := TListNotifyEventSortCompare} 157 {$DEFINE TGListToStringConverter := TListNotifyEventToStringConverter} 158 {$DEFINE TGListFromStringConverter := TListNotifyEventFromStringConverter} 159 {$DEFINE TGListItemArray := TListNotifyEventItemArray} 160 {$DEFINE INTERFACE} 161 {$I 'GenericList.inc'} 162 163 // TListNotifyEvent<Integer, TNotifyEvent> 164 TListNotifyEvent = class(TListNotifyEventBase) 165 procedure CallAll(Sender: TObject); 166 end; 167 168 169 TBaseEvent = procedure of object; 170 171 // TListSimpleEventBase<Integer, TBaseEvent> 172 {$DEFINE TGListIndex := Integer} 173 {$DEFINE TGListItem := TBaseEvent} 174 {$DEFINE TGList := TListSimpleEventBase} 175 {$DEFINE TGListSortCompare := TListSimpleEventSortCompare} 176 {$DEFINE TGListToStringConverter := TListSimpleEventToStringConverter} 177 {$DEFINE TGListFromStringConverter := TListSimpleEventFromStringConverter} 178 {$DEFINE TGListItemArray := TListSimpleEventItemArray} 179 {$DEFINE INTERFACE} 180 {$I 'GenericList.inc'} 181 182 // TListSimpleEvent<Integer, TSimpleEvent> 183 TListSimpleEvent = class(TListSimpleEventBase) 184 procedure CallAll; 185 end; 186 141 187 142 188 function StrToStr(Value: string): string; … … 216 262 {$DEFINE TGListIndex := Integer} 217 263 {$DEFINE TGListItem := Byte} 218 {$DEFINE TGList := TListByte }264 {$DEFINE TGList := TListByteBase} 219 265 {$DEFINE TGListSortCompare := TListByteSortCompare} 220 266 {$DEFINE TGListToStringConverter := TListByteToStringConverter} … … 258 304 {$I 'GenericList.inc'} 259 305 306 // TListNotifyEventBase<Integer, TNotifyEvent> 307 {$DEFINE TGListIndex := Integer} 308 {$DEFINE TGListItem := TNotifyEvent} 309 {$DEFINE TGList := TListNotifyEventBase} 310 {$DEFINE TGListSortCompare := TListNotifyEventSortCompare} 311 {$DEFINE TGListToStringConverter := TListNotifyEventToStringConverter} 312 {$DEFINE TGListFromStringConverter := TListNotifyEventFromStringConverter} 313 {$DEFINE TGListItemArray := TListNotifyEventItemArray} 314 {$DEFINE IMPLEMENTATION} 315 {$I 'GenericList.inc'} 316 317 // TListSimpleEventBase<Integer, TBaseEvent> 318 {$DEFINE TGListIndex := Integer} 319 {$DEFINE TGListItem := TBaseEvent} 320 {$DEFINE TGList := TListSimpleEventBase} 321 {$DEFINE TGListSortCompare := TListSimpleEventSortCompare} 322 {$DEFINE TGListToStringConverter := TListSimpleEventToStringConverter} 323 {$DEFINE TGListFromStringConverter := TListSimpleEventFromStringConverter} 324 {$DEFINE TGListItemArray := TListSimpleEventItemArray} 325 {$DEFINE IMPLEMENTATION} 326 {$I 'GenericList.inc'} 327 328 260 329 261 330 function StrToStr(Value: string): string; … … 263 332 Result := Value; 264 333 end; 334 335 { TListSimpleEvent } 336 337 procedure TListSimpleEvent.CallAll; 338 var 339 I: TGListIndex; 340 begin 341 I := 0; 342 while (I < Count) do begin 343 TBaseEvent(Items[I])(); 344 I := I + 1; 345 end; 346 end; 347 265 348 266 349 { TListChar } … … 323 406 end; 324 407 325 procedure TList Method.CallNotifyEvents(Sender: TObject);408 procedure TListNotifyEvent.CallAll(Sender: TObject); 326 409 var 327 410 I: TGListIndex; … … 334 417 end; 335 418 419 { TListByte } 420 421 procedure TListByte.WriteToStream(Stream: TStream); 422 var 423 I: Integer; 424 begin 425 Stream.Position := 0; 426 I := 0; 427 while I < Count do begin 428 Stream.WriteByte(Items[I]); 429 I := I + 1; 430 end; 431 end; 432 433 procedure TListByte.WriteToStreamPart(Stream: TStream; ItemIndex, ItemCount: Integer); 434 var 435 I: Integer; 436 begin 437 I := ItemIndex; 438 while I < ItemCount do begin 439 Stream.WriteByte(Items[I]); 440 I := I + 1; 441 end; 442 end; 443 444 procedure TListByte.ReplaceStream(Stream: TStream); 445 var 446 I: Integer; 447 begin 448 Stream.Position := 0; 449 I := 0; 450 while I < Count do begin 451 Items[I] := Stream.ReadByte; 452 I := I + 1; 453 end; 454 end; 455 456 procedure TListByte.ReplaceStreamPart(Stream: TStream; ItemIndex, 457 ItemCount: Integer); 458 var 459 I: Integer; 460 begin 461 I := ItemIndex; 462 while I < ItemCount do begin 463 Items[I] := Stream.ReadByte; 464 I := I + 1; 465 end; 466 end; 467 468 procedure TListByte.AddStream(Stream: TStream); 469 var 470 I: Integer; 471 begin 472 Stream.Position := 0; 473 I := Count; 474 Count := Count + Stream.Size; 475 while I < Count do begin 476 Items[I] := Stream.ReadByte; 477 I := I + 1; 478 end; 479 end; 480 481 procedure TListByte.AddStreamPart(Stream: TStream; ItemCount: Integer); 482 var 483 I: Integer; 484 begin 485 I := Count; 486 Count := Count + ItemCount; 487 while I < Count do begin 488 Items[I] := Stream.ReadByte; 489 I := I + 1; 490 end; 491 end; 492 493 procedure TListByte.WriteBuffer(var Buffer; Count: Integer); 494 begin 495 496 end; 497 498 procedure TListByte.ReadBuffer(var Buffer; Count: Integer); 499 begin 500 501 end; 502 336 503 end. -
trunk/Components/TemplateGenerics/Specialized/SpecializedMatrix.pas
r29 r30 1 1 unit SpecializedMatrix; 2 2 3 {$mode objfpc}{$H+}3 {$mode Delphi}{$H+} 4 4 5 5 interface -
trunk/Components/TemplateGenerics/Specialized/SpecializedPoint.pas
r29 r30 1 1 unit SpecializedPoint; 2 2 3 {$mode objfpc}{$H+}3 {$mode Delphi}{$H+} 4 4 5 5 interface … … 11 11 12 12 type 13 TPoint2DIndex = (piX, piY); 14 15 // TPoint2D<TPoint2DIndex, Integer> 16 {$DEFINE TGPointIndex := TPoint2DIndex} 13 // TPoint<Integer> 17 14 {$DEFINE TGPointType := Integer} 18 {$DEFINE TGPoint := TPoint 2D}15 {$DEFINE TGPoint := TPoint} 19 16 {$DEFINE INTERFACE} 20 17 {$I 'GenericPoint.inc'} 18 19 // TSmallPoint<SmallInt> 20 {$DEFINE TGPointType := SmallInt} 21 {$DEFINE TGPoint := TSmallPoint} 22 {$DEFINE INTERFACE} 23 {$I 'GenericPoint.inc'} 24 25 // TPointSingle<Single> 26 {$DEFINE TGPointType := Single} 27 {$DEFINE TGPoint := TPointSingle} 28 {$DEFINE INTERFACE} 29 {$I 'GenericPoint.inc'} 30 31 // TPointDouble<Double> 32 {$DEFINE TGPointType := Double} 33 {$DEFINE TGPoint := TPointDouble} 34 {$DEFINE INTERFACE} 35 {$I 'GenericPoint.inc'} 36 21 37 implementation 22 38 23 // TPoint2D<TPoint2DIndex, Integer> 24 {$DEFINE TGPointIndex := T2DPointIndex} 39 // TPoint<Integer> 25 40 {$DEFINE TGPointType := Integer} 26 {$DEFINE TGPoint := TPoint 2D}41 {$DEFINE TGPoint := TPoint} 27 42 {$DEFINE IMPLEMENTATION} 28 43 {$I 'GenericPoint.inc'} 29 44 45 // TSmallPoint<SmallInt> 46 {$DEFINE TGPointType := SmallInt} 47 {$DEFINE TGPoint := TSmallPoint} 48 {$DEFINE IMPLEMENTATION} 49 {$I 'GenericPoint.inc'} 50 51 // TPointSingle<Single> 52 {$DEFINE TGPointType := Single} 53 {$DEFINE TGPoint := TPointSingle} 54 {$DEFINE IMPLEMENTATION} 55 {$I 'GenericPoint.inc'} 56 57 // TPointDouble<Double> 58 {$DEFINE TGPointType := Double} 59 {$DEFINE TGPoint := TPointDouble} 60 {$DEFINE IMPLEMENTATION} 61 {$I 'GenericPoint.inc'} 30 62 end. 31 63 -
trunk/Components/TemplateGenerics/TemplateGenerics.lpk
r29 r30 1 1 <?xml version="1.0"?> 2 2 <CONFIG> 3 <Package Version=" 3">3 <Package Version="4"> 4 4 <PathDelim Value="\"/> 5 5 <Name Value="TemplateGenerics"/> 6 <Author Value="Chronos"/> 6 <AddToProjectUsesSection Value="True"/> 7 <Author Value="Chronos (robie@centrum.cz)"/> 7 8 <CompilerOptions> 8 <Version Value="1 0"/>9 <Version Value="11"/> 9 10 <PathDelim Value="\"/> 10 11 <SearchPaths> 11 12 <IncludeFiles Value="Generic"/> 12 <OtherUnitFiles Value="Specialized;Generic "/>13 <OtherUnitFiles Value="Specialized;Generic;Additional"/> 13 14 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 14 15 </SearchPaths> 16 <CodeGeneration> 17 <Optimizations> 18 <VariablesInRegisters Value="True"/> 19 <OptimizationLevel Value="3"/> 20 </Optimizations> 21 </CodeGeneration> 15 22 <Other> 23 <CompilerMessages> 24 <UseMsgFile Value="True"/> 25 </CompilerMessages> 16 26 <CompilerPath Value="$(CompPath)"/> 17 27 </Other> 18 28 </CompilerOptions> 19 29 <Description Value="Generic classes implemented as templates."/> 20 <Version Minor=" 3"/>21 <Files Count="2 2">30 <Version Minor="4"/> 31 <Files Count="27"> 22 32 <Item1> 23 33 <Filename Value="ReadMe.txt"/> … … 66 76 <Item12> 67 77 <Filename Value="Generic\GenericBitmap.inc"/> 78 <UnitName Value="GenericBitmap"/> 68 79 </Item12> 69 80 <Item13> … … 72 83 </Item13> 73 84 <Item14> 85 <Filename Value="Generic\GenericStream.inc"/> 86 <UnitName Value="GenericStream"/> 87 </Item14> 88 <Item15> 89 <Filename Value="Generic\GenericRectangle.inc"/> 90 <UnitName Value="GenericRectangle"/> 91 </Item15> 92 <Item16> 74 93 <Filename Value="Specialized\SpecializedList.pas"/> 75 94 <UnitName Value="SpecializedList"/> 76 </Item1 4>77 <Item1 5>95 </Item16> 96 <Item17> 78 97 <Filename Value="Specialized\SpecializedDictionary.pas"/> 79 98 <UnitName Value="SpecializedDictionary"/> 80 </Item1 5>81 <Item1 6>99 </Item17> 100 <Item18> 82 101 <Filename Value="Specialized\SpecializedStack.pas"/> 83 102 <UnitName Value="SpecializedStack"/> 84 </Item1 6>85 <Item1 7>103 </Item18> 104 <Item19> 86 105 <Filename Value="Specialized\SpecializedTree.pas"/> 87 106 <UnitName Value="SpecializedTree"/> 88 </Item1 7>89 <Item 18>107 </Item19> 108 <Item20> 90 109 <Filename Value="Specialized\SpecializedQueue.pas"/> 91 110 <UnitName Value="SpecializedQueue"/> 92 </Item 18>93 <Item 19>111 </Item20> 112 <Item21> 94 113 <Filename Value="Specialized\SpecializedSet.pas"/> 95 114 <UnitName Value="SpecializedSet"/> 96 </Item 19>97 <Item2 0>115 </Item21> 116 <Item22> 98 117 <Filename Value="Specialized\SpecializedPoint.pas"/> 99 118 <UnitName Value="SpecializedPoint"/> 100 </Item2 0>101 <Item2 1>119 </Item22> 120 <Item23> 102 121 <Filename Value="Specialized\SpecializedMatrix.pas"/> 103 122 <UnitName Value="SpecializedMatrix"/> 104 </Item2 1>105 <Item2 2>123 </Item23> 124 <Item24> 106 125 <Filename Value="Specialized\SpecializedBitmap.pas"/> 107 126 <UnitName Value="SpecializedBitmap"/> 108 </Item22> 127 </Item24> 128 <Item25> 129 <Filename Value="Specialized\SpecializedStream.pas"/> 130 <UnitName Value="SpecializedStream"/> 131 </Item25> 132 <Item26> 133 <Filename Value="Specialized\SpecializedRectangle.pas"/> 134 <UnitName Value="SpecializedRectangle"/> 135 </Item26> 136 <Item27> 137 <Filename Value="Additional\UBinarySerializer.pas"/> 138 <UnitName Value="UBinarySerializer"/> 139 </Item27> 109 140 </Files> 110 141 <Type Value="RunAndDesignTime"/> 111 142 <RequiredPkgs Count="2"> 112 143 <Item1> 113 <PackageName Value="LCL "/>144 <PackageName Value="LCLBase"/> 114 145 </Item1> 115 146 <Item2> … … 119 150 </RequiredPkgs> 120 151 <UsageOptions> 121 <IncludePath Value="Generic"/>122 152 <UnitPath Value="$(PkgOutDir)"/> 123 153 </UsageOptions> … … 125 155 <Version Value="2"/> 126 156 </PublishOptions> 157 <CustomOptions Items="ExternHelp" Version="2"> 158 <_ExternHelp Items="Count"/> 159 </CustomOptions> 127 160 </Package> 128 161 </CONFIG> -
trunk/Components/TemplateGenerics/TemplateGenerics.pas
r29 r30 3 3 } 4 4 5 unit TemplateGenerics; 5 unit TemplateGenerics; 6 6 7 7 interface … … 10 10 SpecializedList, SpecializedDictionary, SpecializedStack, SpecializedTree, 11 11 SpecializedQueue, SpecializedSet, SpecializedPoint, SpecializedMatrix, 12 SpecializedBitmap, LazarusPackageIntf; 12 SpecializedBitmap, SpecializedStream, SpecializedRectangle, 13 UBinarySerializer, LazarusPackageIntf; 13 14 14 15 implementation 15 16 16 procedure Register; 17 procedure Register; 17 18 begin 18 end; 19 end; 19 20 20 21 initialization 21 RegisterPackage('TemplateGenerics', @Register); 22 RegisterPackage('TemplateGenerics', @Register); 22 23 end.
Note:
See TracChangeset
for help on using the changeset viewer.