VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFileOSX.h@ 44770

最後變更 在這個檔案從44770是 589,由 vboxsync 提交於 18 年 前

Make it build and run on Mac OS X.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.6 KB
 
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
4 *
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/
9 *
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.
14 *
15 * The Original Code is mozilla.org code.
16 *
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.
21 *
22 * Contributor(s):
23 * Conrad Carlen <[email protected]>
24 *
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.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39#ifndef nsLocalFileMac_h__
40#define nsLocalFileMac_h__
41
42#include "nsILocalFileMac.h"
43#include "nsString.h"
44#include "nsIHashable.h"
45
46class nsDirEnumerator;
47
48//*****************************************************************************
49// nsLocalFile
50//
51// The native charset of this implementation is UTF-8. The Unicode used by the
52// Mac OS file system is decomposed, so "Native" versions of these routines will
53// always use decomposed Unicode (NFD). Their "non-Native" counterparts are
54// intended to be simple wrappers which call the "Native" version and convert
55// between UTF-8 and UTF-16. All the work is done on the "Native" side except
56// for the conversion to NFC (composed Unicode) done in "non-Native" getters.
57//*****************************************************************************
58
59class NS_COM nsLocalFile : public nsILocalFileMac,
60 public nsIHashable
61{
62 friend class nsDirEnumerator;
63
64public:
65 NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
66
67 nsLocalFile();
68
69 static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
70
71 NS_DECL_ISUPPORTS
72 NS_DECL_NSIFILE
73 NS_DECL_NSILOCALFILE
74 NS_DECL_NSILOCALFILEMAC
75 NS_DECL_NSIHASHABLE
76
77public:
78
79 static void GlobalInit();
80 static void GlobalShutdown();
81
82private:
83 ~nsLocalFile();
84
85protected:
86 nsLocalFile(const nsLocalFile& src);
87
88 nsresult SetBaseRef(CFURLRef aCFURLRef); // Does CFRetain on aCFURLRef
89 nsresult UpdateTargetRef();
90
91 nsresult GetFSRefInternal(FSRef& aFSSpec, PRBool bForceUpdateCache = PR_TRUE);
92 nsresult GetPathInternal(nsACString& path); // Returns path WRT mFollowLinks
93 nsresult EqualsInternal(nsISupports* inFile,
94 PRBool aUpdateCache, PRBool *_retval);
95
96 nsresult CopyInternal(nsIFile* newParentDir,
97 const nsAString& newName,
98 PRBool followLinks);
99
100 static PRInt64 HFSPlustoNSPRTime(const UTCDateTime& utcTime);
101 static void NSPRtoHFSPlusTime(PRInt64 nsprTime, UTCDateTime& utcTime);
102 static nsresult CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr);
103
104protected:
105 CFURLRef mBaseRef; // The FS object we represent
106 CFURLRef mTargetRef; // If mBaseRef is an alias, its target
107
108 FSRef mCachedFSRef;
109 PRPackedBool mCachedFSRefValid;
110
111 PRPackedBool mFollowLinks;
112 PRPackedBool mFollowLinksDirty;
113
114 static const char kPathSepChar;
115 static const PRUnichar kPathSepUnichar;
116 static const PRInt64 kJanuaryFirst1970Seconds;
117};
118
119#endif // nsLocalFileMac_h__
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette