Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......@@ -45,6 +56,16 @@ bool Fidelity::Common::VOOption::buildXml(QDomElement* parent)
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 {
......@@ -82,9 +84,16 @@ public:
*/
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();
};}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment