ToString method to Packet

This commit is contained in:
Natale Patriciello
2014-11-14 15:27:37 -08:00
parent d4f2adc449
commit 37ed3b545b
2 changed files with 17 additions and 0 deletions

View File

@@ -412,6 +412,14 @@ Packet::PrintByteTags (std::ostream &os) const
}
}
std::string
Packet::ToString() const
{
std::ostringstream oss;
Print (oss);
return oss.str();
}
void
Packet::Print (std::ostream &os) const
{

View File

@@ -453,6 +453,15 @@ public:
*/
void Print (std::ostream &os) const;
/**
* \brief Return a string representation of the packet
*
* An empty string is returned if you haven't called EnablePrinting ()
*
* \return String representation
*/
std::string ToString (void) const;
/**
* \brief Returns an iterator which points to the first 'item'
* stored in this buffer.