Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Private Member Functions | Private Attributes
nsChromeRegistry::nsProviderArray Class Reference

#include <nsChromeRegistry.h>

List of all members.

Public Types

enum  MatchType { EXACT = 0, LOCALE = 1, ANY = 2 }

Public Member Functions

 nsProviderArray ()
 ~nsProviderArray ()
nsIURIGetBase (const nsACString &aPreferred, MatchType aType)
const nsACString & GetSelected (const nsACString &aPreferred, MatchType aType)
void SetBase (const nsACString &aProvider, nsIURI *base)
void EnumerateToArray (nsCStringArray *a)
void Clear ()

Private Member Functions

ProviderEntryGetProvider (const nsACString &aPreferred, MatchType aType)

Private Attributes

nsVoidArray mArray

Detailed Description

Definition at line 135 of file nsChromeRegistry.h.


Member Enumeration Documentation

Enumerator:
EXACT 
LOCALE 
ANY 

Definition at line 145 of file nsChromeRegistry.h.

                   {
      EXACT = 0,
      LOCALE = 1, // "en-GB" is selected, we found "en-US"
      ANY = 2
    };

Constructor & Destructor Documentation

Definition at line 138 of file nsChromeRegistry.h.

                      :
      mArray(1) { }

Definition at line 140 of file nsChromeRegistry.h.

      { Clear(); }

Here is the call graph for this function:


Member Function Documentation

Definition at line 324 of file nsChromeRegistry.cpp.

{
  PRInt32 i = mArray.Count();
  while (i--) {
    ProviderEntry* entry = NS_REINTERPRET_CAST(ProviderEntry*, mArray[i]);
    delete entry;
  }

  mArray.Clear();
}

Here is the caller graph for this function:

Definition at line 314 of file nsChromeRegistry.cpp.

{
  PRInt32 i = mArray.Count();
  while (i--) {
    ProviderEntry *entry = NS_REINTERPRET_CAST(ProviderEntry*, mArray[i]);
    a->AppendCString(entry->provider);
  }
}
nsIURI * nsChromeRegistry::nsProviderArray::GetBase ( const nsACString &  aPreferred,
MatchType  aType 
)

Definition at line 274 of file nsChromeRegistry.cpp.

{
  ProviderEntry* provider = GetProvider(aPreferred, aType);

  if (!provider)
    return nsnull;

  return provider->baseURI;
}

Definition at line 241 of file nsChromeRegistry.cpp.

{
  PRInt32 i = mArray.Count();
  if (!i)
    return nsnull;

  ProviderEntry* found = nsnull;  // Only set if we find a partial-match locale
  ProviderEntry* entry;

  while (i--) {
    entry = NS_REINTERPRET_CAST(ProviderEntry*, mArray[i]);
    if (aPreferred.Equals(entry->provider))
      return entry;

    if (aType != LOCALE)
      continue;

    if (LanguagesMatch(aPreferred, entry->provider)) {
      found = entry;
      continue;
    }

    if (!found && entry->provider.EqualsLiteral("en-US"))
      found = entry;
  }

  if (!found && aType != EXACT)
    return entry;

  return found;
}

Here is the call graph for this function:

const nsACString & nsChromeRegistry::nsProviderArray::GetSelected ( const nsACString &  aPreferred,
MatchType  aType 
)

Definition at line 285 of file nsChromeRegistry.cpp.

{
  ProviderEntry* entry = GetProvider(aPreferred, aType);

  if (entry)
    return entry->provider;

  return EmptyCString();
}
void nsChromeRegistry::nsProviderArray::SetBase ( const nsACString &  aProvider,
nsIURI base 
)

Definition at line 296 of file nsChromeRegistry.cpp.

{
  ProviderEntry* provider = GetProvider(aProvider, EXACT);

  if (provider) {
    provider->baseURI = aBaseURL;
    return;
  }

  // no existing entries, add a new one
  provider = new ProviderEntry(aProvider, aBaseURL);
  if (!provider)
    return; // It's safe to silently fail on OOM

  mArray.AppendElement(provider);
}

Member Data Documentation

Definition at line 160 of file nsChromeRegistry.h.


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