Browse Source

added indent to dump_hex

Darren Ranalli 19 years ago
parent
commit
3758283048
2 changed files with 6 additions and 3 deletions
  1. 5 2
      panda/src/express/datagram.cxx
  2. 1 1
      panda/src/express/datagram.h

+ 5 - 2
panda/src/express/datagram.cxx

@@ -53,12 +53,15 @@ clear() {
 //               contents, as a sequence of hex (and ASCII) values.
 //               contents, as a sequence of hex (and ASCII) values.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void Datagram::
 void Datagram::
-dump_hex(ostream &out) const {
+dump_hex(ostream &out, unsigned int indent) const {
   const char *message = (const char *)get_data();
   const char *message = (const char *)get_data();
   size_t num_bytes = get_length();
   size_t num_bytes = get_length();
   for (size_t line = 0; line < num_bytes; line += 16) {
   for (size_t line = 0; line < num_bytes; line += 16) {
     char hex[12];
     char hex[12];
     sprintf(hex, "%04x ", ((unsigned int )line));
     sprintf(hex, "%04x ", ((unsigned int )line));
+    for (unsigned int ind = 0; ind < indent; ind++) {
+      out << " ";
+    }
     out << hex;
     out << hex;
 
 
     size_t p;
     size_t p;
@@ -226,6 +229,6 @@ write(ostream &out, unsigned int indent) const {
   #ifndef NDEBUG //[
   #ifndef NDEBUG //[
   out.width(indent);
   out.width(indent);
   out<<""<<"Datagram:\n";
   out<<""<<"Datagram:\n";
-  dump_hex(out);
+  dump_hex(out, indent);
   #endif //] NDEBUG
   #endif //] NDEBUG
 }
 }

+ 1 - 1
panda/src/express/datagram.h

@@ -55,7 +55,7 @@ PUBLISHED:
   virtual ~Datagram();
   virtual ~Datagram();
 
 
   virtual void clear();
   virtual void clear();
-  void dump_hex(ostream &out) const;
+  void dump_hex(ostream &out, unsigned int indent=0) const;
 
 
   INLINE void add_bool(bool value);
   INLINE void add_bool(bool value);
   INLINE void add_int8(PN_int8 value);
   INLINE void add_int8(PN_int8 value);