Back to index

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

#include <nsComponent.h>

Collaboration diagram for nsComponent:
Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  NO_ATTR = 0x00000000, SELECTED = 0x00000001, INVISIBLE = 0x00000010, LAUNCHAPP = 0x00000100,
  DOWNLOAD_ONLY = 0x00001000, MAIN_COMPONENT = 0x00010000
}
enum  {
  NO_ATTR = 0x00000000, SELECTED = 0x00000001, INVISIBLE = 0x00000010, LAUNCHAPP = 0x00000100,
  DOWNLOAD_ONLY = 0x00001000
}

Public Member Functions

 nsComponent ()
 ~nsComponent ()
nsComponentDuplicate ()
int SetDescShort (char *aDescShort)
char * GetDescShort ()
int SetDescLong (char *aDescLong)
char * GetDescLong ()
int SetArchive (char *aAcrhive)
char * GetArchive ()
int SetInstallSize (int aInstallSize)
int GetInstallSize ()
int SetArchiveSize (int aArchiveSize)
int GetArchiveSize ()
int GetCurrentSize ()
int SetURL (char *aURL, int aIndex)
char * GetURL (int aIndex)
int AddDependee (char *aDependee)
int ResolveDependees (int aBeingSelected, nsComponentList *aComps)
int SetSelected ()
int SetUnselected ()
int IsSelected ()
int SetInvisible ()
int SetVisible ()
int IsInvisible ()
int SetLaunchApp ()
int SetDontLaunchApp ()
int IsLaunchApp ()
int SetDownloadOnly ()
int IsDownloadOnly ()
int SetMainComponent ()
int IsMainComponent ()
int SetNext (nsComponent *aComponent)
int InitNext ()
nsComponentGetNext ()
int SetIndex (int aIndex)
int GetIndex ()
int AddRef ()
int Release ()
int InitRefCount ()
int DepAddRef ()
int DepRelease ()
int DepGetRefCount ()
int SetResumePos (int aResPos)
int GetResumePos ()
int SetDownloaded (int which)
int IsDownloaded ()
 nsComponent ()
 ~nsComponent ()
nsComponentDuplicate ()
int SetDescShort (char *aDescShort)
char * GetDescShort ()
int SetDescLong (char *aDescLong)
char * GetDescLong ()
int SetArchive (char *aAcrhive)
char * GetArchive ()
int SetInstallSize (int aInstallSize)
int GetInstallSize ()
int SetArchiveSize (int aArchiveSize)
int GetArchiveSize ()
int GetCurrentSize ()
int SetURL (char *aURL, int aIndex)
char * GetURL (int aIndex)
int AddDependee (char *aDependee)
int ResolveDependees (int aBeingSelected, nsComponentList *aComps)
int SetSelected ()
int SetUnselected ()
int IsSelected ()
int SetInvisible ()
int SetVisible ()
int IsInvisible ()
int SetLaunchApp ()
int SetDontLaunchApp ()
int IsLaunchApp ()
int SetDownloadOnly ()
int IsDownloadOnly ()
int SetIndex (int aIndex)
int GetIndex ()
int AddRef ()
int Release ()
int InitRefCount ()
int DepAddRef ()
int DepRelease ()
int DepGetRefCount ()
int SetResumePos (int aResPos)
int GetResumePos ()
int SetDownloaded (int which)
int IsDownloaded ()

Private Attributes

char * mDescShort
char * mDescLong
char * mArchive
int mInstallSize
int mArchiveSize
char * mURL [MAX_URLS]
char * mDependees [MAX_COMPONENTS]
int mNextDependeeIdx
int mAttributes
nsComponentmNext
int mIndex
int mRefCount
int mDepRefCount
int mResPos
int mDownloaded

Detailed Description

Definition at line 49 of file nsComponent.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
NO_ATTR 
SELECTED 
INVISIBLE 
LAUNCHAPP 
DOWNLOAD_ONLY 
MAIN_COMPONENT 

