14 #include "OriginalXmlLabel.h"
15 #include "Application.h"
16 #include "PvlObject.h"
23 OriginalXmlLabel::OriginalXmlLabel() {
32 OriginalXmlLabel::OriginalXmlLabel(
const QString &file) {
33 Blob blob =
Blob(
"IsisCube",
"OriginalXmlLabel");
51 OriginalXmlLabel::~OriginalXmlLabel() {
58 void OriginalXmlLabel::fromBlob(
Isis::Blob blob) {
63 if ( !m_originalLabel.setContent( QByteArray(blob.
getBuffer(), blob.
Size()) ) ) {
64 QString msg =
"XML read/parse error when parsing original label. "
65 "Error at line [" +
toString(errorLine) +
66 "], column [" +
toString(errorColumn) +
67 "]. Error message: " + errorMessage;
68 throw IException(IException::Unknown, msg, _FILEINFO_);
78 Blob OriginalXmlLabel::toBlob()
const {
79 std::stringstream sstream;
80 sstream << m_originalLabel.toString();
81 string orglblStr = sstream.str();
82 Isis::Blob blob(
"IsisCube",
"OriginalXmlLabel");
83 blob.
setData((
char*)orglblStr.data(), orglblStr.length());
86 blob.
Label()[
"ByteOrder"] = Isis::ByteOrderName(Isis::Lsb);
89 blob.
Label()[
"ByteOrder"] = Isis::ByteOrderName(Isis::Msb);
103 void OriginalXmlLabel::readFromXmlFile(
const FileName &xmlFileName) {
104 QFile xmlFile(xmlFileName.
expanded());
105 if ( !xmlFile.open(QIODevice::ReadOnly) ) {
106 QString msg =
"Could not open label file [" + xmlFileName.
expanded() +
108 throw IException(IException::Io, msg, _FILEINFO_);
113 if ( !m_originalLabel.setContent(&xmlFile,
false, &errmsg, &errline, &errcol) ) {
115 QString msg =
"XML read/parse error in file [" + xmlFileName.
expanded()
117 +
"], message: " + errmsg;
118 throw IException(IException::Unknown, msg, _FILEINFO_);
130 const QDomDocument &OriginalXmlLabel::ReturnLabels()
const{
131 return m_originalLabel;