/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsFileSystemDataSource_h__ #define nsFileSystemDataSource_h__ #include "nsIRDFDataSource.h" #include "nsIRDFLiteral.h" #include "nsIRDFResource.h" #include "nsIRDFService.h" #include "nsCOMPtr.h" #include "nsString.h" #include "mozilla/Attributes.h" #if defined(XP_UNIX) || defined(XP_WIN) #define USE_NC_EXTENSION #endif class FileSystemDataSource final : public nsIRDFDataSource { public: NS_DECL_ISUPPORTS NS_DECL_NSIRDFDATASOURCE static nsresult Create(nsISupports* aOuter, const nsIID& aIID, void **aResult); nsresult Init(); private: FileSystemDataSource() { } ~FileSystemDataSource() { } // helper methods bool isFileURI(nsIRDFResource* aResource); bool isDirURI(nsIRDFResource* aSource); nsresult GetVolumeList(nsISimpleEnumerator **aResult); nsresult GetFolderList(nsIRDFResource *source, bool allowHidden, bool onlyFirst, nsISimpleEnumerator **aResult); nsresult GetName(nsIRDFResource *source, nsIRDFLiteral** aResult); nsresult GetURL(nsIRDFResource *source, bool *isFavorite, nsIRDFLiteral** aResult); nsresult GetFileSize(nsIRDFResource *source, nsIRDFInt** aResult); nsresult GetLastMod(nsIRDFResource *source, nsIRDFDate** aResult); nsCOMPtr mRDFService; // pseudo-constants nsCOMPtr mNC_FileSystemRoot; nsCOMPtr mNC_Child; nsCOMPtr mNC_Name; nsCOMPtr mNC_URL; nsCOMPtr mNC_Icon; nsCOMPtr mNC_Length; nsCOMPtr mNC_IsDirectory; nsCOMPtr mWEB_LastMod; nsCOMPtr mNC_FileSystemObject; nsCOMPtr mNC_pulse; nsCOMPtr mRDF_InstanceOf; nsCOMPtr mRDF_type; nsCOMPtr mLiteralTrue; nsCOMPtr mLiteralFalse; #ifdef USE_NC_EXTENSION nsresult GetExtension(nsIRDFResource *source, nsIRDFLiteral** aResult); nsCOMPtr mNC_extension; #endif #ifdef XP_WIN bool isValidFolder(nsIRDFResource *source); nsresult getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral); nsCOMPtr mNC_IEFavoriteObject; nsCOMPtr mNC_IEFavoriteFolder; nsCString ieFavoritesDir; #endif }; #endif // nsFileSystemDataSource_h__