Definition at line 110 of file nsComponent.h.

    {
        NO_ATTR         = 0x00000000,
        SELECTED        = 0x00000001,
        INVISIBLE       = 0x00000010,
        LAUNCHAPP       = 0x00000100,
        DOWNLOAD_ONLY   = 0x00001000,
        MAIN_COMPONENT  = 0x00010000
    };
anonymous enum
Enumerator:
NO_ATTR 
SELECTED 
INVISIBLE 
LAUNCHAPP 
DOWNLOAD_ONLY 

Definition at line 105 of file nsComponent.h.

    {
        NO_ATTR         = 0x00000000,
        SELECTED        = 0x00000001,
        INVISIBLE       = 0x00000010,
        LAUNCHAPP       = 0x00000100,
        DOWNLOAD_ONLY   = 0x00001000
    };

Constructor & Destructor Documentation

Definition at line 43 of file nsComponent.cpp.

                         :
    mDescShort(NULL),
    mDescLong(NULL),
    mArchive(NULL),
    mInstallSize(0),
    mArchiveSize(0),
    mNextDependeeIdx(0),
    mAttributes(NO_ATTR),
    mNext(NULL),
    mIndex(-1),
    mRefCount(0),
    mDepRefCount(0),
    mResPos(0),
    mDownloaded(FALSE)
{
    int i;

    for (i = 0; i < MAX_URLS; i++)
        mURL[i] = NULL;
    for (i = 0; i < MAX_COMPONENTS; i++)
        mDependees[i] = NULL;
}

Here is the caller graph for this function:

Definition at line 66 of file nsComponent.cpp.

{
    int i;

    XI_IF_FREE(mDescShort);
    XI_IF_FREE(mDescLong);
    XI_IF_FREE(mArchive);
    for (i = 0; i < MAX_URLS; i++)
        XI_IF_FREE(mURL[i]);
    for (i = 0; i < MAX_COMPONENTS; i++)
        XI_IF_FREE(mDependees[i]);
}

Member Function Documentation

int nsComponent::AddDependee ( char *  aDependee)

Definition at line 225 of file nsComponent.cpp.

{
    if (!aDependee)
        return E_PARAM;

    mDependees[mNextDependeeIdx] = aDependee;
    mDependees[++mNextDependeeIdx] = NULL;

    return OK;
}

Here is the caller graph for this function:

int nsComponent::AddDependee ( char *  aDependee)

Definition at line 427 of file nsComponent.cpp.

{
    mRefCount++;
    
    return OK;
}

Here is the caller graph for this function:

Definition at line 457 of file nsComponent.cpp.

