本文整理匯總了C++中GetAt函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetAt函數的具體用法?C++ GetAt怎麽用?C++ GetAt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetAt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: while
int CDiagramEntityContainer::Find( CDiagramEntity* testobj )
/* ============================================================
Function : CDiagramEntityContainer::Find
Description : Finds the index of object testobj in the
data array.
Return : int - Index of the
object or -1
if not found.
Parameters : CDiagramEntity* testobj - Object to find.
Usage : Internal function.
============================================================*/
{
int index = -1;
CDiagramEntity* obj;
int count = 0;
while( ( obj = GetAt( count ) ) )
{
if( obj == testobj )
index = count;
count++;
}
return index;
}
示例2:
int CDiagramEntityContainer::GetSelectCount() const
{
int count=0;
for (int i = 0; i < GetSize(); i++)
if (GetAt(i)->IsSelected()) count++;
return count;
}
示例3: GetAt
void CDiagramEntityContainer::RemoveAt( int index )
/* ============================================================
Function : CDiagramEntityContainer::RemoveAt
Description : Removes the object at index.
Return : void
Parameters : int index - The index of the object
to remove.
Usage : Call to remove a specific object. Memory is
freed.
============================================================*/
{
CDiagramEntity* obj = GetAt( index );
if( obj )
{
if (obj == m_lastSelObj) m_lastSelObj = NULL;
delete obj;
m_objs.RemoveAt( index );
SetModified( TRUE );
}
}
示例4: GetSize
void CDiagramEntityContainer::Export( CStringArray& stra, UINT format ) const
/* ============================================================
Function : CDiagramEntityContainer::Export
Description : Exports all objects to format format.
Return : void
Parameters : CStringArray& stra - CStingArray that
will be filled with
data on return.
UINT format - Format to save to.
Usage : Call to export the contents of the container
to a CStringArray. Export will - of course -
have to be defined for the derived objects.
============================================================*/
{
int max = GetSize();
for( int t = 0 ; t < max ; t++ )
{
CDiagramEntity* obj = GetAt( t );
stra.Add( obj->Export( format ) );
}
}
示例5: GetAt
void Display::CComplexFillSymbol::Zoom(float rate)
{
for( int i = 0 ; i < GetSize() ; i++ )
{
GetAt(i)->Zoom(rate);
}
}
示例6: Add
bool CBoardCollectionArray::Add(DataStruct &board, CCEtoODBDoc &doc)
{
// look to see if this data will fit
for (int i=0; i<GetCount(); i++)
{
if (GetAt(i)->Add(board, doc))
return true;
}
CBoardCollection *brdColl = new CBoardCollection(m_bUseAsRows);
BlockStruct *block = doc.getBlockAt(board.getInsert()->getBlockNumber());
if (block == NULL)
return false;
CExtent ext = block->getExtent();
double toleranceDistance = 0.;
if (m_bUseAsRows)
toleranceDistance = ext.getYsize() * ((double)m_iTolerancePercent / 100.);
else
toleranceDistance = ext.getXsize() * ((double)m_iTolerancePercent / 100.);
brdColl->SetTolerance(toleranceDistance);
if (brdColl->Add(board, doc))
CTypedArrayContainer<CPtrArray, CBoardCollection*>::Add(brdColl);
else
return false;
return true;
}
示例7: GetAt
/** Find the building center closest to the given point, if it is within
* 'epsilon' distance. The building index, and distance from the given
* point are returned by reference.
*
* \return True if a building was found.
*/
bool vtStructureArray::FindClosestBuildingCenter(const DPoint2 &point,
double epsilon, int &building, double &closest)
{
if (IsEmpty())
return false;
building = -1;
DPoint2 loc;
double dist;
closest = 1E8;
for (uint i = 0; i < GetSize(); i++)
{
vtStructure *str = GetAt(i);
vtBuilding *bld = str->GetBuilding();
if (!bld)
continue;
bld->GetBaseLevelCenter(loc);
dist = (loc - point).Length();
if (dist > epsilon)
continue;
if (dist < closest)
{
building = i;
closest = dist;
}
}
return (building != -1);
}
示例8: MOVETO
void CXTPTaskPanelGroup::OnAnimate(int nStep)
{
if (nStep < 1)
{
m_rcGroupCurrent = m_rcGroupTarget;
}
else
{
MOVETO(m_rcGroupCurrent.top, m_rcGroupTarget.top, nStep);
MOVETO(m_rcGroupCurrent.bottom, m_rcGroupTarget.bottom, nStep);
}
if (!IsDirty() && m_bExpanding)
{
m_bExpanding = FALSE;
m_pPanel->NotifyOwner(XTP_TPN_GROUPEXPANDED, (LPARAM)this);
}
for (int i = 0; i < GetItemCount(); i++)
{
CXTPTaskPanelGroupItem* pItem = GetAt(i);
pItem->OnAnimate(nStep);
}
}
示例9: GetAt
/**--------------------------------------------------------------------------<BR>
C2DBaseSet::SnapToGrid
\brief SnapToGrid.
<P>---------------------------------------------------------------------------*/
void C2DBaseSet::SnapToGrid(void)
{
for (unsigned int i = 0 ; i < size(); i++)
{
GetAt(i)->SnapToGrid();
}
}
示例10: GetAt
void* CFX_BaseSegmentedArray::Add()
{
if (m_DataSize % m_SegmentSize) {
return GetAt(m_DataSize ++);
}
void* pSegment = FX_Alloc(FX_BYTE, m_UnitSize * m_SegmentSize);
if (!pSegment) {
return NULL;
}
if (m_pIndex == NULL) {
m_pIndex = pSegment;
m_DataSize ++;
return pSegment;
}
if (m_IndexDepth == 0) {
void** pIndex = (void**)FX_Alloc(void*, m_IndexSize);
if (pIndex == NULL) {
FX_Free(pSegment);
return NULL;
}
pIndex[0] = m_pIndex;
pIndex[1] = pSegment;
m_pIndex = pIndex;
m_DataSize ++;
m_IndexDepth ++;
return pSegment;
}
示例11: ADDTOCALLSTACK
bool CContainer::r_GetRefContainer( LPCTSTR & pszKey, CScriptObj * & pRef )
{
ADDTOCALLSTACK("CContainer::r_GetRefContainer");
if ( !strnicmp(pszKey, "FIND", 4) ) // find*
{
pszKey += 4;
if ( !strnicmp(pszKey, "ID", 2) ) // findid
{
pszKey += 2;
SKIP_SEPARATORS(pszKey);
pRef = ContentFind(g_Cfg.ResourceGetID(RES_ITEMDEF, pszKey));
SKIP_SEPARATORS(pszKey);
return true;
}
else if ( !strnicmp(pszKey, "CONT", 4) ) // findcont
{
pszKey += 4;
SKIP_SEPARATORS(pszKey);
pRef = GetAt(Exp_GetSingle(pszKey));
SKIP_SEPARATORS(pszKey);
return true;
}
else if ( !strnicmp(pszKey, "TYPE", 4) ) // findtype
{
pszKey += 4;
SKIP_SEPARATORS(pszKey);
pRef = ContentFind(g_Cfg.ResourceGetID(RES_TYPEDEF, pszKey));
SKIP_SEPARATORS(pszKey);
return true;
}
}
return false;
}
示例12: GetAt
void CCSClones::cleanup()
{
for (int i = 0; i < GetSize(); ++i)
delete GetAt(i);
RemoveAll();
}
示例13: fPath
BOOL CMediaFormats::IsUnPlayableFile(CString szFilename, bool bRestrict){
CPath fPath(szFilename);
CString szThisExtention = fPath.GetExtension();
BOOL bDefaultRet = false;
if(bRestrict)
bDefaultRet = true;
for(size_t i = 0; i < GetCount(); i++)
{
CMediaFormatCategory& mfc = GetAt(i);
if( mfc.FindExt(szThisExtention) ){
CString szLabel = mfc.GetLabel();
if ( szLabel.Find(_T("Subtitle")) >= 0 || szLabel.Find(_T("字幕")) >= 0){
return TRUE;
}
if ( szLabel.Find(_T("Image file")) >= 0 || szLabel.Find(_T("圖片")) >= 0){
return TRUE;
}
if ( szLabel.Find(_T("Real Script file")) >= 0 || szLabel.Find(_T("腳本")) >= 0){
return TRUE;
}
return FALSE;
}
}
return bDefaultRet;
}
示例14: GetCount
// Calling this function with bEnable equals to true when
// shuffle is already enabled will re-shuffle the tracks.
void CPlaylist::SetShuffle(bool bEnable)
{
m_bShuffle = bEnable;
if (bEnable && !IsEmpty()) {
m_nShuffledListSize = GetCount();
CAtlArray<plsort_t> positions;
positions.SetCount(m_nShuffledListSize + 1);
srand((unsigned int)time(nullptr));
POSITION pos = GetHeadPosition();
for (size_t i = 0; pos; i++, GetNext(pos)) {
positions[i].n = rand();
positions[i].pos = pos;
}
qsort(positions.GetData(), m_nShuffledListSize, sizeof(plsort_t), compare);
positions[m_nShuffledListSize].pos = nullptr; // Termination
m_posHeadShuffle = positions[0].pos;
m_posTailShuffle = nullptr;
for (size_t i = 0; i < m_nShuffledListSize; i++) {
pos = positions[i].pos;
CPlaylistItem& pli = GetAt(pos);
pli.m_posPrevShuffle = m_posTailShuffle;
pli.m_posNextShuffle = positions[i + 1].pos;
m_posTailShuffle = pos;
}
} else {
m_posHeadShuffle = m_posTailShuffle = nullptr;
m_nShuffledListSize = 0;
}
}
示例15: AddTail
void CPTRList::InsertBefore( int n,void *pData)
{
if ( n<0 )
{
AddTail(pData);
return;
}
if ( n==0 )
{
AddHead(pData);
return ;
}
GetAt(n);
nCurrentBlk = -1;
PTR_BLK *pNew = new PTR_BLK;
pNew->pData = pData;
pNew->pPrev = pCur->pPrev;
pNew->pNext = pCur;
pCur->pPrev->pNext = pNew;
pCur->pPrev = pNew;
nMax++;
}