Commit f8ea7c3c authored by Aleksandr Bakhshiev's avatar Aleksandr Bakhshiev
Browse files

Break links update. DOESN'T TESTED!

--HG--
branch : LinksDebug
parent a2f5c919912d
......@@ -788,6 +788,22 @@ void UADItem::DisconnectFromIndex(const NameT &connector_property_name)
CalcMinMaxInputDataSize();
}
void UADItem::DisconnectFromIndex(const NameT &connector_property_name, const NameT &item_property_name, int index, bool &is_list_item_deleted)
{
UItem::DisconnectFromIndex(connector_property_name, item_property_name, index, is_list_item_deleted);
UpdatePointers();
CalcMinMaxInputDataSize();
}
void UADItem::DisconnectFromIndex(const NameT &connector_property_name, bool &is_list_item_deleted)
{
UItem::DisconnectFromIndex(connector_property_name,is_list_item_deleted);
UpdatePointers();
CalcMinMaxInputDataSize();
}
// 'c'.
bool UADItem::Connect(UEPtr<UConnector> c, int i_index, int c_index)
......
......@@ -206,6 +206,11 @@ virtual void DisconnectFromItem(UEPtr<UItem> na, int i_index);
virtual void DisconnectFromIndex(const NameT &connector_property_name, const NameT &item_property_name, int index);
virtual void DisconnectFromIndex(const NameT &connector_property_name);
protected:
virtual void DisconnectFromIndex(const NameT &connector_property_name, const NameT &item_property_name, int index, bool &is_list_item_deleted);
virtual void DisconnectFromIndex(const NameT &connector_property_name, bool &is_list_item_deleted);
public:
/// 'na', i_index c_index
virtual void DisconnectFromItem(UEPtr<UItem> na, int i_index, int c_index);
......
......@@ -489,17 +489,41 @@ void UConnector::DisconnectFromItem(UEPtr<UItem> na)
if(!na)
return;
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin();
for(;I != ConnectedItemList.end();++I)
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin(),K,L;
while(I != ConnectedItemList.end())
{
int i=0;
bool is_I_erased(false);
while(i<int(I->second.size()))
{
L=I; ++L;
if(I->second[i].Item == na)
DisconnectFromIndex(I->first, I->second[i].Name,i);
{
DisconnectFromIndex(I->first, I->second[i].Name,i, is_I_erased);
if(is_I_erased)
break;
}
else
++i;
}
if(is_I_erased)
{
I=L;
continue;
}
if(I->second.empty())
{
K=I;
++K;
ConnectedItemList.erase(I);
I=K;
}
else
{
++I;
}
}
}
......@@ -509,17 +533,40 @@ void UConnector::DisconnectFromItem(UEPtr<UItem> na, const NameT &item_property_
if(!na)
return;
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin();
for(;I != ConnectedItemList.end();++I)
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin(),K,L;
while(I != ConnectedItemList.end())
{
int i=0;
bool is_I_erased(false);
while(i<int(I->second.size()))
{
if(I->second[i].Item == na && I->second[i].Name == item_property_name)
DisconnectFromIndex(I->first,I->second[i].Name,i); // TODO
{
DisconnectFromIndex(I->first,I->second[i].Name,i,is_I_erased); // TODO
if(is_I_erased)
break;
}
else
++i;
}
if(is_I_erased)
{
I=L;
continue;
}
if(I->second.empty())
{
K=I;
++K;
ConnectedItemList.erase(I);
I=K;
}
else
{
++I;
}
}
}
......@@ -549,6 +596,13 @@ void UConnector::DisconnectFromItem(UEPtr<UItem> na, const NameT &item_property_
// 'index'
void UConnector::DisconnectFromIndex(const NameT &connector_property_name, const NameT &item_property_name, int index)
{
bool is_list_item_deleted(false);
DisconnectFromIndex(connector_property_name, item_property_name, index,is_list_item_deleted);
}
void UConnector::DisconnectFromIndex(const NameT &connector_property_name, const NameT &item_property_name, int index, bool &is_list_item_deleted)
{
is_list_item_deleted=false;
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.find(connector_property_name);
if(I == ConnectedItemList.end())
return;
......@@ -603,12 +657,24 @@ void UConnector::DisconnectFromIndex(const NameT &connector_property_name, const
ADisconnectFromItem(I->second[index].Item,I->second[index].Name,connector_property_name);
I->second.erase(I->second.begin()+index);
if(I->second.empty())
{
ConnectedItemList.erase(I);
is_list_item_deleted=true;
}
}
}
}
void UConnector::DisconnectFromIndex(const NameT &connector_property_name)
{
bool is_list_item_deleted(false);
DisconnectFromIndex(connector_property_name, is_list_item_deleted);
}
void UConnector::DisconnectFromIndex(const NameT &connector_property_name, bool &is_list_item_deleted)
{
is_list_item_deleted=false;
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.find(connector_property_name);
if(I == ConnectedItemList.end())
return;
......@@ -638,6 +704,11 @@ void UConnector::DisconnectFromIndex(const NameT &connector_property_name)
ADisconnectFromItem(I->second[i].Item,I->second[i].Name,connector_property_name);
I->second.erase(I->second.begin()+i);
if(I->second.empty())
{
ConnectedItemList.erase(I);
is_list_item_deleted=true;
}
}
}
......@@ -656,15 +727,21 @@ void UConnector::ADisconnectFromItem(UEPtr<UItem> na, const NameT &item_property
//
void UConnector::DisconnectAllItems(void)
{
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin();
for(;I != ConnectedItemList.end();++I)
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin(),L;
while(I != ConnectedItemList.end())
{
while(!I->second.empty())
L=I; ++L;
std::vector<UItem*> items;
items.reserve(I->second.size());
for(size_t i=0;i<I->second.size();i++)
items.push_back(I->second[i].Item);
for(size_t i=0;i<I->second.size();i++)
{
int index=int(I->second.size())-1;
I->second[index].Item->Disconnect(this);
items[i]->Disconnect(this);
}
I=L;
}
ConnectedItemList.clear();
}
//
......@@ -672,17 +749,35 @@ void UConnector::DisconnectAllItems(void)
// brklevel - ,
void UConnector::DisconnectByObject(UEPtr<UContainer> brklevel)
{
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin();
for(;I != ConnectedItemList.end();++I)
std::map<std::string, std::vector<UCItem> >::iterator I=ConnectedItemList.begin(),K,L;
while(I != ConnectedItemList.end())
{
size_t i=0;
L=I; ++L;
bool is_I_erased(false);
while(i<I->second.size())
{
if(!I->second[i].Item->CheckOwner(brklevel))
I->second[i].Item->Disconnect(this);
{
if(I->second.size() == 1)
{
I->second[i].Item->Disconnect(this);
is_I_erased=true;
break;
}
else
{
I->second[i].Item->Disconnect(this);
}
}
else
++i;
}
if(is_I_erased)
I=L;
else
++I;
}
}
......
......@@ -240,6 +240,13 @@ virtual bool AConnectToItem(UEPtr<UItem> na, const NameT &item_property_name, co
//
virtual void ADisconnectFromItem(UEPtr<UItem> na, const NameT &item_property_name, const NameT &connector_property_name);
protected:
// 'index'
// true is_list_item_deleted ConnectedItemList
virtual void DisconnectFromIndex(const NameT &connector_property_name, const NameT &item_property_name, int index, bool &is_list_item_deleted);
virtual void DisconnectFromIndex(const NameT &connector_property_name, bool &is_list_item_deleted);
public:
// 'index'
virtual void DisconnectFromIndex(const NameT &connector_property_name, const NameT &item_property_name, int index);
......
......@@ -634,7 +634,14 @@ bool UNet::SaveComponent(RDK::USerStorageXML *serstorage, bool links, unsigned i
serstorage->AddNode(GetName());
if(Storage)
serstorage->SetNodeAttribute("Class",/*RDK::sntoa(cont->GetClass())*/Storage->FindClassName(GetClass()));
try
{
serstorage->SetNodeAttribute("Class",/*RDK::sntoa(cont->GetClass())*/Storage->FindClassName(GetClass()));
}
catch(UStorage::EClassIdNotExist &)
{
serstorage->SetNodeAttribute("Class","None");
}
serstorage->AddNode(UVariable::GetPropertyTypeNameByType(ptParameter));
if(!GetComponentProperties(serstorage,params_type_mask))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment