On Wednesday 17 May 2006 08:34, Jon Keating wrote: > Having only operator+= might be sufficient, but I think we should also > have an operator+ that is implemented in terms of operator+=. It would > make more sense to have it, if we have operator+=.
It's there, hiding at the end of the file. > There is no CBuffer::print() like in the current code. It would be nice > to have a print function or 2. One could be used by the > operator<<(stream, CBuffer), and then one can be used for packet dumps. > Or if we only have one print(), the packet dump function could just > make the output of print() prettier. There is a operator<<(ostream&, const CBuffer&) (at the end) but it doesn't do any formating. But I'll add a function for printing packet dumps, similar to the existing print(). This will give us two functions. operator<<(): prints each element in the buffer separated by a space. prettyPrint(): prints the buffer like this: address: <16 bytes in hex> <the same in ascii> address+16: ... I have a problem with stream formatting that perhaps someone here can help me with. The following code CBuffer buf; uint16_t data[5] = { 10, 20, 30, 40, 50 }; buf.write(data, data + 5); cout << hex << setw(2) << setfill('0') << buf << endl; outputs 0a 0 14 0 1e 0 28 0 32 0 not 0a 00 14 00 1e 00 28 00 32 00 as I think it should. Why does hex apply to all elements in the buffer, but not setw(2)? // Erik -- You tried your best and failed miserably. The lesson is: never try. -- Homer Simpson Erik Johansson http://ejohansson.se ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Licq-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/licq-devel