Mercurial > projects > qtd
comparison qt/core/QList.d @ 323:7a3c43424dca signals
make all examples compile with new signals/slots
author | eldar_ins@eldar-laptop |
---|---|
date | Mon, 28 Dec 2009 16:28:55 +0500 |
parents | ce07227f00c1 |
children | 115130499d78 |
comparison
equal
deleted
inserted
replaced
322:7c2cf27391c4 | 323:7a3c43424dca |
---|---|
366 QListData p; | 366 QListData p; |
367 QListData.Data* d; | 367 QListData.Data* d; |
368 } | 368 } |
369 | 369 |
370 public: | 370 public: |
371 /* | |
371 void output() | 372 void output() |
372 { | 373 { |
373 writeln("QList atomic ", d.ref_.load()); | 374 writeln("QList atomic ", d.ref_.load()); |
374 } | 375 } |
376 */ | |
375 | 377 |
376 static QList!T opCall() | 378 static QList!T opCall() |
377 { | 379 { |
378 QList!T res; | 380 QList!T res; |
379 writeln("QList opCall"); | 381 // writeln("QList opCall"); |
380 | 382 |
381 res.d = &QListData.shared_null; | 383 res.d = &QListData.shared_null; |
382 res.d.ref_.increment(); | 384 res.d.ref_.increment(); |
383 | 385 |
384 return res; | 386 return res; |
385 } | 387 } |
386 | 388 |
387 this(this) | 389 this(this) |
388 { | 390 { |
389 writeln("QList postblit"); | 391 // writeln("QList postblit"); |
390 d.ref_.increment(); | 392 d.ref_.increment(); |
391 if (!d.sharable) | 393 if (!d.sharable) |
392 detach_helper(); | 394 detach_helper(); |
393 } | 395 } |
394 | 396 |
395 ~this() | 397 ~this() |
396 { | 398 { |
397 writeln("QList ~this"); | 399 // writeln("QList ~this"); |
398 if (d && !d.ref_.decrement()) | 400 if (d && !d.ref_.decrement()) |
399 free(d); | 401 free(d); |
400 } | 402 } |
401 | 403 |
402 ref QList!T opAssign(const ref QList!T l) | 404 ref QList!T opAssign(const ref QList!T l) |
403 { | 405 { |
404 writeln("QList opAssign"); | 406 // writeln("QList opAssign"); |
405 if (d != l.d) { | 407 if (d != l.d) { |
406 l.d.ref_.increment(); | 408 l.d.ref_.increment(); |
407 if (!d.ref_.decrement()) | 409 if (!d.ref_.decrement()) |
408 free(d); | 410 free(d); |
409 d = cast(QListData.Data*)l.d; | 411 d = cast(QListData.Data*)l.d; |
503 *cast(T*)(n) = cast(T)(t); | 505 *cast(T*)(n) = cast(T)(t); |
504 } | 506 } |
505 | 507 |
506 void node_copy(Node *from, Node *to, Node *src) | 508 void node_copy(Node *from, Node *to, Node *src) |
507 { | 509 { |
508 writeln("QList node_copy"); | 510 // writeln("QList node_copy"); |
509 static if (isQObjectType!T || isObjectType!T) | 511 static if (isQObjectType!T || isObjectType!T) |
510 {} // ensure to do nothing. copying only a pointer | 512 {} // ensure to do nothing. copying only a pointer |
511 else static if(is(T == string)) | 513 else static if(is(T == string)) |
512 { | 514 { |
513 while(from != to) // TODO when porting to Qt 5 ensure that QTypeInfo<QString>.isLarge and .isStatic == false | 515 while(from != to) // TODO when porting to Qt 5 ensure that QTypeInfo<QString>.isLarge and .isStatic == false |
544 return res; | 546 return res; |
545 } | 547 } |
546 | 548 |
547 void free(QListData.Data* data) | 549 void free(QListData.Data* data) |
548 { | 550 { |
549 writeln("QList data destroyed"); | 551 // writeln("QList data destroyed"); |
550 node_destruct(cast(Node*)(data.array.ptr + data.begin), | 552 node_destruct(cast(Node*)(data.array.ptr + data.begin), |
551 cast(Node*)(data.array.ptr + data.end)); | 553 cast(Node*)(data.array.ptr + data.end)); |
552 if (data.ref_.load() == 0) | 554 if (data.ref_.load() == 0) |
553 qFree(data); | 555 qFree(data); |
554 } | 556 } |