本文整理汇总了C++中nsVoidArray类的典型用法代码示例。如果您正苦于以下问题:C++ nsVoidArray类的具体用法?C++ nsVoidArray怎么用?C++ nsVoidArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nsVoidArray类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: InsertElementsAt
PRBool nsVoidArray::InsertElementsAt(const nsVoidArray& other, PRInt32 aIndex)
{
PRInt32 oldCount = Count();
PRInt32 otherCount = other.Count();
NS_ASSERTION(aIndex >= 0,"InsertElementsAt(negative index)");
if (PRUint32(aIndex) > PRUint32(oldCount))
{
// An invalid index causes the insertion to fail
// Invalid indexes are ones that are more than one entry past the end of
// the array (i.e., they can append).
return PR_FALSE;
}
if (oldCount + otherCount > GetArraySize())
{
if (!GrowArrayBy(otherCount))
return PR_FALSE;;
}
// else the array is already large enough
PRInt32 slide = oldCount - aIndex;
if (0 != slide)
{
// Slide data over to make room for the insertion
memmove(mImpl->mArray + aIndex + otherCount, mImpl->mArray + aIndex,
slide * sizeof(mImpl->mArray[0]));
}
for (PRInt32 i = 0; i < otherCount; i++)
{
// copy all the elements (destroys aIndex)
mImpl->mArray[aIndex++] = other.mImpl->mArray[i];
mImpl->mCount++;
}
#if DEBUG_VOIDARRAY
if (mImpl->mCount > mMaxCount &&
mImpl->mCount < (PRInt32)(sizeof(MaxElements)/sizeof(MaxElements[0])))
{
MaxElements[mImpl->mCount]++;
MaxElements[mMaxCount]--;
mMaxCount = mImpl->mCount;
}
#endif
return PR_TRUE;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:48,代码来源:nsVoidArray.cpp
示例2: ToNewCString
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGPathSegList::SetValueString(const nsAString& aValue)
{
nsresult rv;
char *str = ToNewCString(aValue);
nsVoidArray data;
nsSVGPathDataParser parser(&data);
rv = parser.Parse(str);
if (NS_SUCCEEDED(rv)) {
WillModify();
ReleaseSegments();
mSegments = data;
PRInt32 count = mSegments.Count();
for (PRInt32 i=0; i<count; ++i) {
nsIDOMSVGPathSeg* seg = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->AddObserver(this);
}
DidModify();
}
else {
NS_ERROR("path data parse error!");
PRInt32 count = data.Count();
for (PRInt32 i=0; i<count; ++i) {
nsIDOMSVGPathSeg* seg = (nsIDOMSVGPathSeg*)data.ElementAt(i);
NS_RELEASE(seg);
}
}
nsMemory::Free(str);
return rv;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:41,代码来源:nsSVGPathSegList.cpp
示例3: FindPropInList
PRBool TypeInState::FindPropInList(nsIAtom *aProp,
const nsAString &aAttr,
nsAString *outValue,
nsVoidArray &aList,
PRInt32 &outIndex)
{
// linear search. list should be short.
PRInt32 i, count = aList.Count();
for (i=0; i<count; i++)
{
PropItem *item = (PropItem*)aList[i];
if ( (item->tag == aProp) &&
(item->attr == aAttr) )
{
if (outValue) *outValue = item->value;
outIndex = i;
return PR_TRUE;
}
}
return PR_FALSE;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:21,代码来源:TypeInState.cpp
示例4: AddSingleCard
void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList, nsIAddrDatabase *pDb)
{
// We always have a nickname and everything else is optional.
// Map both home and work related fields to our address card. Eudora
// fields that can't be mapped will be left in the 'note' field!
nsIMdbRow* newRow = nsnull;
pDb->GetNewRow( &newRow);
if (!newRow)
return;
nsCString displayName, name, firstName, lastName;
nsCString fax, secondaryFax, phone, mobile, secondaryMobile, webLink;
nsCString address, address2, city, state, zip, country;
nsCString phoneWK, webLinkWK, title, company;
nsCString addressWK, address2WK, cityWK, stateWK, zipWK, countryWK;
nsCString primaryLocation, otherPhone, otherWeb;
nsCString additionalEmail, stillMoreEmail;
nsCString note(pEntry->m_notes);
nsString noteUTF16;
PRBool isSecondaryMobileWorkNumber = PR_TRUE;
PRBool isSecondaryFaxWorkNumber = PR_TRUE;
nsCOMPtr<nsIStringBundle> bundle( dont_AddRef(nsEudoraStringBundle::GetStringBundleProxy()) );
if (!note.IsEmpty())
{
ExtractNoteField( note, fax, "fax");
ExtractNoteField( note, secondaryFax, "fax2");
ExtractNoteField( note, phone, "phone");
ExtractNoteField( note, mobile, "mobile");
ExtractNoteField( note, secondaryMobile, "mobile2");
ExtractNoteField( note, address, "address");
ExtractNoteField( note, city, "city");
ExtractNoteField( note, state, "state");
ExtractNoteField( note, zip, "zip");
ExtractNoteField( note, country, "country");
ExtractNoteField( note, name, "name");
ExtractNoteField( note, firstName, "first");
ExtractNoteField( note, lastName, "last");
ExtractNoteField( note, webLink, "web");
ExtractNoteField( note, addressWK, "address2");
ExtractNoteField( note, cityWK, "city2");
ExtractNoteField( note, stateWK, "state2");
ExtractNoteField( note, zipWK, "zip2");
ExtractNoteField( note, countryWK, "country2");
ExtractNoteField( note, phoneWK, "phone2");
ExtractNoteField( note, title, "title");
ExtractNoteField( note, company, "company");
ExtractNoteField( note, webLinkWK, "web2");
ExtractNoteField( note, primaryLocation, "primary");
ExtractNoteField( note, additionalEmail, "otheremail");
ExtractNoteField( note, otherPhone, "otherphone");
ExtractNoteField( note, otherWeb, "otherweb");
// Is there any "extra" data that we may want to format nicely and place
// in the notes field?
if ( !additionalEmail.IsEmpty() || !otherPhone.IsEmpty() || !otherWeb.IsEmpty() )
{
nsCString otherNotes(note);
if ( !additionalEmail.IsEmpty() )
{
// Reconstitute line breaks for additional email
additionalEmail.ReplaceSubstring( "\x03", "\n");
// Try to figure out if there are multiple email addresses in additionalEmail
PRInt32 idx = additionalEmail.FindCharInSet("\t\r\n,; ");
if (idx != -1)
{
// We found a character that indicates that there's more than one email address here.
// Separate out the addresses after the first one.
additionalEmail.Right(stillMoreEmail, additionalEmail.Length() - idx - 1);
stillMoreEmail.Trim(kWhitespace);
// Separate out the first address.
nsCString tempStashEmail(additionalEmail);
tempStashEmail.Left(additionalEmail, idx);
}
// If there were more than one additional email addresses store all the extra
// ones in the notes field, labeled nicely.
if ( !stillMoreEmail.IsEmpty() )
FormatExtraDataInNoteField(EUDORAIMPORT_ADDRESS_LABEL_OTHEREMAIL, bundle, stillMoreEmail, noteUTF16);
}
if ( !otherPhone.IsEmpty() )
{
// Reconstitute line breaks for other phone numbers
otherPhone.ReplaceSubstring( "\x03", "\n");
// Store other phone numbers in the notes field, labeled nicely
FormatExtraDataInNoteField(EUDORAIMPORT_ADDRESS_LABEL_OTHERPHONE, bundle, otherPhone, noteUTF16);
}
if ( !otherWeb.IsEmpty() )
{
// Reconstitute line breaks for other web sites
otherWeb.ReplaceSubstring( "\x03", "\n");
//.........这里部分代码省略.........
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:101,代码来源:nsEudoraAddress.cpp
示例5: AddSingleCard
void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList, nsIAddrDatabase *pDb)
{
// We always have a nickname and everything else is optional.
// Map both home and work related fiedls to our address card. Eudora
// fields that can't be mapped will be left in the 'note' field!
nsIMdbRow* newRow = nsnull;
pDb->GetNewRow( &newRow);
if (!newRow)
return;
nsCString displayName, name, firstName, lastName;
nsCString fax, phone, mobile, webLink;
nsCString address, address2, city, state, zip, country;
nsCString phoneWK, webLinkWK, title, company;
nsCString addressWK, address2WK, cityWK, stateWK, zipWK, countryWK;
nsCString note(pEntry->m_notes);
if (!note.IsEmpty())
{
ExtractNoteField( note, fax, "fax");
ExtractNoteField( note, phone, "phone");
ExtractNoteField( note, mobile, "mobile");
ExtractNoteField( note, address, "address");
ExtractNoteField( note, city, "city");
ExtractNoteField( note, state, "state");
ExtractNoteField( note, zip, "zip");
ExtractNoteField( note, country, "country");
ExtractNoteField( note, name, "name");
ExtractNoteField( note, firstName, "first");
ExtractNoteField( note, lastName, "last");
ExtractNoteField( note, webLink, "web");
ExtractNoteField( note, addressWK, "address2");
ExtractNoteField( note, cityWK, "city2");
ExtractNoteField( note, stateWK, "state2");
ExtractNoteField( note, zipWK, "zip2");
ExtractNoteField( note, countryWK, "country2");
ExtractNoteField( note, phoneWK, "phone2");
ExtractNoteField( note, title, "title");
ExtractNoteField( note, company, "company");
ExtractNoteField( note, webLinkWK, "web2");
}
CAliasData *pData = emailList.Count() ? (CAliasData *)emailList.ElementAt(0) : nsnull;
if (pData && !pData->m_realName.IsEmpty())
displayName = pData->m_realName;
else if (!name.IsEmpty())
displayName = name;
else
displayName = pEntry->m_name;
address.ReplaceSubstring( "\x03", "\x0D\x0A");
SplitString( address, address2);
note.ReplaceSubstring( "\x03", "\x0D\x0A");
fax.ReplaceSubstring( "\x03", " ");
phone.ReplaceSubstring( "\x03", " ");
name.ReplaceSubstring( "\x03", " ");
city.ReplaceSubstring( "\x03", " ");
state.ReplaceSubstring( "\x03", " ");
zip.ReplaceSubstring( "\x03", " ");
country.ReplaceSubstring( "\x03", " ");
addressWK.ReplaceSubstring( "\x03", "\x0D\x0A");
SplitString( addressWK, address2WK);
phoneWK.ReplaceSubstring( "\x03", " ");
cityWK.ReplaceSubstring( "\x03", " ");
stateWK.ReplaceSubstring( "\x03", " ");
zipWK.ReplaceSubstring( "\x03", " ");
countryWK.ReplaceSubstring( "\x03", " ");
title.ReplaceSubstring( "\x03", " ");
company.ReplaceSubstring( "\x03", " ");
if (newRow)
{
nsAutoString uniStr;
// Home related fields.
ADD_FIELD_TO_DB_ROW(pDb, AddDisplayName, newRow, displayName, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddNickName, newRow, pEntry->m_name, uniStr);
if (pData)
ADD_FIELD_TO_DB_ROW(pDb, AddPrimaryEmail, newRow, pData->m_email, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddFirstName, newRow, firstName, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddLastName, newRow, lastName, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddWebPage2, newRow, webLink, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddFaxNumber, newRow, fax, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddHomePhone, newRow, phone, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddHomeAddress, newRow, address, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddHomeAddress2, newRow, address2, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddHomeCity, newRow, city, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddHomeZipCode, newRow, zip, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddHomeState, newRow, state, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddHomeCountry, newRow, country, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddCellularNumber, newRow, mobile, uniStr);
// Work related fields.
ADD_FIELD_TO_DB_ROW(pDb, AddJobTitle, newRow, title, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddCompany, newRow, company, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddWebPage1, newRow, webLinkWK, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddWorkPhone, newRow, phoneWK, uniStr);
//.........这里部分代码省略.........
开发者ID:rn10950,项目名称:RetroZilla,代码行数:101,代码来源:nsEudoraAddress.cpp
示例6: DeleteWrappers
static void
DeleteWrappers(nsVoidArray &wrappers)
{
for (PRInt32 i=0; i<wrappers.Count(); ++i)
gDConnect->DeleteInstance((DConnectInstance *) wrappers[i]);
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:6,代码来源:ipcDConnectService.cpp
示例7: return
nsIDOMSVGPathSeg*
nsSVGPathSegList::ElementAt(PRInt32 index)
{
return (nsIDOMSVGPathSeg*)mSegments.ElementAt(index);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:5,代码来源:nsSVGPathSegList.cpp
示例8: GetNumberOfItems
/* readonly attribute unsigned long numberOfItems; */
NS_IMETHODIMP nsSVGPathSegList::GetNumberOfItems(PRUint32 *aNumberOfItems)
{
*aNumberOfItems = mSegments.Count();
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:6,代码来源:nsSVGPathSegList.cpp
注:本文中的nsVoidArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论