{
    if (mDepRefCount == 0)
        SetSelected();

    mDepRefCount++;
        
    return OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 482 of file nsComponent.cpp.

{
    return mDepRefCount;
}

Definition at line 468 of file nsComponent.cpp.

{
    mDepRefCount--;

    if (mDepRefCount < 0)
        mDepRefCount = 0;

    if (mDepRefCount == 0)
        SetUnselected();
 
    return OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 80 of file nsComponent.cpp.

{
    nsComponent *zdup = new nsComponent();
    *zdup = *this;
    zdup->InitRefCount();
    zdup->InitNext();

    return zdup;
}

Here is the call graph for this function:

Definition at line 142 of file nsComponent.cpp.

{
    if (mArchive)
        return mArchive;

    return NULL;
}

Here is the caller graph for this function:

Definition at line 176 of file nsComponent.cpp.

{
    if (mArchiveSize >= 0)
        return mArchiveSize;

    return 0;
}

Here is the caller graph for this function:

Definition at line 185 of file nsComponent.cpp.

{
    // assumes cwd is the same as the installer binary location

    char path[MAXPATHLEN];
    struct stat stbuf;

    if (!mArchive)
        return 0;

    sprintf(path, "./xpi/%s", mArchive);
    if (0 != stat(path, &stbuf))
        return 0;

    return (stbuf.st_size/1024); // return size in KB
}

Here is the caller graph for this function:

Definition at line 122 of file nsComponent.cpp.

{
    if (mDescLong)
        return mDescLong;

    return NULL;
}

Here is the caller graph for this function:

Definition at line 102 of file nsComponent.cpp.

{
    if (mDescShort)
        return mDescShort;

    return NULL;
}

Here is the caller graph for this function:

Definition at line 418 of file nsComponent.cpp.

{
    if (mIndex < 0 || mIndex > MAX_COMPONENTS)
        return E_OUT_OF_BOUNDS;
    
    return mIndex;
}

Here is the caller graph for this function:

Definition at line 159 of file nsComponent.cpp.

{
    if (mInstallSize >= 0)
        return mInstallSize;

    return 0;
}

Here is the caller graph for this function:

Definition at line 398 of file nsComponent.cpp.

{
    if (mNext)
        return mNext;

    return NULL;
}

Here is the caller graph for this function:

Definition at line 496 of file nsComponent.cpp.

{
    if (mResPos > 0)
        return mResPos;

    return 0;
}

Here is the caller graph for this function:

char * nsComponent::GetURL ( int  aIndex)

Definition at line 216 of file nsComponent.cpp.

{
    if (aIndex < 0 || aIndex >= MAX_URLS)
        return NULL;

    return mURL[aIndex];
}

Here is the caller graph for this function:

char* nsComponent::GetURL ( int  aIndex)

Definition at line 390 of file nsComponent.cpp.

{
    mNext = NULL;

    return OK;
}

Here is the caller graph for this function:

Definition at line 449 of file nsComponent.cpp.

{
    mRefCount = 1;

    return OK;
}

Here is the caller graph for this function:

Definition at line 513 of file nsComponent.cpp.

{
    return mDownloaded;
}

Here is the caller graph for this function:

Definition at line 353 of file nsComponent.cpp.

{
    if (mAttributes & nsComponent::DOWNLOAD_ONLY)
        return TRUE;

    return FALSE;
}

Here is the caller graph for this function:

Definition at line 310 of file nsComponent.cpp.

{
    if (mAttributes & nsComponent::INVISIBLE)
        return TRUE;

    return FALSE;
}

Here is the caller graph for this function:

Definition at line 336 of file nsComponent.cpp.

{
    if (mAttributes & nsComponent::LAUNCHAPP)
        return TRUE;

    return FALSE;
}

Here is the caller graph for this function:

Definition at line 370 of file nsComponent.cpp.

Here is the caller graph for this function:

Definition at line 284 of file nsComponent.cpp.

{
    if (mAttributes & nsComponent::SELECTED)
        return TRUE;

    return FALSE;
}

Here is the caller graph for this function:

Definition at line 435 of file nsComponent.cpp.

{
    mRefCount--;

    if (mRefCount < 0)
        return E_REF_COUNT;

    if (mRefCount == 0)
        delete this;

    return OK;
}

Here is the caller graph for this function:

int nsComponent::ResolveDependees ( int  aBeingSelected,
nsComponentList aComps 
)

Definition at line 237 of file nsComponent.cpp.

{
    int i;
    nsComponent *currComp = NULL;
    
    // param check
    if (!aComps)
        return E_PARAM;

    // loop over all dependees
    for (i = 0; i < mNextDependeeIdx; i++)
    {
        if (!mDependees[i])
            break;

        currComp = aComps->GetCompByShortDesc(mDependees[i]);
        if (!currComp)
            continue;
        
        if (aBeingSelected)
            currComp->DepAddRef();
        else    
            currComp->DepRelease();
    }

    return OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int nsComponent::ResolveDependees ( int  aBeingSelected,
nsComponentList aComps 
)
int nsComponent::SetArchive ( char *  aAcrhive)

Definition at line 131 of file nsComponent.cpp.

{
    if (!aArchive)
        return E_PARAM;

    mArchive = aArchive;

    return OK;
}

Here is the caller graph for this function:

int nsComponent::SetArchive ( char *  aAcrhive)
int nsComponent::SetArchiveSize ( int  aArchiveSize)

Definition at line 168 of file nsComponent.cpp.

{
    mArchiveSize = aArchiveSize;

    return OK;
}

Here is the caller graph for this function:

int nsComponent::SetArchiveSize ( int  aArchiveSize)
int nsComponent::SetDescLong ( char *  aDescLong)

Definition at line 111 of file nsComponent.cpp.

{
    if (!aDescLong)
        return E_PARAM;

    mDescLong = aDescLong;

    return OK;
}

Here is the caller graph for this function:

int nsComponent::SetDescLong ( char *  aDescLong)
int nsComponent::SetDescShort ( char *  aDescShort)

Definition at line 91 of file nsComponent.cpp.

{
    if (!aDescShort)
        return E_PARAM;

    mDescShort = aDescShort;

    return OK;
}

Here is the caller graph for this function:

int nsComponent::SetDescShort ( char *  aDescShort)

Definition at line 327 of file nsComponent.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 505 of file nsComponent.cpp.

{
    mDownloaded = which;

    return OK;
}

Here is the caller graph for this function:

Definition at line 345 of file nsComponent.cpp.

Here is the caller graph for this function:

Definition at line 407 of file nsComponent.cpp.

{
    if (aIndex < 0 || aIndex > MAX_COMPONENTS)
        return E_OUT_OF_BOUNDS;

    mIndex = aIndex;
        
    return OK;
}

Here is the caller graph for this function:

int nsComponent::SetInstallSize ( int  aInstallSize)

Definition at line 151 of file nsComponent.cpp.

{
    mInstallSize = aInstallSize;

    return OK;
}

Here is the caller graph for this function:

int nsComponent::SetInstallSize ( int  aInstallSize)

Definition at line 293 of file nsComponent.cpp.

Here is the caller graph for this function:

Definition at line 319 of file nsComponent.cpp.

Here is the caller graph for this function:

Definition at line 362 of file nsComponent.cpp.

Here is the caller graph for this function:

Definition at line 379 of file nsComponent.cpp.

{
    if (!aComponent)
        return E_PARAM;

    mNext = aComponent;
    
    return OK;
}

Here is the caller graph for this function:

Definition at line 488 of file nsComponent.cpp.

{
    mResPos = aResPos;

    return OK;
}

Here is the caller graph for this function:

Definition at line 266 of file nsComponent.cpp.

Here is the caller graph for this function:

Definition at line 274 of file nsComponent.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int nsComponent::SetURL ( char *  aURL,
int  aIndex 
)

Definition at line 203 of file nsComponent.cpp.

{
    if (!aURL)
        return E_PARAM;
    if (mURL[aIndex])
        return E_URL_ALREADY;

    mURL[aIndex] = aURL;
    
    return OK;
}

Here is the caller graph for this function:

int nsComponent::SetURL ( char *  aURL,
int  aIndex 
)

Definition at line 301 of file nsComponent.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

char * nsComponent::mArchive [private]

Definition at line 123 of file nsComponent.h.

Definition at line 125 of file nsComponent.h.

Definition at line 129 of file nsComponent.h.

char * nsComponent::mDependees [private]

Definition at line 127 of file nsComponent.h.

Definition at line 133 of file nsComponent.h.

char * nsComponent::mDescLong [private]

Definition at line 122 of file nsComponent.h.

char * nsComponent::mDescShort [private]

Definition at line 121 of file nsComponent.h.

Definition at line 135 of file nsComponent.h.

Definition at line 131 of file nsComponent.h.

Definition at line 124 of file nsComponent.h.

Definition at line 130 of file nsComponent.h.

Definition at line 128 of file nsComponent.h.

Definition at line 132 of file nsComponent.h.

Definition at line 134 of file nsComponent.h.

char * nsComponent::mURL [private]

Definition at line 126 of file nsComponent.h.


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