本文整理汇总了C++中nsVoidArray::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ nsVoidArray::Count方法的具体用法?C++ nsVoidArray::Count怎么用?C++ nsVoidArray::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsVoidArray
的用法示例。
在下文中一共展示了nsVoidArray::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DumpAliasArray
void DumpAliasArray( nsVoidArray& a)
{
CAliasEntry *pEntry;
CAliasData *pData;
PRInt32 cnt = a.Count();
IMPORT_LOG1( "Alias list size: %ld\n", cnt);
for (PRInt32 i = 0; i < cnt; i++) {
pEntry = (CAliasEntry *)a.ElementAt( i);
IMPORT_LOG1( "\tAlias: %s\n", pEntry->m_name.get());
if (pEntry->m_list.Count() > 1) {
IMPORT_LOG1( "\tList count #%ld\n", pEntry->m_list.Count());
for (PRInt32 j = 0; j < pEntry->m_list.Count(); j++) {
pData = (CAliasData *) pEntry->m_list.ElementAt( j);
IMPORT_LOG0( "\t\t--------\n");
IMPORT_LOG1( "\t\temail: %s\n", pData->m_email.get());
IMPORT_LOG1( "\t\trealName: %s\n", pData->m_realName.get());
IMPORT_LOG1( "\t\tnickName: %s\n", pData->m_nickName.get());
}
}
else if (pEntry->m_list.Count()) {
pData = (CAliasData *) pEntry->m_list.ElementAt( 0);
IMPORT_LOG1( "\t\temail: %s\n", pData->m_email.get());
IMPORT_LOG1( "\t\trealName: %s\n", pData->m_realName.get());
IMPORT_LOG1( "\t\tnickName: %s\n", pData->m_nickName.get());
}
}
}
示例2: AddGroupMembersAsCards
nsresult nsEudoraAddress::AddGroupMembersAsCards(nsVoidArray &membersArray, nsIAddrDatabase *pDb)
{
PRInt32 max = membersArray.Count();
CAliasData *pData;
nsresult rv = NS_OK;
nsCOMPtr <nsIMdbRow> newRow;
nsAutoString uniStr;
nsCAutoString displayName;
for (PRInt32 i = 0; i < max; i++)
{
pData = (CAliasData *)membersArray.ElementAt(i);
if (!pData || (pData->m_email.IsEmpty()))
continue;
rv = pDb->GetNewRow(getter_AddRefs(newRow));
if (NS_FAILED(rv) || !newRow)
return rv;
if (!pData->m_realName.IsEmpty())
displayName = pData->m_realName;
else if (!pData->m_nickName.IsEmpty())
displayName = pData->m_nickName;
else
displayName.Truncate();
ADD_FIELD_TO_DB_ROW(pDb, AddDisplayName, newRow, displayName, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddPrimaryEmail, newRow, pData->m_email, uniStr);
rv = pDb->AddCardRowToDB( newRow);
NS_ENSURE_SUCCESS(rv, rv);
}
return rv;
}
示例3: AddSingleList
nsresult nsEudoraAddress::AddSingleList(CAliasEntry *pEntry, nsVoidArray &emailList, nsIAddrDatabase *pDb)
{
// Create a list.
nsCOMPtr <nsIMdbRow> newRow;
nsresult rv = pDb->GetNewListRow(getter_AddRefs(newRow));
if (NS_FAILED(rv) || !newRow)
return rv;
rv = pDb->AddListName(newRow, pEntry->m_name.get());
NS_ENSURE_SUCCESS(rv, rv);
// Now add the members.
PRInt32 max = emailList.Count();
for (PRInt32 i = 0; i < max; i++)
{
CAliasData *pData = (CAliasData *)emailList.ElementAt(i);
nsCAutoString ldifValue(NS_LITERAL_CSTRING("mail=") + nsDependentCString(pData->m_email.get()));
rv = pDb->AddLdifListMember(newRow, ldifValue.get());
}
rv = pDb->AddCardRowToDB(newRow);
NS_ENSURE_SUCCESS(rv, rv);
rv = pDb->AddListDirNode(newRow);
return rv;
}
示例4: GetItem
/* nsIDOMSVGPathSeg getItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::GetItem(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);
return NS_OK;
}
示例5: InsertElementsAt
PRBool nsSmallVoidArray::InsertElementsAt(const nsVoidArray &aOther, PRInt32 aIndex)
{
#ifdef DEBUG
for (int i = 0; i < aOther.Count(); i++) {
NS_ASSERTION(!(NS_PTR_TO_INT32(aOther.ElementAt(i)) & 0x1),
"Attempt to add element with 0x1 bit set to nsSmallVoidArray");
}
#endif
if (aIndex == 0 && IsEmpty() && aOther.Count() == 1) {
SetSingle(aOther.FastElementAt(0));
return PR_TRUE;
}
if (!EnsureArray()) {
return PR_FALSE;
}
return AsArray()->InsertElementsAt(aOther, aIndex);
}
示例6: RememberGroupMembers
//
// Since there is no way to check if a card for a given email address already exists,
// elements in 'membersArray' are make unique. So for each email address in 'emailList'
// we check it in 'membersArray' and if it's not there then we add it to 'membersArray'.
//
void nsEudoraAddress::RememberGroupMembers(nsVoidArray &membersArray, nsVoidArray &emailList)
{
PRInt32 cnt = emailList.Count();
CAliasData *pData;
for (PRInt32 i = 0; i < cnt; i++)
{
pData = (CAliasData *)emailList.ElementAt(i);
if (!pData)
continue;
PRInt32 memberCnt = membersArray.Count();
PRInt32 j = 0;
for (j = 0; j < memberCnt; j++)
{
if (pData == membersArray.ElementAt(j))
break;
}
if (j >= memberCnt)
membersArray.AppendElement(pData); // add to member list
}
}
示例7: ResolveEntries
void nsEudoraAddress::ResolveEntries(nsCString& name, nsVoidArray& list,
nsVoidArray& result, bool addResolvedEntries,
bool wasResolved, int32_t& numResolved)
{
/* a safe-guard against recursive entries */
if (result.Count() > m_alias.Count())
return;
int32_t max = list.Count();
int32_t i;
CAliasData * pData;
CAliasEntry * pEntry;
for (i = 0; i < max; i++) {
pData = (CAliasData *)list.ElementAt(i);
// resolve the email to an existing alias!
if (!name.Equals(pData->m_email, nsCaseInsensitiveCStringComparator()) &&
((pEntry = ResolveAlias(pData->m_fullEntry)) != nullptr)) {
// This new entry has all of the entries for this puppie.
// Resolve all of it's entries!
numResolved++; // Track the number of entries resolved
// We pass in true for the 5th parameter so that we know that we're
// calling ourselves recursively.
ResolveEntries(pEntry->m_name,
pEntry->m_list,
result,
addResolvedEntries,
true,
numResolved);
}
else if (addResolvedEntries || !wasResolved) {
// This is either an ordinary entry (i.e. just contains the info) or we were told
// to add resolved alias entries.
result.AppendElement(pData);
}
}
}
示例8: WillModify
void
nsSVGPathSegList::ReleaseSegments()
{
WillModify();
PRInt32 count = mSegments.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIDOMSVGPathSeg* seg = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->RemoveObserver(this);
NS_RELEASE(seg);
}
mSegments.Clear();
DidModify();
}
示例9: ProcessPendingChildEntries
void nsOEScanBoxes::ProcessPendingChildEntries(PRUint32 parent, PRUint32 rootIndex, nsVoidArray &childArray)
{
PRInt32 i, max;
MailboxEntry *pEntry;
for (i = 0, max = childArray.Count(); i < max; i++)
{
pEntry = (MailboxEntry *) childArray.ElementAt(i);
if ((!pEntry->processed) && (pEntry->parent == parent))
{
AddChildEntry(pEntry, rootIndex);
pEntry->processed = PR_TRUE; // indicate it's been processed.
// See if there are unprocessed child folders for this child in the
// array as well (ie, both child and grand-child are on the list).
ProcessPendingChildEntries(pEntry->index, rootIndex, childArray);
}
}
}
示例10: AddSingleList
nsresult nsEudoraAddress::AddSingleList(CAliasEntry *pEntry, nsVoidArray &emailList, nsIAddrDatabase *pDb)
{
// Create a list.
nsCOMPtr <nsIMdbRow> newRow;
nsresult rv = pDb->GetNewListRow(getter_AddRefs(newRow));
if (NS_FAILED(rv) || !newRow)
return rv;
// Extract name from notes, if any
nsCString name;
if (!pEntry->m_notes.IsEmpty())
{
nsCString note(pEntry->m_notes);
ExtractNoteField(note, name, "name");
}
// If we got a name from the notes, use that for the name otherwise use the
// name in pEntry (which is the Eudora nickname).
rv = pDb->AddListName(newRow, name.IsEmpty() ? pEntry->m_name.get() : name.get());
NS_ENSURE_SUCCESS(rv, rv);
// Add the name in pEntry as the list nickname, because it was the Eudora nickname
rv = pDb->AddListNickName(newRow, pEntry->m_name.get());
NS_ENSURE_SUCCESS(rv, rv);
// Now add the members.
int32_t max = emailList.Count();
for (int32_t i = 0; i < max; i++)
{
CAliasData *pData = (CAliasData *)emailList.ElementAt(i);
nsAutoCString ldifValue("mail");
ldifValue.Append(pData->m_email);
rv = pDb->AddLdifListMember(newRow, ldifValue.get());
}
rv = pDb->AddCardRowToDB(newRow);
NS_ENSURE_SUCCESS(rv, rv);
rv = pDb->AddListDirNode(newRow);
return rv;
}
示例11: parser
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;
}
示例12: 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;
}
示例13: GetNumberOfItems
/* readonly attribute unsigned long numberOfItems; */
NS_IMETHODIMP nsSVGPathSegList::GetNumberOfItems(PRUint32 *aNumberOfItems)
{
*aNumberOfItems = mSegments.Count();
return NS_OK;
}
示例14: AddSingleCard
//.........这里部分代码省略.........
// 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");
// Store other web sites in the notes field, labeled nicely
FormatExtraDataInNoteField(EUDORAIMPORT_ADDRESS_LABEL_OTHERWEB, bundle, otherWeb, noteUTF16);
}
noteUTF16.Append( NS_ConvertASCIItoUTF16(note) );
}
}
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", "\n");
SplitString( address, address2);
note.ReplaceSubstring( "\x03", "\n");
fax.ReplaceSubstring( "\x03", " ");
secondaryFax.ReplaceSubstring( "\x03", " ");
phone.ReplaceSubstring( "\x03", " ");
name.ReplaceSubstring( "\x03", " ");
city.ReplaceSubstring( "\x03", " ");
state.ReplaceSubstring( "\x03", " ");
zip.ReplaceSubstring( "\x03", " ");
country.ReplaceSubstring( "\x03", " ");
addressWK.ReplaceSubstring( "\x03", "\n");
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)
{
示例15: 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);
//.........这里部分代码省略.........