Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Private Member Functions | Private Attributes
nsProfileCollector::BookmarkCounter Class Reference
Collaboration diagram for nsProfileCollector::BookmarkCounter:
Collaboration graph
[legend]

List of all members.

Public Types

enum  BookmarkType {
  ITEM, FOLDER, LIVEMARK, SEPARATOR,
  kLastBookmarkType
}

Public Member Functions

 BookmarkCounter ()
nsresult Init ()
void CountChildren (nsIRDFResource *root, PRBool deep, nsTArray< PRInt32 > &count)

Private Member Functions

void CountRecursive (nsIRDFResource *root, PRBool deep, nsTArray< PRInt32 > &count)

Private Attributes

nsCOMPtr< nsIRDFDataSourcemDataSource
nsCOMPtr< nsIRDFResourcemRDFType
nsCOMPtr< nsIRDFResourcemNCBookmark
nsCOMPtr< nsIRDFResourcemNCFolder
nsCOMPtr< nsIRDFResourcemNCLivemark
nsCOMPtr< nsIRDFResourcemNCSeparator

Detailed Description

Definition at line 116 of file nsProfileCollector.cpp.


Member Enumeration Documentation

Enumerator:
ITEM 
FOLDER 
LIVEMARK 
SEPARATOR 
kLastBookmarkType 

Definition at line 123 of file nsProfileCollector.cpp.


Constructor & Destructor Documentation

Definition at line 119 of file nsProfileCollector.cpp.

{}

Member Function Documentation

Definition at line 896 of file nsProfileCollector.cpp.

{
  count.SetLength(kLastBookmarkType);
  for (PRUint32 i = 0; i < kLastBookmarkType; ++i) {
    count[i] = 0;
  }
  CountRecursive(root, deep, count);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 908 of file nsProfileCollector.cpp.

{
  nsCOMPtr<nsIRDFContainer> container =
    do_CreateInstance("@mozilla.org/rdf/container;1");
  if (!container) {
    return;
  }

  nsresult rv = container->Init(mDataSource, root);
  if (NS_FAILED(rv)) {
    return;
  }

  nsCOMPtr<nsISimpleEnumerator> elements;
  container->GetElements(getter_AddRefs(elements));
  if (!elements) {
    return;
  }

  nsCOMPtr<nsISupports> item;
  while (NS_SUCCEEDED(elements->GetNext(getter_AddRefs(item)))) {
    nsCOMPtr<nsIRDFResource> child = do_QueryInterface(item);
    if (!child) {
      continue;
    }

    // Figure out whether the child is a folder
    nsCOMPtr<nsIRDFNode> typeNode;
    mDataSource->GetTarget(child, mRDFType, PR_TRUE, getter_AddRefs(typeNode));
    if (!typeNode) {
      continue;
    }

    if (typeNode == mNCBookmark) {
      ++count[ITEM];
    } else if (typeNode == mNCFolder) {
      ++count[FOLDER];
      if (deep) {
        CountRecursive(child, deep, count);
      }
    } else if (typeNode == mNCLivemark) {
      ++count[LIVEMARK];
    } else if (typeNode == mNCSeparator) {
      ++count[SEPARATOR];
    }
  }
}

Here is the call graph for this function:

Definition at line 863 of file nsProfileCollector.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 152 of file nsProfileCollector.cpp.

Definition at line 155 of file nsProfileCollector.cpp.

Definition at line 156 of file nsProfileCollector.cpp.

Definition at line 157 of file nsProfileCollector.cpp.

Definition at line 158 of file nsProfileCollector.cpp.

Definition at line 154 of file nsProfileCollector.cpp.


The documentation for this class was generated from the following file: