git-svn-id: svn://db.shs.com.ru/libs@255 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-08-03 20:29:43 +00:00
parent e648e2546a
commit 89b3f90131
8 changed files with 58 additions and 46 deletions

View File

@@ -25,13 +25,23 @@ bool KInterface::test(int v) {
}
CDType & KInterface::operator [](const PIString & name_) {
return core->k_[name_];
}
const CDType KInterface::operator [](const PIString & name_) const {
return core->k_[name_];
}
CDType & KInterface::operator [](const PIDeque<int> & path_) {
return core->k_[path_];
}
CDType & KInterface::operator [](const PIString & name_) {
return core->k_[name_];
const CDType KInterface::operator [](const PIDeque<int> & path_) const {
return core->k_[path_];
}

View File

@@ -20,9 +20,9 @@ public:
CDType & operator [](int v);
const CDType operator [](int v) const;
CDType & operator [](const PIString & name_);
const CDType operator [](const PIString & name_) const {return (*this)[name_];}
const CDType operator [](const PIString & name_) const;
CDType & operator [](const PIDeque<int> & path_);
const CDType operator [](const PIDeque<int> & path_) const {return (*this)[path_];}
const CDType operator [](const PIDeque<int> & path_) const;
CDSection & section(int v);
const CDSection section(int v) const;
CDSection & section(const PIDeque<int> & path);

View File

@@ -205,7 +205,39 @@ PIVariantTypes::Enum CDType::parseEnumComment(PIString c) {
//}
CDType & CDSection::operator [](const PIString & name_) {
int CDSection::count(bool recursive) const {
int ret = k.size_s();
if (recursive) {
PIMap<int, CDSection>::const_iterator i;
for (i = s.begin(); i != s.end(); ++i)
ret += i->second.count(recursive);
}
return ret;
}
int CDSection::sectionsCount() const {
return s.size();
}
PIStringList CDSection::index_names() const {
PIStringList ret;
PIMap<int, CDType>::const_iterator i;
for (i = k.begin(); i != k.end(); ++i)
ret << i->second.name();
return ret;
}
void CDSection::calculate() {
/*CDCore::instance()->k_.*/prepareCalculate();
PIEvaluator e;
calculateRecursive(&e);
}
CDType & CDSection::getByName(const PIString & name_) {
PIStringList np = name_.split(".");
if (np.isEmpty()) return null;
//piCout << np;
@@ -255,7 +287,7 @@ CDType & CDSection::operator [](const PIString & name_) {
}
CDType & CDSection::operator [](const PIDeque<int> & path_) {
CDType & CDSection::getByPath(const PIDeque<int> & path_) {
if (path_.isEmpty()) return null;
CDSection * s = this;
for (int i = 0; i < path_.size_s() - 1; ++i)
@@ -264,37 +296,6 @@ CDType & CDSection::operator [](const PIDeque<int> & path_) {
return (*s)[path_.back()];
}
int CDSection::count(bool recursive) const {
int ret = k.size_s();
if (recursive) {
PIMap<int, CDSection>::const_iterator i;
for (i = s.begin(); i != s.end(); ++i)
ret += i->second.count(recursive);
}
return ret;
}
int CDSection::sectionsCount() const {
return s.size();
}
PIStringList CDSection::index_names() const {
PIStringList ret;
PIMap<int, CDType>::const_iterator i;
for (i = k.begin(); i != k.end(); ++i)
ret << i->second.name();
return ret;
}
void CDSection::calculate() {
/*CDCore::instance()->k_.*/prepareCalculate();
PIEvaluator e;
calculateRecursive(&e);
}
void CDSection::write(PIIODevice * d, const PIString & prefix) {
if (!d) return;
@@ -557,4 +558,3 @@ PIVariantTypes::Enum CDSection::enumValues() const {
return ret;
}

View File

@@ -78,10 +78,10 @@ public:
// CDType & operator [](int v) {if (!k.contains(v)) k[v].index_ = v; return k[v];}
CDType & operator [](int v) {return k[v];}
const CDType operator [](int v) const {return k[v];}
CDType & operator [](const PIString & name_);
const CDType operator [](const PIString & name_) const {return (*this)[name_];}
CDType & operator [](const PIDeque<int> & path_);
const CDType operator [](const PIDeque<int> & path_) const {return (*this)[path_];}
CDType & operator [](const PIString & name_) {return getByName(name_);}
const CDType operator [](const PIString & name_) const {return const_cast<CDSection*>(this)->getByName(name_);}
CDType & operator [](const PIDeque<int> & path_) {return getByPath(path_);}
const CDType operator [](const PIDeque<int> & path_) const {return const_cast<CDSection*>(this)->getByPath(path_);}
CDSection & section(int v) {return s[v];}
const CDSection section(int v) const {return s[v];}
@@ -103,6 +103,8 @@ protected:
k = k_;
s = s_;
}
CDType & getByName(const PIString & name_);
CDType & getByPath(const PIDeque<int> & path_);
void write(PIIODevice * d, const PIString & prefix = PIString());
void read(const void * ep);
void update(CDSection & v, UpdateModeFlags mode = SaveByName);

View File

@@ -13,7 +13,7 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
ui->setupUi(this);
new ConfigHighlighter(ui->codeEdit->document());
loading = false;
connect(ui->blockView, SIGNAL(actionEvent(BlockItemBase::Action,QList<QGraphicsItem*>)), this, SLOT(recreateRequest()));
connect(ui->blockView, SIGNAL(schemeAction(BlockItemBase::Action,QList<QGraphicsItem*>)), this, SLOT(recreateRequest()));
connect(ui->blockView->scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
conn = 0;
PICodeInfo::EnumInfo * ei = PICodeInfo::enumsInfo->value("PIIODevice::DeviceMode");

View File

@@ -704,7 +704,7 @@ void BlockView::deleteCopyTemp() {
void BlockView::emitActionEvent(BlockItemBase::Action action, QList<QGraphicsItem * > items) {
if (!ae_enabled) return;
emit actionEvent(action, items);
emit schemeAction(action, items);
}

View File

@@ -186,7 +186,7 @@ public slots:
signals:
void blockDoubleClicked(BlockItem * );
void busDoubleClicked(BlockBusItem * );
void actionEvent(BlockItemBase::Action action, QList<QGraphicsItem * > items);
void schemeAction(BlockItemBase::Action action, QList<QGraphicsItem * > items);
void blockRemoved(BlockItem * item);
void connectionsChanged();
void copyEnabledChanged(bool);

View File

@@ -11,7 +11,7 @@ class CDSection;
class CDType;
}
namespace QAD {
class Enum;
struct Enum;
}
class CDKItemModel;