+// Print
+/**
+ * \brief Prints the common part (vr [length offset] name) of DataEntry, SeqEntry
+ * @param os ostream we want to print in
+ * @param indent Indentation string to be prepended during printing
+ */
+void DocEntry::Print(std::ostream &os, std::string const & )
+{
+ size_t o;
+ std::string st;
+ TSKey v;
+ std::string d2;
+ VRKey vr;
+ std::ostringstream s;
+ uint32_t lgth;
+
+ o = GetOffset();
+ vr = GetVR();
+ if ( vr == GDCM_VRUNKNOWN )
+ vr = " ";
+
+ s << DictEntry::TranslateToKey(GetGroup(),GetElement());
+
+ if (PrintLevel >= 2)
+ {
+ s << " lg : ";
+ lgth = GetReadLength(); // ReadLength, as opposed to (usable) Length
+ if (lgth == 0xffffffff)
+ {
+ st = " ffff ";
+ s.setf(std::ios::left);
+ s << std::setw(4);
+ s << " x(ffff) ";
+ s.setf(std::ios::left);
+ s << std::setw(8) << "-1";
+ }
+ else
+ {
+ st = Util::Format("x(%x)",lgth); // we may keep it
+ s.setf(std::ios::left);
+ s << std::setw(11-st.size()) << " ";
+ s << st << " ";
+ s.setf(std::ios::left);
+ s << std::setw(8) << lgth;
+ }
+ s << " Off.: ";
+ st = Util::Format("x(%x)",o); // we may keep it
+ s << std::setw(11-st.size()) << " ";
+ s << st << " ";
+ s << std::setw(8) << o;
+ }
+ //if (PrintLevel >= 1)
+ s << " ";
+
+ s << "[" << vr << "] ";
+
+ std::string name;
+ uint16_t e = GetElement();
+ if ( e == 0x0000 )
+ name = "Group Length";
+ else if ( GetGroup()%2 == 1 )
+ {
+ if ( e >= 0x0010 && e <= 0x00ff )
+ name = "Private Creator";
+ else if (e == 0x0001)
+ name = "Private Group Length To End";
+ }
+ else
+ {
+ name = GetName();
+ // prevent Print from any CR at end of name (hope it's enought!)
+ if (name[name.length()-1] == 0x0d || name[name.length()-1] == 0x0a)
+ {
+ name.replace(name.length()-1, 1, 1, ' ');
+ }
+ }
+ if (PrintLevel >= 1)
+ {
+ s.setf(std::ios::left);
+ s << std::setw(66-name.length()) << " ";
+ }
+
+ s << "[" << name << "]";
+ os << s.str();
+}
+
+//-----------------------------------------------------------------------------
+} // end namespace gdcm