本文整理汇总了C++中nsAutoTArray::ElementAt方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAutoTArray::ElementAt方法的具体用法?C++ nsAutoTArray::ElementAt怎么用?C++ nsAutoTArray::ElementAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAutoTArray
的用法示例。
在下文中一共展示了nsAutoTArray::ElementAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
nsIRDFResource*
RDFContentSinkImpl::GetContextElement(PRInt32 ancestor /* = 0 */)
{
if ((nsnull == mContextStack) ||
(PRUint32(ancestor) >= mContextStack->Length())) {
return nsnull;
}
return mContextStack->ElementAt(
mContextStack->Length()-ancestor-1).mResource;
}
示例2:
nsIRDFResource*
RDFContentSinkImpl::GetContextElement(int32_t ancestor /* = 0 */)
{
if ((nullptr == mContextStack) ||
(uint32_t(ancestor) >= mContextStack->Length())) {
return nullptr;
}
return mContextStack->ElementAt(
mContextStack->Length()-ancestor-1).mResource;
}
示例3:
bool
nsXBLStreamListener::HasRequest(nsIURI* aURI, nsIContent* aElt)
{
// XXX Could be more efficient.
uint32_t count = mBindingRequests.Length();
for (uint32_t i = 0; i < count; i++) {
nsXBLBindingRequest* req = mBindingRequests.ElementAt(i);
bool eq;
if (req->mBoundElement == aElt &&
NS_SUCCEEDED(req->mBindingURI->Equals(aURI, &eq)) && eq)
return true;
}
return false;
}
示例4:
HTMLContentSink::~HTMLContentSink()
{
if (mNotificationTimer) {
mNotificationTimer->Cancel();
}
int32_t numContexts = mContextStack.Length();
if (mCurrentContext == mHeadContext && numContexts > 0) {
// Pop off the second html context if it's not done earlier
mContextStack.RemoveElementAt(--numContexts);
}
int32_t i;
for (i = 0; i < numContexts; i++) {
SinkContext* sc = mContextStack.ElementAt(i);
if (sc) {
sc->End();
if (sc == mCurrentContext) {
mCurrentContext = nullptr;
}
delete sc;
}
}
if (mCurrentContext == mHeadContext) {
mCurrentContext = nullptr;
}
delete mCurrentContext;
delete mHeadContext;
for (i = 0; uint32_t(i) < ArrayLength(mNodeInfoCache); ++i) {
NS_IF_RELEASE(mNodeInfoCache[i]);
}
}
示例5: doc
nsresult
nsXBLStreamListener::HandleEvent(nsIDOMEvent* aEvent)
{
nsresult rv = NS_OK;
uint32_t i;
uint32_t count = mBindingRequests.Length();
// Get the binding document; note that we don't hold onto it in this object
// to avoid creating a cycle
Event* event = aEvent->InternalDOMEvent();
EventTarget* target = event->GetCurrentTarget();
nsCOMPtr<nsIDocument> bindingDocument = do_QueryInterface(target);
NS_ASSERTION(bindingDocument, "Event not targeted at document?!");
// See if we're still alive.
nsCOMPtr<nsIDocument> doc(do_QueryReferent(mBoundDocument));
if (!doc) {
NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?\n");
}
else {
// We have to do a flush prior to notification of the document load.
// This has to happen since the HTML content sink can be holding on
// to notifications related to our children (e.g., if you bind to the
// <body> tag) that result in duplication of content.
// We need to get the sink's notifications flushed and then make the binding
// ready.
if (count > 0) {
nsXBLBindingRequest* req = mBindingRequests.ElementAt(0);
nsIDocument* document = req->mBoundElement->GetCurrentDoc();
if (document)
document->FlushPendingNotifications(Flush_ContentAndNotify);
}
// Remove ourselves from the set of pending docs.
nsBindingManager *bindingManager = doc->BindingManager();
nsIURI* documentURI = bindingDocument->GetDocumentURI();
bindingManager->RemoveLoadingDocListener(documentURI);
if (!bindingDocument->GetRootElement()) {
// FIXME: How about an error console warning?
NS_WARNING("XBL doc with no root element - this usually shouldn't happen");
return NS_ERROR_FAILURE;
}
// Put our doc info in the doc table.
nsBindingManager *xblDocBindingManager = bindingDocument->BindingManager();
nsRefPtr<nsXBLDocumentInfo> info =
xblDocBindingManager->GetXBLDocumentInfo(documentURI);
xblDocBindingManager->RemoveXBLDocumentInfo(info); // Break the self-imposed cycle.
if (!info) {
if (nsXBLService::IsChromeOrResourceURI(documentURI)) {
NS_WARNING("An XBL file is malformed. Did you forget the XBL namespace on the bindings tag?");
}
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("XBL"), nullptr,
nsContentUtils::eXBL_PROPERTIES,
"MalformedXBL",
nullptr, 0, documentURI);
return NS_ERROR_FAILURE;
}
// If the doc is a chrome URI, then we put it into the XUL cache.
#ifdef MOZ_XUL
if (nsXBLService::IsChromeOrResourceURI(documentURI)) {
nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
if (cache && cache->IsEnabled())
cache->PutXBLDocumentInfo(info);
}
#endif
bindingManager->PutXBLDocumentInfo(info);
// Notify all pending requests that their bindings are
// ready and can be installed.
for (i = 0; i < count; i++) {
nsXBLBindingRequest* req = mBindingRequests.ElementAt(i);
req->DocumentLoaded(bindingDocument);
}
}
target->RemoveEventListener(NS_LITERAL_STRING("load"), this, false);
return rv;
}