Bumping manifests a=b2g-bump
[gecko.git] / rdf / datasource / nsFileSystemDataSource.h
blobb1e6fec6c873c9c998c8d083c91a5af58a3eb0b8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsFileSystemDataSource_h__
7 #define nsFileSystemDataSource_h__
9 #include "nsIRDFDataSource.h"
10 #include "nsIRDFLiteral.h"
11 #include "nsIRDFResource.h"
12 #include "nsIRDFService.h"
13 #include "nsCOMPtr.h"
14 #include "nsString.h"
15 #include "mozilla/Attributes.h"
17 #if defined(XP_UNIX) || defined(XP_WIN)
18 #define USE_NC_EXTENSION
19 #endif
21 class FileSystemDataSource MOZ_FINAL : public nsIRDFDataSource
23 public:
24 NS_DECL_ISUPPORTS
25 NS_DECL_NSIRDFDATASOURCE
27 static nsresult Create(nsISupports* aOuter,
28 const nsIID& aIID, void **aResult);
30 nsresult Init();
32 private:
33 FileSystemDataSource() { }
34 ~FileSystemDataSource() { }
36 // helper methods
37 bool isFileURI(nsIRDFResource* aResource);
38 bool isDirURI(nsIRDFResource* aSource);
39 nsresult GetVolumeList(nsISimpleEnumerator **aResult);
40 nsresult GetFolderList(nsIRDFResource *source, bool allowHidden, bool onlyFirst, nsISimpleEnumerator **aResult);
41 nsresult GetName(nsIRDFResource *source, nsIRDFLiteral** aResult);
42 nsresult GetURL(nsIRDFResource *source, bool *isFavorite, nsIRDFLiteral** aResult);
43 nsresult GetFileSize(nsIRDFResource *source, nsIRDFInt** aResult);
44 nsresult GetLastMod(nsIRDFResource *source, nsIRDFDate** aResult);
46 nsCOMPtr<nsIRDFService> mRDFService;
48 // pseudo-constants
49 nsCOMPtr<nsIRDFResource> mNC_FileSystemRoot;
50 nsCOMPtr<nsIRDFResource> mNC_Child;
51 nsCOMPtr<nsIRDFResource> mNC_Name;
52 nsCOMPtr<nsIRDFResource> mNC_URL;
53 nsCOMPtr<nsIRDFResource> mNC_Icon;
54 nsCOMPtr<nsIRDFResource> mNC_Length;
55 nsCOMPtr<nsIRDFResource> mNC_IsDirectory;
56 nsCOMPtr<nsIRDFResource> mWEB_LastMod;
57 nsCOMPtr<nsIRDFResource> mNC_FileSystemObject;
58 nsCOMPtr<nsIRDFResource> mNC_pulse;
59 nsCOMPtr<nsIRDFResource> mRDF_InstanceOf;
60 nsCOMPtr<nsIRDFResource> mRDF_type;
62 nsCOMPtr<nsIRDFLiteral> mLiteralTrue;
63 nsCOMPtr<nsIRDFLiteral> mLiteralFalse;
65 #ifdef USE_NC_EXTENSION
66 nsresult GetExtension(nsIRDFResource *source, nsIRDFLiteral** aResult);
67 nsCOMPtr<nsIRDFResource> mNC_extension;
68 #endif
70 #ifdef XP_WIN
71 bool isValidFolder(nsIRDFResource *source);
72 nsresult getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral);
73 nsCOMPtr<nsIRDFResource> mNC_IEFavoriteObject;
74 nsCOMPtr<nsIRDFResource> mNC_IEFavoriteFolder;
75 nsCString ieFavoritesDir;
76 #endif
79 #endif // nsFileSystemDataSource_h__