1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/rdf/datasource/src/nsFileSystemDataSource.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsFileSystemDataSource_h__ 1.10 +#define nsFileSystemDataSource_h__ 1.11 + 1.12 +#include "nsIRDFDataSource.h" 1.13 +#include "nsIRDFLiteral.h" 1.14 +#include "nsIRDFResource.h" 1.15 +#include "nsIRDFService.h" 1.16 +#include "nsCOMPtr.h" 1.17 +#include "nsString.h" 1.18 +#include "mozilla/Attributes.h" 1.19 + 1.20 +#if defined(XP_UNIX) || defined(XP_WIN) 1.21 +#define USE_NC_EXTENSION 1.22 +#endif 1.23 + 1.24 +class FileSystemDataSource MOZ_FINAL : public nsIRDFDataSource 1.25 +{ 1.26 +public: 1.27 + NS_DECL_ISUPPORTS 1.28 + NS_DECL_NSIRDFDATASOURCE 1.29 + 1.30 + static nsresult Create(nsISupports* aOuter, 1.31 + const nsIID& aIID, void **aResult); 1.32 + 1.33 + ~FileSystemDataSource() { } 1.34 + nsresult Init(); 1.35 + 1.36 +private: 1.37 + FileSystemDataSource() { } 1.38 + 1.39 + // helper methods 1.40 + bool isFileURI(nsIRDFResource* aResource); 1.41 + bool isDirURI(nsIRDFResource* aSource); 1.42 + nsresult GetVolumeList(nsISimpleEnumerator **aResult); 1.43 + nsresult GetFolderList(nsIRDFResource *source, bool allowHidden, bool onlyFirst, nsISimpleEnumerator **aResult); 1.44 + nsresult GetName(nsIRDFResource *source, nsIRDFLiteral** aResult); 1.45 + nsresult GetURL(nsIRDFResource *source, bool *isFavorite, nsIRDFLiteral** aResult); 1.46 + nsresult GetFileSize(nsIRDFResource *source, nsIRDFInt** aResult); 1.47 + nsresult GetLastMod(nsIRDFResource *source, nsIRDFDate** aResult); 1.48 + 1.49 + nsCOMPtr<nsIRDFService> mRDFService; 1.50 + 1.51 + // pseudo-constants 1.52 + nsCOMPtr<nsIRDFResource> mNC_FileSystemRoot; 1.53 + nsCOMPtr<nsIRDFResource> mNC_Child; 1.54 + nsCOMPtr<nsIRDFResource> mNC_Name; 1.55 + nsCOMPtr<nsIRDFResource> mNC_URL; 1.56 + nsCOMPtr<nsIRDFResource> mNC_Icon; 1.57 + nsCOMPtr<nsIRDFResource> mNC_Length; 1.58 + nsCOMPtr<nsIRDFResource> mNC_IsDirectory; 1.59 + nsCOMPtr<nsIRDFResource> mWEB_LastMod; 1.60 + nsCOMPtr<nsIRDFResource> mNC_FileSystemObject; 1.61 + nsCOMPtr<nsIRDFResource> mNC_pulse; 1.62 + nsCOMPtr<nsIRDFResource> mRDF_InstanceOf; 1.63 + nsCOMPtr<nsIRDFResource> mRDF_type; 1.64 + 1.65 + nsCOMPtr<nsIRDFLiteral> mLiteralTrue; 1.66 + nsCOMPtr<nsIRDFLiteral> mLiteralFalse; 1.67 + 1.68 +#ifdef USE_NC_EXTENSION 1.69 + nsresult GetExtension(nsIRDFResource *source, nsIRDFLiteral** aResult); 1.70 + nsCOMPtr<nsIRDFResource> mNC_extension; 1.71 +#endif 1.72 + 1.73 +#ifdef XP_WIN 1.74 + bool isValidFolder(nsIRDFResource *source); 1.75 + nsresult getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral); 1.76 + nsCOMPtr<nsIRDFResource> mNC_IEFavoriteObject; 1.77 + nsCOMPtr<nsIRDFResource> mNC_IEFavoriteFolder; 1.78 + nsCString ieFavoritesDir; 1.79 +#endif 1.80 +}; 1.81 + 1.82 +#endif // nsFileSystemDataSource_h__