update
This commit is contained in:
parent
0f7d7a44bf
commit
efb7d3aa5f
|
@ -99,8 +99,8 @@ public:
|
||||||
class RuleMatch : public Serializable {
|
class RuleMatch : public Serializable {
|
||||||
public:
|
public:
|
||||||
virtual QString matchType() const = 0;
|
virtual QString matchType() const = 0;
|
||||||
virtual std::shared_ptr<ExtractWrap> bindRule() const = 0;
|
virtual std::shared_ptr<ExtractUnit> bindRule() const = 0;
|
||||||
virtual void bindRule(std::shared_ptr<ExtractWrap> rule) = 0;
|
virtual void bindRule(std::shared_ptr<ExtractUnit> rule) = 0;
|
||||||
virtual bool checkpass(const QByteArray& buffer) const = 0;
|
virtual bool checkpass(const QByteArray& buffer) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -332,12 +332,12 @@ QString AsUnsigned::topic()
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
std::shared_ptr<ExtractWrap> AsList::elementRule() const
|
std::shared_ptr<ExtractUnit> AsList::elementRule() const
|
||||||
{
|
{
|
||||||
return this->_list._bind_unit;
|
return this->_list._bind_unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AsList::setElementRule(std::shared_ptr<ExtractWrap> u)
|
bool AsList::setElementRule(std::shared_ptr<ExtractUnit> u)
|
||||||
{
|
{
|
||||||
this->_list._bind_unit = u;
|
this->_list._bind_unit = u;
|
||||||
return true;
|
return true;
|
||||||
|
@ -381,7 +381,7 @@ void AsList::loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject& o
|
||||||
QString bind_unit_name = "";
|
QString bind_unit_name = "";
|
||||||
STRING_PEAK(bind_unit_name, obj);
|
STRING_PEAK(bind_unit_name, obj);
|
||||||
xdev = core->operator[](bind_unit_name)->newDefault();
|
xdev = core->operator[](bind_unit_name)->newDefault();
|
||||||
this->_list._bind_unit = std::dynamic_pointer_cast<ExtractWrap>(xdev);
|
this->_list._bind_unit = std::dynamic_pointer_cast<ExtractUnit>(xdev);
|
||||||
|
|
||||||
|
|
||||||
QJsonObject unit_obj;
|
QJsonObject unit_obj;
|
||||||
|
@ -623,7 +623,7 @@ void AsRuleSet::loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject
|
||||||
|
|
||||||
auto xdev = core->operator[](match_name)->newDefault();
|
auto xdev = core->operator[](match_name)->newDefault();
|
||||||
xdev->loadFrom(core, match_obj);
|
xdev->loadFrom(core, match_obj);
|
||||||
_bind.sub_units << std::dynamic_pointer_cast<ExtractWrap>(xdev);
|
_bind.sub_units << std::dynamic_pointer_cast<ExtractUnit>(xdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,17 +653,17 @@ std::shared_ptr<Serializable> AsRuleSet::newDefault() const
|
||||||
return std::make_shared<AsRuleSet>();
|
return std::make_shared<AsRuleSet>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ExtractWrap> AsRuleSet::operator[](int index) const
|
std::shared_ptr<ExtractUnit> AsRuleSet::operator[](int index) const
|
||||||
{
|
{
|
||||||
return this->_bind.sub_units[index];
|
return this->_bind.sub_units[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsRuleSet::replace(int index, std::shared_ptr<ExtractWrap> inst)
|
void AsRuleSet::replace(int index, std::shared_ptr<ExtractUnit> inst)
|
||||||
{
|
{
|
||||||
this->_bind.sub_units.replace(index, inst);
|
this->_bind.sub_units.replace(index, inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
extract::AsRuleSet& AsRuleSet::append(std::shared_ptr<ExtractWrap> u)
|
extract::AsRuleSet& AsRuleSet::append(std::shared_ptr<ExtractUnit> u)
|
||||||
{
|
{
|
||||||
this->_bind.sub_units.append(u);
|
this->_bind.sub_units.append(u);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -683,14 +683,14 @@ QList<QString> AsRuleSet::fieldNames() const
|
||||||
return fields_store;;
|
return fields_store;;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ExtractWrap> AsRuleSet::operator[](const QString& field) const
|
std::shared_ptr<ExtractUnit> AsRuleSet::operator[](const QString& field) const
|
||||||
{
|
{
|
||||||
for (auto pair : this->_bind.sub_units) {
|
for (auto pair : this->_bind.sub_units) {
|
||||||
if(pair->name() == field)
|
if(pair->name() == field)
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::shared_ptr<ExtractWrap>();
|
return std::shared_ptr<ExtractUnit>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsRuleSet::setAlias(const QString& typeAlias)
|
void AsRuleSet::setAlias(const QString& typeAlias)
|
||||||
|
@ -713,33 +713,33 @@ QString AsRuleSet::topic()
|
||||||
return NAME(AsRuleSet);
|
return NAME(AsRuleSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ExtractProcess::name() const
|
QString SingleBasedUnit::name() const
|
||||||
{
|
{
|
||||||
return _inst._field_name;
|
return _inst._field_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExtractProcess::setOffsetSpan(int bytes)
|
bool SingleBasedUnit::setOffsetSpan(int bytes)
|
||||||
{
|
{
|
||||||
_inst._bytes_offset = bytes;
|
_inst._bytes_offset = bytes;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtractProcess::offsetSpan() const
|
int SingleBasedUnit::offsetSpan() const
|
||||||
{
|
{
|
||||||
return _inst._bytes_offset;
|
return _inst._bytes_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ExtractDelegate> ExtractProcess::delegateInst() const
|
std::shared_ptr<ExtractDelegate> SingleBasedUnit::delegateInst() const
|
||||||
{
|
{
|
||||||
return _inst._delegate_inst;
|
return _inst._delegate_inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractProcess::setDelegate(std::shared_ptr<ExtractDelegate> inst)
|
void SingleBasedUnit::setDelegate(std::shared_ptr<ExtractDelegate> inst)
|
||||||
{
|
{
|
||||||
_inst._delegate_inst = inst;
|
_inst._delegate_inst = inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractProcess::registSubField(std::shared_ptr<ScopeFieldsSetter> inst)
|
void SingleBasedUnit::registSubField(std::shared_ptr<ScopeFieldsSetter> inst)
|
||||||
{
|
{
|
||||||
inst->setField(name(), _inst._delegate_inst->outType());
|
inst->setField(name(), _inst._delegate_inst->outType());
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ void ExtractProcess::registSubField(std::shared_ptr<ScopeFieldsSetter> inst)
|
||||||
_inst._delegate_inst->registSubField(nlayer);
|
_inst._delegate_inst->registSubField(nlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractProcess::parse(const QByteArray& bytes, std::shared_ptr<DataContext> out) const
|
void SingleBasedUnit::parse(const QByteArray& bytes, std::shared_ptr<DataContext> out) const
|
||||||
{
|
{
|
||||||
auto context = std::make_shared<ValueAccessContext>();
|
auto context = std::make_shared<ValueAccessContext>();
|
||||||
context->init(name(), out);
|
context->init(name(), out);
|
||||||
|
@ -756,7 +756,7 @@ void ExtractProcess::parse(const QByteArray& bytes, std::shared_ptr<DataContext>
|
||||||
_inst._delegate_inst->parse(bytes_sec, context);
|
_inst._delegate_inst->parse(bytes_sec, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractProcess::loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject& obj)
|
void SingleBasedUnit::loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonObject& obj)
|
||||||
{
|
{
|
||||||
QJsonObject field_obj;
|
QJsonObject field_obj;
|
||||||
OBJECT_PEAK(field_obj, obj);
|
OBJECT_PEAK(field_obj, obj);
|
||||||
|
@ -773,7 +773,7 @@ void ExtractProcess::loadFrom(std::shared_ptr<TranslateBasic> core, const QJsonO
|
||||||
_inst._delegate_inst->loadFrom(core, data_obj);
|
_inst._delegate_inst->loadFrom(core, data_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractProcess::saveTo(QJsonObject& obj) const
|
void SingleBasedUnit::saveTo(QJsonObject& obj) const
|
||||||
{
|
{
|
||||||
QJsonObject field_obj;
|
QJsonObject field_obj;
|
||||||
STRING_SAVE(_inst._field_name, field_obj);
|
STRING_SAVE(_inst._field_name, field_obj);
|
||||||
|
@ -788,17 +788,17 @@ void ExtractProcess::saveTo(QJsonObject& obj) const
|
||||||
OBJECT_SAVE(field_obj, obj);
|
OBJECT_SAVE(field_obj, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Serializable> ExtractProcess::newDefault() const
|
std::shared_ptr<Serializable> SingleBasedUnit::newDefault() const
|
||||||
{
|
{
|
||||||
return std::make_shared<ExtractProcess>();
|
return std::make_shared<SingleBasedUnit>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractProcess::setName(const QString& name)
|
void SingleBasedUnit::setName(const QString& name)
|
||||||
{
|
{
|
||||||
_inst._field_name = name;
|
_inst._field_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtractProcess::countWithin() const
|
int SingleBasedUnit::countWithin() const
|
||||||
{
|
{
|
||||||
return _inst._delegate_inst->countWithin() + offsetSpan();
|
return _inst._delegate_inst->countWithin() + offsetSpan();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ×ֶδúÀí
|
/// ×ֶδúÀí
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ExtractWrap : public ExtractStruct {
|
class ExtractUnit : public ExtractStruct {
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ×Ö¶ÎÃû³Æ
|
/// ×Ö¶ÎÃû³Æ
|
||||||
|
@ -246,15 +246,15 @@ namespace extract {
|
||||||
struct __Private {
|
struct __Private {
|
||||||
QString _alias_name = "";
|
QString _alias_name = "";
|
||||||
int count_acculate = 0;
|
int count_acculate = 0;
|
||||||
std::shared_ptr<ExtractWrap> _bind_unit = nullptr;
|
std::shared_ptr<ExtractUnit> _bind_unit = nullptr;
|
||||||
std::shared_ptr<SizeProvider> _bind_size_v = nullptr;
|
std::shared_ptr<SizeProvider> _bind_size_v = nullptr;
|
||||||
} _list;
|
} _list;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QString topic();
|
static QString topic();
|
||||||
|
|
||||||
std::shared_ptr<ExtractWrap> elementRule() const;
|
std::shared_ptr<ExtractUnit> elementRule() const;
|
||||||
bool setElementRule(std::shared_ptr<ExtractWrap> u);
|
bool setElementRule(std::shared_ptr<ExtractUnit> u);
|
||||||
std::shared_ptr<SizeProvider> sizeProvider() const;
|
std::shared_ptr<SizeProvider> sizeProvider() const;
|
||||||
bool setSizeProvider(std::shared_ptr<SizeProvider> ins);
|
bool setSizeProvider(std::shared_ptr<SizeProvider> ins);
|
||||||
|
|
||||||
|
@ -312,20 +312,20 @@ namespace extract {
|
||||||
private:
|
private:
|
||||||
struct __Private {
|
struct __Private {
|
||||||
QString alias_name = "";
|
QString alias_name = "";
|
||||||
QList<std::shared_ptr<ExtractWrap>> sub_units;
|
QList<std::shared_ptr<ExtractUnit>> sub_units;
|
||||||
}_bind;
|
}_bind;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QString topic();
|
static QString topic();
|
||||||
|
|
||||||
QList<QString> fieldNames() const;
|
QList<QString> fieldNames() const;
|
||||||
std::shared_ptr<ExtractWrap> operator[](const QString& field) const;
|
std::shared_ptr<ExtractUnit> operator[](const QString& field) const;
|
||||||
|
|
||||||
int memberCount() const;
|
int memberCount() const;
|
||||||
std::shared_ptr<ExtractWrap> operator[](int index) const;
|
std::shared_ptr<ExtractUnit> operator[](int index) const;
|
||||||
void replace(int index, std::shared_ptr<ExtractWrap> inst);
|
void replace(int index, std::shared_ptr<ExtractUnit> inst);
|
||||||
void removeAt(int index);
|
void removeAt(int index);
|
||||||
AsRuleSet& append(std::shared_ptr<ExtractWrap> u);
|
AsRuleSet& append(std::shared_ptr<ExtractUnit> u);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString unitType() const override;
|
QString unitType() const override;
|
||||||
|
@ -345,7 +345,7 @@ namespace extract {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ExtractProcess : public ExtractWrap {
|
class SingleBasedUnit : public ExtractUnit {
|
||||||
private:
|
private:
|
||||||
struct __Private {
|
struct __Private {
|
||||||
QString _field_name = "";
|
QString _field_name = "";
|
||||||
|
|
Loading…
Reference in New Issue