aboutsummaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-02-08 00:44:10 +0000
committerMike Buland <eichlan@xagasoft.com>2009-02-08 00:44:10 +0000
commit366a8063730aa7ae696bcb9cf56eafd13d43dfc0 (patch)
tree42e3597edfde0c183506ad0d452f045cb7726137 /src/hash.h
parent4f59dec6bad120b72f1bc075715d79bfbe881f7e (diff)
downloadlibbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.gz
libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.bz2
libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.tar.xz
libbu++-366a8063730aa7ae696bcb9cf56eafd13d43dfc0.zip
So many updates. I recommend using the new FString iterators instead of direct
indexing. It is now many times faster, and requires less overhead. Also, more stuff iterator related in every class. More on that later.
Diffstat (limited to '')
-rw-r--r--src/hash.h35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/hash.h b/src/hash.h
index 8856860..3868a4e 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -575,7 +575,17 @@ namespace Bu
575 { 575 {
576 } 576 }
577 577
578 bool isActive() 578 DEPRECATED bool isActive() const
579 {
580 return !bFinished;
581 }
582
583 bool isValid() const
584 {
585 return !bFinished;
586 }
587
588 operator bool() const
579 { 589 {
580 return !bFinished; 590 return !bFinished;
581 } 591 }
@@ -605,7 +615,7 @@ namespace Bu
605 /** 615 /**
606 * Iterator equality comparison operator. Iterators the same? 616 * Iterator equality comparison operator. Iterators the same?
607 */ 617 */
608 bool operator==( const iterator &oth ) 618 bool operator==( const iterator &oth ) const
609 { 619 {
610 if( bFinished != oth.bFinished ) 620 if( bFinished != oth.bFinished )
611 return false; 621 return false;
@@ -624,7 +634,7 @@ namespace Bu
624 /** 634 /**
625 * Iterator not equality comparison operator. Not the same? 635 * Iterator not equality comparison operator. Not the same?
626 */ 636 */
627 bool operator!=( const iterator &oth ) 637 bool operator!=( const iterator &oth ) const
628 { 638 {
629 return !(*this == oth ); 639 return !(*this == oth );
630 } 640 }
@@ -650,6 +660,11 @@ namespace Bu
650 { 660 {
651 return hsh.getValueAtPos( nPos ); 661 return hsh.getValueAtPos( nPos );
652 } 662 }
663
664 const value &operator *() const
665 {
666 return hsh.getValueAtPos( nPos );
667 }
653 668
654 /** 669 /**
655 * Get the key behind this iterator. 670 * Get the key behind this iterator.
@@ -697,6 +712,16 @@ namespace Bu
697 bool bFinished; 712 bool bFinished;
698 713
699 public: 714 public:
715 bool isValid() const
716 {
717 return !bFinished;
718 }
719
720 operator bool() const
721 {
722 return !bFinished;
723 }
724
700 /** 725 /**
701 * Iterator incrementation operator. Move the iterator forward. 726 * Iterator incrementation operator. Move the iterator forward.
702 */ 727 */
@@ -722,7 +747,7 @@ namespace Bu
722 /** 747 /**
723 * Iterator equality comparison operator. Iterators the same? 748 * Iterator equality comparison operator. Iterators the same?
724 */ 749 */
725 bool operator==( const const_iterator &oth ) 750 bool operator==( const const_iterator &oth ) const
726 { 751 {
727 if( bFinished != oth.bFinished ) 752 if( bFinished != oth.bFinished )
728 return false; 753 return false;
@@ -741,7 +766,7 @@ namespace Bu
741 /** 766 /**
742 * Iterator not equality comparison operator. Not the same? 767 * Iterator not equality comparison operator. Not the same?
743 */ 768 */
744 bool operator!=( const const_iterator &oth ) 769 bool operator!=( const const_iterator &oth ) const
745 { 770 {
746 return !(*this == oth ); 771 return !(*this == oth );
747 } 772 }