~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpcom/io/nsLocalFileOSX.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 <ccarlen@netscape.com>
 
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
 
 
45
class nsDirEnumerator;
 
46
 
 
47
//*****************************************************************************
 
48
//  nsLocalFile
 
49
//
 
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
//*****************************************************************************
 
57
 
 
58
class NS_COM nsLocalFile : public nsILocalFileMac
 
59
{
 
60
    friend class nsDirEnumerator;
 
61
    
 
62
public:
 
63
    NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
 
64
    
 
65
                        nsLocalFile();
 
66
 
 
67
    static NS_METHOD    nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
 
68
 
 
69
    NS_DECL_ISUPPORTS
 
70
    NS_DECL_NSIFILE
 
71
    NS_DECL_NSILOCALFILE
 
72
    NS_DECL_NSILOCALFILEMAC
 
73
 
 
74
public:
 
75
 
 
76
    static void         GlobalInit();
 
77
    static void         GlobalShutdown();
 
78
    
 
79
private:
 
80
                        ~nsLocalFile();
 
81
 
 
82
protected:
 
83
                        nsLocalFile(const nsLocalFile& src);
 
84
    
 
85
    nsresult            SetBaseRef(CFURLRef aCFURLRef); // Does CFRetain on aCFURLRef
 
86
    nsresult            UpdateTargetRef();
 
87
    
 
88
    nsresult            GetFSRefInternal(FSRef& aFSSpec, PRBool bForceUpdateCache = PR_TRUE);
 
89
    nsresult            GetPathInternal(nsACString& path);  // Returns path WRT mFollowLinks
 
90
 
 
91
    nsresult            MoveCopy(nsIFile* newParentDir, const nsAString &newName, PRBool isCopy, PRBool followLinks);
 
92
 
 
93
    static PRInt64      HFSPlustoNSPRTime(const UTCDateTime& utcTime);
 
94
    static void         NSPRtoHFSPlusTime(PRInt64 nsprTime, UTCDateTime& utcTime);
 
95
    static nsresult     CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr);
 
96
 
 
97
protected:
 
98
    CFURLRef            mBaseRef;           // The FS object we represent
 
99
    CFURLRef            mTargetRef;         // If mBaseRef is an alias, its target
 
100
 
 
101
    FSRef               mCachedFSRef;
 
102
    PRPackedBool        mCachedFSRefValid;
 
103
    
 
104
    PRPackedBool        mFollowLinks;
 
105
    PRPackedBool        mFollowLinksDirty;
 
106
 
 
107
    static const char         kPathSepChar;
 
108
    static const PRUnichar    kPathSepUnichar;
 
109
    static const PRInt64      kJanuaryFirst1970Seconds;    
 
110
};
 
111
 
 
112
#endif // nsLocalFileMac_h__