Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Private Attributes
xptiWorkingSet Class Reference

#include <xptiprivate.h>

Collaboration diagram for xptiWorkingSet:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { NOT_FOUND = 0xffffffff }

Public Member Functions

 xptiWorkingSet ()
 xptiWorkingSet (nsISupportsArray *aDirectories)
 ~xptiWorkingSet ()
PRBool IsValid () const
void InvalidateInterfaceInfos ()
void ClearHashTables ()
void ClearFiles ()
void ClearZipItems ()
xptiTypelibGutsGetTypelibGuts (const xptiTypelib &typelib)
PRUint32 GetFileCount () const
PRUint32 GetFileFreeSpace ()
PRUint32 FindFile (PRUint32 dir, const char *name)
PRUint32 GetTypelibDirectoryIndex (const xptiTypelib &typelib)
const char * GetTypelibFileName (const xptiTypelib &typelib)
xptiFileGetFileAt (PRUint32 i) const
void SetFileAt (PRUint32 i, const xptiFile &r)
void AppendFile (const xptiFile &r)
PRBool NewFileArray (PRUint32 count)
PRBool ExtendFileArray (PRUint32 count)
PRUint32 GetZipItemCount () const
PRUint32 GetZipItemFreeSpace ()
PRUint32 FindZipItemWithName (const char *name)
xptiZipItemGetZipItemAt (PRUint32 i) const
void SetZipItemAt (PRUint32 i, const xptiZipItem &r)
void AppendZipItem (const xptiZipItem &r)
PRBool NewZipItemArray (PRUint32 count)
PRBool ExtendZipItemArray (PRUint32 count)
PRUint32 GetDirectoryCount ()
nsresult GetCloneOfDirectoryAt (PRUint32 i, nsILocalFile **dir)
nsresult GetDirectoryAt (PRUint32 i, nsILocalFile **dir)
PRBool FindDirectory (nsILocalFile *dir, PRUint32 *index)
PRBool FindDirectoryOfFile (nsILocalFile *file, PRUint32 *index)
PRBool DirectoryAtMatchesPersistentDescriptor (PRUint32 i, const char *desc)
XPTArenaGetStringArena ()
XPTArenaGetStructArena ()

Public Attributes

PLDHashTablemNameTable
PLDHashTablemIIDTable
PRUint32mFileMergeOffsetMap
PRUint32mZipItemMergeOffsetMap

Private Attributes

PRUint32 mFileCount
PRUint32 mMaxFileCount
xptiFilemFileArray
PRUint32 mZipItemCount
PRUint32 mMaxZipItemCount
xptiZipItemmZipItemArray
XPTArenamStringArena
XPTArenamStructArena
nsCOMPtr< nsISupportsArraymDirectories

Detailed Description

Definition at line 310 of file xptiprivate.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
NOT_FOUND 

Definition at line 333 of file xptiprivate.h.

{NOT_FOUND = 0xffffffff};

Constructor & Destructor Documentation

Definition at line 210 of file xptiWorkingSet.cpp.

{
    MOZ_COUNT_DTOR(xptiWorkingSet);

    ClearFiles();
    ClearZipItems();
    ClearHashTables();

    if(mNameTable)
        PL_DHashTableDestroy(mNameTable);
        
    if(mIIDTable)
        PL_DHashTableDestroy(mIIDTable);

    if(mFileArray)
        delete [] mFileArray;

    if(mZipItemArray)
        delete [] mZipItemArray;

    // Destroy arenas last in case they are referenced in other members' dtors.

    if(mStringArena)
    {
#ifdef DEBUG
        XPT_DumpStats(mStringArena);
#endif        
        XPT_DestroyArena(mStringArena);
    }
    
    if(mStructArena)
    {
#ifdef DEBUG
        XPT_DumpStats(mStructArena);
#endif        
        XPT_DestroyArena(mStructArena);
    }
}        

Here is the call graph for this function:


Member Function Documentation

Definition at line 367 of file xptiprivate.h.

    { 
        NS_ASSERTION(mFileArray, "bad state!");
        NS_ASSERTION(mFileCount < mMaxFileCount, "bad param!");
        mFileArray[mFileCount++] = r;
    }

