Added method to take out an object from an array.
git-svn-id: http://voip.null.ro/svn/yate@2528 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
6d3dbc61cc
commit
9d682e3cd4
|
@ -111,7 +111,6 @@ GenObject* Array::get(int column,int row) const
|
|||
{
|
||||
if (column < 0 || column >= m_columns || row < 0 || row >= m_rows)
|
||||
return 0;
|
||||
// return ((*(ObjList *)(m_obj[column]))+row)->get();
|
||||
ObjList* l = static_cast<ObjList*>(m_obj[column]);
|
||||
if (l)
|
||||
l = (*l)+row;
|
||||
|
@ -121,6 +120,19 @@ GenObject* Array::get(int column,int row) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
GenObject* Array::take(int column,int row)
|
||||
{
|
||||
if (column < 0 || column >= m_columns || row < 0 || row >= m_rows)
|
||||
return 0;
|
||||
ObjList* l = static_cast<ObjList*>(m_obj[column]);
|
||||
if (l)
|
||||
l = (*l)+row;
|
||||
if (l)
|
||||
return l->set(0,false);
|
||||
Debug(DebugFail,"Array %p take item holder (%d,%d) does not exist!",this,column,row);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Array::set(GenObject *obj, int column, int row)
|
||||
{
|
||||
if (column < 0 || column >= m_columns || row < 0 || row >= m_rows)
|
||||
|
|
10
yateclass.h
10
yateclass.h
|
@ -1270,7 +1270,15 @@ public:
|
|||
* @return Pointer to the stored object, NULL for out of bound indexes
|
||||
*/
|
||||
GenObject* get(int column, int row) const;
|
||||
|
||||
|
||||
/**
|
||||
* Retrive and remove an object from the array
|
||||
* @param column Number of the column in the array
|
||||
* @param row Number of the row in the array
|
||||
* @return Pointer to the stored object, NULL for out of bound indexes
|
||||
*/
|
||||
GenObject* take(int column, int row);
|
||||
|
||||
/**
|
||||
* Store an object in the array
|
||||
* @param obj Object to store in the array
|
||||
|
|
Loading…
Reference in New Issue