mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
cc_frm: add overloaded versions of getCCItemId() and removeCCItem()
Allows to use with item name as parameter.
Note: Requires that unique names are assigned!
Origin commit data
------------------
Branch: ni/coolstream
Commit: 2ef4f86aa4
Author: Thilo Graf <dbt@novatux.de>
Date: 2020-01-18 (Sat, 18 Jan 2020)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -240,6 +240,16 @@ int CComponentsForm::getCCItemId(CComponentsItem* cc_Item) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CComponentsForm::getCCItemId(const std::string &item_name) const
|
||||||
|
{
|
||||||
|
if (!item_name.empty()){
|
||||||
|
for (size_t i= 0; i< v_cc_items.size(); i++)
|
||||||
|
if (v_cc_items.at(i)->getItemName() == item_name)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int CComponentsForm::genIndex()
|
int CComponentsForm::genIndex()
|
||||||
{
|
{
|
||||||
int count = v_cc_items.size();
|
int count = v_cc_items.size();
|
||||||
@@ -339,6 +349,12 @@ void CComponentsForm::removeCCItem(CComponentsItem* cc_Item)
|
|||||||
removeCCItem(id);
|
removeCCItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CComponentsForm::removeCCItem(const std::string &item_name)
|
||||||
|
{
|
||||||
|
uint id = getCCItemId(item_name);
|
||||||
|
removeCCItem(id);
|
||||||
|
}
|
||||||
|
|
||||||
void CComponentsForm::exchangeCCItem(const uint& cc_item_id_a, const uint& cc_item_id_b)
|
void CComponentsForm::exchangeCCItem(const uint& cc_item_id_a, const uint& cc_item_id_b)
|
||||||
{
|
{
|
||||||
if (!v_cc_items.empty())
|
if (!v_cc_items.empty())
|
||||||
|
@@ -100,11 +100,27 @@ class CComponentsForm : public CComponentsItem
|
|||||||
int addCCItem(const std::vector<CComponentsItem*> &cc_items);
|
int addCCItem(const std::vector<CComponentsItem*> &cc_items);
|
||||||
void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item);
|
void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item);
|
||||||
|
|
||||||
///removes item object from container and deallocates instance
|
/**Function to remove item from item collection and deallocates instance.
|
||||||
|
* @param[in] cc_item_id
|
||||||
|
* @li item id as unsigned int
|
||||||
|
*/
|
||||||
void removeCCItem(const uint& cc_item_id);
|
void removeCCItem(const uint& cc_item_id);
|
||||||
///removes item object from container and deallocates instance
|
|
||||||
|
/**Function to remove item from item collection and deallocates instance.
|
||||||
|
* @param[in] cc_Item
|
||||||
|
* @li CComponentsItem*
|
||||||
|
*/
|
||||||
void removeCCItem(CComponentsItem* cc_Item);
|
void removeCCItem(CComponentsItem* cc_Item);
|
||||||
|
|
||||||
|
/**Function to remove item from item collection and deallocates instance.
|
||||||
|
* @param[in] item_name
|
||||||
|
* @li std::string
|
||||||
|
* NOTE: Requires that unique names are assigned!
|
||||||
|
* @see
|
||||||
|
* getItemName()
|
||||||
|
*/
|
||||||
|
void removeCCItem(const std::string &item_name);
|
||||||
|
|
||||||
void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item);
|
void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item);
|
||||||
void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item);
|
void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item);
|
||||||
void exchangeCCItem(const uint& item_id_a, const uint& item_id_b);
|
void exchangeCCItem(const uint& item_id_a, const uint& item_id_b);
|
||||||
@@ -118,6 +134,18 @@ class CComponentsForm : public CComponentsItem
|
|||||||
*/
|
*/
|
||||||
int getCCItemId(CComponentsItem* cc_Item) const;
|
int getCCItemId(CComponentsItem* cc_Item) const;
|
||||||
|
|
||||||
|
/**Function to get current item id from passed item name.
|
||||||
|
* @param[in] item_name
|
||||||
|
* @li std::string
|
||||||
|
* @return
|
||||||
|
* int, in case of not found item returns -1
|
||||||
|
* NOTE: Requires that unique names are assigned!
|
||||||
|
* @see
|
||||||
|
* setItemName()
|
||||||
|
* getItemName()
|
||||||
|
*/
|
||||||
|
int getCCItemId(const std::string &item_name) const;
|
||||||
|
|
||||||
/**Function to get current item from item collection.
|
/**Function to get current item from item collection.
|
||||||
* @param[in] cc_item_id
|
* @param[in] cc_item_id
|
||||||
* @li item id as unsigned int
|
* @li item id as unsigned int
|
||||||
|
Reference in New Issue
Block a user