Here is the caller graph for this function:

Definition at line 399 of file xptiprivate.h.

Here is the caller graph for this function:

Definition at line 191 of file xptiWorkingSet.cpp.

Here is the caller graph for this function:

Definition at line 181 of file xptiWorkingSet.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 201 of file xptiWorkingSet.cpp.

Here is the caller graph for this function:

Definition at line 411 of file xptiWorkingSet.cpp.

{
    nsCOMPtr<nsILocalFile> dir;
    GetDirectoryAt(i, getter_AddRefs(dir));
    if(!dir)
        return PR_FALSE;

    nsCOMPtr<nsILocalFile> descDir;
    nsresult rv = NS_NewNativeLocalFile(EmptyCString(), PR_FALSE, getter_AddRefs(descDir));
    if(NS_FAILED(rv))
        return PR_FALSE;

    rv = descDir->SetPersistentDescriptor(nsDependentCString(inDesc));
    if(NS_FAILED(rv))
        return PR_FALSE;
    
    PRBool matches;
    rv = dir->Equals(descDir, &matches);
    return NS_SUCCEEDED(rv) && matches;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 284 of file xptiWorkingSet.cpp.

{
    if(mFileArray && count < mMaxFileCount)
        return PR_TRUE;

    xptiFile* newArray = new xptiFile[count];
    if(!newArray)
        return PR_FALSE;

    if(mFileArray)
    {
        for(PRUint32 i = 0; i < mFileCount; ++i)
            newArray[i] = mFileArray[i];
        delete [] mFileArray;
    }
    mFileArray = newArray;
    mMaxFileCount = count;
    return PR_TRUE;
}

Here is the caller graph for this function:

Definition at line 335 of file xptiWorkingSet.cpp.

{
    if(mZipItemArray && count < mMaxZipItemCount)
        return PR_TRUE;

    xptiZipItem* newArray = new xptiZipItem[count];
    if(!newArray)
        return PR_FALSE;

    if(mZipItemArray)
    {
        for(PRUint32 i = 0; i < mZipItemCount; ++i)
            newArray[i] = mZipItemArray[i];
        delete [] mZipItemArray;
    }
    mZipItemArray = newArray;
    mMaxZipItemCount = count;
    return PR_TRUE;
}

Here is the caller graph for this function:

Definition at line 375 of file xptiWorkingSet.cpp.

{
    PRUint32 count;
    nsresult rv = mDirectories->Count(&count);
    if(NS_FAILED(rv))
        return PR_FALSE;

    for(PRUint32 i = 0; i < count; i++)
    {
        PRBool same;
        nsCOMPtr<nsILocalFile> current;
        mDirectories->QueryElementAt(i, NS_GET_IID(nsILocalFile), 
                                     getter_AddRefs(current));
        if(!current || NS_FAILED(current->Equals(dir, &same)))
            break;
        if(same)
        {
            *index = i;    
            return PR_TRUE;       
        }
    }
    return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 399 of file xptiWorkingSet.cpp.

{
    nsCOMPtr<nsIFile> dirAbstract;
    file->GetParent(getter_AddRefs(dirAbstract));
    if(!dirAbstract)
        return PR_FALSE;
    nsCOMPtr<nsILocalFile> dir = do_QueryInterface(dirAbstract);
    if(!dir)
        return PR_FALSE;
    return FindDirectory(dir, index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRUint32 xptiWorkingSet::FindFile ( PRUint32  dir,
const char *  name 
)

Definition at line 250 of file xptiWorkingSet.cpp.

{
    if(mFileArray)
    {
        for(PRUint32 i = 0; i < mFileCount;++i)
        {
            xptiFile& file = mFileArray[i];
            if(file.GetDirectory() == dir && 
               0 == PL_strcmp(name, file.GetName()))
            {
                return i;
            }    
        }
    }
    return NOT_FOUND;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 307 of file xptiWorkingSet.cpp.

{
    if(mZipItemArray)
    {
        for(PRUint32 i = 0; i < mZipItemCount;++i)
            if(0 == PL_strcmp(name, mZipItemArray[i].GetName()))
                return i;
    }
    return NOT_FOUND;
}

Definition at line 365 of file xptiWorkingSet.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 370 of file xptiWorkingSet.cpp.

{
    return mDirectories->QueryElementAt(i, NS_GET_IID(nsILocalFile), (void**)dir);
}       

Here is the caller graph for this function:

Definition at line 358 of file xptiWorkingSet.cpp.

{
    PRUint32 count = 0;
    mDirectories->Count(&count);
    return count;
}

Here is the caller graph for this function:

Definition at line 353 of file xptiprivate.h.

    {
        NS_ASSERTION(mFileArray, "bad state!");
        NS_ASSERTION(i < mFileCount, "bad param!");
        return mFileArray[i];
    }

Here is the caller graph for this function:

Definition at line 337 of file xptiprivate.h.

{return mFileCount;}

Here is the caller graph for this function:

Definition at line 338 of file xptiprivate.h.

        {return mFileArray ? mMaxFileCount - mFileCount : 0;} 

Definition at line 420 of file xptiprivate.h.

{return mStringArena;}

Here is the caller graph for this function:

Definition at line 421 of file xptiprivate.h.

{return mStructArena;}

Here is the caller graph for this function:

Definition at line 343 of file xptiprivate.h.

    {
        return GetFileAt(typelib.GetFileIndex()).GetDirectory();
    }

Here is the call graph for this function:

Definition at line 348 of file xptiprivate.h.

    {
        return GetFileAt(typelib.GetFileIndex()).GetName();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 326 of file xptiprivate.h.

    { 
        return typelib.IsZip() ?
            GetZipItemAt(typelib.GetZipItemIndex()).GetGuts() :
            GetFileAt(typelib.GetFileIndex()).GetGuts();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 385 of file xptiprivate.h.

    {
        NS_ASSERTION(mZipItemArray, "bad state!");
        NS_ASSERTION(i < mZipItemCount, "bad param!");
        return mZipItemArray[i];
    }

Here is the caller graph for this function:

Definition at line 379 of file xptiprivate.h.

{return mZipItemCount;}

Here is the caller graph for this function:

Definition at line 380 of file xptiprivate.h.

Here is the caller graph for this function:

Definition at line 171 of file xptiWorkingSet.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 144 of file xptiWorkingSet.cpp.

Here is the caller graph for this function:

Definition at line 268 of file xptiWorkingSet.cpp.

{
    if(mFileArray)
        delete [] mFileArray;
    mFileCount = 0;
    mFileArray = new xptiFile[count];
    if(!mFileArray)
    {
        mMaxFileCount = 0;
        return PR_FALSE;
    }
    mMaxFileCount = count;
    return PR_TRUE;
}

Here is the caller graph for this function:

Definition at line 319 of file xptiWorkingSet.cpp.

Here is the caller graph for this function:

Definition at line 360 of file xptiprivate.h.

    { 
        NS_ASSERTION(mFileArray, "bad state!");
        NS_ASSERTION(i < mFileCount, "bad param!");
        mFileArray[i] = r;
    }

Definition at line 392 of file xptiprivate.h.

    { 
        NS_ASSERTION(mZipItemArray, "bad state!");
        NS_ASSERTION(i < mZipItemCount, "bad param!");
        mZipItemArray[i] = r;
    }

Member Data Documentation

Definition at line 436 of file xptiprivate.h.

Definition at line 427 of file xptiprivate.h.

Definition at line 425 of file xptiprivate.h.

Definition at line 442 of file xptiprivate.h.

Definition at line 441 of file xptiprivate.h.

Definition at line 426 of file xptiprivate.h.

Definition at line 430 of file xptiprivate.h.

Definition at line 440 of file xptiprivate.h.

Definition at line 433 of file xptiprivate.h.

Definition at line 434 of file xptiprivate.h.

Definition at line 431 of file xptiprivate.h.

Definition at line 429 of file xptiprivate.h.

Definition at line 443 of file xptiprivate.h.


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