Back to index

lightning-sunbird  0.9+nobinonly
nsComponent.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Samir Gehani <sgehani@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #ifndef _NS_COMPONENT_H_
00041 #define _NS_COMPONENT_H_
00042 
00043 #include "XIDefines.h"
00044 #include "XIErrors.h"
00045 #include <malloc.h>
00046 
00047 #include "nsComponentList.h"
00048 
00049 class nsComponent
00050 {
00051 public:
00052     nsComponent();
00053     ~nsComponent();
00054 
00055     nsComponent *   Duplicate();
00056 
00057 /*--------------------------------------------------------------*
00058  *   Accessors/Mutators
00059  *--------------------------------------------------------------*/
00060     int             SetDescShort(char *aDescShort);
00061     char *          GetDescShort();
00062     int             SetDescLong(char *aDescLong);
00063     char *          GetDescLong();
00064     int             SetArchive(char *aAcrhive);
00065     char *          GetArchive();
00066     int             SetInstallSize(int aInstallSize);
00067     int             GetInstallSize();
00068     int             SetArchiveSize(int aArchiveSize);
00069     int             GetArchiveSize();
00070     int             GetCurrentSize();
00071     int             SetURL(char *aURL, int aIndex);
00072     char *          GetURL(int aIndex);
00073     int             AddDependee(char *aDependee); 
00074     int             ResolveDependees(int aBeingSelected, 
00075                                      nsComponentList *aComps);
00076     int             SetSelected();
00077     int             SetUnselected();
00078     int             IsSelected();
00079     int             SetInvisible();
00080     int             SetVisible();
00081     int             IsInvisible(); 
00082     int             SetLaunchApp();
00083     int             SetDontLaunchApp();
00084     int             IsLaunchApp();
00085     int             SetDownloadOnly();
00086     int             IsDownloadOnly();
00087     int             SetIndex(int aIndex);
00088     int             GetIndex();
00089     int             AddRef();
00090     int             Release();
00091     int             InitRefCount();
00092 
00093     // used for `dependee' tracking
00094     int             DepAddRef();
00095     int             DepRelease();
00096     int             DepGetRefCount();
00097     int             SetResumePos(int aResPos);
00098     int             GetResumePos();
00099     int             SetDownloaded(int which);
00100     int             IsDownloaded();
00101   
00102 /*---------------------------------------------------------------*
00103  *   Attributes
00104  *---------------------------------------------------------------*/
00105     enum 
00106     {
00107         NO_ATTR         = 0x00000000,
00108         SELECTED        = 0x00000001,
00109         INVISIBLE       = 0x00000010,
00110         LAUNCHAPP       = 0x00000100,
00111         DOWNLOAD_ONLY   = 0x00001000
00112     };
00113 
00114 private:
00115     char            *mDescShort;
00116     char            *mDescLong;
00117     char            *mArchive;
00118     int             mInstallSize;
00119     int             mArchiveSize;
00120     char            *mURL[MAX_URLS];
00121     char            *mDependees[MAX_COMPONENTS];
00122     int             mNextDependeeIdx;
00123     int             mAttributes;
00124     int             mIndex;
00125     int             mRefCount;
00126     int             mDepRefCount;
00127     int             mResPos;
00128     int             mDownloaded;
00129 };
00130 
00131 #endif /* _NS_COMPONENT_H_ */