summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/FileSystem.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/platform/FileSystem.h
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/platform/FileSystem.h')
-rw-r--r--WebCore/platform/FileSystem.h103
1 files changed, 101 insertions, 2 deletions
diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h
index da31281..a3d5d2d 100644
--- a/WebCore/platform/FileSystem.h
+++ b/WebCore/platform/FileSystem.h
@@ -30,21 +30,107 @@
#ifndef FileSystem_h
#define FileSystem_h
+#if PLATFORM(GTK)
+#include <gmodule.h>
+#endif
+#if PLATFORM(QT)
+#include <QFile>
+#include <QLibrary>
+#if defined(Q_OS_WIN32)
+#include <windows.h>
+#endif
+#endif
+
+#if PLATFORM(DARWIN)
+#include <CoreFoundation/CFBundle.h>
+#endif
+
+#include <time.h>
+
#include <wtf/Platform.h>
+#include <wtf/Vector.h>
+
+#include "PlatformString.h"
typedef const struct __CFData* CFDataRef;
+#if PLATFORM(WIN)
+// These are to avoid including <winbase.h> in a header for Chromium
+typedef void *HANDLE;
+// Assuming STRICT
+typedef struct HINSTANCE__* HINSTANCE;
+typedef HINSTANCE HMODULE;
+#endif
+
namespace WebCore {
class CString;
-class String;
#if PLATFORM(WIN)
typedef HANDLE PlatformFileHandle;
-const PlatformFileHandle invalidPlatformFileHandle = INVALID_HANDLE_VALUE;
+typedef HMODULE PlatformModule;
+// FIXME: -1 is INVALID_HANDLE_VALUE, defined in <winbase.h>. Chromium tries to
+// avoid using Windows headers in headers. We'd rather move this into the .cpp.
+const PlatformFileHandle invalidPlatformFileHandle = reinterpret_cast<HANDLE>(-1);
+
+struct PlatformModuleVersion {
+ unsigned leastSig;
+ unsigned mostSig;
+
+ PlatformModuleVersion(unsigned)
+ : leastSig(0)
+ , mostSig(0)
+ {
+ }
+
+ PlatformModuleVersion(unsigned lsb, unsigned msb)
+ : leastSig(lsb)
+ , mostSig(msb)
+ {
+ }
+
+};
+#elif PLATFORM(QT)
+
+typedef QFile* PlatformFileHandle;
+const PlatformFileHandle invalidPlatformFileHandle = 0;
+#if defined(Q_WS_MAC)
+typedef CFBundleRef PlatformModule;
+typedef unsigned PlatformModuleVersion;
+#elif defined(Q_WS_X11) || defined(Q_WS_QWS)
+typedef QLibrary* PlatformModule;
+typedef unsigned PlatformModuleVersion;
+#elif defined(Q_OS_WIN32)
+typedef HMODULE PlatformModule;
+struct PlatformModuleVersion {
+ unsigned leastSig;
+ unsigned mostSig;
+
+ PlatformModuleVersion(unsigned)
+ : leastSig(0)
+ , mostSig(0)
+ {
+ }
+
+ PlatformModuleVersion(unsigned lsb, unsigned msb)
+ : leastSig(lsb)
+ , mostSig(msb)
+ {
+ }
+
+};
+#endif
+
#else
typedef int PlatformFileHandle;
+#if PLATFORM(GTK)
+typedef GModule* PlatformModule;
+#else
+typedef void* PlatformModule;
+#endif
const PlatformFileHandle invalidPlatformFileHandle = -1;
+
+typedef unsigned PlatformModuleVersion;
#endif
bool fileExists(const String&);
@@ -55,6 +141,10 @@ bool getFileModificationTime(const String&, time_t& result);
String pathByAppendingComponent(const String& path, const String& component);
bool makeAllDirectories(const String& path);
String homeDirectoryPath();
+String pathGetFileName(const String&);
+String directoryName(const String&);
+
+Vector<String> listDirectory(const String& path, const String& filter = String());
CString fileSystemRepresentation(const String&);
@@ -65,6 +155,9 @@ CString openTemporaryFile(const char* prefix, PlatformFileHandle&);
void closeFile(PlatformFileHandle&);
int writeToFile(PlatformFileHandle, const char* data, int length);
+// Methods for dealing with loadable modules
+bool unloadModule(PlatformModule);
+
#if PLATFORM(WIN)
String localUserSpecificStorageDirectory();
String roamingUserSpecificStorageDirectory();
@@ -72,6 +165,12 @@ String roamingUserSpecificStorageDirectory();
bool safeCreateFile(const String&, CFDataRef);
#endif
+#if PLATFORM(GTK)
+String filenameToString(const char*);
+char* filenameFromString(const String&);
+String filenameForDisplay(const String&);
+#endif
+
} // namespace WebCore
#endif // FileSystem_h