I3Identifier.cc File Reference

#include "I3Identifier.h"
#include "SHA1.h"

Functions

std::ostream & operator<< (std::ostream &os, const I3Identifier &id)


Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const I3Identifier id 
)

Parameters:
os String stream
id I3Identifier to be output
Returns:
os parameter
00193 {
00194     bool allzeros;
00195     const char hex[] = "0123456789abcdef";
00196     string s0, s1;
00197 
00198     if (id.name.length() != 0) {
00199         os << "(" << id.name << ") ";
00200     }
00201 
00202     for (int i = 0; i < id.prefixLength / 8; i++) {
00203         os << hex[id.key[i] >> 4];
00204         os << hex[id.key[i] & 0xf];
00205     }
00206     os << ':';
00207 
00208     allzeros = true;
00209     for (int i = id.prefixLength / 8; i < id.keyLength / 8; i++) {
00210         if (id.key[i] != 0) {
00211             allzeros = false;
00212             break;
00213         }
00214     }
00215     if (allzeros) {
00216         os << "0...";
00217     } else {
00218         for (int i = id.prefixLength / 8; i < id.keyLength / 8; i++) {
00219             os << hex[id.key[i] >> 4];
00220             os << hex[id.key[i] & 0xf];
00221         }
00222     }
00223     return os;
00224 }


Generated on Fri Sep 19 13:05:05 2008 for ITM OverSim by  doxygen 1.5.5