diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-08-13 07:36:56 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-08-13 07:36:56 +0000 |
commit | 8e08c85cd77d7306fb3feaef8544778408c9d858 (patch) | |
tree | deff606ad2d85b05ee6afac6b1b9397dcc46ac57 /src | |
parent | 8e49d2335332b3b97b516c9e00c5235d4f13f03e (diff) | |
download | libbu++-8e08c85cd77d7306fb3feaef8544778408c9d858.tar.gz libbu++-8e08c85cd77d7306fb3feaef8544778408c9d858.tar.bz2 libbu++-8e08c85cd77d7306fb3feaef8544778408c9d858.tar.xz libbu++-8e08c85cd77d7306fb3feaef8544778408c9d858.zip |
Bu::Hash can now be sent through the Formatter, it's cute.
Diffstat (limited to 'src')
-rw-r--r-- | src/hash.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1149,6 +1149,24 @@ namespace Bu | |||
1149 | template<> uint32_t __calcHashCode<std::string>( const std::string &k ); | 1149 | template<> uint32_t __calcHashCode<std::string>( const std::string &k ); |
1150 | template<> bool __cmpHashKeys<std::string>( const std::string &a, const std::string &b ); | 1150 | template<> bool __cmpHashKeys<std::string>( const std::string &a, const std::string &b ); |
1151 | 1151 | ||
1152 | class Formatter; | ||
1153 | Formatter &operator<<( Formatter &rOut, char *sStr ); | ||
1154 | Formatter &operator<<( Formatter &rOut, signed char c ); | ||
1155 | template<typename key, typename value> | ||
1156 | Formatter &operator<<( Formatter &f, const Bu::Hash<key, value> &l ) | ||
1157 | { | ||
1158 | f << '{'; | ||
1159 | for( typename Bu::Hash<key,value>::const_iterator i = l.begin(); i; i++ ) | ||
1160 | { | ||
1161 | if( i != l.begin() ) | ||
1162 | f << ", "; | ||
1163 | f << i.getKey() << ": " << i.getValue(); | ||
1164 | } | ||
1165 | f << '}'; | ||
1166 | |||
1167 | return f; | ||
1168 | } | ||
1169 | |||
1152 | /* | 1170 | /* |
1153 | template<typename key, typename value> | 1171 | template<typename key, typename value> |
1154 | Archive &operator<<( Archive &ar, Hash<key,value> &h ) | 1172 | Archive &operator<<( Archive &ar, Hash<key,value> &h ) |