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
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.
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"
45
class nsDirEnumerator;
47
//*****************************************************************************
50
// The native charset of this implementation is UTF-8. The Unicode used by the
51
// Mac OS file system is decomposed, so "Native" versions of these routines will
52
// always use decomposed Unicode (NFD). Their "non-Native" counterparts are
53
// intended to be simple wrappers which call the "Native" version and convert
54
// between UTF-8 and UTF-16. All the work is done on the "Native" side except
55
// for the conversion to NFC (composed Unicode) done in "non-Native" getters.
56
//*****************************************************************************
58
class NS_COM nsLocalFile : public nsILocalFileMac
60
friend class nsDirEnumerator;
63
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
67
static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
72
NS_DECL_NSILOCALFILEMAC
76
static void GlobalInit();
77
static void GlobalShutdown();
83
nsLocalFile(const nsLocalFile& src);
85
nsresult SetBaseRef(CFURLRef aCFURLRef); // Does CFRetain on aCFURLRef
86
nsresult UpdateTargetRef();
88
nsresult GetFSRefInternal(FSRef& aFSSpec, PRBool bForceUpdateCache = PR_TRUE);
89
nsresult GetPathInternal(nsACString& path); // Returns path WRT mFollowLinks
91
nsresult MoveCopy(nsIFile* newParentDir, const nsAString &newName, PRBool isCopy, PRBool followLinks);
93
static PRInt64 HFSPlustoNSPRTime(const UTCDateTime& utcTime);
94
static void NSPRtoHFSPlusTime(PRInt64 nsprTime, UTCDateTime& utcTime);
95
static nsresult CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr);
98
CFURLRef mBaseRef; // The FS object we represent
99
CFURLRef mTargetRef; // If mBaseRef is an alias, its target
102
PRPackedBool mCachedFSRefValid;
104
PRPackedBool mFollowLinks;
105
PRPackedBool mFollowLinksDirty;
107
static const char kPathSepChar;
108
static const PRUnichar kPathSepUnichar;
109
static const PRInt64 kJanuaryFirst1970Seconds;
112
#endif // nsLocalFileMac_h__