VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFileUnix.h@ 106945

Last change on this file since 106945 was 102195, checked in by vboxsync, 13 months ago

libs/xpcom/xpcom: Get rid of nsprpub based file I/O and convert to IPRT, bugref:10545

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/* -*- Mode: C++; tab-width: 8; 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 Communicator client code, released
16 * March 31, 1998.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998-1999
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Mike Shaver <shaver@mozilla.org>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40/*
41 * Implementation of nsIFile for ``Unixy'' systems.
42 */
43
44#ifndef _nsLocalFileUNIX_H_
45#define _nsLocalFileUNIX_H_
46
47#include <iprt/file.h>
48
49#include <sys/stat.h>
50#include <sys/types.h>
51#include <unistd.h>
52
53#include "nscore.h"
54#include "nsString.h"
55#include "nsReadableUtils.h"
56
57/**
58 * we need these for statfs()
59 */
60#ifdef HAVE_SYS_STATVFS_H
61 #if defined(__osf__) && defined(__DECCXX)
62 extern "C" int statvfs(const char *, struct statvfs *);
63 #endif
64 #include <sys/statvfs.h>
65#endif
66
67#ifdef HAVE_SYS_STATFS_H
68 #include <sys/statfs.h>
69#endif
70
71#ifdef HAVE_STATVFS
72 #define STATFS statvfs
73#else
74 #define STATFS statfs
75#endif
76
77// so we can statfs on freebsd
78#if defined(__FreeBSD__)
79 #define HAVE_SYS_STATFS_H
80 #define STATFS statfs
81 #include <sys/param.h>
82 #include <sys/mount.h>
83#endif
84
85class NS_COM nsLocalFile : public nsILocalFile
86{
87public:
88 NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
89
90 nsLocalFile();
91
92 static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
93
94 // nsISupports
95 NS_DECL_ISUPPORTS
96
97 // nsIFile
98 NS_DECL_NSIFILE
99
100 // nsILocalFile
101 NS_DECL_NSILOCALFILE
102
103public:
104 static void GlobalInit();
105 static void GlobalShutdown();
106
107private:
108 nsLocalFile(const nsLocalFile& other);
109 ~nsLocalFile() {}
110
111protected:
112 struct stat mCachedStat;
113 nsCString mPath;
114 PRPackedBool mHaveCachedStat;
115
116 void LocateNativeLeafName(nsACString::const_iterator &,
117 nsACString::const_iterator &);
118
119 nsresult CopyDirectoryTo(nsIFile *newParent);
120 nsresult CreateAllAncestors(PRUint32 permissions);
121 nsresult GetNativeTargetPathName(nsIFile *newParent,
122 const nsACString &newName,
123 nsACString &_retval);
124
125 void InvalidateCache() {
126 mHaveCachedStat = PR_FALSE;
127 }
128 nsresult FillStatCache();
129
130 nsresult CreateAndKeepOpen(PRUint32 type, uint32_t flags,
131 PRUint32 permissions, RTFILE *_retval);
132};
133
134#endif /* _nsLocalFileUNIX_H_ */
Note: See TracBrowser for help on using the repository browser.

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