Commit 738cf80b authored by Oliver Bock's avatar Oliver Bock
Browse files

Added support for nested VOOption objects (in compliance with VOTable 1.1 standard)

git-svn-id: https://svn.origo.ethz.ch/fidelity@9 53d1999f-d1a8-4366-aa61-588fded17473
parent e1d9085b
......@@ -20,19 +20,30 @@
#include "VOOption.h"
using namespace Fidelity::Common;
Fidelity::Common::VOOption::VOOption()
{
initAttributes();
}
Fidelity::Common::VOOption::~VOOption()
{}
{
delete m_OptionList;
}
void Fidelity::Common::VOOption::initAttributes()
{
m_OptionList = new QList<VOOption*>();
}
bool Fidelity::Common::VOOption::buildXml(QDomElement* parent)
{
parent->setTagName("OPTION");
QDomDocument doc = parent->ownerDocument();
if (!m_Name.isEmpty()) {
parent->setAttribute("name", m_Name);
}
......@@ -44,6 +55,16 @@ bool Fidelity::Common::VOOption::buildXml(QDomElement* parent)
qDebug("[VOOption] \"value\" is a mandatory attribute!");
return(false);
}
if (!m_OptionList->isEmpty()) {
for (int i = 0;i < m_OptionList->size();i++) {
QDomElement tag = doc.createElement("OPTION");
if(m_OptionList->at(i)->buildXml(&tag) == false) {
return(false);
}
parent->appendChild(tag);
}
}
return(true);
}
......@@ -69,6 +90,7 @@ QString Fidelity::Common::VOOption::Value()
return m_Value;
}
void Fidelity::Common::VOOption::initAttributes()
{}
QList<VOOption*>* Fidelity::Common::VOOption::OptionList()
{
return m_OptionList;
}
......@@ -22,7 +22,9 @@
#define VOOPTION_H
#include <QString>
#include <QDomDocument>
#include <QDomElement>
#include <QList>
namespace Fidelity {
namespace Common {
......@@ -81,10 +83,17 @@ public:
* @return the value of m_Value
*/
QString Value();
/**
* Get the value of m_OptionList
* @return the value of m_OptionList
*/
QList<VOOption*>* OptionList();
private:
QString m_Name;
QString m_Value;
QList<VOOption*>* m_OptionList;
void initAttributes();
};}}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment