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 the GNU General Public License Version 2 or later (the "GPL"), or
00028  * 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             SetMainComponent();
00088     int             IsMainComponent();
00089     int             SetNext(nsComponent *aComponent);
00090     int             InitNext();
00091     nsComponent     *GetNext();
00092     int             SetIndex(int aIndex);
00093     int             GetIndex();
00094     int             AddRef();
00095     int             Release();
00096     int             InitRefCount();
00097 
00098     // used for `dependee' tracking
00099     int             DepAddRef();
00100     int             DepRelease();
00101     int             DepGetRefCount();
00102     int             SetResumePos(int aResPos);
00103     int             GetResumePos();
00104     int             SetDownloaded(int which);
00105     int             IsDownloaded();
00106   
00107 /*---------------------------------------------------------------*
00108  *   Attributes
00109  *---------------------------------------------------------------*/
00110     enum 
00111     {
00112         NO_ATTR         = 0x00000000,
00113         SELECTED        = 0x00000001,
00114         INVISIBLE       = 0x00000010,
00115         LAUNCHAPP       = 0x00000100,
00116         DOWNLOAD_ONLY   = 0x00001000,
00117         MAIN_COMPONENT  = 0x00010000
00118     };
00119 
00120 private:
00121     char            *mDescShort;
00122     char            *mDescLong;
00123     char            *mArchive;
00124     int             mInstallSize;
00125     int             mArchiveSize;
00126     char            *mURL[MAX_URLS];
00127     char            *mDependees[MAX_COMPONENTS];
00128     int             mNextDependeeIdx;
00129     int             mAttributes;
00130     nsComponent     *mNext;
00131     int             mIndex;
00132     int             mRefCount;
00133     int             mDepRefCount;
00134     int             mResPos;
00135     int             mDownloaded;
00136 };
00137 
00138 #endif /* _NS_COMPONENT_H_ */