From 8e08c85cd77d7306fb3feaef8544778408c9d858 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 13 Aug 2009 07:36:56 +0000 Subject: Bu::Hash can now be sent through the Formatter, it's cute. --- src/hash.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/hash.h b/src/hash.h index 50a35b8..f183a4c 100644 --- a/src/hash.h +++ b/src/hash.h @@ -1149,6 +1149,24 @@ namespace Bu template<> uint32_t __calcHashCode( const std::string &k ); template<> bool __cmpHashKeys( const std::string &a, const std::string &b ); + class Formatter; + Formatter &operator<<( Formatter &rOut, char *sStr ); + Formatter &operator<<( Formatter &rOut, signed char c ); + template + Formatter &operator<<( Formatter &f, const Bu::Hash &l ) + { + f << '{'; + for( typename Bu::Hash::const_iterator i = l.begin(); i; i++ ) + { + if( i != l.begin() ) + f << ", "; + f << i.getKey() << ": " << i.getValue(); + } + f << '}'; + + return f; + } + /* template Archive &operator<<( Archive &ar, Hash &h ) -- cgit v1.2.3