Changeset 424 for Generics/NativeGenerics
- Timestamp:
- Sep 18, 2012, 10:52:19 AM (12 years ago)
- Location:
- Generics/NativeGenerics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Demo/Demo.lpi
r423 r424 38 38 </Item2> 39 39 </RequiredPackages> 40 <Units Count=" 68">40 <Units Count="74"> 41 41 <Unit0> 42 42 <Filename Value="Demo.lpr"/> … … 56 56 <ResourceBaseClass Value="Form"/> 57 57 <UnitName Value="UMainForm"/> 58 <EditorIndex Value=" 0"/>59 <WindowIndex Value="0"/> 60 <TopLine Value=" 18"/>61 <CursorPos X=" 36" Y="10"/>58 <EditorIndex Value="1"/> 59 <WindowIndex Value="0"/> 60 <TopLine Value="652"/> 61 <CursorPos X="15" Y="33"/> 62 62 <UsageCount Value="233"/> 63 63 <Bookmarks Count="1"> … … 65 65 </Bookmarks> 66 66 <Loaded Value="True"/> 67 <LoadedDesigner Value="True"/>68 67 <DefaultSyntaxHighlighter Value="Delphi"/> 69 68 </Unit1> … … 74 73 <TopLine Value="47"/> 75 74 <CursorPos X="20" Y="60"/> 76 <UsageCount Value="1 "/>75 <UsageCount Value="10"/> 77 76 <DefaultSyntaxHighlighter Value="Delphi"/> 78 77 </Unit2> … … 82 81 <TopLine Value="1"/> 83 82 <CursorPos X="25" Y="13"/> 84 <UsageCount Value=" 6"/>83 <UsageCount Value="5"/> 85 84 <DefaultSyntaxHighlighter Value="None"/> 86 85 </Unit3> … … 90 89 <TopLine Value="359"/> 91 90 <CursorPos X="62" Y="376"/> 92 <UsageCount Value="9 8"/>91 <UsageCount Value="97"/> 93 92 <DefaultSyntaxHighlighter Value="Delphi"/> 94 93 </Unit4> … … 98 97 <TopLine Value="31"/> 99 98 <CursorPos X="44" Y="47"/> 100 <UsageCount Value="8 5"/>99 <UsageCount Value="84"/> 101 100 <DefaultSyntaxHighlighter Value="Delphi"/> 102 101 </Unit5> … … 106 105 <TopLine Value="1"/> 107 106 <CursorPos X="36" Y="48"/> 108 <UsageCount Value="8 5"/>107 <UsageCount Value="84"/> 109 108 <DefaultSyntaxHighlighter Value="Delphi"/> 110 109 </Unit6> … … 114 113 <TopLine Value="3"/> 115 114 <CursorPos X="1" Y="3"/> 116 <UsageCount Value="8 5"/>115 <UsageCount Value="84"/> 117 116 <DefaultSyntaxHighlighter Value="Delphi"/> 118 117 </Unit7> … … 122 121 <TopLine Value="11"/> 123 122 <CursorPos X="42" Y="11"/> 124 <UsageCount Value="8 5"/>123 <UsageCount Value="84"/> 125 124 <DefaultSyntaxHighlighter Value="Delphi"/> 126 125 </Unit8> … … 130 129 <TopLine Value="3"/> 131 130 <CursorPos X="1" Y="3"/> 132 <UsageCount Value="8 5"/>131 <UsageCount Value="84"/> 133 132 <DefaultSyntaxHighlighter Value="Delphi"/> 134 133 </Unit9> … … 138 137 <TopLine Value="1"/> 139 138 <CursorPos X="22" Y="30"/> 140 <UsageCount Value="8 5"/>139 <UsageCount Value="84"/> 141 140 <DefaultSyntaxHighlighter Value="Delphi"/> 142 141 </Unit10> … … 147 146 <TopLine Value="6"/> 148 147 <CursorPos X="56" Y="36"/> 149 <UsageCount Value="8 4"/>148 <UsageCount Value="83"/> 150 149 <DefaultSyntaxHighlighter Value="Delphi"/> 151 150 </Unit11> … … 156 155 <TopLine Value="27"/> 157 156 <CursorPos X="50" Y="59"/> 158 <UsageCount Value="8 3"/>157 <UsageCount Value="82"/> 159 158 <DefaultSyntaxHighlighter Value="Delphi"/> 160 159 </Unit12> … … 165 164 <TopLine Value="57"/> 166 165 <CursorPos X="48" Y="85"/> 167 <UsageCount Value="8 3"/>166 <UsageCount Value="82"/> 168 167 <DefaultSyntaxHighlighter Value="Delphi"/> 169 168 </Unit13> … … 173 172 <TopLine Value="1"/> 174 173 <CursorPos X="33" Y="14"/> 175 <UsageCount Value="8 3"/>174 <UsageCount Value="82"/> 176 175 <DefaultSyntaxHighlighter Value="Delphi"/> 177 176 </Unit14> … … 182 181 <TopLine Value="52"/> 183 182 <CursorPos X="1" Y="81"/> 184 <UsageCount Value="8 3"/>183 <UsageCount Value="82"/> 185 184 <DefaultSyntaxHighlighter Value="Delphi"/> 186 185 </Unit15> … … 191 190 <TopLine Value="29"/> 192 191 <CursorPos X="1" Y="62"/> 193 <UsageCount Value="8 3"/>192 <UsageCount Value="82"/> 194 193 <DefaultSyntaxHighlighter Value="Delphi"/> 195 194 </Unit16> … … 200 199 <TopLine Value="9"/> 201 200 <CursorPos X="60" Y="36"/> 202 <UsageCount Value="8 2"/>201 <UsageCount Value="81"/> 203 202 <DefaultSyntaxHighlighter Value="Delphi"/> 204 203 </Unit17> … … 208 207 <TopLine Value="9"/> 209 208 <CursorPos X="28" Y="23"/> 210 <UsageCount Value="9 4"/>209 <UsageCount Value="93"/> 211 210 <DefaultSyntaxHighlighter Value="Delphi"/> 212 211 </Unit18> … … 217 216 <TopLine Value="2624"/> 218 217 <CursorPos X="37" Y="2636"/> 219 <UsageCount Value="8 1"/>218 <UsageCount Value="80"/> 220 219 <DefaultSyntaxHighlighter Value="Delphi"/> 221 220 </Unit19> … … 225 224 <TopLine Value="199"/> 226 225 <CursorPos X="14" Y="213"/> 227 <UsageCount Value="1 9"/>226 <UsageCount Value="18"/> 228 227 <DefaultSyntaxHighlighter Value="Delphi"/> 229 228 </Unit20> … … 233 232 <TopLine Value="199"/> 234 233 <CursorPos X="3" Y="201"/> 235 <UsageCount Value="1 9"/>234 <UsageCount Value="18"/> 236 235 <DefaultSyntaxHighlighter Value="Delphi"/> 237 236 </Unit21> … … 241 240 <TopLine Value="1"/> 242 241 <CursorPos X="21" Y="20"/> 243 <UsageCount Value=" 10"/>242 <UsageCount Value="9"/> 244 243 <DefaultSyntaxHighlighter Value="Delphi"/> 245 244 </Unit22> … … 250 249 <TopLine Value="1"/> 251 250 <CursorPos X="27" Y="26"/> 252 <UsageCount Value="1 9"/>251 <UsageCount Value="18"/> 253 252 <DefaultSyntaxHighlighter Value="Delphi"/> 254 253 </Unit23> … … 258 257 <TopLine Value="381"/> 259 258 <CursorPos X="3" Y="398"/> 260 <UsageCount Value="1 9"/>259 <UsageCount Value="18"/> 261 260 <DefaultSyntaxHighlighter Value="Delphi"/> 262 261 </Unit24> … … 266 265 <TopLine Value="2270"/> 267 266 <CursorPos X="22" Y="2273"/> 268 <UsageCount Value=" 10"/>267 <UsageCount Value="9"/> 269 268 <DefaultSyntaxHighlighter Value="Delphi"/> 270 269 </Unit25> … … 275 274 <TopLine Value="1"/> 276 275 <CursorPos X="25" Y="41"/> 277 <UsageCount Value=" 10"/>276 <UsageCount Value="9"/> 278 277 <DefaultSyntaxHighlighter Value="Delphi"/> 279 278 </Unit26> … … 283 282 <TopLine Value="38"/> 284 283 <CursorPos X="3" Y="50"/> 285 <UsageCount Value=" 2"/>284 <UsageCount Value="1"/> 286 285 <DefaultSyntaxHighlighter Value="Delphi"/> 287 286 </Unit27> … … 291 290 <TopLine Value="649"/> 292 291 <CursorPos X="38" Y="671"/> 293 <UsageCount Value="1 "/>292 <UsageCount Value="10"/> 294 293 <DefaultSyntaxHighlighter Value="Delphi"/> 295 294 </Unit28> … … 299 298 <TopLine Value="1185"/> 300 299 <CursorPos X="22" Y="1196"/> 301 <UsageCount Value="1 "/>300 <UsageCount Value="10"/> 302 301 <DefaultSyntaxHighlighter Value="Delphi"/> 303 302 </Unit29> … … 308 307 <TopLine Value="112"/> 309 308 <CursorPos X="3" Y="124"/> 310 <UsageCount Value="1 "/>309 <UsageCount Value="10"/> 311 310 <DefaultSyntaxHighlighter Value="Delphi"/> 312 311 </Unit30> … … 316 315 <TopLine Value="71"/> 317 316 <CursorPos X="10" Y="84"/> 318 <UsageCount Value="1 "/>317 <UsageCount Value="10"/> 319 318 <DefaultSyntaxHighlighter Value="Delphi"/> 320 319 </Unit31> … … 324 323 <TopLine Value="148"/> 325 324 <CursorPos X="11" Y="169"/> 326 <UsageCount Value="1 "/>325 <UsageCount Value="10"/> 327 326 <DefaultSyntaxHighlighter Value="Delphi"/> 328 327 </Unit32> … … 332 331 <TopLine Value="511"/> 333 332 <CursorPos X="11" Y="524"/> 334 <UsageCount Value="1 "/>333 <UsageCount Value="10"/> 335 334 <DefaultSyntaxHighlighter Value="Delphi"/> 336 335 </Unit33> … … 340 339 <TopLine Value="411"/> 341 340 <CursorPos X="10" Y="424"/> 342 <UsageCount Value="1 "/>341 <UsageCount Value="10"/> 343 342 <DefaultSyntaxHighlighter Value="Delphi"/> 344 343 </Unit34> … … 347 346 <UnitName Value="GenericList"/> 348 347 <IsVisibleTab Value="True"/> 349 <EditorIndex Value=" 1"/>350 <WindowIndex Value="0"/> 351 <TopLine Value=" 530"/>352 <CursorPos X=" 1" Y="542"/>353 <UsageCount Value="6 1"/>348 <EditorIndex Value="5"/> 349 <WindowIndex Value="0"/> 350 <TopLine Value="190"/> 351 <CursorPos X="56" Y="205"/> 352 <UsageCount Value="63"/> 354 353 <Loaded Value="True"/> 355 354 </Unit35> … … 357 356 <Filename Value="../Units/GenericMatrix.pas"/> 358 357 <UnitName Value="GenericMatrix"/> 359 <EditorIndex Value=" 13"/>360 <WindowIndex Value="0"/> 361 <TopLine Value=" 94"/>362 <CursorPos X=" 18" Y="118"/>358 <EditorIndex Value="0"/> 359 <WindowIndex Value="0"/> 360 <TopLine Value="127"/> 361 <CursorPos X="51" Y="143"/> 363 362 <UsageCount Value="39"/> 364 363 <Loaded Value="True"/> … … 370 369 <TopLine Value="34"/> 371 370 <CursorPos X="18" Y="48"/> 372 <UsageCount Value="3 7"/>371 <UsageCount Value="36"/> 373 372 </Unit37> 374 373 <Unit38> … … 378 377 <TopLine Value="18"/> 379 378 <CursorPos X="24" Y="28"/> 380 <UsageCount Value=" 9"/>379 <UsageCount Value="8"/> 381 380 </Unit38> 382 381 <Unit39> 383 382 <Filename Value="../Units/GenericDictionary.pas"/> 384 383 <UnitName Value="GenericDictionary"/> 385 <EditorIndex Value="12"/>386 384 <WindowIndex Value="0"/> 387 385 <TopLine Value="1"/> 388 386 <CursorPos X="1" Y="1"/> 389 387 <UsageCount Value="40"/> 390 <Loaded Value="True"/>391 388 </Unit39> 392 389 <Unit40> … … 395 392 <TopLine Value="9"/> 396 393 <CursorPos X="10" Y="22"/> 397 <UsageCount Value="3 8"/>394 <UsageCount Value="37"/> 398 395 <DefaultSyntaxHighlighter Value="Delphi"/> 399 396 </Unit40> … … 404 401 <TopLine Value="45"/> 405 402 <CursorPos X="1" Y="68"/> 406 <UsageCount Value="3 9"/>403 <UsageCount Value="38"/> 407 404 </Unit41> 408 405 <Unit42> … … 411 408 <TopLine Value="257"/> 412 409 <CursorPos X="3" Y="270"/> 413 <UsageCount Value="3 5"/>410 <UsageCount Value="34"/> 414 411 </Unit42> 415 412 <Unit43> … … 419 416 <TopLine Value="1"/> 420 417 <CursorPos X="1" Y="1"/> 421 <UsageCount Value=" 9"/>418 <UsageCount Value="8"/> 422 419 </Unit43> 423 420 <Unit44> … … 427 424 <TopLine Value="22"/> 428 425 <CursorPos X="14" Y="38"/> 429 <UsageCount Value=" 9"/>426 <UsageCount Value="8"/> 430 427 </Unit44> 431 428 <Unit45> 432 429 <Filename Value="../Units/GenericRange.pas"/> 433 430 <UnitName Value="GenericRange"/> 434 <EditorIndex Value="10"/> 435 <WindowIndex Value="0"/> 436 <TopLine Value="4"/> 437 <CursorPos X="6" Y="16"/> 431 <WindowIndex Value="0"/> 432 <TopLine Value="1"/> 433 <CursorPos X="20" Y="8"/> 438 434 <UsageCount Value="40"/> 439 <Loaded Value="True"/>440 435 </Unit45> 441 436 <Unit46> … … 444 439 <TopLine Value="958"/> 445 440 <CursorPos X="11" Y="971"/> 446 <UsageCount Value=" 9"/>441 <UsageCount Value="8"/> 447 442 </Unit46> 448 443 <Unit47> 449 444 <Filename Value="../Units/GenericTree.pas"/> 450 445 <UnitName Value="GenericTree"/> 451 <EditorIndex Value="11"/>452 446 <WindowIndex Value="0"/> 453 447 <TopLine Value="50"/> 454 448 <CursorPos X="49" Y="68"/> 455 449 <UsageCount Value="40"/> 456 <Loaded Value="True"/>457 450 </Unit47> 458 451 <Unit48> 459 452 <Filename Value="../Units/GenericString.pas"/> 460 453 <UnitName Value="GenericString"/> 461 <EditorIndex Value="14"/>462 454 <WindowIndex Value="0"/> 463 455 <TopLine Value="35"/> 464 456 <CursorPos X="23" Y="40"/> 465 457 <UsageCount Value="33"/> 466 <Loaded Value="True"/>467 458 </Unit48> 468 459 <Unit49> 469 460 <Filename Value="../Units/GenericBitmap.pas"/> 470 461 <UnitName Value="GenericBitmap"/> 471 <EditorIndex Value="15"/>472 462 <WindowIndex Value="0"/> 473 463 <TopLine Value="1"/> 474 464 <CursorPos X="15" Y="14"/> 475 465 <UsageCount Value="32"/> 476 <Loaded Value="True"/>477 466 </Unit49> 478 467 <Unit50> … … 482 471 <TopLine Value="1151"/> 483 472 <CursorPos X="22" Y="1165"/> 484 <UsageCount Value="2 9"/>473 <UsageCount Value="28"/> 485 474 </Unit50> 486 475 <Unit51> … … 489 478 <TopLine Value="310"/> 490 479 <CursorPos X="22" Y="314"/> 491 <UsageCount Value="2 9"/>480 <UsageCount Value="28"/> 492 481 </Unit51> 493 482 <Unit52> … … 496 485 <TopLine Value="53"/> 497 486 <CursorPos X="3" Y="46"/> 498 <UsageCount Value="2 9"/>487 <UsageCount Value="28"/> 499 488 </Unit52> 500 489 <Unit53> … … 504 493 <TopLine Value="347"/> 505 494 <CursorPos X="15" Y="360"/> 506 <UsageCount Value="2 9"/>495 <UsageCount Value="28"/> 507 496 </Unit53> 508 497 <Unit54> … … 511 500 <TopLine Value="308"/> 512 501 <CursorPos X="3" Y="310"/> 513 <UsageCount Value="2 9"/>502 <UsageCount Value="28"/> 514 503 </Unit54> 515 504 <Unit55> … … 518 507 <TopLine Value="54"/> 519 508 <CursorPos X="3" Y="63"/> 520 <UsageCount Value="2 9"/>509 <UsageCount Value="28"/> 521 510 </Unit55> 522 511 <Unit56> … … 525 514 <TopLine Value="147"/> 526 515 <CursorPos X="3" Y="152"/> 527 <UsageCount Value="2 9"/>516 <UsageCount Value="28"/> 528 517 </Unit56> 529 518 <Unit57> … … 533 522 <TopLine Value="153"/> 534 523 <CursorPos X="15" Y="166"/> 535 <UsageCount Value="2 9"/>524 <UsageCount Value="28"/> 536 525 </Unit57> 537 526 <Unit58> … … 541 530 <TopLine Value="2962"/> 542 531 <CursorPos X="3" Y="2975"/> 543 <UsageCount Value="2 8"/>532 <UsageCount Value="27"/> 544 533 </Unit58> 545 534 <Unit59> … … 548 537 <TopLine Value="5239"/> 549 538 <CursorPos X="3" Y="5243"/> 550 <UsageCount Value="2 8"/>539 <UsageCount Value="27"/> 551 540 </Unit59> 552 541 <Unit60> 553 542 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/sysutils/filutilh.inc"/> 554 <EditorIndex Value="7"/>555 543 <WindowIndex Value="0"/> 556 544 <TopLine Value="62"/> 557 545 <CursorPos X="3" Y="75"/> 558 546 <UsageCount Value="11"/> 559 <Loaded Value="True"/>560 547 </Unit60> 561 548 <Unit61> 562 549 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/inc/systemh.inc"/> 563 <EditorIndex Value=" 2"/>564 <WindowIndex Value="0"/> 565 <TopLine Value=" 1027"/>566 <CursorPos X=" 11" Y="1040"/>550 <EditorIndex Value="8"/> 551 <WindowIndex Value="0"/> 552 <TopLine Value="576"/> 553 <CursorPos X="28" Y="587"/> 567 554 <UsageCount Value="11"/> 568 555 <Loaded Value="True"/> … … 571 558 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/win/sysutils.pp"/> 572 559 <UnitName Value="sysutils"/> 573 <EditorIndex Value="8"/>574 560 <WindowIndex Value="0"/> 575 561 <TopLine Value="300"/> 576 562 <CursorPos X="1" Y="302"/> 577 563 <UsageCount Value="11"/> 578 <Loaded Value="True"/>579 564 </Unit62> 580 565 <Unit63> 581 566 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/win/wininc/func.inc"/> 582 <EditorIndex Value="9"/>583 567 <WindowIndex Value="0"/> 584 568 <TopLine Value="169"/> 585 569 <CursorPos X="15" Y="177"/> 586 570 <UsageCount Value="11"/> 587 <Loaded Value="True"/>588 571 </Unit63> 589 572 <Unit64> 590 573 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/inc/file.inc"/> 591 <EditorIndex Value="4"/>592 574 <WindowIndex Value="0"/> 593 575 <TopLine Value="299"/> 594 576 <CursorPos X="3" Y="304"/> 595 577 <UsageCount Value="11"/> 596 <Loaded Value="True"/>597 578 </Unit64> 598 579 <Unit65> 599 580 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/win/sysfile.inc"/> 600 <EditorIndex Value="5"/>601 581 <WindowIndex Value="0"/> 602 582 <TopLine Value="133"/> 603 583 <CursorPos X="11" Y="143"/> 604 584 <UsageCount Value="11"/> 605 <Loaded Value="True"/>606 585 </Unit65> 607 586 <Unit66> 608 587 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/win/sysos.inc"/> 609 <EditorIndex Value="6"/>610 588 <WindowIndex Value="0"/> 611 589 <TopLine Value="250"/> 612 590 <CursorPos X="20" Y="268"/> 613 591 <UsageCount Value="11"/> 614 <Loaded Value="True"/>615 592 </Unit66> 616 593 <Unit67> 617 594 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/inc/text.inc"/> 618 <EditorIndex Value="3"/>619 595 <WindowIndex Value="0"/> 620 596 <TopLine Value="108"/> 621 597 <CursorPos X="3" Y="110"/> 622 598 <UsageCount Value="10"/> 623 <Loaded Value="True"/>624 599 </Unit67> 600 <Unit68> 601 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/sysutils/sysstrh.inc"/> 602 <EditorIndex Value="6"/> 603 <WindowIndex Value="0"/> 604 <TopLine Value="71"/> 605 <CursorPos X="10" Y="84"/> 606 <UsageCount Value="10"/> 607 <Loaded Value="True"/> 608 </Unit68> 609 <Unit69> 610 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/classesh.inc"/> 611 <EditorIndex Value="2"/> 612 <WindowIndex Value="0"/> 613 <TopLine Value="257"/> 614 <CursorPos X="14" Y="270"/> 615 <UsageCount Value="10"/> 616 <Loaded Value="True"/> 617 </Unit69> 618 <Unit70> 619 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/stringl.inc"/> 620 <EditorIndex Value="4"/> 621 <WindowIndex Value="0"/> 622 <TopLine Value="736"/> 623 <CursorPos X="3" Y="738"/> 624 <UsageCount Value="10"/> 625 <Loaded Value="True"/> 626 </Unit70> 627 <Unit71> 628 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/lists.inc"/> 629 <EditorIndex Value="3"/> 630 <WindowIndex Value="0"/> 631 <TopLine Value="199"/> 632 <CursorPos X="3" Y="205"/> 633 <UsageCount Value="10"/> 634 <Loaded Value="True"/> 635 </Unit71> 636 <Unit72> 637 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/sysutils/sysstr.inc"/> 638 <EditorIndex Value="7"/> 639 <WindowIndex Value="0"/> 640 <TopLine Value="167"/> 641 <CursorPos X="3" Y="169"/> 642 <UsageCount Value="10"/> 643 <Loaded Value="True"/> 644 </Unit72> 645 <Unit73> 646 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/i386/i386.inc"/> 647 <EditorIndex Value="9"/> 648 <WindowIndex Value="0"/> 649 <TopLine Value="224"/> 650 <CursorPos X="11" Y="213"/> 651 <UsageCount Value="10"/> 652 <Loaded Value="True"/> 653 </Unit73> 625 654 </Units> 626 655 <JumpHistory Count="30" HistoryIndex="29"> 627 656 <Position1> 628 657 <Filename Value="../Units/GenericList.pas"/> 629 <Caret Line=" 744" Column="17" TopLine="737"/>658 <Caret Line="601" Column="1" TopLine="588"/> 630 659 </Position1> 631 660 <Position2> 632 <Filename Value="../ ../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/inc/file.inc"/>633 <Caret Line=" 304" Column="3" TopLine="299"/>661 <Filename Value="../Units/GenericList.pas"/> 662 <Caret Line="188" Column="1" TopLine="175"/> 634 663 </Position2> 635 664 <Position3> 636 <Filename Value=" ../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/win/sysfile.inc"/>637 <Caret Line=" 173" Column="10" TopLine="160"/>665 <Filename Value="UMainForm.pas"/> 666 <Caret Line="611" Column="1" TopLine="599"/> 638 667 </Position3> 639 668 <Position4> 640 <Filename Value="../ ../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/win/sysfile.inc"/>641 <Caret Line=" 143" Column="11" TopLine="133"/>669 <Filename Value="../Units/GenericList.pas"/> 670 <Caret Line="602" Column="1" TopLine="589"/> 642 671 </Position4> 643 672 <Position5> 644 673 <Filename Value="../Units/GenericList.pas"/> 645 <Caret Line=" 26" Column="29" TopLine="12"/>674 <Caret Line="611" Column="1" TopLine="590"/> 646 675 </Position5> 647 676 <Position6> 648 677 <Filename Value="../Units/GenericList.pas"/> 649 <Caret Line=" 732" Column="24" TopLine="727"/>678 <Caret Line="612" Column="1" TopLine="591"/> 650 679 </Position6> 651 680 <Position7> 652 681 <Filename Value="../Units/GenericList.pas"/> 653 <Caret Line=" 23" Column="54" TopLine="12"/>682 <Caret Line="394" Column="1" TopLine="381"/> 654 683 </Position7> 655 684 <Position8> 656 685 <Filename Value="../Units/GenericList.pas"/> 657 <Caret Line=" 57" Column="1" TopLine="41"/>686 <Caret Line="395" Column="1" TopLine="381"/> 658 687 </Position8> 659 688 <Position9> 660 689 <Filename Value="../Units/GenericList.pas"/> 661 <Caret Line=" 324" Column="1" TopLine="311"/>690 <Caret Line="613" Column="1" TopLine="600"/> 662 691 </Position9> 663 692 <Position10> 664 693 <Filename Value="../Units/GenericList.pas"/> 665 <Caret Line=" 686" Column="6" TopLine="673"/>694 <Caret Line="238" Column="1" TopLine="225"/> 666 695 </Position10> 667 696 <Position11> 668 697 <Filename Value="../Units/GenericList.pas"/> 669 <Caret Line=" 694" Column="6" TopLine="681"/>698 <Caret Line="239" Column="1" TopLine="225"/> 670 699 </Position11> 671 700 <Position12> 672 701 <Filename Value="../Units/GenericList.pas"/> 673 <Caret Line="7 02" Column="6" TopLine="689"/>702 <Caret Line="720" Column="1" TopLine="707"/> 674 703 </Position12> 675 704 <Position13> 676 705 <Filename Value="../Units/GenericList.pas"/> 677 <Caret Line=" 710" Column="6" TopLine="697"/>706 <Caret Line="617" Column="35" TopLine="600"/> 678 707 </Position13> 679 708 <Position14> 680 <Filename Value=" ../Units/GenericList.pas"/>681 <Caret Line=" 21" Column="7" TopLine="14"/>709 <Filename Value="UMainForm.pas"/> 710 <Caret Line="611" Column="1" TopLine="599"/> 682 711 </Position14> 683 712 <Position15> 684 713 <Filename Value="../Units/GenericList.pas"/> 685 <Caret Line=" 746" Column="37" TopLine="734"/>714 <Caret Line="602" Column="1" TopLine="597"/> 686 715 </Position15> 687 716 <Position16> 688 717 <Filename Value="../Units/GenericList.pas"/> 689 <Caret Line=" 52" Column="1" TopLine="37"/>718 <Caret Line="611" Column="1" TopLine="597"/> 690 719 </Position16> 691 720 <Position17> 692 721 <Filename Value="../Units/GenericList.pas"/> 693 <Caret Line=" 35" Column="14" TopLine="22"/>722 <Caret Line="612" Column="1" TopLine="597"/> 694 723 </Position17> 695 724 <Position18> 696 725 <Filename Value="../Units/GenericList.pas"/> 697 <Caret Line=" 716" Column="36" TopLine="715"/>726 <Caret Line="613" Column="1" TopLine="597"/> 698 727 </Position18> 699 728 <Position19> 700 729 <Filename Value="../Units/GenericList.pas"/> 701 <Caret Line=" 121" Column="1" TopLine="108"/>730 <Caret Line="720" Column="1" TopLine="707"/> 702 731 </Position19> 703 732 <Position20> 704 733 <Filename Value="../Units/GenericList.pas"/> 705 <Caret Line=" 130" Column="38" TopLine="108"/>734 <Caret Line="721" Column="1" TopLine="707"/> 706 735 </Position20> 707 736 <Position21> 708 737 <Filename Value="../Units/GenericList.pas"/> 709 <Caret Line="7 69" Column="58" TopLine="765"/>738 <Caret Line="722" Column="1" TopLine="707"/> 710 739 </Position21> 711 740 <Position22> 712 741 <Filename Value="../Units/GenericList.pas"/> 713 <Caret Line=" 131" Column="70" TopLine="119"/>742 <Caret Line="614" Column="1" TopLine="601"/> 714 743 </Position22> 715 744 <Position23> 716 745 <Filename Value="../Units/GenericList.pas"/> 717 <Caret Line=" 130" Column="36" TopLine="119"/>746 <Caret Line="615" Column="1" TopLine="601"/> 718 747 </Position23> 719 748 <Position24> 720 <Filename Value=" ../Units/GenericList.pas"/>721 <Caret Line=" 771" Column="32" TopLine="765"/>749 <Filename Value="UMainForm.pas"/> 750 <Caret Line="33" Column="15" TopLine="403"/> 722 751 </Position24> 723 752 <Position25> 724 <Filename Value="../ Units/GenericList.pas"/>725 <Caret Line="1 30" Column="15" TopLine="117"/>753 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/stringl.inc"/> 754 <Caret Line="1285" Column="3" TopLine="1282"/> 726 755 </Position25> 727 756 <Position26> 728 <Filename Value=" ../Units/GenericList.pas"/>729 <Caret Line=" 725" Column="1" TopLine="716"/>757 <Filename Value="UMainForm.pas"/> 758 <Caret Line="33" Column="15" TopLine="652"/> 730 759 </Position26> 731 760 <Position27> 732 761 <Filename Value="../Units/GenericList.pas"/> 733 <Caret Line=" 778" Column="9" TopLine="757"/>762 <Caret Line="232" Column="3" TopLine="229"/> 734 763 </Position27> 735 764 <Position28> 736 <Filename Value="../ Units/GenericList.pas"/>737 <Caret Line=" 773" Column="29" TopLine="754"/>765 <Filename Value="../../../../../Lazarus/1.1_2.7.1/fpc/2.7.1/source/rtl/objpas/sysutils/sysstr.inc"/> 766 <Caret Line="169" Column="3" TopLine="167"/> 738 767 </Position28> 739 768 <Position29> 740 769 <Filename Value="../Units/GenericList.pas"/> 741 <Caret Line=" 59" Column="24" TopLine="45"/>770 <Caret Line="200" Column="10" TopLine="197"/> 742 771 </Position29> 743 772 <Position30> 744 773 <Filename Value="../Units/GenericList.pas"/> 745 <Caret Line=" 35" Column="15" TopLine="23"/>774 <Caret Line="203" Column="42" TopLine="190"/> 746 775 </Position30> 747 776 </JumpHistory> -
Generics/NativeGenerics/Units/GenericList.pas
r423 r424 27 27 function GetCount: TIndex; virtual; abstract; 28 28 procedure SetCount(const AValue: TIndex); virtual; abstract; 29 procedure SetCapacity(const AValue: TIndex); virtual; abstract;30 function GetCapacity: TIndex; virtual; abstract;31 29 function Get(Index: TIndex): TItem; virtual; abstract; 32 30 procedure Put(Index: TIndex; const AValue: TItem); virtual; abstract; 31 procedure QuickSort(L, R : TIndex; Compare: TSortCompare); 33 32 public 33 function Add(const Item: TItem): TIndex; virtual; 34 procedure AddArray(Values: array of TItem); 35 procedure AddList(List: TGAbstractList<TItem>); 36 procedure AddListPart(List: TGAbstractList<TItem>; ItemIndex, ItemCount: TIndex); 37 procedure Assign(Source: TGAbstractList<TItem>); virtual; 34 38 constructor Create; virtual; 35 39 procedure Clear; virtual; 36 function Add(const Item: TItem): TIndex; virtual; 40 function CompareItem(const Item1, Item2: TItem): Boolean; virtual; abstract; 41 procedure CopyItems(CurIndex, NewIndex, ACount: TIndex); virtual; 42 procedure Delete(const Index: TIndex); virtual; 43 procedure DeleteItems(const Index, ACount: TIndex); virtual; 44 function EqualTo(List: TGAbstractList<TItem>): Boolean; virtual; 45 procedure Exchange(const Index1, Index2: TIndex); virtual; 46 procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 47 function Extract(Item: TItem): TItem; virtual; 48 procedure Fill(Start, Count: TIndex; Value: TItem); virtual; 49 function GetArray(Index, ACount: TIndex): TItemArray; virtual; 50 procedure GetList(List: TGAbstractList<TItem>; Index, ACount: TIndex); virtual; 51 function IndexOfList(List: TGAbstractList<TItem>; Start: TIndex = 0): TIndex; virtual; 52 procedure Insert(const Index: TIndex; Item: TItem); virtual; 53 procedure InsertCount(const Index: TIndex; ACount: TIndex); virtual; 54 procedure InsertList(const Index: TIndex; List: TGAbstractList<TItem>); virtual; 55 procedure InsertArray(const Index: TIndex; Values: array of TItem); virtual; 56 function IndexOf(Item: TItem; Start: TIndex = 0): TIndex; virtual; 57 function Implode(Separator: string; Converter: TToStringConverter): string; 58 procedure Move(const CurIndex, NewIndex: TIndex); virtual; 59 procedure MoveItems(CurIndex, NewIndex, ACount: TIndex); virtual; 60 procedure ReplaceArray(const Index: TIndex; Values: array of TItem); virtual; 61 procedure ReplaceList(const Index: TIndex; Source: TGAbstractList<TItem>); virtual; 62 procedure ReplaceListPart(const Index: TIndex; Source: TGAbstractList<TItem>; 63 SourceIndex, SourceCount: TIndex); virtual; 64 function Remove(const Item: TItem): TIndex; 65 procedure Reverse; 66 procedure Sort(Compare: TSortCompare); virtual; 67 procedure SetArray(Values: array of TItem); virtual; 37 68 property Count: TIndex read GetCount write SetCount; 38 property Capacity: TIndex read GetCapacity write SetCapacity;39 69 property Items[Index: TIndex]: TItem read Get write Put; default; 40 70 property First: TItem read GetFirst write SetFirst; … … 50 80 protected 51 81 function Get(Index: TIndex): TItem; override; 52 function GetCapacity: TIndex; override;82 function GetCapacity: TIndex; 53 83 function GetCount: TIndex; override; 54 procedure SetCapacity(const AValue: TIndex); override;84 procedure SetCapacity(const AValue: TIndex); 55 85 procedure SetCapacityOptimized(const NewCapacity: TIndex); 56 86 procedure SetCount(const AValue: TIndex); override; 57 87 procedure Put(Index: TIndex; const AValue: TItem); override; 58 procedure QuickSort(L, R : TIndex; Compare: TSortCompare);59 88 public 60 function Add(const Item: TItem): TIndex; override; 61 procedure AddArray(Values: array of TItem); 62 procedure AddList(List: TGList<TItem>); 63 procedure AddListPart(List: TGList<TItem>; ItemIndex, ItemCount: TIndex); 64 procedure Assign(Source: TGList<TItem>); virtual; 65 procedure Delete(Index: TIndex); virtual; 66 procedure DeleteItems(Index, Count: TIndex); 67 function EqualTo(List: TGList<TItem>): Boolean; 68 procedure Exchange(Index1, Index2: TIndex); 69 procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 70 function Extract(Item: TItem): TItem; 71 procedure Fill(Start, Count: TIndex; Value: TItem); 72 function GetArray(Index, ACount: TIndex): TItemArray; 73 procedure GetList(List: TGList<TItem>; Index, ACount: TIndex); 74 function Implode(Separator: string; Converter: TToStringConverter): string; 75 function IndexOf(Item: TItem; Start: TIndex = 0): TIndex; 76 function IndexOfList(List: TGList<TItem>; Start: TIndex = 0): TIndex; 77 procedure Insert(Index: TIndex; Item: TItem); 78 procedure InsertList(Index: TIndex; List: TGList<TItem>); 79 procedure InsertArray(Index: TIndex; Values: array of TItem); 80 procedure InsertCount(Index: TIndex; ACount: TIndex); 81 procedure Move(CurIndex, NewIndex: TIndex); 82 procedure MoveItems(CurIndex, NewIndex, Count: TIndex); 83 function Remove(Item: TItem): TIndex; 84 procedure Reverse; 85 procedure ReplaceArray(Index: TIndex; Values: array of TItem); 86 procedure ReplaceList(Index: TIndex; Source: TGList<TItem>); 87 procedure ReplaceListPart(Index: TIndex; Source: TGList<TItem>; 88 SourceIndex, SourceCount: TIndex); 89 procedure Sort(Compare: TSortCompare); 90 procedure SetArray(Values: array of TItem); 89 procedure Fill(Start, Count: TIndex; Value: TItem); override; 90 procedure Clear; override; 91 procedure ReplaceList(const Index: TIndex; Source: TGAbstractList<TItem>); override; 92 function CompareItem(const Item1, Item2: TItem): Boolean; override; 93 procedure CopyItems(CurIndex, NewIndex, ACount: TIndex); override; 94 property Capacity: TIndex read GetCapacity write SetCapacity; 91 95 end; 92 96 … … 96 100 public 97 101 OwnsObjects: Boolean; 98 procedure Delete( Index: Integer); override;102 procedure Delete(const Index: Integer); override; 99 103 procedure Clear; override; 100 procedure Assign(Source: TG List<TItem>); override;104 procedure Assign(Source: TGAbstractList<TItem>); override; 101 105 constructor Create; override; 102 106 destructor Destroy; override; … … 108 112 procedure Delete(Index: Integer); override; 109 113 procedure Clear; override; 110 procedure Assign(Source: TG List<TItem>); override;114 procedure Assign(Source: TGAbstractList<TItem>); override; 111 115 constructor Create; override; 112 116 destructor Destroy; override; … … 192 196 end; 193 197 198 procedure TGList<TItem>.Fill(Start, Count: TIndex; Value: TItem); 199 begin 200 (*if SizeOf(Value) = 1 then System.FillByte(FItems[Start], Count, Byte(Value)) 201 else if SizeOf(Value) = 2 then System.FillWord(FItems[Start], Count, Word(Value)) 202 else if SizeOf(Value) = 4 then System.FillDWord(FItems[Start], Count, DWord(Value)) 203 else if SizeOf(Value) = 8 then System.FillQWord(FItems[Start], Count, QWord(Value)) 204 else*) inherited; 205 end; 206 207 procedure TGList<TItem>.Clear; 208 begin 209 inherited; 210 Capacity := 0; 211 end; 212 213 procedure TGList<TItem>.ReplaceList(const Index: TIndex; Source: TGAbstractList<TItem> 214 ); 215 begin 216 if Source is TGList<TItem> then begin 217 System.Move(TGList<TItem>(Source).FItems[0], FItems[Index], Source.Count * SizeOf(TItem)); 218 end else inherited; 219 end; 220 194 221 procedure TGList<TItem>.SetCount(const AValue: TIndex); 195 222 begin … … 201 228 end; 202 229 203 function TGList<TItem>.GetArray(Index, ACount: TIndex): TItemArray; 230 function TGList<TItem>.CompareItem(const Item1, Item2: TItem): Boolean; 231 begin 232 Result := CompareMem(Addr(Item1), Addr(Item2), SizeOf(TItem)); 233 end; 234 235 function TGList<TItem>.GetCount: TIndex; 236 begin 237 Result := FCount; 238 end; 239 240 procedure TGList<TItem>.CopyItems(CurIndex, NewIndex, ACount: TIndex); 241 begin 242 System.Move(FItems[CurIndex], FItems[NewIndex], ACount * SizeOf(TItem)); 243 end; 244 245 { TGObjectList } 246 247 procedure TGObjectList<TItem>.Assign(Source: TGAbstractList<TItem>); 248 begin 249 Clear; 250 OwnsObjects := False; 251 inherited; 252 end; 253 254 procedure TGObjectList<TItem>.Put(Index: Integer; const AValue: TItem); 255 begin 256 if OwnsObjects then FItems[Index].Free; 257 inherited Put(Index, AValue); 258 end; 259 260 procedure TGObjectList<TItem>.Delete(const Index: Integer); 261 begin 262 if OwnsObjects then FItems[Index].Free; 263 inherited Delete(Index); 264 end; 265 266 procedure TGObjectList<TItem>.Clear; 204 267 var 205 268 I: Integer; 206 269 begin 207 SetLength(Result, ACount); 270 if OwnsObjects then begin 271 I := 0; 272 while I < Count do begin 273 FItems[I].Free; 274 I := I + 1; 275 end; 276 end; 277 inherited Clear; 278 end; 279 280 constructor TGObjectList<TItem>.Create; 281 begin 282 inherited; 283 OwnsObjects := True; 284 end; 285 286 destructor TGObjectList<TItem>.Destroy; 287 begin 288 Clear; 289 inherited Destroy; 290 end; 291 292 { TGStringList } 293 294 procedure TGStringList<TItem>.Assign(Source: TGAbstractList<TItem>); 295 begin 296 Clear; 297 inherited; 298 end; 299 300 procedure TGStringList<TItem>.Delete(Index: Integer); 301 begin 302 FItems[Index] := ''; 303 inherited Delete(Index); 304 end; 305 306 procedure TGStringList<TItem>.Clear; 307 var 308 I: Integer; 309 begin 208 310 I := 0; 209 311 while I < Count do begin 210 Result[I] := FItems[Index + I]; 211 I := I + 1; 212 end; 213 end; 214 215 procedure TGList<TItem>.GetList(List: TGList<TItem>; Index, ACount: TIndex); 216 begin 217 List.Clear; 218 List.AddListPart(Self, Index, ACount); 219 end; 220 221 procedure TGList<TItem>.QuickSort(L, R: TIndex; Compare: TSortCompare); 312 FItems[I] := ''; 313 I := I + 1; 314 end; 315 inherited Clear; 316 end; 317 318 constructor TGStringList<TItem>.Create; 319 begin 320 inherited; 321 end; 322 323 destructor TGStringList<TItem>.Destroy; 324 begin 325 Clear; 326 inherited Destroy; 327 end; 328 329 { TGAbstractList<TItem> } 330 331 function TGAbstractList<TItem>.GetLast: TItem; 332 begin 333 if Count = 0 then 334 raise EListError.CreateFmt(SListIndexError, [0]) 335 else 336 Result := Items[Count - 1]; 337 end; 338 339 procedure TGAbstractList<TItem>.SetLast(const AValue: TItem); 340 begin 341 if Count = 0 then 342 raise EListError.CreateFmt(SListIndexError, [0]) 343 else 344 Items[Count - 1] := AValue; 345 end; 346 347 function TGAbstractList<TItem>.GetFirst: TItem; 348 begin 349 if Count = 0 then 350 raise EListError.CreateFmt(SListIndexError, [0]) 351 else 352 Result := Items[0]; 353 end; 354 355 procedure TGAbstractList<TItem>.SetFirst(const AValue: TItem); 356 begin 357 if Count = 0 then 358 raise EListError.CreateFmt(SListIndexError, [0]) 359 else 360 Items[0] := AValue; 361 end; 362 363 procedure TGAbstractList<TItem>.QuickSort(L, R: TIndex; Compare: TSortCompare); 222 364 var 223 365 I, J: TIndex; … … 227 369 I := L; 228 370 J := R; 229 P := FItems[(L + R) div 2];371 P := Items[(L + R) div 2]; 230 372 repeat 231 while Compare(P, FItems[I]) > 0 do373 while Compare(P, Items[I]) > 0 do 232 374 I := I + 1; 233 while Compare(P, FItems[J]) < 0 do375 while Compare(P, Items[J]) < 0 do 234 376 J := J - 1; 235 377 if I <= J then 236 378 begin 237 Q := FItems[I];238 FItems[I] := FItems[J];239 FItems[J] := Q;379 Q := Items[I]; 380 Items[I] := Items[J]; 381 Items[J] := Q; 240 382 I := I + 1; 241 383 J := J - 1; … … 248 390 end; 249 391 250 procedure TGList<TItem>.Assign(Source: TGList<TItem>); 251 var 252 I: TIndex; 253 begin 254 Count := Source.Count; 255 I := 0; 256 while I < Count do begin 257 FItems[I] := Source[I]; 258 I := I + 1; 259 end; 260 end; 261 262 function TGList<TItem>.Extract(Item: TItem): TItem; 392 constructor TGAbstractList<TItem>.Create; 393 begin 394 end; 395 396 procedure TGAbstractList<TItem>.Clear; 397 begin 398 Count := 0; 399 end; 400 401 procedure TGAbstractList<TItem>.Delete(const Index: TIndex); 402 begin 403 DeleteItems(Index, 1); 404 end; 405 406 procedure TGAbstractList<TItem>.DeleteItems(const Index, ACount: TIndex); 407 begin 408 if (Index < 0) or (Index >= (Count - ACount)) then 409 raise EListError.CreateFmt(SListIndexError, [Index]); 410 CopyItems(Index + ACount, Index, Count - Index - ACount); 411 //SetCapacityOptimized(Capacity - ACount); 412 Count := Count - ACount; 413 end; 414 415 function TGAbstractList<TItem>.EqualTo(List: TGAbstractList<TItem>): Boolean; 416 var 417 I: TIndex; 418 begin 419 Result := Count = List.Count; 420 if Result then begin 421 I := 0; 422 while I < Count do begin 423 if not CompareItem(Items[I], List.Items[I]) then begin 424 Result := False; 425 Break; 426 end; 427 I := I + 1; 428 end; 429 end; 430 end; 431 432 procedure TGAbstractList<TItem>.Exchange(const Index1, Index2: TIndex); 433 var 434 Temp: TItem; 435 begin 436 if ((Index1 >= Count) or (Index1 < 0)) then 437 raise EListError.CreateFmt(SListIndexError, [Index1]); 438 if ((Index2 >= Count) or (Index2 < 0)) then 439 raise EListError.CreateFmt(SListIndexError, [Index2]); 440 Temp := Items[Index1]; 441 Items[Index1] := Items[Index2]; 442 Items[Index2] := Temp; 443 end; 444 445 procedure TGAbstractList<TItem>.Explode(Text, Separator: string; 446 Converter: TFromStringConverter; SlicesCount: Integer); 447 begin 448 Clear; 449 while (Pos(Separator, Text) > 0) and 450 ((Count < (SlicesCount - 1)) or (SlicesCount = -1)) do begin 451 Add(Converter(Copy(Text, 1, Pos(Separator, Text) - 1))); 452 System.Delete(Text, 1, Pos(Separator, Text) + Length(Separator) - 1); 453 end; 454 Add(Converter(Text)); 455 end; 456 457 function TGAbstractList<TItem>.Extract(Item: TItem): TItem; 263 458 var 264 459 I: TIndex; … … 272 467 end; 273 468 274 function TGList<TItem>.IndexOf(Item: TItem; Start: TIndex): TIndex; 275 begin 276 Result := Start; 277 while (Result < FCount) and 278 not CompareMem(Addr(FItems[Result]), Addr(Item), SizeOf(TItem)) do 279 Result := Result + 1; 280 if Result = FCount then Result := -1; 281 end; 282 283 procedure TGList<TItem>.Insert(Index: TIndex; Item: TItem); 284 begin 285 if (Index < 0) or (Index > FCount) then 286 raise EListError.CreateFmt(SListIndexError, [Index]); 287 InsertCount(Index, 1); 288 FItems[Index] := Item; 289 end; 290 291 procedure TGList<TItem>.InsertList(Index: TIndex; List: TGList<TItem>); 292 begin 293 if (Index < 0) or (Index > FCount) then 294 raise EListError.CreateFmt(SListIndexError, [Index]); 295 InsertCount(Index, List.Count); 296 ReplaceList(Index, List); 297 end; 298 299 function TGList<TItem>.IndexOfList(List: TGList<TItem>; Start: TIndex): TIndex; 469 procedure TGAbstractList<TItem>.Fill(Start, Count: TIndex; Value: TItem); 470 var 471 I: TIndex; 472 begin 473 I := Start; 474 while I < Count do begin 475 Items[I] := Value; 476 I := I + 1; 477 end; 478 end; 479 480 function TGAbstractList<TItem>.GetArray(Index, ACount: TIndex): TItemArray; 481 var 482 I: Integer; 483 begin 484 SetLength(Result, ACount); 485 I := 0; 486 while I < Count do begin 487 Result[I] := Items[Index + I]; 488 I := I + 1; 489 end; 490 end; 491 492 procedure TGAbstractList<TItem>.GetList(List: TGAbstractList<TItem>; Index, ACount: TIndex); 493 begin 494 List.Clear; 495 List.AddListPart(Self, Index, ACount); 496 end; 497 498 function TGAbstractList<TItem>.IndexOfList(List: TGAbstractList<TItem>; Start: TIndex 499 ): TIndex; 300 500 var 301 501 I: TIndex; … … 306 506 I := 1; 307 507 while I < List.Count do begin 308 if not Compare Mem(Addr(FItems[Result + I]), Addr(List.FItems[I]), SizeOf(TItem)) then begin508 if not CompareItem(Items[Result + I], List.Items[I]) then begin 309 509 Result := -1; 310 510 Break; … … 316 516 end; 317 517 318 function TGList<TItem>.GetCount: TIndex; 319 begin 320 Result := FCount; 321 end; 322 323 procedure TGList<TItem>.Move(CurIndex, NewIndex: TIndex); 324 var 325 Temp: TItem; 326 begin 327 if ((CurIndex < 0) or (CurIndex > Count - 1)) then 328 raise EListError.CreateFmt(SListIndexError, [CurIndex]); 329 if ((NewIndex < 0) or (NewIndex > Count -1)) then 330 raise EListError.CreateFmt(SlistIndexError, [NewIndex]); 331 Temp := FItems[CurIndex]; 332 if NewIndex > CurIndex then begin 333 System.Move(FItems[CurIndex + 1], FItems[CurIndex], (NewIndex - CurIndex) * SizeOf(TItem)); 334 end else 335 if NewIndex < CurIndex then begin 336 System.Move(FItems[NewIndex], FItems[NewIndex + 1], (CurIndex - NewIndex) * SizeOf(TItem)); 337 end; 338 FItems[NewIndex] := Temp; 339 //Delete(CurIndex); 340 //Insert(NewIndex, Temp); 341 end; 342 343 procedure TGList<TItem>.MoveItems(CurIndex, NewIndex, Count: TIndex); 344 var 345 S: Integer; 346 D: Integer; 347 begin 348 if CurIndex < NewIndex then begin 349 S := CurIndex + Count - 1; 350 D := NewIndex + Count - 1; 351 while S >= CurIndex do begin 352 Move(S, D); 353 S := S - 1; 354 D := D - 1; 518 function TGAbstractList<TItem>.IndexOf(Item: TItem; Start: TIndex): TIndex; 519 begin 520 Result := Start; 521 while (Result < Count) and (not CompareItem(Items[Result], Item)) do 522 Result := Result + 1; 523 if Result = Count then Result := -1; 524 end; 525 526 procedure TGAbstractList<TItem>.Insert(const Index: TIndex; Item: TItem); 527 begin 528 if (Index > Count) then 529 raise EListError.CreateFmt(SListIndexError, [Index]); 530 InsertCount(Index, 1); 531 Items[Index] := Item; 532 end; 533 534 procedure TGAbstractList<TItem>.InsertList(const Index: TIndex; List: TGAbstractList<TItem>); 535 begin 536 if (Index < 0) or (Index > Count) then 537 raise EListError.CreateFmt(SListIndexError, [Index]); 538 InsertCount(Index, List.Count); 539 ReplaceList(Index, List); 540 end; 541 542 procedure TGAbstractList<TItem>.InsertArray(const Index: TIndex; 543 Values: array of TItem); 544 begin 545 if (Index < 0) or (Index > Count) then 546 raise EListError.CreateFmt(SListIndexError, [Index]); 547 InsertCount(Index, Length(Values)); 548 ReplaceArray(Index, Values); 549 end; 550 551 procedure TGAbstractList<TItem>.InsertCount(const Index: TIndex; ACount: TIndex); 552 begin 553 if (Index < 0) or (Index > Count) then 554 raise EListError.CreateFmt(SListIndexError, [Index]); 555 Count := Count + ACount; 556 CopyItems(Index, Index + ACount, Count - ACount - Index); 557 end; 558 559 function TGAbstractList<TItem>.Implode(Separator: string; 560 Converter: TToStringConverter): string; 561 var 562 I: TIndex; 563 begin 564 Result := ''; 565 I := 0; 566 while I < Count do begin 567 Result := Result + Converter(Items[I]); 568 if I < (Count - 1) then 569 Result := Result + Separator; 570 I := I + 1; 571 end; 572 end; 573 574 procedure TGAbstractList<TItem>.CopyItems(CurIndex, NewIndex, ACount: TIndex); 575 var 576 I: Integer; 577 begin 578 if CurIndex > NewIndex then begin 579 I := 0; 580 while I < ACount do begin 581 Items[NewIndex] := Items[CurIndex]; 582 CurIndex := CurIndex + 1; 583 NewIndex := NewIndex + 1; 584 I := I + 1; 355 585 end; 356 end else 357 if CurIndex > NewIndex then begin 358 S := CurIndex; 359 D := NewIndex; 360 while S < (CurIndex + Count) do begin 361 Move(S, D); 362 S := S + 1; 363 D := D + 1; 586 end else begin 587 I := ACount - 1; 588 NewIndex := NewIndex + ACount - 1; 589 CurIndex := CurIndex + ACount - 1; 590 while I >= 0 do begin 591 Items[NewIndex] := Items[CurIndex]; 592 NewIndex := NewIndex - 1; 593 CurIndex := CurIndex - 1; 594 I := I - 1; 364 595 end; 365 596 end; 366 597 end; 367 598 368 function TGList<TItem>.Remove(Item: TItem): TIndex; 599 procedure TGAbstractList<TItem>.Move(const CurIndex, NewIndex: TIndex); 600 begin 601 MoveItems(CurIndex, NewIndex, 1); 602 end; 603 604 procedure TGAbstractList<TItem>.MoveItems(CurIndex, NewIndex, 605 ACount: TIndex); 606 var 607 I: Integer; 608 Temp: TGList<TItem>; 609 begin 610 try 611 Temp := TGList<TItem>.Create; 612 Temp.AddListPart(Self, NewIndex, ACount); 613 CopyItems(CurIndex, NewIndex, ACount); 614 ReplaceList(CurIndex, Temp); 615 finally 616 Temp.Free; 617 end; 618 end; 619 620 procedure TGAbstractList<TItem>.ReplaceArray(const Index: TIndex; 621 Values: array of TItem); 622 var 623 I: TIndex; 624 begin 625 I := 0; 626 while I < Length(Values) do begin 627 Items[Index + I] := Values[I]; 628 I := I + 1; 629 end; 630 end; 631 632 procedure TGAbstractList<TItem>.ReplaceList(const Index: TIndex; Source: TGAbstractList<TItem> 633 ); 634 var 635 I: TIndex; 636 begin 637 I := 0; 638 while I < Source.Count do begin 639 Items[Index + I] := Source[I]; 640 I := I + 1; 641 end; 642 end; 643 644 procedure TGAbstractList<TItem>.ReplaceListPart(const Index: TIndex; 645 Source: TGAbstractList<TItem>; SourceIndex, SourceCount: TIndex); 646 var 647 I: TIndex; 648 begin 649 I := 0; 650 while I < SourceCount do begin 651 Items[Index + I] := Source[SourceIndex + I]; 652 I := I + 1; 653 end; 654 end; 655 656 function TGAbstractList<TItem>.Remove(const Item: TItem): TIndex; 369 657 begin 370 658 Result := IndexOf(Item); … … 373 661 end; 374 662 375 function TGList<TItem>.EqualTo(List: TGList<TItem>): Boolean; 376 var 377 I: TIndex; 378 begin 379 Result := Count = List.Count; 380 if Result then begin 381 I := 0; 382 while I < Count do begin 383 if not CompareMem(Addr(FItems[I]), Addr(List.FItems[I]), SizeOf(TItem)) then begin 384 Result := False; 385 Break; 386 end; 387 I := I + 1; 388 end; 389 end; 390 end; 391 392 procedure TGList<TItem>.Reverse; 663 procedure TGAbstractList<TItem>.Reverse; 393 664 var 394 665 I: TIndex; … … 401 672 end; 402 673 403 procedure TGList<TItem>.ReplaceArray(Index: TIndex; 404 Values: array of TItem); 405 var 406 I: TIndex; 407 begin 408 I := 0; 409 while I < Length(Values) do begin 410 Items[Index + I] := Values[I]; 411 I := I + 1; 412 end; 413 end; 414 415 procedure TGList<TItem>.ReplaceList(Index: TIndex; Source: TGList<TItem>); 416 var 417 I: TIndex; 418 begin 419 I := 0; 420 while I < Source.Count do begin 421 Items[Index + I] := Source[I]; 422 I := I + 1; 423 end; 424 end; 425 426 procedure TGList<TItem>.ReplaceListPart(Index: TIndex; Source: TGList<TItem>; 427 SourceIndex, SourceCount: TIndex); 428 var 429 I: TIndex; 430 begin 431 I := 0; 432 while I < SourceCount do begin 433 Items[Index + I] := Source[SourceIndex + I]; 434 I := I + 1; 435 end; 436 end; 437 438 procedure TGList<TItem>.Sort(Compare: TSortCompare); 439 begin 440 if FCount > 1 then 441 QuickSort(0, FCount - 1, Compare); 442 end; 443 444 procedure TGList<TItem>.AddArray(Values: array of TItem); 445 var 446 I: TIndex; 447 begin 674 procedure TGAbstractList<TItem>.Sort(Compare: TSortCompare); 675 begin 676 if Count > 1 then 677 QuickSort(0, Count - 1, Compare); 678 end; 679 680 procedure TGAbstractList<TItem>.SetArray(Values: array of TItem); 681 var 682 I: TIndex; 683 begin 684 Clear; 448 685 I := 0; 449 686 while I <= High(Values) do begin … … 451 688 I := I + 1; 452 689 end; 453 end;454 455 procedure TGList<TItem>.SetArray(Values: array of TItem);456 var457 I: TIndex;458 begin459 Clear;460 I := 0;461 while I <= High(Values) do begin462 Add(Values[I]);463 I := I + 1;464 end;465 end;466 467 procedure TGList<TItem>.InsertArray(Index: TIndex; Values: array of TItem);468 begin469 if (Index < 0) or (Index > FCount) then470 raise EListError.CreateFmt(SListIndexError, [Index]);471 InsertCount(Index, Length(Values));472 ReplaceArray(Index, Values);473 end;474 475 procedure TGList<TItem>.InsertCount(Index: TIndex; ACount: TIndex);476 begin477 if (Index < 0) or (Index > FCount) then478 raise EListError.CreateFmt(SListIndexError, [Index]);479 Count := Count + ACount;480 if Index < FCount then481 System.Move(FItems[Index], FItems[Index + ACount], (FCount - ACount - Index) * SizeOf(TItem));482 end;483 484 function TGList<TItem>.Implode(Separator: string; Converter: TToStringConverter): string;485 var486 I: TIndex;487 begin488 Result := '';489 I := 0;490 while I < Count do begin491 Result := Result + Converter(FItems[I]);492 if I < (Count - 1) then493 Result := Result + Separator;494 I := I + 1;495 end;496 end;497 498 procedure TGList<TItem>.Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1);499 begin500 Clear;501 while (Pos(Separator, Text) > 0) and502 ((Count < (SlicesCount - 1)) or (SlicesCount = -1)) do begin503 Add(Converter(Copy(Text, 1, Pos(Separator, Text) - 1)));504 System.Delete(Text, 1, Pos(Separator, Text) + Length(Separator) - 1);505 end;506 Add(Converter(Text));507 end;508 509 function TGList<TItem>.Add(const Item: TItem): TIndex;510 begin511 Count := Count + 1;512 Result := FCount - 1;513 Items[Result] := Item;514 end;515 516 procedure TGList<TItem>.AddList(List: TGList<TItem>);517 var518 I: TIndex;519 begin520 I := 0;521 while I < List.Count do begin522 Add(List[I]);523 I := I + 1;524 end;525 end;526 527 procedure TGList<TItem>.AddListPart(List: TGList<TItem>; ItemIndex, ItemCount: TIndex);528 var529 I: TIndex;530 J: TIndex;531 begin532 I := Count;533 J := ItemIndex;534 Count := Count + ItemCount;535 while I < Count do begin536 Items[I] := List[J];537 I := I + 1;538 J := J + 1;539 end;540 end;541 542 procedure TGList<TItem>.Delete(Index: TIndex);543 begin544 if (Index < 0) or (Index >= FCount) then545 raise EListError.CreateFmt(SListIndexError, [Index]);546 FCount := FCount - 1;547 System.Move(FItems[Index + 1], FItems[Index], (FCount - Index) * SizeOf(TItem));548 SetCapacityOptimized(Capacity - 1);549 end;550 551 procedure TGList<TItem>.DeleteItems(Index, Count: TIndex);552 var553 I: TIndex;554 begin555 I := Index;556 while I < (Index + Count) do begin557 Delete(Index);558 I := I + 1;559 end;560 end;561 562 procedure TGList<TItem>.Fill(Start, Count: TIndex; Value: TItem);563 var564 I: TIndex;565 begin566 I := Start;567 while I < Count do begin568 FItems[I] := Value;569 I := I + 1;570 end;571 end;572 573 procedure TGList<TItem>.Exchange(Index1, Index2: TIndex);574 var575 Temp: TItem;576 begin577 if ((Index1 >= FCount) or (Index1 < 0)) then578 raise EListError.CreateFmt(SListIndexError, [Index1]);579 if ((Index2 >= FCount) or (Index2 < 0)) then580 raise EListError.CreateFmt(SListIndexError, [Index2]);581 Temp := FItems[Index1];582 FItems[Index1] := FItems[Index2];583 FItems[Index2] := Temp;584 end;585 586 { TGObjectList }587 588 procedure TGObjectList<TItem>.Assign(Source: TGList<TItem>);589 begin590 Clear;591 OwnsObjects := False;592 inherited;593 end;594 595 procedure TGObjectList<TItem>.Put(Index: Integer; const AValue: TItem);596 begin597 if OwnsObjects then FItems[Index].Free;598 inherited Put(Index, AValue);599 end;600 601 procedure TGObjectList<TItem>.Delete(Index: Integer);602 begin603 if OwnsObjects then FItems[Index].Free;604 inherited Delete(Index);605 end;606 607 procedure TGObjectList<TItem>.Clear;608 var609 I: Integer;610 begin611 if OwnsObjects then begin612 I := 0;613 while I < Count do begin614 FItems[I].Free;615 I := I + 1;616 end;617 end;618 inherited Clear;619 end;620 621 constructor TGObjectList<TItem>.Create;622 begin623 inherited;624 OwnsObjects := True;625 end;626 627 destructor TGObjectList<TItem>.Destroy;628 begin629 Clear;630 inherited Destroy;631 end;632 633 { TGStringList }634 635 procedure TGStringList<TItem>.Assign(Source: TGList<TItem>);636 begin637 Clear;638 inherited;639 end;640 641 procedure TGStringList<TItem>.Delete(Index: Integer);642 begin643 FItems[Index] := '';644 inherited Delete(Index);645 end;646 647 procedure TGStringList<TItem>.Clear;648 var649 I: Integer;650 begin651 I := 0;652 while I < Count do begin653 FItems[I] := '';654 I := I + 1;655 end;656 inherited Clear;657 end;658 659 constructor TGStringList<TItem>.Create;660 begin661 inherited;662 end;663 664 destructor TGStringList<TItem>.Destroy;665 begin666 Clear;667 inherited Destroy;668 end;669 670 { TGAbstractList<TItem> }671 672 function TGAbstractList<TItem>.GetLast: TItem;673 begin674 if Count = 0 then675 raise EListError.CreateFmt(SListIndexError, [0])676 else677 Result := Items[Count - 1];678 end;679 680 procedure TGAbstractList<TItem>.SetLast(const AValue: TItem);681 begin682 if Count = 0 then683 raise EListError.CreateFmt(SListIndexError, [0])684 else685 Items[Count - 1] := AValue;686 end;687 688 function TGAbstractList<TItem>.GetFirst: TItem;689 begin690 if Count = 0 then691 raise EListError.CreateFmt(SListIndexError, [0])692 else693 Result := Items[0];694 end;695 696 procedure TGAbstractList<TItem>.SetFirst(const AValue: TItem);697 begin698 if Count = 0 then699 raise EListError.CreateFmt(SListIndexError, [0])700 else701 Items[0] := AValue;702 end;703 704 constructor TGAbstractList<TItem>.Create;705 begin706 end;707 708 procedure TGAbstractList<TItem>.Clear;709 begin710 Count := 0;711 Capacity := 0;712 690 end; 713 691 … … 719 697 end; 720 698 699 procedure TGAbstractList<TItem>.AddArray(Values: array of TItem); 700 var 701 I: TIndex; 702 begin 703 I := 0; 704 while I <= High(Values) do begin 705 Add(Values[I]); 706 I := I + 1; 707 end; 708 end; 709 710 procedure TGAbstractList<TItem>.AddList(List: TGAbstractList<TItem>); 711 begin 712 Count := Count + List.Count; 713 ReplaceList(Count - List.Count, List); 714 end; 715 716 procedure TGAbstractList<TItem>.AddListPart(List: TGAbstractList<TItem>; ItemIndex, 717 ItemCount: TIndex); 718 begin 719 Count := Count + ItemCount; 720 ReplaceListPart(Count - ItemCount, List, ItemIndex, ItemCount); 721 end; 722 723 procedure TGAbstractList<TItem>.Assign(Source: TGAbstractList<TItem>); 724 begin 725 Count := Source.Count; 726 ReplaceList(0, Source); 727 end; 728 721 729 { TGFileList<TItem> } 722 730 -
Generics/NativeGenerics/Units/GenericRange.pas
r132 r424 6 6 7 7 uses 8 SysUtils, Classes , GenericList;8 SysUtils, Classes; 9 9 10 10 type
Note:
See TracChangeset
for help on using the changeset viewer.