当前位置: 首页>>代码示例>>C++>>正文


C++ CBCGPGridRow::GetItemCount方法代码示例

本文整理汇总了C++中CBCGPGridRow::GetItemCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPGridRow::GetItemCount方法的具体用法?C++ CBCGPGridRow::GetItemCount怎么用?C++ CBCGPGridRow::GetItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBCGPGridRow的用法示例。


在下文中一共展示了CBCGPGridRow::GetItemCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WriteRowsToArchive

//****************************************************************************************
BOOL CBCGPGridSerializeManager::WriteRowsToArchive (CArchive& archive, const CBCGPGridRange& range)
{
	ASSERT (m_pOwnerGrid != NULL);
	ASSERT (m_ClipboardFormatType == CF_Rows);
	
	const int nRowCount = range.m_nBottom - range.m_nTop + 1;
	if (nRowCount <= 0)
	{
		return FALSE;
	}
	
	const int nColCount = m_pOwnerGrid->GetColumnCount ();
	if (nColCount <= 0)
	{
		return FALSE;
	}
	
	const int nRowOffset = max (0, range.m_nTop);
	
	try 
	{
		// array of rows:
		// persistent CBCGPGridRow		\
		// int - items count			|	row
		// array of items in the row:	|
		// persistent CBCGPGridItem		/
		
		//--------------------------------
		// Serialize rows inside the range
		//--------------------------------
		for (int nRow = 0; nRow < nRowCount; nRow++)
		{
			//----------------
			// Store row data:
			//----------------
			CBCGPGridRow* pRow = m_pOwnerGrid->GetRow (nRow + nRowOffset);
			if (pRow == NULL)
			{
				return FALSE;
			}
			
			ASSERT_VALID (pRow);
			archive << pRow;
			
			const int nItemCount = min (nColCount, pRow->GetItemCount ());
			archive << nItemCount;
			
			for (int nCol = 0; nCol < nItemCount; nCol++)
			{
				//-----------------
				// Store item data:
				//-----------------
				CBCGPGridItem* pItem = pRow->GetItem (nCol);
				if (pItem == NULL)
				{
					return FALSE;
				}
				
				ASSERT_VALID (pItem);
				archive << pItem;
			}
			
		}
		
	}
	catch (CArchiveException* pEx)
	{
		TRACE(_T("CBCGPGridSerializeManager::WriteRowsToArchive. Archive exception\r\n"));
		pEx->Delete ();
		return FALSE;
	}
	
	return TRUE;
}
开发者ID:iclosure,项目名称:jframework,代码行数:75,代码来源:BCGPGridSerialize.cpp

示例2: WriteItemsToArchive

//****************************************************************************************
BOOL CBCGPGridSerializeManager::WriteItemsToArchive (CArchive& archive, const CBCGPGridRange& range)
{
	// range is order
	ASSERT (m_pOwnerGrid != NULL);
	ASSERT (m_ClipboardFormatType == CF_Items);
	
	const int nRowCount = range.m_nBottom - range.m_nTop + 1;
	if (nRowCount <= 0)
	{
		return FALSE;
	}
	
	const int nColCount = range.m_nRight - range.m_nLeft + 1;
	if (nColCount <= 0)
	{
		return FALSE;
	}

	const int nRowOffset = max (0, range.m_nTop);
	const int nColOffset = max (0, range.m_nLeft);

	const int nLastColumn = m_pOwnerGrid->GetColumnsInfo ().GetColumnCount (TRUE) - 1;

	try 
	{
		// array of items by rows:
		// int	- rowitems count		|	row
		// persistent CBCGPGridItem		|

		//---------------------------------
		// Serialize items inside the range
		//---------------------------------
		for (int nRow = 0; nRow < nRowCount; nRow++)
		{
			CBCGPGridRow* pRow = m_pOwnerGrid->GetRow (nRow + nRowOffset);
			if (pRow == NULL)
			{
				return FALSE;
			}
			ASSERT_VALID (pRow);
			
			const int nItemCount = min (range.m_nRight - range.m_nLeft + 1, pRow->GetItemCount ());
			archive << nItemCount;
			
			for (int nCol = 0; nCol < nItemCount; nCol++)
			{
				//-----------------
				// Store item data:
				//-----------------
				if (nCol + nColOffset > nLastColumn)
				{
					return FALSE;
				}

				int nColIndex = m_pOwnerGrid->GetColumnsInfo ().OrderToIndex (nCol + nColOffset);
				if (nColIndex == -1)
				{
					return FALSE;
				}
				
				CBCGPGridItem* pItem = pRow->GetItem (nColIndex);
				if (pItem == NULL)
				{
					return FALSE;
				}

				ASSERT_VALID (pItem);
				archive << pItem;
			}
			
		}

	}
	catch (CArchiveException* pEx)
	{
		TRACE(_T("CBCGPGridSerializeManager::WriteItemsToArchive. Archive exception\r\n"));
		pEx->Delete ();
		return FALSE;
	}

	return TRUE;
}
开发者ID:iclosure,项目名称:jframework,代码行数:83,代码来源:BCGPGridSerialize.cpp


注:本文中的CBCGPGridRow::GetItemCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。