Bug 452317 - FeedConverter.js: QueryInterface should throw NS_ERROR_NO_INTERFACE...
[wine-gecko.git] / xpcom / io / nsLocalFileOSX.h
blob1fdcc9632832c76e450a4efd2c55e7079045ec56
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2001, 2002
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Conrad Carlen <ccarlen@netscape.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef nsLocalFileMac_h__
40 #define nsLocalFileMac_h__
42 #include "nsILocalFileMac.h"
43 #include "nsString.h"
44 #include "nsIHashable.h"
45 #include "nsIClassInfoImpl.h"
47 class nsDirEnumerator;
49 //*****************************************************************************
50 // nsLocalFile
52 // The native charset of this implementation is UTF-8. The Unicode used by the
53 // Mac OS file system is decomposed, so "Native" versions of these routines will
54 // always use decomposed Unicode (NFD). Their "non-Native" counterparts are
55 // intended to be simple wrappers which call the "Native" version and convert
56 // between UTF-8 and UTF-16. All the work is done on the "Native" side except
57 // for the conversion to NFC (composed Unicode) done in "non-Native" getters.
58 //*****************************************************************************
60 class NS_COM nsLocalFile : public nsILocalFileMac,
61 public nsIHashable
63 friend class nsDirEnumerator;
65 public:
66 NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
68 nsLocalFile();
70 static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
72 NS_DECL_ISUPPORTS
73 NS_DECL_NSIFILE
74 NS_DECL_NSILOCALFILE
75 NS_DECL_NSILOCALFILEMAC
76 NS_DECL_NSIHASHABLE
78 public:
80 static void GlobalInit();
81 static void GlobalShutdown();
83 private:
84 ~nsLocalFile();
86 protected:
87 nsLocalFile(const nsLocalFile& src);
89 nsresult SetBaseRef(CFURLRef aCFURLRef); // Does CFRetain on aCFURLRef
90 nsresult UpdateTargetRef();
92 nsresult GetFSRefInternal(FSRef& aFSSpec);
93 nsresult GetPathInternal(nsACString& path); // Returns path WRT mFollowLinks
94 nsresult EqualsInternal(nsISupports* inFile, PRBool *_retval);
96 nsresult CopyInternal(nsIFile* newParentDir,
97 const nsAString& newName,
98 PRBool followLinks);
100 static PRInt64 HFSPlustoNSPRTime(const UTCDateTime& utcTime);
101 static void NSPRtoHFSPlusTime(PRInt64 nsprTime, UTCDateTime& utcTime);
102 static nsresult CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr);
104 protected:
105 CFURLRef mBaseRef; // The FS object we represent
106 CFURLRef mTargetRef; // If mBaseRef is an alias, its target
108 PRPackedBool mFollowLinks;
109 PRPackedBool mFollowLinksDirty;
111 static const char kPathSepChar;
112 static const PRUnichar kPathSepUnichar;
113 static const PRInt64 kJanuaryFirst1970Seconds;
116 #endif // nsLocalFileMac_h__