Backend/Database/GTable.cpp
/*!
 * @brief swap GTable columns
 * @details swap columns between two indices
 * @param index the index of the first column
 * @param index2 the index of the second column
 */
@brief swap GTable columns
@details swap columns between two indices
@param index the index of the first column
@param index2 the index of the second column
@brief swap GTable columns @details swap columns between two indices @param index the index of the first column @param index2 the index of the second column
void GTable::swapCol(unsigned int index, unsigned int index2)
{
	if (index == index2)
		return;
	if (index >= numberOfCols() || index2 >= numberOfCols())
		return;
	if (index > index2)
	{
		int tempIndex = index;
		index = index2;
		index2 = tempIndex;
	}
	GString cHeader1 = "";
	if (!(index >= header.size()))
		cHeader1 = header[index];
	GString cHeader2 = "";
	if (!(index2 >= header.size()))
		cHeader2 = header[index2];
	shmea::GList col1 = getCol(index);
	shmea::GList col2 = getCol(index2);
	removeCol(index);
	removeCol(index2);
	addCol(cHeader1, col1, index2);
	addCol(cHeader2, col2, index);
}
void GTable :: swapCol ( unsigned int index , unsigned int index2 ) { if ( index == index2 ) return ; if ( index >= numberOfCols ( ) || index2 >= numberOfCols ( ) ) return ; if ( index > index2 ) { int tempIndex = index ; index = index2 ; index2 = tempIndex ; } GString cHeader1 = " " ; if ( ! ( index >= header . size ( ) ) ) cHeader1 = header [ index ] ; GString cHeader2 = " " ; if ( ! ( index2 >= header . size ( ) ) ) cHeader2 = header [ index2 ] ; shmea :: GList col1 = getCol ( index ) ; shmea :: GList col2 = getCol ( index2 ) ; removeCol ( index ) ; removeCol ( index2 ) ; addCol ( cHeader1 , col1 , index2 ) ; addCol ( cHeader2 , col2 , index ) ; }
@brief swap GTable columns
 @details swap columns between two indices
 @param index the index of the first column
 @param index2 the index of the second column
@brief swap GTable columns @details swap columns between two indices @param index the index of the first column @param index2 the index of the second column
// error checking // Make sure index is smaller than index2 // swap headers // swap columns