Brief description of class still missing. More...
#include <AbstractFileFormat.h>
Public Member Functions | |
| AbstractFileFormat () | |
| AbstractFileFormat (const AbstractFileFormat &o) | |
| void | addExtension (QString e) |
| void | addExtensions (const QString &el) |
| void | clearExtensions () |
| virtual int | complexity () const |
| QString | extensionFilter () const |
| const QStringList & | extensions () const |
| virtual SignalFileFormat::Format | format () const |
| virtual bool | isReadOnly () const |
| virtual bool | isValid (const QString &) const |
| virtual bool | load (SignalFile *file) const |
| virtual bool | load (const Signal *sig, double *samples) const |
| const QString & | name () const |
| void | operator= (const AbstractFileFormat &o) |
| virtual bool | save (const SubSignalPool &subpool, const QString &filePath) const |
| void | setName (const QString &n) |
| virtual SignalFileFormat::Storage | storage () const |
| QString | toString () const |
| ~AbstractFileFormat () | |
Protected Member Functions | |
| virtual XMLMember | xml_member (XML_MEMBER_ARGS) |
| virtual bool | xml_setProperty (XML_SETPROPERTY_ARGS) |
| virtual void | xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const |
Brief description of class still missing.
Full description of class still missing
Description of constructor still missing
References TRACE.
: XMLClass(), SharedObject(o) { TRACE; _name=o._name; _extensions=o._extensions; }
| void GeopsyCore::AbstractFileFormat::addExtension | ( | QString | e | ) |
Add e to the list of accepted extensions. The first one is the default one.
References TRACE.
Referenced by addExtensions(), and MatFormat::MatFormat().
{
TRACE;
if(e.left(1)==".") {
e=e.mid(1);
}
_extensions << e.trimmed();
}
| void GeopsyCore::AbstractFileFormat::addExtensions | ( | const QString & | el | ) |
Add extensions from a coma-separated list.
References addExtension(), and TRACE.
{
TRACE;
QStringList eList=el.split(",");
foreach(QString e, eList) {
addExtension(e);
}
}
| void GeopsyCore::AbstractFileFormat::clearExtensions | ( | ) | [inline] |
{_extensions.clear();}
| virtual int GeopsyCore::AbstractFileFormat::complexity | ( | ) | const [inline, virtual] |
Reimplemented in GeopsyCore::AsciiSignalFormat.
Referenced by GeopsyCore::CustomFileFormats::fromContent().
{return 0;}
| QString GeopsyCore::AbstractFileFormat::extensionFilter | ( | ) | const |
Returns all possible extension as filter string.
References TRACE.
Referenced by GeopsyCore::SignalFileFormat::filter().
{
TRACE;
QString f;
foreach(QString e, _extensions) {
if(!f.isEmpty()) {
f+=" ";
}
f+="*."+e;
}
return f;
}
| const QStringList& GeopsyCore::AbstractFileFormat::extensions | ( | ) | const [inline] |
Referenced by GeopsyCore::SignalFileFormat::filter(), GeopsyCore::CustomFileFormats::fromExtension(), GeopsyGui::AsciiSignalFormatEditor::setFormat(), and GeopsyCore::SignalFileFormat::suffix().
{return _extensions;}
| virtual SignalFileFormat::Format GeopsyCore::AbstractFileFormat::format | ( | ) | const [inline, virtual] |
Reimplemented in GeopsyCore::AsciiSignalFormat.
References GeopsyCore::SignalFileFormat::Custom.
Referenced by GeopsyCore::CustomFileFormats::clear(), GeopsyCore::CustomFileFormats::fromContent(), GeopsyCore::CustomFileFormats::fromExtension(), GeopsyCore::CustomFileFormats::fromString(), GeopsyCore::CustomFileFormats::list(), and GeopsyCore::CustomFileFormats::setFormats().
{return SignalFileFormat::Custom;}
| virtual bool GeopsyCore::AbstractFileFormat::isReadOnly | ( | ) | const [inline, virtual] |
Reimplemented in MatFormat.
Referenced by GeopsyCore::SignalFileFormat::isReadOnly(), and GeopsyCore::SubSignalPool::save().
{return true;}
| virtual bool GeopsyCore::AbstractFileFormat::isValid | ( | const QString & | ) | const [inline, virtual] |
Reimplemented in GeopsyCore::AsciiSignalFormat, and MatFormat.
Referenced by GeopsyCore::CustomFileFormats::fromContent().
{return false;}
| bool GeopsyCore::AbstractFileFormat::load | ( | SignalFile * | file | ) | const [virtual] |
Reimplemented in MatFormat.
References TRACE.
Referenced by GeopsyCore::SignalFile::load().
{
TRACE;
return false;
}
| bool GeopsyCore::AbstractFileFormat::load | ( | const Signal * | sig, |
| double * | samples | ||
| ) | const [virtual] |
| const QString& GeopsyCore::AbstractFileFormat::name | ( | ) | const [inline] |
| void GeopsyCore::AbstractFileFormat::operator= | ( | const AbstractFileFormat & | o | ) |
References TRACE.
{
TRACE;
SharedObject::operator=(o);
_name=o._name;
_extensions=o._extensions;
}
| bool GeopsyCore::AbstractFileFormat::save | ( | const SubSignalPool & | subpool, |
| const QString & | filePath | ||
| ) | const [virtual] |
Reimplemented in MatFormat.
References TRACE.
Referenced by GeopsyCore::SubSignalPool::save().
{
TRACE;
return false;
}
| void GeopsyCore::AbstractFileFormat::setName | ( | const QString & | n | ) | [inline] |
Referenced by MatFormat::MatFormat().
{_name=n;}
| virtual SignalFileFormat::Storage GeopsyCore::AbstractFileFormat::storage | ( | ) | const [inline, virtual] |
References GeopsyCore::SignalFileFormat::Multi.
Referenced by GeopsyCore::SubSignalPool::save().
{return SignalFileFormat::Multi;}
| QString GeopsyCore::AbstractFileFormat::toString | ( | ) | const |
Removes all spaces from name() and set upper letters for first letters of each word.
References QGpCoreTools::endl(), QGpCoreTools::tr(), and TRACE.
Referenced by GeopsyCore::CustomFileFormats::fromString(), and GeopsyCore::SignalFileFormat::toString().
{
TRACE;
QString standardName;
QRegExp reg;
reg.setPattern(" *([a-zA-Z])");
int index=reg.indexIn(_name, 0);
if(index<0) {
App::stream() << tr("Bad format name, it must start with a letter.") << endl;
return QString::null;
}
standardName=reg.cap(0).toUpper();
index+=reg.matchedLength();
int lastIndex=index;
reg.setPattern(" +\\b([a-zA-Z]?)");
index=reg.indexIn(_name, lastIndex);
while(index>=0) {
standardName+=_name.mid(lastIndex, index-lastIndex);
standardName+=reg.cap(1).toUpper();
index+=reg.matchedLength();
lastIndex=index;
index=reg.indexIn(_name, lastIndex);
}
standardName+=_name.mid(lastIndex);
return standardName;
}
| XMLMember GeopsyCore::AbstractFileFormat::xml_member | ( | XML_MEMBER_ARGS | ) | [protected, virtual] |
Re-implement this function to offer XML restore (children and properties) support to your class.
From tag and map (with contains the attibute value) return a unique identifier under the format of a XMLMember. XMLMember is initialized with 3 types of contructors:
Map of attributes can be inspected in this way (can be achived also in xml_setProperty()):
static const QString tmp("childrenName"); XMLRestoreAttributeIterator it=map.find(tmp); if(it!=map.end()) { // found attribute "childrenName" }
If the map of attributes is not used:
Q_UNUSED(attributes);
if(tag=="x1") return XMLMember(0);
else if(tag=="y1") return XMLMember(1);
else if(tag=="x2") return XMLMember(2);
else if(tag=="y2") return XMLMember(3);
else return XMLMember(XMLMember::Unknown);
Arithmetic operations + and - apply to XMLMember to avoid confusion of property id numbers between inherited objects. Offset 3 corresponds to the number of properties defined in this object.
if(tag=="anInteger") return XMLMember(0); else if(tag=="aString") return XMLMember(1); else if(tag=="aDouble") return XMLMember(2); return AbstractLine::xml_member(tag, attributes, context)+3;
For the arguments of this function use Macro XML_MEMBER_ARGS.
Reimplemented from QGpCoreTools::XMLClass.
Reimplemented in GeopsyCore::AsciiSignalFormat.
References TRACE.
| bool GeopsyCore::AbstractFileFormat::xml_setProperty | ( | XML_SETPROPERTY_ARGS | ) | [protected, virtual] |
Re-implement this function to offer XML restore properties support to your class.
From memberID set the corresponding property with value content. The map of attributes is given as a supplementary information (not useful in all cases).
For a general case:
Q_UNUSED(attributes); double val=content.toDouble(); switch (memberID) { case 0: _x1=val; return true; case 1: _y1=val; return true; case 2: _x2=val; return true; case 3: _y2=val; return true; default: return false; }
For classes inheriting other classes (see also xml_member())
switch (memberID) { case 0: _anInteger=content.toString(); return true; case 1: _aString=content.toInt(); return true; case 2: _aDouble=content.toDouble(); return true; default: return AbstractLine::xml_setProperty(memberID-3, map, content);
For the arguments of this function use Macro XML_SETPROPERTY_ARGS.
Reimplemented from QGpCoreTools::XMLClass.
Reimplemented in GeopsyCore::AsciiSignalFormat.
References TRACE.
{
TRACE;
Q_UNUSED(tag);
Q_UNUSED(attributes);
Q_UNUSED(context);
switch (memberID) {
case 0: _name=content.toString(); return true;
case 1: _extensions=content.toString().split(","); return true;
default:
break;
}
return false;
}
| void GeopsyCore::AbstractFileFormat::xml_writeProperties | ( | XML_WRITEPROPERTIES_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
Reimplemented in GeopsyCore::AsciiSignalFormat.
References TRACE, and QGpCoreTools::XMLClass::writeProperty().
{
TRACE;
Q_UNUSED(context);
writeProperty(s, "name", _name);
writeProperty(s, "extensions", _extensions.join(","));
}