A column processor able to use a column strategy to manipulate data. More...
#include <importfilemodel.h>

Public Member Functions | |
| Processor () | |
| Processor (const Processor &original) | |
| ~Processor () | |
| const QVariant | operator() (const QVariant &input) const |
| void | setStrategy (const Strategy::StrategyType &type) |
| void | setStrategyFormat (const QVariant &data, const Strategy::StrategyFormatTypes &fType) |
| const Strategy::StrategyType | currentStrategy () const |
A column processor able to use a column strategy to manipulate data.
QVector sometimes, when resizing, copies the Processors. Therefore, the processors copy-constructor should be implemented decently!
| Processor::Processor | ( | ) |
: strategy(0)
{
setStrategy(Strategy::StrategyNone);
}
| Processor::Processor | ( | const Processor & | original | ) |
: m_settings(original.m_settings)
{
setStrategy(original.currentStrategy());
}
| Processor::~Processor | ( | ) |
{
if (strategy) delete strategy;
}
| const Strategy::StrategyType Processor::currentStrategy | ( | ) | const |
Referenced by Processor().
{
return strategy->name();
}
{
Q_ASSERT(strategy != 0);
return strategy->process(input);
}
| void Processor::setStrategy | ( | const Strategy::StrategyType & | type | ) |
Referenced by Processor().
{
switch (type){
if (strategy) delete strategy;
case Strategy::StrategyNone: strategy = new Strategy(m_settings); break;
case Strategy::StrategyTimestamp: strategy = new TimestampStrategy(m_settings); break;
case Strategy::StrategySensorData: strategy = new DataStrategy(m_settings); Q_ASSERT(false); break;
case Strategy::StrategySensorSqlData: strategy = new SqlDataStrategy(m_settings); break;
}
}
| void Processor::setStrategyFormat | ( | const QVariant & | data, | |
| const Strategy::StrategyFormatTypes & | fType | |||
| ) |
{
m_settings.insert(fType, data);
strategy->reconfigure();
}
1.7.1