All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
#include <MetaData.h>
Public Member Functions | |
| virtual int | count (int subId) const |
| virtual QVariant | data (int subId, const QString &index) const |
| virtual bool | hasIndex (int subId, const QString &index) const |
| MetaArray () | |
| MetaArray (const MetaArray &o) | |
| void | setValue (int index, valueType v) |
| valueType | value (int index) const |
| virtual void | writeProperties (XMLStream &s) const |
| virtual void | writeProperties (XMLStream &s, const XMLSaveAttributes &attributes) const |
| ~MetaArray () | |
| GeopsyCore::MetaArray< valueType >::MetaArray | ( | ) | [inline] |
{_count=0;_values=0;}
| GeopsyCore::MetaArray< valueType >::MetaArray | ( | const MetaArray< valueType > & | o | ) |
: MetaData(o) { _count=o._count; if(o._values) { _values=new valueType[_count]; memcpy(_values, o._values, sizeof(valueType)*_count); } else { _values=0; } }
| GeopsyCore::MetaArray< valueType >::~MetaArray | ( | ) | [inline] |
{delete [] _values;}
| virtual int GeopsyCore::MetaArray< valueType >::count | ( | int | subId | ) | const [inline, virtual] |
Reimplemented from GeopsyCore::MetaData.
{Q_UNUSED(subId); return _count;}
| QVariant GeopsyCore::MetaArray< valueType >::data | ( | int | subId, |
| const QString & | index | ||
| ) | const [virtual] |
Reimplemented from GeopsyCore::MetaData.
{
Q_UNUSED(subId);
bool ok;
int i=index.toInt(&ok);
if(ok && i<_count) {
return _values[i];
} else {
return QVariant();
}
}
| bool GeopsyCore::MetaArray< valueType >::hasIndex | ( | int | subId, |
| const QString & | index | ||
| ) | const [virtual] |
Reimplemented from GeopsyCore::MetaData.
{
Q_UNUSED(subId);
bool ok;
int i=index.toInt(&ok);
return ok && i<_count && _values[i]!=0;
}
| void GeopsyCore::MetaArray< valueType >::setValue | ( | int | index, |
| valueType | v | ||
| ) | [inline] |
{if(index>=_count) enlarge(index); _values[index]=v;}
| valueType GeopsyCore::MetaArray< valueType >::value | ( | int | index | ) | const [inline] |
{return index<_count ? _values[index] : 0;}
| void GeopsyCore::MetaArray< valueType >::writeProperties | ( | XMLStream & | s | ) | const [virtual] |
Reimplemented from GeopsyCore::MetaData.
References QGpCoreTools::XMLSaveAttributes::add(), and TRACE.
{
TRACE;
if(!storeAsXML()) {
static const QString key("index");
XMLSaveAttributes att;
QString& value=att.add(key);
for(int i=0;i<_count;i++) {
value=QString::number(i);
if(hasIndex(0, value)) writeProperty(s, xml_tagName(), att, toString(value));
}
}
}
| void GeopsyCore::MetaArray< valueType >::writeProperties | ( | XMLStream & | s, |
| const XMLSaveAttributes & | attributes | ||
| ) | const [virtual] |
Reimplemented from GeopsyCore::MetaData.
References QGpCoreTools::XMLSaveAttributes::add(), and TRACE.
{
TRACE;
if(!storeAsXML()) {
static const QString key("index");
XMLSaveAttributes att(attributes);
QString& value=att.add(key);
for(int i=0;i<_count;i++) {
value=QString::number(i);
if(hasIndex(0, value)) writeProperty(s, xml_tagName(), att, toString(value));
}
}
}