Back to index

lightning-sunbird  0.9+nobinonly
nsDirectoryService.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; 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.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   IBM Corp.
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef nsDirectoryService_h___
00040 #define nsDirectoryService_h___
00041 
00042 #include "nsIDirectoryService.h"
00043 #include "nsHashtable.h"
00044 #include "nsILocalFile.h"
00045 #include "nsISupportsArray.h"
00046 #include "nsIAtom.h"
00047 
00048 #define NS_XPCOM_INIT_CURRENT_PROCESS_DIR       "MozBinD"   // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
00049                                                             // CANNOT be used to GET a location
00050 #define NS_DIRECTORY_SERVICE_CID  {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
00051 
00052 class nsDirectoryService : public nsIDirectoryService,
00053                            public nsIProperties,
00054                            public nsIDirectoryServiceProvider2
00055 {
00056   public:
00057 
00058   // nsISupports interface
00059   NS_DECL_ISUPPORTS
00060 
00061   NS_DECL_NSIPROPERTIES  
00062 
00063   NS_DECL_NSIDIRECTORYSERVICE
00064 
00065   NS_DECL_NSIDIRECTORYSERVICEPROVIDER
00066   
00067   NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
00068 
00069   nsDirectoryService();
00070    ~nsDirectoryService();
00071 
00072   static nsresult RealInit();
00073   void RegisterCategoryProviders();
00074 
00075   static NS_METHOD
00076   Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
00077 
00078   static nsDirectoryService* gService;
00079 
00080 private:
00081     nsresult GetCurrentProcessDirectory(nsILocalFile** aFile);
00082     
00083     static PRBool PR_CALLBACK ReleaseValues(nsHashKey* key, void* data, void* closure);
00084     nsSupportsHashtable mHashtable;
00085     nsCOMPtr<nsISupportsArray> mProviders;
00086 
00087 public:
00088     static nsIAtom *sCurrentProcess;
00089     static nsIAtom *sComponentRegistry;
00090     static nsIAtom *sComponentDirectory;
00091     static nsIAtom *sXPTIRegistry;
00092     static nsIAtom *sGRE_Directory;
00093     static nsIAtom *sGRE_ComponentDirectory;
00094     static nsIAtom *sOS_DriveDirectory;
00095     static nsIAtom *sOS_TemporaryDirectory;
00096     static nsIAtom *sOS_CurrentProcessDirectory;
00097     static nsIAtom *sOS_CurrentWorkingDirectory;
00098     static nsIAtom *sOS_DesktopDirectory;
00099     static nsIAtom *sOS_HomeDirectory;
00100 #if defined (XP_MACOSX)
00101     static nsIAtom *sDirectory;
00102     static nsIAtom *sTrashDirectory;
00103     static nsIAtom *sStartupDirectory;
00104     static nsIAtom *sShutdownDirectory;
00105     static nsIAtom *sAppleMenuDirectory;
00106     static nsIAtom *sControlPanelDirectory;
00107     static nsIAtom *sExtensionDirectory;
00108     static nsIAtom *sFontsDirectory;
00109     static nsIAtom *sPreferencesDirectory;
00110     static nsIAtom *sDocumentsDirectory;
00111     static nsIAtom *sInternetSearchDirectory;
00112     static nsIAtom *sUserLibDirectory;
00113     static nsIAtom *sDefaultDownloadDirectory;
00114     static nsIAtom *sUserDesktopDirectory;
00115     static nsIAtom *sLocalDesktopDirectory;
00116     static nsIAtom *sUserApplicationsDirectory;
00117     static nsIAtom *sLocalApplicationsDirectory;
00118     static nsIAtom *sUserDocumentsDirectory;
00119     static nsIAtom *sLocalDocumentsDirectory;
00120     static nsIAtom *sUserInternetPlugInDirectory;
00121     static nsIAtom *sLocalInternetPlugInDirectory;
00122     static nsIAtom *sUserFrameworksDirectory;
00123     static nsIAtom *sLocalFrameworksDirectory;
00124     static nsIAtom *sUserPreferencesDirectory;
00125     static nsIAtom *sLocalPreferencesDirectory;
00126     static nsIAtom *sPictureDocumentsDirectory;
00127     static nsIAtom *sMovieDocumentsDirectory;
00128     static nsIAtom *sMusicDocumentsDirectory;
00129     static nsIAtom *sInternetSitesDirectory;
00130 #elif defined (XP_WIN) 
00131     static nsIAtom *sSystemDirectory;
00132     static nsIAtom *sWindowsDirectory;
00133     static nsIAtom *sWindowsProgramFiles;
00134     static nsIAtom *sDesktop;
00135     static nsIAtom *sPrograms;
00136     static nsIAtom *sControls;
00137     static nsIAtom *sPrinters;
00138     static nsIAtom *sPersonal;
00139     static nsIAtom *sFavorites;
00140     static nsIAtom *sStartup;
00141     static nsIAtom *sRecent;
00142     static nsIAtom *sSendto;
00143     static nsIAtom *sBitbucket;
00144     static nsIAtom *sStartmenu;
00145     static nsIAtom *sDesktopdirectory;
00146     static nsIAtom *sDrives;
00147     static nsIAtom *sNetwork;
00148     static nsIAtom *sNethood;
00149     static nsIAtom *sFonts;
00150     static nsIAtom *sTemplates;
00151     static nsIAtom *sCommon_Startmenu;
00152     static nsIAtom *sCommon_Programs;
00153     static nsIAtom *sCommon_Startup;
00154     static nsIAtom *sCommon_Desktopdirectory;
00155     static nsIAtom *sAppdata;
00156     static nsIAtom *sLocalAppdata;
00157     static nsIAtom *sPrinthood;
00158     static nsIAtom *sWinCookiesDirectory;
00159 #elif defined (XP_UNIX)
00160     static nsIAtom *sLocalDirectory;
00161     static nsIAtom *sLibDirectory;
00162 #elif defined (XP_OS2)
00163     static nsIAtom *sSystemDirectory;
00164     static nsIAtom *sOS2Directory;
00165 #elif defined (XP_BEOS)
00166     static nsIAtom *sSettingsDirectory;
00167     static nsIAtom *sSystemDirectory;
00168 #endif
00169 
00170 
00171 };
00172 
00173 
00174 #endif
00175