本文整理匯總了C++中ElementAt函數的典型用法代碼示例。如果您正苦於以下問題:C++ ElementAt函數的具體用法?C++ ElementAt怎麽用?C++ ElementAt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ElementAt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetSize
BOOL CDomainContainer::GetDomains( CSPStringArray & astr )
{
astr.SetSize( GetSize() );
for( int i=0; i<GetSize(); i++ )
{
CDomain & domain = ElementAt(i);
CSPString string = domain.m_strName;
astr.SetAt( i, string );
}
return TRUE;
}
示例2: GetSize
INT_PTR CHotKeys::Find(CHotKey* pHotKey)
{
INT_PTR count = GetSize();
for(int i=0; i < count; i++)
{
if(pHotKey == ElementAt(i))
{
return i;
}
}
return -1;
}
示例3: ElementAt
void
nsSVGTransformList::ReleaseTransforms()
{
PRInt32 count = mTransforms.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIDOMSVGTransform* transform = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(transform);
val->RemoveObserver(this);
NS_RELEASE(transform);
}
mTransforms.Clear();
}
示例4: ElementAt
void CKData::AutoSetKType( )
{
if( GetSize() >= 4 )
{
long elapse1 = ElementAt(1).m_time - ElementAt(0).m_time;
long elapse2 = ElementAt(2).m_time - ElementAt(1).m_time;
long elapse3 = ElementAt(3).m_time - ElementAt(2).m_time;
long elapse = min(elapse1,elapse2);
elapse = min(elapse,elapse3);
if( elapse < 600 )
m_nKType = ktypeMin5;
else if( elapse < 1200 )
m_nKType = ktypeMin15;
else if( elapse < 2400 )
m_nKType = ktypeMin30;
else if( elapse < 7200 )
m_nKType = ktypeMin60;
else if( elapse < 172800 )
m_nKType = ktypeDay;
else if( elapse < 864000 )
m_nKType = ktypeWeek;
else if( elapse < 4320000 )
m_nKType = ktypeWeek;
}
}
示例5:
TextCompositionArray::index_type
TextCompositionArray::IndexOf(const NativeIMEContext& aNativeIMEContext)
{
if (!aNativeIMEContext.IsValid()) {
return NoIndex;
}
for (index_type i = Length(); i > 0; --i) {
if (ElementAt(i - 1)->GetNativeIMEContext() == aNativeIMEContext) {
return i - 1;
}
}
return NoIndex;
}
示例6: l
CStockInfo & CStockContainer::GetStockInfoByID( int nID )
{
CSPMutex::Scoped l(m_mutex);
if( ID_STOCKCNTN_AVERAGE == nID )
return m_infoAverage;
if( ID_STOCKCNTN_WEIGHTAVERAGE == nID )
return m_infoWeightAverage;
if( nID >= 0 && nID < GetSize() )
return ElementAt( nID );
SP_ASSERT( FALSE );
return m_infoNull;
}
示例7: WillModify
void
nsSVGPathSegList::RemoveElementAt(PRInt32 index)
{
WillModify();
nsIDOMSVGPathSeg* seg = ElementAt(index);
NS_ASSERTION(seg, "null pathsegment");
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->RemoveObserver(this);
mSegments.RemoveElementAt(index);
NS_RELEASE(seg);
DidModify();
}
示例8: ElementAt
// "BigInt" comes from the WebCrypto spec
// ("unsigned long" isn't very "big", of course)
// Likewise, the spec calls for big-endian ints
bool
CryptoBuffer::GetBigIntValue(unsigned long& aRetVal)
{
if (Length() > sizeof(aRetVal)) {
return false;
}
aRetVal = 0;
for (size_t i=0; i < Length(); ++i) {
aRetVal = (aRetVal << 8) + ElementAt(i);
}
return true;
}
示例9: ElementAt
int CDomainContainer::AddDomain( CDomain & newdomain )
{
if( 0 == newdomain.m_strName.GetLength() )
return -1;
for( int i=0; i<GetSize(); i++ )
{
CDomain & domain = ElementAt(i);
if( 0 == newdomain.m_strName.CompareNoCase( domain.m_strName ) )
return -1;
}
return Add( newdomain );
}
示例10: SP_ASSERT
BOOL CKData::GetRatioVolume( double * pValue, DWORD dateCur, int nDays )
{
SP_ASSERT( pValue && nDays > 0 );
// Find date Current to calculate from
int nIndex = GetIndexByDate( dateCur );
if( -1 == nIndex )
return FALSE;
// data not enough
if( nDays > nIndex )
return FALSE;
// 檢查是否是相鄰成交日
if( !IsAdjacentDays( nIndex, nDays ) )
return FALSE;
// begin calculate
double dAll = 0;
int nCount = 0;
for( int i=nIndex-1; i>=0; i-- )
{
dAll += ElementAt(i).m_fVolume;
nCount ++;
if( nCount >= nDays )
break;
}
// data not enough
if( nCount != nDays || nCount <= 0 )
return FALSE;
if( fabs(dAll) < 1 )
return FALSE;
if( pValue )
*pValue = (ElementAt(nIndex).m_fVolume / dAll ) * nCount;
return TRUE;
}
示例11: WillModify
void
nsSVGLengthList::ReleaseLengths()
{
WillModify();
PRInt32 count = mLengths.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsISVGLength* length = ElementAt(i);
length->SetContext(nsnull, 0);
NS_REMOVE_SVGVALUE_OBSERVER(length);
NS_RELEASE(length);
}
mLengths.Clear();
DidModify();
}
示例12: NS_ADDREF
/* nsIDOMSVGLengthList removeItem (in unsigned long index); */
NS_IMETHODIMP nsSVGLengthList::RemoveItem(PRUint32 index, nsIDOMSVGLength **_retval)
{
if (index >= static_cast<PRUint32>(mLengths.Count())) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
WillModify();
RemoveElementAt(index);
DidModify();
return NS_OK;
}
示例13: NS_ADDREF
/* nsIDOMSVGPathSeg removeItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::RemoveItem(PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
if (index >= NS_STATIC_CAST(PRUint32, mSegments.Count())) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
WillModify();
RemoveElementAt(index);
DidModify();
return NS_OK;
}
示例14: ElementAt
void UI_Controller::Update(World *wrld) {
// Select item
if (MouseListener::mouse_pressed & 1 || MouseListener::mouse_pressed & 2) {
int trans_x = mouse_x * ((wrld -> VIEWPORT_WIDTH / wrld -> VIEWPORT_ZOOM) / SCREEN_W);
int trans_y = mouse_y * ((wrld -> VIEWPORT_HEIGHT / wrld -> VIEWPORT_ZOOM) / SCREEN_H);
// Element at position
UI_Element *elem = ElementAt(trans_x, trans_y);
// Check if move
if (elem != nullptr) {
// Cast to slot
UI_Slot *slt = dynamic_cast<UI_Slot*>(elem);
// Ensure that it is slot
if (slt != nullptr) {
if (MouseListener::mouse_pressed & 1) {
if (!(mouse_item -> GetItem()) && slt -> GetStack() -> GetItem()) {
mouse_item -> SetItem(slt -> GetStack() -> GetItem(), slt -> GetStack() -> GetQuantity());
slt -> GetStack() -> Clear();
}
else if(mouse_item -> GetItem() && !(slt -> GetStack() -> GetItem())) {
slt -> GetStack() -> SetItem(mouse_item -> GetItem(), mouse_item -> GetQuantity());
mouse_item -> Clear();
}
else if(mouse_item -> GetItem() && slt -> GetStack() -> GetItem() -> getID() == mouse_item -> GetItem() -> getID()) {
slt -> GetStack() -> Add(mouse_item -> GetQuantity());
mouse_item -> Clear();
}
}
else if (MouseListener::mouse_pressed & 2) {
if (!(mouse_item -> GetItem()) && slt -> GetStack() -> GetItem()) {
int mouse_qty = ceil((float)slt -> GetStack() -> GetQuantity() / 2.0f);
mouse_item -> SetItem(slt -> GetStack() -> GetItem(), mouse_qty);
slt -> GetStack() -> Remove(mouse_qty);
}
else if(mouse_item -> GetItem() && !(slt -> GetStack() -> GetItem())) {
slt -> GetStack() -> SetItem(mouse_item -> GetItem(), 1);
mouse_item -> Remove(1);
}
else if(mouse_item -> GetItem() && slt -> GetStack() -> GetItem() -> getID() == mouse_item -> GetItem() -> getID()) {
slt -> GetStack() -> Add(1);
mouse_item -> Remove(1);
}
}
}
}
}
}
示例15: RemoveStock
BOOL CDomain::RemoveStock( LPCTSTR lpszStockCode )
{
if( NULL == lpszStockCode || strlen(lpszStockCode) <= 0 )
return FALSE;
for( int k=0; k<GetSize(); k++ )
{
if( 0 == ElementAt(k).CompareNoCase(lpszStockCode) )
{
RemoveAt(k);
return TRUE;
}
}
return FALSE;
}