From 366a8063730aa7ae696bcb9cf56eafd13d43dfc0 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 8 Feb 2009 00:44:10 +0000 Subject: 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. --- src/hash.h | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'src/hash.h') 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 { } - bool isActive() + DEPRECATED bool isActive() const + { + return !bFinished; + } + + bool isValid() const + { + return !bFinished; + } + + operator bool() const { return !bFinished; } @@ -605,7 +615,7 @@ namespace Bu /** * Iterator equality comparison operator. Iterators the same? */ - bool operator==( const iterator &oth ) + bool operator==( const iterator &oth ) const { if( bFinished != oth.bFinished ) return false; @@ -624,7 +634,7 @@ namespace Bu /** * Iterator not equality comparison operator. Not the same? */ - bool operator!=( const iterator &oth ) + bool operator!=( const iterator &oth ) const { return !(*this == oth ); } @@ -650,6 +660,11 @@ namespace Bu { return hsh.getValueAtPos( nPos ); } + + const value &operator *() const + { + return hsh.getValueAtPos( nPos ); + } /** * Get the key behind this iterator. @@ -697,6 +712,16 @@ namespace Bu bool bFinished; public: + bool isValid() const + { + return !bFinished; + } + + operator bool() const + { + return !bFinished; + } + /** * Iterator incrementation operator. Move the iterator forward. */ @@ -722,7 +747,7 @@ namespace Bu /** * Iterator equality comparison operator. Iterators the same? */ - bool operator==( const const_iterator &oth ) + bool operator==( const const_iterator &oth ) const { if( bFinished != oth.bFinished ) return false; @@ -741,7 +766,7 @@ namespace Bu /** * Iterator not equality comparison operator. Not the same? */ - bool operator!=( const const_iterator &oth ) + bool operator!=( const const_iterator &oth ) const { return !(*this == oth ); } -- cgit v1.2.3